X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fconfigdialog.cpp;h=e84cf232c93ae45d3a67a89c96b7321f623c4a48;hb=c436dad60e34fb9da720a89db917eb4cf4e3a624;hp=26134121f8577e68a7761f79665695cd966185dc;hpb=4333fdb4f2f297db8272d2ebc8323028df8c105f;p=virtualjaguar diff --git a/src/gui/configdialog.cpp b/src/gui/configdialog.cpp index 2613412..e84cf23 100644 --- a/src/gui/configdialog.cpp +++ b/src/gui/configdialog.cpp @@ -1,22 +1,24 @@ // // 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" @@ -24,13 +26,15 @@ ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/): QDialog(parent) { tabWidget = new QTabWidget; generalTab = new GeneralTab(this); - controllerTab = new ControllerTab(this); + controllerTab1 = new ControllerTab(this); + controllerTab2 = new ControllerTab(this); if (vjs.hardwareTypeAlpine) alpineTab = new AlpineTab(this); tabWidget->addTab(generalTab, tr("General")); - tabWidget->addTab(controllerTab, tr("Controller")); + tabWidget->addTab(controllerTab1, tr("Controller #1")); + tabWidget->addTab(controllerTab2, tr("Controller #2")); if (vjs.hardwareTypeAlpine) tabWidget->addTab(alpineTab, tr("Alpine")); @@ -48,6 +52,8 @@ ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/): QDialog(parent) setWindowTitle(tr("Virtual Jaguar Settings")); LoadDialogFromSettings(); +// controllerTab1->UpdateLabel(); // Now it's safe to do this... ;-) +// controllerTab2->UpdateLabel(); // Now it's safe to do this... ;-) } ConfigDialog::~ConfigDialog() @@ -56,14 +62,16 @@ 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); if (vjs.hardwareTypeAlpine) { @@ -71,18 +79,28 @@ void ConfigDialog::LoadDialogFromSettings(void) alpineTab->edit2->setText(vjs.absROMPath); alpineTab->writeROM->setChecked(vjs.allowWritesToROM); } + + for(int i=0; i<21; i++) + { + controllerTab1->controllerWidget->keys[i] = vjs.p1KeyBindings[i]; + controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i]; + } } 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()); +// strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data()); +// strcpy(vjs.CDBootPath, generalTab->edit2->text().toAscii().data()); + strcpy(vjs.EEPROMPath, CheckForTrailingSlash( + generalTab->edit3->text()).toAscii().data()); + strcpy(vjs.ROMPath, CheckForTrailingSlash( + generalTab->edit4->text()).toAscii().data()); vjs.useJaguarBIOS = generalTab->useBIOS->isChecked(); + vjs.GPUEnabled = generalTab->useGPU->isChecked(); vjs.DSPEnabled = generalTab->useDSP->isChecked(); - vjs.audioEnabled = generalTab->useHostAudio->isChecked(); + vjs.fullscreen = generalTab->useFullScreen->isChecked(); +// vjs.audioEnabled = generalTab->useHostAudio->isChecked(); if (vjs.hardwareTypeAlpine) { @@ -90,4 +108,18 @@ void ConfigDialog::UpdateVJSettings(void) strcpy(vjs.absROMPath, alpineTab->edit2->text().toAscii().data()); vjs.allowWritesToROM = alpineTab->writeROM->isChecked(); } + + for(int i=0; i<21; i++) + { + vjs.p1KeyBindings[i] = controllerTab1->controllerWidget->keys[i]; + vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i]; + } +} + +QString ConfigDialog::CheckForTrailingSlash(QString s) +{ + if (!s.endsWith('/') && !s.endsWith('\\')) + s.append('/'); + + return s; }