2 // configdialog.cpp - Configuration dialog
5 // (C) 2010 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 01/29/2010 Created this file
12 // JLH 06/23/2011 Added initial implementation
13 // JLH 10/14/2011 Fixed possibly missing final slash in paths
16 #include "configdialog.h"
18 #include "alpinetab.h"
19 #include "controllertab.h"
20 #include "controllerwidget.h"
21 #include "generaltab.h"
25 ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/): QDialog(parent),
26 tabWidget(new QTabWidget),
27 generalTab(new GeneralTab(this)),
28 controllerTab1(new ControllerTab(this))
30 // tabWidget = new QTabWidget;
31 // generalTab = new GeneralTab(this);
32 // controllerTab1 = new ControllerTab(this);
33 //// controllerTab2 = new ControllerTab(this);
35 // if (vjs.hardwareTypeAlpine)
36 // alpineTab = new AlpineTab(this);
38 tabWidget->addTab(generalTab, tr("General"));
39 tabWidget->addTab(controllerTab1, tr("Controllers"));
40 // tabWidget->addTab(controllerTab2, tr("Controller #2"));
42 if (vjs.hardwareTypeAlpine)
44 alpineTab = new AlpineTab(this);
45 tabWidget->addTab(alpineTab, tr("Alpine"));
48 buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
50 connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
51 connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
53 QVBoxLayout * mainLayout = new QVBoxLayout;
54 mainLayout->addWidget(tabWidget);
55 mainLayout->addWidget(buttonBox);
56 setLayout(mainLayout);
58 setWindowTitle(tr("Virtual Jaguar Settings"));
59 LoadDialogFromSettings();
63 ConfigDialog::~ConfigDialog()
68 void ConfigDialog::LoadDialogFromSettings(void)
70 // generalTab->edit1->setText(vjs.jagBootPath);
71 // generalTab->edit2->setText(vjs.CDBootPath);
72 generalTab->edit3->setText(vjs.EEPROMPath);
73 generalTab->edit4->setText(vjs.ROMPath);
75 generalTab->useBIOS->setChecked(vjs.useJaguarBIOS);
76 generalTab->useGPU->setChecked(vjs.GPUEnabled);
77 generalTab->useDSP->setChecked(vjs.DSPEnabled);
78 generalTab->useFullScreen->setChecked(vjs.fullscreen);
79 // generalTab->useHostAudio->setChecked(vjs.audioEnabled);
80 generalTab->useFastBlitter->setChecked(vjs.useFastBlitter);
82 if (vjs.hardwareTypeAlpine)
84 alpineTab->edit1->setText(vjs.alpineROMPath);
85 alpineTab->edit2->setText(vjs.absROMPath);
86 alpineTab->writeROM->setChecked(vjs.allowWritesToROM);
89 #warning "!!! Need to load settings from controller profile !!!"
90 // We do this now, but not here. Need to fix this...
92 for(int i=0; i<21; i++)
94 // We need to find the right profile and load it up here...
95 controllerTab1->controllerWidget->keys[i] = vjs.p1KeyBindings[i];
96 // controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i];
102 void ConfigDialog::UpdateVJSettings(void)
104 // strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data());
105 // strcpy(vjs.CDBootPath, generalTab->edit2->text().toAscii().data());
106 strcpy(vjs.EEPROMPath, CheckForTrailingSlash(
107 generalTab->edit3->text()).toAscii().data());
108 strcpy(vjs.ROMPath, CheckForTrailingSlash(
109 generalTab->edit4->text()).toAscii().data());
111 vjs.useJaguarBIOS = generalTab->useBIOS->isChecked();
112 vjs.GPUEnabled = generalTab->useGPU->isChecked();
113 vjs.DSPEnabled = generalTab->useDSP->isChecked();
114 vjs.fullscreen = generalTab->useFullScreen->isChecked();
115 // vjs.audioEnabled = generalTab->useHostAudio->isChecked();
116 vjs.useFastBlitter = generalTab->useFastBlitter->isChecked();
118 if (vjs.hardwareTypeAlpine)
120 strcpy(vjs.alpineROMPath, alpineTab->edit1->text().toAscii().data());
121 strcpy(vjs.absROMPath, alpineTab->edit2->text().toAscii().data());
122 vjs.allowWritesToROM = alpineTab->writeROM->isChecked();
125 #warning "!!! Need to save settings to controller profile !!!"
126 // We do this now, but not here. Need to fix this...
128 for(int i=0; i<21; i++)
130 // We need to find the right profile and load it up here...
131 vjs.p1KeyBindings[i] = controllerTab1->controllerWidget->keys[i];
132 // vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i];
138 QString ConfigDialog::CheckForTrailingSlash(QString s)
140 if (!s.endsWith('/') && !s.endsWith('\\'))