2 // alpinetab.cpp: "Alpine" tab on the settings dialog
4 // Part of the Virtual Jaguar Project
5 // (C) 2011 Underground Software
6 // See the README and GPLv3 files for licensing and warranty information
8 // JLH = James Hammons <jlhamm@acm.org>
9 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
12 // --- ---------- ------------------------------------------------------------
13 // JLH 07/15/2011 Created this file
14 // JPM 09/03/2018 Depend the platform transform slashes or backslashes
17 #include "alpinetab.h"
21 AlpineTab::AlpineTab(QWidget
* parent
/*= 0*/): QWidget(parent
)
23 QLabel
* label1
= new QLabel("ROM to load:");
24 QLabel
* label2
= new QLabel("ABS to load:");
25 QLabel
* label3
= new QLabel("Windows refresh:");
26 // QLabel * label3 = new QLabel("EEPROMs:");
27 // QLabel * label4 = new QLabel("Software:");
29 edit1
= new QLineEdit("");
30 edit2
= new QLineEdit("");
31 edit3
= new QLineEdit("");
32 // edit3 = new QLineEdit("");
33 // edit4 = new QLineEdit("");
34 edit1
->setPlaceholderText("ROM to load when Virtual Jaguar loads");
35 edit2
->setPlaceholderText("ABS to load when Virtual Jaguar loads");
36 edit3
->setPlaceholderText("Windows refresh rate");
37 // edit3->setPlaceholderText("EEPROM path");
38 // edit4->setPlaceholderText("Software path");
40 QVBoxLayout
* layout1
= new QVBoxLayout
;
41 layout1
->addWidget(label1
);
42 layout1
->addWidget(label2
);
43 layout1
->addWidget(label3
);
44 // layout1->addWidget(label3);
45 // layout1->addWidget(label4);
47 QVBoxLayout
* layout2
= new QVBoxLayout
;
48 layout2
->addWidget(edit1
);
49 layout2
->addWidget(edit2
);
50 layout2
->addWidget(edit3
);
51 // layout2->addWidget(edit3);
52 // layout2->addWidget(edit4);
54 QHBoxLayout
* layout3
= new QHBoxLayout
;
55 layout3
->addLayout(layout1
);
56 layout3
->addLayout(layout2
);
58 QVBoxLayout
* layout4
= new QVBoxLayout
;
59 layout4
->addLayout(layout3
);
62 writeROM
= new QCheckBox(tr("Allow writes to cartridge ROM"));
63 // useDSP = new QCheckBox(tr("Enable DSP"));
64 // useHostAudio = new QCheckBox(tr("Enable audio playback"));
65 // useUnknownSoftware = new QCheckBox(tr("Allow unknown software in file chooser"));
66 // Currently, this is unused, so let's signal this to the user:
67 //writeROM->setDisabled(true);
69 layout4
->addWidget(writeROM
);
70 // layout4->addWidget(useDSP);
71 // layout4->addWidget(useHostAudio);
72 // layout4->addWidget(useUnknownSoftware);
79 AlpineTab::~AlpineTab()
84 // Load / Update the tabs dialog from the settings
85 void AlpineTab::GetSettings(void)
87 QVariant
v(vjs
.refresh
);
88 edit1
->setText(vjs
.alpineROMPath
);
89 edit2
->setText(vjs
.absROMPath
);
90 edit3
->setText(v
.toString());
91 writeROM
->setChecked(vjs
.allowWritesToROM
);
95 // Save / Update the settings from the tabs dialog
96 void AlpineTab::SetSettings(void)
100 strcpy(vjs
.alpineROMPath
, CheckForSlashes(edit1
->text()).toUtf8().data());
101 strcpy(vjs
.absROMPath
, CheckForSlashes(edit2
->text()).toUtf8().data());
102 vjs
.refresh
= edit3
->text().toUInt(&ok
, 10);
103 vjs
.allowWritesToROM
= writeROM
->isChecked();
107 // Depend the platform transform slashes or backslashes
108 QString
AlpineTab::CheckForSlashes(QString s
)
111 s
.replace(QString("/"), QString("\\"));
113 s
.replace(QString("\\"), QString("/"));