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 !!!"
91 for(int i=0; i<21; i++)
93 // We need to find the right profile and load it up here...
94 controllerTab1->controllerWidget->keys[i] = vjs.p1KeyBindings[i];
95 // controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i];
101 void ConfigDialog::UpdateVJSettings(void)
103 // strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data());
104 // strcpy(vjs.CDBootPath, generalTab->edit2->text().toAscii().data());
105 strcpy(vjs.EEPROMPath, CheckForTrailingSlash(
106 generalTab->edit3->text()).toAscii().data());
107 strcpy(vjs.ROMPath, CheckForTrailingSlash(
108 generalTab->edit4->text()).toAscii().data());
110 vjs.useJaguarBIOS = generalTab->useBIOS->isChecked();
111 vjs.GPUEnabled = generalTab->useGPU->isChecked();
112 vjs.DSPEnabled = generalTab->useDSP->isChecked();
113 vjs.fullscreen = generalTab->useFullScreen->isChecked();
114 // vjs.audioEnabled = generalTab->useHostAudio->isChecked();
115 vjs.useFastBlitter = generalTab->useFastBlitter->isChecked();
117 if (vjs.hardwareTypeAlpine)
119 strcpy(vjs.alpineROMPath, alpineTab->edit1->text().toAscii().data());
120 strcpy(vjs.absROMPath, alpineTab->edit2->text().toAscii().data());
121 vjs.allowWritesToROM = alpineTab->writeROM->isChecked();
124 #warning "!!! Need to save settings to controller profile !!!"
125 for(int i=0; i<21; i++)
127 // We need to find the right profile and load it up here...
128 vjs.p1KeyBindings[i] = controllerTab1->controllerWidget->keys[i];
129 // vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i];
134 QString ConfigDialog::CheckForTrailingSlash(QString s)
136 if (!s.endsWith('/') && !s.endsWith('\\'))