X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fconfigdialog.cpp;h=42942f0eb7fb4022de7ea6744ef75811f94ec875;hb=ddac3e0e78a5c4b0236bdeaff18cf9a3ac4ba4f7;hp=3ee9a92108e31649770992c7022f113962a86460;hpb=786e438a8bcaf738b84ab79733015ea2b1f4bbb9;p=virtualjaguar diff --git a/src/gui/configdialog.cpp b/src/gui/configdialog.cpp index 3ee9a92..42942f0 100644 --- a/src/gui/configdialog.cpp +++ b/src/gui/configdialog.cpp @@ -1,39 +1,49 @@ // // configdialog.cpp - Configuration dialog // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What -// --- ---------- ------------------------------------------------------------- +// --- ---------- ------------------------------------------------------------ // JLH 01/29/2010 Created this file // JLH 06/23/2011 Added initial implementation +// JLH 10/14/2011 Fixed possibly missing final slash in paths // #include "configdialog.h" -#include "generaltab.h" -#include "controllertab.h" #include "alpinetab.h" +#include "controllertab.h" +#include "controllerwidget.h" +#include "generaltab.h" #include "settings.h" -ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/): QDialog(parent) +ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/): QDialog(parent), + tabWidget(new QTabWidget), + generalTab(new GeneralTab(this)), + controllerTab1(new ControllerTab(this)) { - tabWidget = new QTabWidget; - generalTab = new GeneralTab(this); - controllerTab = new ControllerTab(this); +// tabWidget = new QTabWidget; +// generalTab = new GeneralTab(this); +// controllerTab1 = new ControllerTab(this); +//// controllerTab2 = new ControllerTab(this); - if (vjs.hardwareTypeAlpine) - alpineTab = new AlpineTab(this); +// if (vjs.hardwareTypeAlpine) +// alpineTab = new AlpineTab(this); tabWidget->addTab(generalTab, tr("General")); - tabWidget->addTab(controllerTab, tr("Controller")); + tabWidget->addTab(controllerTab1, tr("Controllers")); +// tabWidget->addTab(controllerTab2, tr("Controller #2")); if (vjs.hardwareTypeAlpine) + { + alpineTab = new AlpineTab(this); tabWidget->addTab(alpineTab, tr("Alpine")); + } buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); @@ -46,46 +56,89 @@ ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/): QDialog(parent) setLayout(mainLayout); setWindowTitle(tr("Virtual Jaguar Settings")); - LoadDialogFromSettings(); } + ConfigDialog::~ConfigDialog() { } + void ConfigDialog::LoadDialogFromSettings(void) { - generalTab->edit1->setText(vjs.jagBootPath); - generalTab->edit2->setText(vjs.CDBootPath); +// generalTab->edit1->setText(vjs.jagBootPath); +// generalTab->edit2->setText(vjs.CDBootPath); generalTab->edit3->setText(vjs.EEPROMPath); generalTab->edit4->setText(vjs.ROMPath); generalTab->useBIOS->setChecked(vjs.useJaguarBIOS); + generalTab->useGPU->setChecked(vjs.GPUEnabled); generalTab->useDSP->setChecked(vjs.DSPEnabled); - generalTab->useHostAudio->setChecked(vjs.audioEnabled); + generalTab->useFullScreen->setChecked(vjs.fullscreen); +// generalTab->useHostAudio->setChecked(vjs.audioEnabled); + generalTab->useFastBlitter->setChecked(vjs.useFastBlitter); if (vjs.hardwareTypeAlpine) { alpineTab->edit1->setText(vjs.alpineROMPath); + alpineTab->edit2->setText(vjs.absROMPath); alpineTab->writeROM->setChecked(vjs.allowWritesToROM); } + +#warning "!!! Need to load settings from controller profile !!!" +// We do this now, but not here. Need to fix this... +#if 0 + for(int i=0; i<21; i++) + { +// We need to find the right profile and load it up here... + controllerTab1->controllerWidget->keys[i] = vjs.p1KeyBindings[i]; +// controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i]; + } +#endif } + void ConfigDialog::UpdateVJSettings(void) { - strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data()); - strcpy(vjs.CDBootPath, generalTab->edit2->text().toAscii().data()); - strcpy(vjs.EEPROMPath, generalTab->edit3->text().toAscii().data()); - strcpy(vjs.ROMPath, generalTab->edit4->text().toAscii().data()); - - vjs.useJaguarBIOS = generalTab->useBIOS->isChecked(); - vjs.DSPEnabled = generalTab->useDSP->isChecked(); - vjs.audioEnabled = generalTab->useHostAudio->isChecked(); +// strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data()); +// strcpy(vjs.CDBootPath, generalTab->edit2->text().toAscii().data()); + strcpy(vjs.EEPROMPath, CheckForTrailingSlash( + generalTab->edit3->text()).toUtf8().data()); + strcpy(vjs.ROMPath, CheckForTrailingSlash( + generalTab->edit4->text()).toUtf8().data()); + + vjs.useJaguarBIOS = generalTab->useBIOS->isChecked(); + vjs.GPUEnabled = generalTab->useGPU->isChecked(); + vjs.DSPEnabled = generalTab->useDSP->isChecked(); + vjs.fullscreen = generalTab->useFullScreen->isChecked(); +// vjs.audioEnabled = generalTab->useHostAudio->isChecked(); + vjs.useFastBlitter = generalTab->useFastBlitter->isChecked(); if (vjs.hardwareTypeAlpine) { - strcpy(vjs.alpineROMPath, alpineTab->edit1->text().toAscii().data()); + strcpy(vjs.alpineROMPath, alpineTab->edit1->text().toUtf8().data()); + strcpy(vjs.absROMPath, alpineTab->edit2->text().toUtf8().data()); vjs.allowWritesToROM = alpineTab->writeROM->isChecked(); } + +#warning "!!! Need to save settings to controller profile !!!" +// We do this now, but not here. Need to fix this... +#if 0 + for(int i=0; i<21; i++) + { +// We need to find the right profile and load it up here... + vjs.p1KeyBindings[i] = controllerTab1->controllerWidget->keys[i]; +// vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i]; + } +#endif +} + + +QString ConfigDialog::CheckForTrailingSlash(QString s) +{ + if (!s.endsWith('/') && !s.endsWith('\\')) + s.append('/'); + + return s; }