Commit | Line | Data |
---|---|---|
cf76e892 JPM |
1 | // |
2 | // generaltab.cpp: "General" 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> | |
bc10fc42 | 9 | // JPM = Jean-Paul Mari <djipi.mari@gmail.com> |
cf76e892 JPM |
10 | // |
11 | // WHO WHEN WHAT | |
12 | // --- ---------- ------------------------------------------------------------ | |
13 | // JLH 06/23/2011 Created this file | |
fe3b257d | 14 | // JPM Sept./2018 Added a Models & Bios tab, slashes / backslashes formatting, and screenshot path |
bc10fc42 | 15 | // |
cf76e892 | 16 | |
fe3b257d JPM |
17 | // STILL TO DO: |
18 | // To scan the bios folder for the 5 known BIOSes, and just present a radio button to choose between them... | |
19 | // | |
20 | ||
21 | ||
bc10fc42 | 22 | #include "configdialog.h" |
cf76e892 | 23 | #include "generaltab.h" |
024bfc46 | 24 | #include "settings.h" |
cf76e892 JPM |
25 | |
26 | ||
bc10fc42 | 27 | // |
cf76e892 JPM |
28 | GeneralTab::GeneralTab(QWidget * parent/*= 0*/): QWidget(parent) |
29 | { | |
cf76e892 JPM |
30 | // QLabel * label1 = new QLabel("Boot ROM:"); |
31 | // QLabel * label2 = new QLabel("CD Boot ROM:"); | |
32 | QLabel * label3 = new QLabel("EEPROMs:"); | |
33 | QLabel * label4 = new QLabel("Software:"); | |
25251f31 | 34 | QLabel * label5 = new QLabel("Screenshots:"); |
cf76e892 JPM |
35 | |
36 | // edit1 = new QLineEdit(""); | |
37 | // edit2 = new QLineEdit(""); | |
38 | edit3 = new QLineEdit(""); | |
39 | edit4 = new QLineEdit(""); | |
25251f31 | 40 | edit5 = new QLineEdit(""); |
cf76e892 JPM |
41 | // edit1->setPlaceholderText("Boot ROM location"); |
42 | // edit2->setPlaceholderText("CD Boot ROM location"); | |
43 | edit3->setPlaceholderText("EEPROM path"); | |
44 | edit4->setPlaceholderText("Software path"); | |
25251f31 | 45 | edit5->setPlaceholderText("Screenshot path"); |
cf76e892 JPM |
46 | |
47 | QVBoxLayout * layout1 = new QVBoxLayout; | |
48 | // layout1->addWidget(label1); | |
49 | // layout1->addWidget(label2); | |
50 | layout1->addWidget(label3); | |
51 | layout1->addWidget(label4); | |
25251f31 | 52 | layout1->addWidget(label5); |
cf76e892 JPM |
53 | |
54 | QVBoxLayout * layout2 = new QVBoxLayout; | |
55 | // layout2->addWidget(edit1); | |
56 | // layout2->addWidget(edit2); | |
57 | layout2->addWidget(edit3); | |
58 | layout2->addWidget(edit4); | |
25251f31 | 59 | layout2->addWidget(edit5); |
cf76e892 JPM |
60 | |
61 | QHBoxLayout * layout3 = new QHBoxLayout; | |
62 | layout3->addLayout(layout1); | |
63 | layout3->addLayout(layout2); | |
64 | ||
65 | QVBoxLayout * layout4 = new QVBoxLayout; | |
66 | layout4->addLayout(layout3); | |
67 | ||
68 | // Checkboxes... | |
bc10fc42 | 69 | #ifndef NEWMODELSBIOSHANDLER |
cf76e892 | 70 | useBIOS = new QCheckBox(tr("Enable Jaguar BIOS")); |
bc10fc42 | 71 | #endif |
cf76e892 JPM |
72 | useGPU = new QCheckBox(tr("Enable GPU")); |
73 | useDSP = new QCheckBox(tr("Enable DSP")); | |
74 | useFullScreen = new QCheckBox(tr("Start Virtual Jaguar in full screen")); | |
75 | // useHostAudio = new QCheckBox(tr("Enable audio playback (requires DSP)")); | |
76 | useUnknownSoftware = new QCheckBox(tr("Show all files in file chooser")); | |
77 | useFastBlitter = new QCheckBox(tr("Use fast blitter")); | |
78 | ||
bc10fc42 | 79 | #ifndef NEWMODELSBIOSHANDLER |
cf76e892 | 80 | layout4->addWidget(useBIOS); |
bc10fc42 | 81 | #endif |
cf76e892 JPM |
82 | layout4->addWidget(useGPU); |
83 | layout4->addWidget(useDSP); | |
84 | layout4->addWidget(useFullScreen); | |
85 | // layout4->addWidget(useHostAudio); | |
86 | layout4->addWidget(useUnknownSoftware); | |
87 | layout4->addWidget(useFastBlitter); | |
88 | ||
89 | setLayout(layout4); | |
90 | } | |
91 | ||
024bfc46 | 92 | |
bc10fc42 | 93 | // |
cf76e892 JPM |
94 | GeneralTab::~GeneralTab() |
95 | { | |
96 | } | |
97 | ||
024bfc46 JPM |
98 | |
99 | // Load / Update the tabs dialog from the settings | |
100 | void GeneralTab::GetSettings(void) | |
101 | { | |
102 | // generalTab->edit1->setText(vjs.jagBootPath); | |
103 | // generalTab->edit2->setText(vjs.CDBootPath); | |
104 | edit3->setText(vjs.EEPROMPath); | |
105 | edit4->setText(vjs.ROMPath); | |
25251f31 | 106 | edit5->setText(vjs.screenshotPath); |
bc10fc42 | 107 | #ifndef NEWMODELSBIOSHANDLER |
024bfc46 | 108 | useBIOS->setChecked(vjs.useJaguarBIOS); |
bc10fc42 | 109 | #endif |
024bfc46 JPM |
110 | useGPU->setChecked(vjs.GPUEnabled); |
111 | useDSP->setChecked(vjs.DSPEnabled); | |
112 | useFullScreen->setChecked(vjs.fullscreen); | |
113 | // generalTab->useHostAudio->setChecked(vjs.audioEnabled); | |
114 | useFastBlitter->setChecked(vjs.useFastBlitter); | |
115 | } | |
116 | ||
117 | ||
bc10fc42 | 118 | // Save & Update the settings from the tabs dialog |
024bfc46 JPM |
119 | void GeneralTab::SetSettings(void) |
120 | { | |
121 | // strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data()); | |
122 | // strcpy(vjs.CDBootPath, generalTab->edit2->text().toAscii().data()); | |
123 | strcpy(vjs.EEPROMPath, CheckForTrailingSlash(edit3->text()).toUtf8().data()); | |
124 | strcpy(vjs.ROMPath, CheckForTrailingSlash(edit4->text()).toUtf8().data()); | |
25251f31 | 125 | strcpy(vjs.screenshotPath, CheckForTrailingSlash(edit5->text()).toUtf8().data()); |
024bfc46 | 126 | |
bc10fc42 | 127 | #ifndef NEWMODELSBIOSHANDLER |
024bfc46 | 128 | vjs.useJaguarBIOS = useBIOS->isChecked(); |
bc10fc42 | 129 | #endif |
024bfc46 JPM |
130 | vjs.GPUEnabled = useGPU->isChecked(); |
131 | vjs.DSPEnabled = useDSP->isChecked(); | |
132 | vjs.fullscreen = useFullScreen->isChecked(); | |
133 | // vjs.audioEnabled = generalTab->useHostAudio->isChecked(); | |
134 | vjs.useFastBlitter = useFastBlitter->isChecked(); | |
135 | } | |
136 | ||
137 | ||
138 | // Append a slash or a backslash at the end of the string | |
bc10fc42 | 139 | // Depend the platform transform slashes or backslashes |
024bfc46 JPM |
140 | QString GeneralTab::CheckForTrailingSlash(QString s) |
141 | { | |
142 | if (!s.endsWith('/') && !s.endsWith('\\')) | |
bc10fc42 | 143 | { |
024bfc46 | 144 | s.append('/'); |
bc10fc42 JPM |
145 | } |
146 | #ifdef _WIN32 | |
147 | s.replace(QString("/"), QString("\\")); | |
148 | #else | |
149 | s.replace(QString("\\"), QString("/")); | |
150 | #endif | |
024bfc46 JPM |
151 | return s; |
152 | } | |
153 | ||
154 | ||
cf76e892 JPM |
155 | #if 0 |
156 | vjs.useJoystick = settings.value("useJoystick", false).toBool(); | |
157 | vjs.joyport = settings.value("joyport", 0).toInt(); | |
158 | vjs.frameSkip = settings.value("frameSkip", 0).toInt(); | |
159 | vjs.useJaguarBIOS = settings.value("useJaguarBIOS", false).toBool(); | |
160 | vjs.DSPEnabled = settings.value("DSPEnabled", false).toBool(); | |
161 | vjs.usePipelinedDSP = settings.value("usePipelinedDSP", false).toBool(); | |
162 | vjs.fullscreen = settings.value("fullscreen", false).toBool(); | |
163 | vjs.renderType = settings.value("renderType", 0).toInt(); | |
164 | strcpy(vjs.jagBootPath, settings.value("JagBootROM", "./bios/[BIOS] Atari Jaguar (USA, Europe).zip").toString().toAscii().data()); | |
165 | strcpy(vjs.CDBootPath, settings.value("CDBootROM", "./bios/jagcd.rom").toString().toAscii().data()); | |
166 | strcpy(vjs.EEPROMPath, settings.value("EEPROMs", "./eeproms").toString().toAscii().data()); | |
167 | strcpy(vjs.ROMPath, settings.value("ROMs", "./software").toString().toAscii().data()); | |
168 | #endif |