]> Shamusworld >> Repos - virtualjaguar/blob - src/gui/configdialog.cpp
f9b3fe40de6fac0053d7ffd6a0401c45d36bd032
[virtualjaguar] / src / gui / configdialog.cpp
1 //
2 // configdialog.cpp - Configuration dialog
3 //
4 // by James L. Hammons
5 // (C) 2010 Underground Software
6 //
7 // JLH = James L. Hammons <jlhamm@acm.org>
8 //
9 // Who  When        What
10 // ---  ----------  -------------------------------------------------------------
11 // JLH  01/29/2010  Created this file
12 // JLH  06/23/2011  Added initial implementation
13 //
14
15 #include "configdialog.h"
16
17 #include "generaltab.h"
18 #include "controllertab.h"
19 #include "settings.h"
20
21
22 ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/): QDialog(parent)
23 {
24         tabWidget = new QTabWidget;
25         generalTab = new GeneralTab(this);
26         controllerTab = new ControllerTab(this);
27         tabWidget->addTab(generalTab, tr("General"));
28         tabWidget->addTab(controllerTab, tr("Controller"));
29
30         buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
31
32         connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
33         connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
34
35         QVBoxLayout * mainLayout = new QVBoxLayout;
36         mainLayout->addWidget(tabWidget);
37         mainLayout->addWidget(buttonBox);
38         setLayout(mainLayout);
39
40         setWindowTitle(tr("Virtual Jaguar Settings"));
41
42         LoadDialogFromSettings();
43 }
44
45 ConfigDialog::~ConfigDialog()
46 {
47 }
48
49 void ConfigDialog::LoadDialogFromSettings(void)
50 {
51         generalTab->edit1->setText(vjs.jagBootPath);
52         generalTab->edit2->setText(vjs.CDBootPath);
53         generalTab->edit3->setText(vjs.EEPROMPath);
54         generalTab->edit4->setText(vjs.ROMPath);
55 }
56
57 void ConfigDialog::UpdateVJSettings(void)
58 {
59         strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data());
60         strcpy(vjs.CDBootPath,  generalTab->edit2->text().toAscii().data());
61         strcpy(vjs.EEPROMPath,  generalTab->edit3->text().toAscii().data());
62         strcpy(vjs.ROMPath,     generalTab->edit4->text().toAscii().data());
63 }