2 // configdialog.cpp - Configuration dialog
5 // (C) 2010 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
8 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
11 // --- ---------- ------------------------------------------------------------
12 // JLH 01/29/2010 Created this file
13 // JLH 06/23/2011 Added initial implementation
14 // JLH 10/14/2011 Fixed possibly missing final slash in paths
15 // JPM 06/06/2016 Visual Studio support
16 // JPM 06/19/2016 Soft debugger support
17 // JPM 09/ /2017 Added a Keybindings tab
18 // JPM 09/03/2018 Added a Models & Bios tab
21 #include "configdialog.h"
22 #include "alpinetab.h"
23 #include "debugger/debuggertab.h"
24 #include "controllertab.h"
25 #include "controllerwidget.h"
26 #include "generaltab.h"
27 #include "modelsbiostab.h"
28 #include "KeyBindingsTab.h"
32 ConfigDialog::ConfigDialog(QWidget
* parent
/*= 0*/) : QDialog(parent
),
33 tabWidget(new QTabWidget
),
34 generalTab(new GeneralTab(this)),
35 #ifdef NEWMODELSBIOSHANDLER
36 modelsbiosTab(new ModelsBiosTab
),
38 controllerTab1(new ControllerTab(this)),
39 keybindingsTab(new KeyBindingsTab(this))
41 // tabWidget = new QTabWidget;
42 // generalTab = new GeneralTab(this);
43 // controllerTab1 = new ControllerTab(this);
44 //// controllerTab2 = new ControllerTab(this);
46 // if (vjs.hardwareTypeAlpine)
47 // alpineTab = new AlpineTab(this);
49 tabWidget
->addTab(generalTab
, tr("General"));
50 #ifdef NEWMODELSBIOSHANDLER
51 tabWidget
->addTab(modelsbiosTab
, tr("Models and BIOS"));
53 tabWidget
->addTab(controllerTab1
, tr("Controllers"));
54 // tabWidget->addTab(controllerTab2, tr("Controller #2"));
55 tabWidget
->addTab(keybindingsTab
, tr("Key Bindings"));
57 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
59 alpineTab
= new AlpineTab(this);
60 tabWidget
->addTab(alpineTab
, tr("Alpine"));
63 if (vjs
.softTypeDebugger
)
65 debuggerTab
= new DebuggerTab(this);
66 tabWidget
->addTab(debuggerTab
, tr("Debugger"));
69 buttonBox
= new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel
);
71 connect(buttonBox
, SIGNAL(accepted()), this, SLOT(accept()));
72 connect(buttonBox
, SIGNAL(rejected()), this, SLOT(reject()));
74 QVBoxLayout
* mainLayout
= new QVBoxLayout
;
75 mainLayout
->addWidget(tabWidget
);
76 mainLayout
->addWidget(buttonBox
);
77 setLayout(mainLayout
);
79 setWindowTitle(tr("Virtual Jaguar Settings"));
80 LoadDialogFromSettings();
84 ConfigDialog::~ConfigDialog()
89 // Load & Update the tabs dialog from the settings
90 void ConfigDialog::LoadDialogFromSettings(void)
92 // General & Keybindings tab settings
93 generalTab
->GetSettings();
94 keybindingsTab
->GetSettings();
95 #ifdef NEWMODELSBIOSHANDLER
96 modelsbiosTab
->GetSettings();
99 // Alpine tab settings (also needed by the Debugger)
100 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
102 alpineTab
->GetSettings();
105 // Debugger tab settings
106 if (vjs
.softTypeDebugger
)
108 debuggerTab
->GetSettings();
112 #pragma message("Warning: !!! Need to load settings from controller profile !!!")
114 #warning "!!! Need to load settings from controller profile !!!"
116 // We do this now, but not here. Need to fix this...
118 for(int i
=0; i
<21; i
++)
120 // We need to find the right profile and load it up here...
121 controllerTab1
->controllerWidget
->keys
[i
] = vjs
.p1KeyBindings
[i
];
122 // controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i];
128 // Save & Update the settings from the tabs dialog
129 void ConfigDialog::UpdateVJSettings(void)
131 generalTab
->SetSettings();
132 keybindingsTab
->SetSettings();
133 #ifdef NEWMODELSBIOSHANDLER
134 modelsbiosTab
->SetSettings();
137 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
139 alpineTab
->SetSettings();
142 if (vjs
.softTypeDebugger
)
144 debuggerTab
->SetSettings();
148 #pragma message("Warning: !!! Need to save settings to controller profile !!!")
150 #warning "!!! Need to save settings to controller profile !!!"
152 // We do this now, but not here. Need to fix this...
154 for(int i
=0; i
<21; i
++)
156 // We need to find the right profile and load it up here...
157 vjs
.p1KeyBindings
[i
] = controllerTab1
->controllerWidget
->keys
[i
];
158 // vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i];