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
19 #include "configdialog.h"
21 #include "alpinetab.h"
22 #include "debugger\debuggertab.h"
23 #include "controllertab.h"
24 #include "controllerwidget.h"
25 #include "generaltab.h"
29 ConfigDialog::ConfigDialog(QWidget
* parent
/*= 0*/): QDialog(parent
),
30 tabWidget(new QTabWidget
),
31 generalTab(new GeneralTab(this)),
32 controllerTab1(new ControllerTab(this))
34 // tabWidget = new QTabWidget;
35 // generalTab = new GeneralTab(this);
36 // controllerTab1 = new ControllerTab(this);
37 //// controllerTab2 = new ControllerTab(this);
39 // if (vjs.hardwareTypeAlpine)
40 // alpineTab = new AlpineTab(this);
42 tabWidget
->addTab(generalTab
, tr("General"));
43 tabWidget
->addTab(controllerTab1
, tr("Controllers"));
44 // tabWidget->addTab(controllerTab2, tr("Controller #2"));
46 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
48 alpineTab
= new AlpineTab(this);
49 tabWidget
->addTab(alpineTab
, tr("Alpine"));
52 if (vjs
.softTypeDebugger
)
54 debuggerTab
= new DebuggerTab(this);
55 tabWidget
->addTab(debuggerTab
, tr("Debugger"));
58 buttonBox
= new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel
);
60 connect(buttonBox
, SIGNAL(accepted()), this, SLOT(accept()));
61 connect(buttonBox
, SIGNAL(rejected()), this, SLOT(reject()));
63 QVBoxLayout
* mainLayout
= new QVBoxLayout
;
64 mainLayout
->addWidget(tabWidget
);
65 mainLayout
->addWidget(buttonBox
);
66 setLayout(mainLayout
);
68 setWindowTitle(tr("Virtual Jaguar Settings"));
69 LoadDialogFromSettings();
73 ConfigDialog::~ConfigDialog()
78 void ConfigDialog::LoadDialogFromSettings(void)
80 // generalTab->edit1->setText(vjs.jagBootPath);
81 // generalTab->edit2->setText(vjs.CDBootPath);
82 generalTab
->edit3
->setText(vjs
.EEPROMPath
);
83 generalTab
->edit4
->setText(vjs
.ROMPath
);
85 generalTab
->useBIOS
->setChecked(vjs
.useJaguarBIOS
);
86 generalTab
->useGPU
->setChecked(vjs
.GPUEnabled
);
87 generalTab
->useDSP
->setChecked(vjs
.DSPEnabled
);
88 generalTab
->useFullScreen
->setChecked(vjs
.fullscreen
);
89 // generalTab->useHostAudio->setChecked(vjs.audioEnabled);
90 generalTab
->useFastBlitter
->setChecked(vjs
.useFastBlitter
);
92 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
94 QVariant
v(vjs
.refresh
);
95 alpineTab
->edit1
->setText(vjs
.alpineROMPath
);
96 alpineTab
->edit2
->setText(vjs
.absROMPath
);
97 alpineTab
->edit3
->setText(v
.toString());
98 alpineTab
->writeROM
->setChecked(vjs
.allowWritesToROM
);
101 if (vjs
.softTypeDebugger
)
103 QVariant
v(vjs
.nbrdisasmlines
);
104 //debuggerTab->edit1->setText(vjs.debuggerROMPath);
105 //debuggerTab->edit2->setText(vjs.absROMPath);
106 debuggerTab
->edit3
->setText(v
.toString());
107 //debuggerTab->writeROM->setChecked(vjs.allowWritesToROM
108 debuggerTab
->displayHWlabels
->setChecked(vjs
.displayHWlabels
);
109 debuggerTab
->disasmopcodes
->setChecked(vjs
.disasmopcodes
);
110 debuggerTab
->displayFullSourceFilename
->setChecked(vjs
.displayFullSourceFilename
);
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 void ConfigDialog::UpdateVJSettings(void)
134 // strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data());
135 // strcpy(vjs.CDBootPath, generalTab->edit2->text().toAscii().data());
136 strcpy(vjs
.EEPROMPath
, CheckForTrailingSlash(
137 generalTab
->edit3
->text()).toUtf8().data());
138 strcpy(vjs
.ROMPath
, CheckForTrailingSlash(
139 generalTab
->edit4
->text()).toUtf8().data());
141 vjs
.useJaguarBIOS
= generalTab
->useBIOS
->isChecked();
142 vjs
.GPUEnabled
= generalTab
->useGPU
->isChecked();
143 vjs
.DSPEnabled
= generalTab
->useDSP
->isChecked();
144 vjs
.fullscreen
= generalTab
->useFullScreen
->isChecked();
145 // vjs.audioEnabled = generalTab->useHostAudio->isChecked();
146 vjs
.useFastBlitter
= generalTab
->useFastBlitter
->isChecked();
148 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
150 strcpy(vjs
.alpineROMPath
, alpineTab
->edit1
->text().toUtf8().data());
151 strcpy(vjs
.absROMPath
, alpineTab
->edit2
->text().toUtf8().data());
152 vjs
.refresh
= alpineTab
->edit3
->text().toUInt(&ok
, 10);
153 vjs
.allowWritesToROM
= alpineTab
->writeROM
->isChecked();
156 if (vjs
.softTypeDebugger
)
158 //strcpy(vjs.debuggerROMPath, debuggerTab->edit1->text().toUtf8().data());
159 //strcpy(vjs.absROMPath, debuggerTab->edit2->text().toUtf8().data());
160 vjs
.nbrdisasmlines
= debuggerTab
->edit3
->text().toUInt(&ok
, 10);
161 //vjs.allowWritesToROM = debuggerTab->writeROM->isChecked();
162 vjs
.displayHWlabels
= debuggerTab
->displayHWlabels
->isChecked();
163 vjs
.disasmopcodes
= debuggerTab
->disasmopcodes
->isChecked();
164 vjs
.displayFullSourceFilename
= debuggerTab
->displayFullSourceFilename
->isChecked();
168 #pragma message("Warning: !!! Need to save settings to controller profile !!!")
170 #warning "!!! Need to save settings to controller profile !!!"
172 // We do this now, but not here. Need to fix this...
174 for(int i
=0; i
<21; i
++)
176 // We need to find the right profile and load it up here...
177 vjs
.p1KeyBindings
[i
] = controllerTab1
->controllerWidget
->keys
[i
];
178 // vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i];
184 QString
ConfigDialog::CheckForTrailingSlash(QString s
)
186 if (!s
.endsWith('/') && !s
.endsWith('\\'))