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>
9 // RG = Richard Goedeken
12 // --- ---------- ------------------------------------------------------------
13 // JLH 01/29/2010 Created this file
14 // JLH 06/23/2011 Added initial implementation
15 // JLH 10/14/2011 Fixed possibly missing final slash in paths
16 // JPM 06/06/2016 Visual Studio support
17 // JPM 06/19/2016 Soft debugger support
18 // JPM 09/ /2017 Added a Keybindings tab
19 // JPM 09/03/2018 Added a Models & Bios tab
20 // RG Jan./2021 Linux build fix
23 #include "configdialog.h"
24 #include "alpinetab.h"
25 #include "debugger/debuggertab.h"
26 #include "controllertab.h"
27 #include "controllerwidget.h"
28 #include "generaltab.h"
29 #include "modelsbiostab.h"
30 #include "keybindingstab.h"
34 ConfigDialog::ConfigDialog(QWidget
* parent
/*= 0*/) : QDialog(parent
),
35 tabWidget(new QTabWidget
),
36 generalTab(new GeneralTab(this)),
37 #ifdef NEWMODELSBIOSHANDLER
38 modelsbiosTab(new ModelsBiosTab
),
40 controllerTab1(new ControllerTab(this)),
41 keybindingsTab(new KeyBindingsTab(this))
43 // tabWidget = new QTabWidget;
44 // generalTab = new GeneralTab(this);
45 // controllerTab1 = new ControllerTab(this);
46 //// controllerTab2 = new ControllerTab(this);
48 // if (vjs.hardwareTypeAlpine)
49 // alpineTab = new AlpineTab(this);
51 tabWidget
->addTab(generalTab
, tr("General"));
52 #ifdef NEWMODELSBIOSHANDLER
53 tabWidget
->addTab(modelsbiosTab
, tr("Models and BIOS"));
55 tabWidget
->addTab(controllerTab1
, tr("Controllers"));
56 // tabWidget->addTab(controllerTab2, tr("Controller #2"));
57 tabWidget
->addTab(keybindingsTab
, tr("Key Bindings"));
59 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
61 alpineTab
= new AlpineTab(this);
62 tabWidget
->addTab(alpineTab
, tr("Alpine"));
65 if (vjs
.softTypeDebugger
)
67 debuggerTab
= new DebuggerTab(this);
68 tabWidget
->addTab(debuggerTab
, tr("Debugger"));
71 buttonBox
= new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel
);
73 connect(buttonBox
, SIGNAL(accepted()), this, SLOT(accept()));
74 connect(buttonBox
, SIGNAL(rejected()), this, SLOT(reject()));
76 QVBoxLayout
* mainLayout
= new QVBoxLayout
;
77 mainLayout
->addWidget(tabWidget
);
78 mainLayout
->addWidget(buttonBox
);
79 setLayout(mainLayout
);
81 setWindowTitle(tr("Virtual Jaguar Settings"));
82 LoadDialogFromSettings();
86 ConfigDialog::~ConfigDialog()
91 // Load & Update the tabs dialog from the settings
92 void ConfigDialog::LoadDialogFromSettings(void)
94 // General & Keybindings tab settings
95 generalTab
->GetSettings();
96 keybindingsTab
->GetSettings();
97 #ifdef NEWMODELSBIOSHANDLER
98 modelsbiosTab
->GetSettings();
101 // Alpine tab settings (also needed by the Debugger)
102 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
104 alpineTab
->GetSettings();
107 // Debugger tab settings
108 if (vjs
.softTypeDebugger
)
110 debuggerTab
->GetSettings();
114 #pragma message("Warning: !!! Need to load settings from controller profile !!!")
116 #warning "!!! Need to load settings from controller profile !!!"
118 // We do this now, but not here. Need to fix this...
120 for(int i
=0; i
<21; i
++)
122 // We need to find the right profile and load it up here...
123 controllerTab1
->controllerWidget
->keys
[i
] = vjs
.p1KeyBindings
[i
];
124 // controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i];
130 // Save & Update the settings from the tabs dialog
131 void ConfigDialog::UpdateVJSettings(void)
133 generalTab
->SetSettings();
134 keybindingsTab
->SetSettings();
135 #ifdef NEWMODELSBIOSHANDLER
136 modelsbiosTab
->SetSettings();
139 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
141 alpineTab
->SetSettings();
144 if (vjs
.softTypeDebugger
)
146 debuggerTab
->SetSettings();
150 #pragma message("Warning: !!! Need to save settings to controller profile !!!")
152 #warning "!!! Need to save settings to controller profile !!!"
154 // We do this now, but not here. Need to fix this...
156 for(int i
=0; i
<21; i
++)
158 // We need to find the right profile and load it up here...
159 vjs
.p1KeyBindings
[i
] = controllerTab1
->controllerWidget
->keys
[i
];
160 // vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i];