Added a Jaguar model and BIOS configuration tab
[clinton/Virtual-Jaguar-Rx.git] / src / gui / configdialog.cpp
CommitLineData
cf76e892
JPM
1//
2// configdialog.cpp - Configuration dialog
3//
4// by James Hammons
5// (C) 2010 Underground Software
6//
7// JLH = James Hammons <jlhamm@acm.org>
8// JPM = Jean-Paul Mari <djipi.mari@gmail.com>
9//
10// Who When What
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
bc10fc42
JPM
17// JPM 09/ /2017 Added a Keybindings tab
18// JPM 09/03/2018 Added a Models & Bios tab
cf76e892
JPM
19//
20
21#include "configdialog.h"
cf76e892 22#include "alpinetab.h"
5fe21518 23#include "debugger/debuggertab.h"
cf76e892
JPM
24#include "controllertab.h"
25#include "controllerwidget.h"
26#include "generaltab.h"
bc10fc42 27#include "modelsbiostab.h"
024bfc46 28#include "KeyBindingsTab.h"
cf76e892
JPM
29#include "settings.h"
30
31
024bfc46
JPM
32ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/) : QDialog(parent),
33tabWidget(new QTabWidget),
34generalTab(new GeneralTab(this)),
bc10fc42
JPM
35#ifdef NEWMODELSBIOSHANDLER
36modelsbiosTab(new ModelsBiosTab),
37#endif
024bfc46
JPM
38controllerTab1(new ControllerTab(this)),
39keybindingsTab(new KeyBindingsTab(this))
cf76e892
JPM
40{
41// tabWidget = new QTabWidget;
42// generalTab = new GeneralTab(this);
43// controllerTab1 = new ControllerTab(this);
44//// controllerTab2 = new ControllerTab(this);
45
46// if (vjs.hardwareTypeAlpine)
47// alpineTab = new AlpineTab(this);
48
49 tabWidget->addTab(generalTab, tr("General"));
bc10fc42
JPM
50#ifdef NEWMODELSBIOSHANDLER
51 tabWidget->addTab(modelsbiosTab, tr("Models and Bios"));
52#endif
cf76e892
JPM
53 tabWidget->addTab(controllerTab1, tr("Controllers"));
54// tabWidget->addTab(controllerTab2, tr("Controller #2"));
024bfc46 55 tabWidget->addTab(keybindingsTab, tr("Keybindings"));
cf76e892
JPM
56
57 if (vjs.hardwareTypeAlpine || vjs.softTypeDebugger)
58 {
59 alpineTab = new AlpineTab(this);
60 tabWidget->addTab(alpineTab, tr("Alpine"));
61 }
62
63 if (vjs.softTypeDebugger)
64 {
65 debuggerTab = new DebuggerTab(this);
66 tabWidget->addTab(debuggerTab, tr("Debugger"));
67 }
68
69 buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
70
71 connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
72 connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
73
74 QVBoxLayout * mainLayout = new QVBoxLayout;
75 mainLayout->addWidget(tabWidget);
76 mainLayout->addWidget(buttonBox);
77 setLayout(mainLayout);
78
79 setWindowTitle(tr("Virtual Jaguar Settings"));
80 LoadDialogFromSettings();
81}
82
83
84ConfigDialog::~ConfigDialog()
85{
86}
87
88
bc10fc42 89// Load & Update the tabs dialog from the settings
cf76e892
JPM
90void ConfigDialog::LoadDialogFromSettings(void)
91{
024bfc46
JPM
92 // General & Keybindings tab settings
93 generalTab->GetSettings();
94 keybindingsTab->GetSettings();
bc10fc42
JPM
95#ifdef NEWMODELSBIOSHANDLER
96 modelsbiosTab->GetSettings();
97#endif
cf76e892 98
024bfc46 99 // Alpine tab settings (also needed by the Debugger)
cf76e892
JPM
100 if (vjs.hardwareTypeAlpine || vjs.softTypeDebugger)
101 {
024bfc46 102 alpineTab->GetSettings();
cf76e892
JPM
103 }
104
024bfc46 105 // Debugger tab settings
cf76e892
JPM
106 if (vjs.softTypeDebugger)
107 {
024bfc46 108 debuggerTab->GetSettings();
cf76e892
JPM
109 }
110
111#ifdef _MSC_VER
112#pragma message("Warning: !!! Need to load settings from controller profile !!!")
113#else
114#warning "!!! Need to load settings from controller profile !!!"
115#endif // _MSC_VER
116// We do this now, but not here. Need to fix this...
117#if 0
118 for(int i=0; i<21; i++)
119 {
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];
123 }
124#endif
125}
126
127
bc10fc42 128// Save & Update the settings from the tabs dialog
cf76e892
JPM
129void ConfigDialog::UpdateVJSettings(void)
130{
024bfc46
JPM
131 generalTab->SetSettings();
132 keybindingsTab->SetSettings();
bc10fc42
JPM
133#ifdef NEWMODELSBIOSHANDLER
134 modelsbiosTab->SetSettings();
135#endif
cf76e892
JPM
136
137 if (vjs.hardwareTypeAlpine || vjs.softTypeDebugger)
138 {
024bfc46 139 alpineTab->SetSettings();
cf76e892
JPM
140 }
141
142 if (vjs.softTypeDebugger)
143 {
024bfc46 144 debuggerTab->SetSettings();
cf76e892
JPM
145 }
146
147#ifdef _MSC_VER
148#pragma message("Warning: !!! Need to save settings to controller profile !!!")
149#else
150#warning "!!! Need to save settings to controller profile !!!"
151#endif // _MSC_VER
152// We do this now, but not here. Need to fix this...
153#if 0
154 for(int i=0; i<21; i++)
155 {
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];
159 }
160#endif
161}
162