Commit | Line | Data |
---|---|---|
cf76e892 JPM |
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> | |
87d08e09 | 9 | // JPM = Jean-Paul Mari <djipi.mari@gmail.com> |
cf76e892 JPM |
10 | // |
11 | // WHO WHEN WHAT | |
12 | // --- ---------- ------------------------------------------------------------ | |
13 | // JLH 07/15/2011 Created this file | |
87d08e09 JPM |
14 | // JPM 09/03/2018 Depend the platform transform slashes or backslashes |
15 | // | |
cf76e892 JPM |
16 | |
17 | #include "alpinetab.h" | |
024bfc46 | 18 | #include "settings.h" |
cf76e892 JPM |
19 | |
20 | ||
21 | AlpineTab::AlpineTab(QWidget * parent/*= 0*/): QWidget(parent) | |
22 | { | |
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:"); | |
28 | ||
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"); | |
39 | ||
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); | |
46 | ||
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); | |
53 | ||
54 | QHBoxLayout * layout3 = new QHBoxLayout; | |
55 | layout3->addLayout(layout1); | |
56 | layout3->addLayout(layout2); | |
57 | ||
58 | QVBoxLayout * layout4 = new QVBoxLayout; | |
59 | layout4->addLayout(layout3); | |
60 | ||
61 | // Checkboxes... | |
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: | |
eb20f274 | 67 | //writeROM->setDisabled(true); |
cf76e892 JPM |
68 | |
69 | layout4->addWidget(writeROM); | |
70 | // layout4->addWidget(useDSP); | |
71 | // layout4->addWidget(useHostAudio); | |
72 | // layout4->addWidget(useUnknownSoftware); | |
73 | ||
74 | setLayout(layout4); | |
75 | } | |
76 | ||
024bfc46 JPM |
77 | |
78 | // | |
cf76e892 JPM |
79 | AlpineTab::~AlpineTab() |
80 | { | |
81 | } | |
024bfc46 JPM |
82 | |
83 | ||
84 | // Load / Update the tabs dialog from the settings | |
85 | void AlpineTab::GetSettings(void) | |
86 | { | |
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); | |
92 | } | |
93 | ||
94 | ||
95 | // Save / Update the settings from the tabs dialog | |
96 | void AlpineTab::SetSettings(void) | |
97 | { | |
98 | bool ok; | |
99 | ||
87d08e09 JPM |
100 | strcpy(vjs.alpineROMPath, CheckForSlashes(edit1->text()).toUtf8().data()); |
101 | strcpy(vjs.absROMPath, CheckForSlashes(edit2->text()).toUtf8().data()); | |
024bfc46 JPM |
102 | vjs.refresh = edit3->text().toUInt(&ok, 10); |
103 | vjs.allowWritesToROM = writeROM->isChecked(); | |
104 | } | |
105 | ||
87d08e09 JPM |
106 | |
107 | // Depend the platform transform slashes or backslashes | |
108 | QString AlpineTab::CheckForSlashes(QString s) | |
109 | { | |
110 | #ifdef _WIN32 | |
111 | s.replace(QString("/"), QString("\\")); | |
112 | #else | |
113 | s.replace(QString("\\"), QString("/")); | |
114 | #endif | |
115 | return s; | |
116 | } |