ROM cartridge writing detection
[clinton/Virtual-Jaguar-Rx.git] / src / gui / alpinetab.cpp
1 //
2 // alpinetab.cpp: "Alpine" tab on the settings dialog
3 //
4 // Part of the Virtual Jaguar Project
5 // (C) 2011 Underground Software
6 // See the README and GPLv3 files for licensing and warranty information
7 //
8 // JLH = James Hammons <jlhamm@acm.org>
9 //
10 // WHO WHEN WHAT
11 // --- ---------- ------------------------------------------------------------
12 // JLH 07/15/2011 Created this file
13
14 #include "alpinetab.h"
15 #include "settings.h"
16
17
18 AlpineTab::AlpineTab(QWidget * parent/*= 0*/): QWidget(parent)
19 {
20 QLabel * label1 = new QLabel("ROM to load:");
21 QLabel * label2 = new QLabel("ABS to load:");
22 QLabel * label3 = new QLabel("Windows refresh:");
23 // QLabel * label3 = new QLabel("EEPROMs:");
24 // QLabel * label4 = new QLabel("Software:");
25
26 edit1 = new QLineEdit("");
27 edit2 = new QLineEdit("");
28 edit3 = new QLineEdit("");
29 // edit3 = new QLineEdit("");
30 // edit4 = new QLineEdit("");
31 edit1->setPlaceholderText("ROM to load when Virtual Jaguar loads");
32 edit2->setPlaceholderText("ABS to load when Virtual Jaguar loads");
33 edit3->setPlaceholderText("Windows refresh rate");
34 // edit3->setPlaceholderText("EEPROM path");
35 // edit4->setPlaceholderText("Software path");
36
37 QVBoxLayout * layout1 = new QVBoxLayout;
38 layout1->addWidget(label1);
39 layout1->addWidget(label2);
40 layout1->addWidget(label3);
41 // layout1->addWidget(label3);
42 // layout1->addWidget(label4);
43
44 QVBoxLayout * layout2 = new QVBoxLayout;
45 layout2->addWidget(edit1);
46 layout2->addWidget(edit2);
47 layout2->addWidget(edit3);
48 // layout2->addWidget(edit3);
49 // layout2->addWidget(edit4);
50
51 QHBoxLayout * layout3 = new QHBoxLayout;
52 layout3->addLayout(layout1);
53 layout3->addLayout(layout2);
54
55 QVBoxLayout * layout4 = new QVBoxLayout;
56 layout4->addLayout(layout3);
57
58 // Checkboxes...
59 writeROM = new QCheckBox(tr("Allow writes to cartridge ROM"));
60 // useDSP = new QCheckBox(tr("Enable DSP"));
61 // useHostAudio = new QCheckBox(tr("Enable audio playback"));
62 // useUnknownSoftware = new QCheckBox(tr("Allow unknown software in file chooser"));
63 // Currently, this is unused, so let's signal this to the user:
64 //writeROM->setDisabled(true);
65
66 layout4->addWidget(writeROM);
67 // layout4->addWidget(useDSP);
68 // layout4->addWidget(useHostAudio);
69 // layout4->addWidget(useUnknownSoftware);
70
71 setLayout(layout4);
72 }
73
74
75 //
76 AlpineTab::~AlpineTab()
77 {
78 }
79
80
81 // Load / Update the tabs dialog from the settings
82 void AlpineTab::GetSettings(void)
83 {
84 QVariant v(vjs.refresh);
85 edit1->setText(vjs.alpineROMPath);
86 edit2->setText(vjs.absROMPath);
87 edit3->setText(v.toString());
88 writeROM->setChecked(vjs.allowWritesToROM);
89 }
90
91
92 // Save / Update the settings from the tabs dialog
93 void AlpineTab::SetSettings(void)
94 {
95 bool ok;
96
97 strcpy(vjs.alpineROMPath, edit1->text().toUtf8().data());
98 strcpy(vjs.absROMPath, edit2->text().toUtf8().data());
99 vjs.refresh = edit3->text().toUInt(&ok, 10);
100 vjs.allowWritesToROM = writeROM->isChecked();
101 }
102