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 the Keybindings tab
20 #include "configdialog.h"
21 #include "alpinetab.h"
22 #include "debugger/debuggertab.h"
23 #include "controllertab.h"
24 #include "controllerwidget.h"
25 #include "generaltab.h"
26 #include "KeyBindingsTab.h"
30 ConfigDialog::ConfigDialog(QWidget
* parent
/*= 0*/) : QDialog(parent
),
31 tabWidget(new QTabWidget
),
32 generalTab(new GeneralTab(this)),
33 controllerTab1(new ControllerTab(this)),
34 keybindingsTab(new KeyBindingsTab(this))
36 // tabWidget = new QTabWidget;
37 // generalTab = new GeneralTab(this);
38 // controllerTab1 = new ControllerTab(this);
39 //// controllerTab2 = new ControllerTab(this);
41 // if (vjs.hardwareTypeAlpine)
42 // alpineTab = new AlpineTab(this);
44 tabWidget
->addTab(generalTab
, tr("General"));
45 tabWidget
->addTab(controllerTab1
, tr("Controllers"));
46 // tabWidget->addTab(controllerTab2, tr("Controller #2"));
47 tabWidget
->addTab(keybindingsTab
, tr("Keybindings"));
49 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
51 alpineTab
= new AlpineTab(this);
52 tabWidget
->addTab(alpineTab
, tr("Alpine"));
55 if (vjs
.softTypeDebugger
)
57 debuggerTab
= new DebuggerTab(this);
58 tabWidget
->addTab(debuggerTab
, tr("Debugger"));
61 buttonBox
= new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel
);
63 connect(buttonBox
, SIGNAL(accepted()), this, SLOT(accept()));
64 connect(buttonBox
, SIGNAL(rejected()), this, SLOT(reject()));
66 QVBoxLayout
* mainLayout
= new QVBoxLayout
;
67 mainLayout
->addWidget(tabWidget
);
68 mainLayout
->addWidget(buttonBox
);
69 setLayout(mainLayout
);
71 setWindowTitle(tr("Virtual Jaguar Settings"));
72 LoadDialogFromSettings();
76 ConfigDialog::~ConfigDialog()
81 // Load / Update the tabs dialog from the settings
82 void ConfigDialog::LoadDialogFromSettings(void)
84 // General & Keybindings tab settings
85 generalTab
->GetSettings();
86 keybindingsTab
->GetSettings();
88 // Alpine tab settings (also needed by the Debugger)
89 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
91 alpineTab
->GetSettings();
94 // Debugger tab settings
95 if (vjs
.softTypeDebugger
)
97 debuggerTab
->GetSettings();
101 #pragma message("Warning: !!! Need to load settings from controller profile !!!")
103 #warning "!!! Need to load settings from controller profile !!!"
105 // We do this now, but not here. Need to fix this...
107 for(int i
=0; i
<21; i
++)
109 // We need to find the right profile and load it up here...
110 controllerTab1
->controllerWidget
->keys
[i
] = vjs
.p1KeyBindings
[i
];
111 // controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i];
117 // Save / Update the settings from the tabs dialog
118 void ConfigDialog::UpdateVJSettings(void)
120 generalTab
->SetSettings();
121 keybindingsTab
->SetSettings();
123 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
125 alpineTab
->SetSettings();
128 if (vjs
.softTypeDebugger
)
130 debuggerTab
->SetSettings();
134 #pragma message("Warning: !!! Need to save settings to controller profile !!!")
136 #warning "!!! Need to save settings to controller profile !!!"
138 // We do this now, but not here. Need to fix this...
140 for(int i
=0; i
<21; i
++)
142 // We need to find the right profile and load it up here...
143 vjs
.p1KeyBindings
[i
] = controllerTab1
->controllerWidget
->keys
[i
];
144 // vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i];