Document updates for the R3 release
[clinton/Virtual-Jaguar-Rx.git] / src / gui / generaltab.cpp
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>
9 //
10 // WHO WHEN WHAT
11 // --- ---------- ------------------------------------------------------------
12 // JLH 06/23/2011 Created this file
13
14 #include "generaltab.h"
15 #include "settings.h"
16
17
18 GeneralTab::GeneralTab(QWidget * parent/*= 0*/): QWidget(parent)
19 {
20 // I'm thinking we should scan the bios folder for the 5 known BIOSes, and
21 // just present a radio button to choose between them...
22 // (BIOS is built-in now...)
23 // QLabel * label1 = new QLabel("Boot ROM:");
24 // QLabel * label2 = new QLabel("CD Boot ROM:");
25 QLabel * label3 = new QLabel("EEPROMs:");
26 QLabel * label4 = new QLabel("Software:");
27
28 // edit1 = new QLineEdit("");
29 // edit2 = new QLineEdit("");
30 edit3 = new QLineEdit("");
31 edit4 = new QLineEdit("");
32 // edit1->setPlaceholderText("Boot ROM location");
33 // edit2->setPlaceholderText("CD Boot ROM location");
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(label4);
42
43 QVBoxLayout * layout2 = new QVBoxLayout;
44 // layout2->addWidget(edit1);
45 // layout2->addWidget(edit2);
46 layout2->addWidget(edit3);
47 layout2->addWidget(edit4);
48
49 QHBoxLayout * layout3 = new QHBoxLayout;
50 layout3->addLayout(layout1);
51 layout3->addLayout(layout2);
52
53 QVBoxLayout * layout4 = new QVBoxLayout;
54 layout4->addLayout(layout3);
55
56 // Checkboxes...
57 useBIOS = new QCheckBox(tr("Enable Jaguar BIOS"));
58 useGPU = new QCheckBox(tr("Enable GPU"));
59 useDSP = new QCheckBox(tr("Enable DSP"));
60 useFullScreen = new QCheckBox(tr("Start Virtual Jaguar in full screen"));
61 // useHostAudio = new QCheckBox(tr("Enable audio playback (requires DSP)"));
62 useUnknownSoftware = new QCheckBox(tr("Show all files in file chooser"));
63 useFastBlitter = new QCheckBox(tr("Use fast blitter"));
64
65 layout4->addWidget(useBIOS);
66 layout4->addWidget(useGPU);
67 layout4->addWidget(useDSP);
68 layout4->addWidget(useFullScreen);
69 // layout4->addWidget(useHostAudio);
70 layout4->addWidget(useUnknownSoftware);
71 layout4->addWidget(useFastBlitter);
72
73 setLayout(layout4);
74 }
75
76
77 GeneralTab::~GeneralTab()
78 {
79 }
80
81
82 // Load / Update the tabs dialog from the settings
83 void GeneralTab::GetSettings(void)
84 {
85 // generalTab->edit1->setText(vjs.jagBootPath);
86 // generalTab->edit2->setText(vjs.CDBootPath);
87 edit3->setText(vjs.EEPROMPath);
88 edit4->setText(vjs.ROMPath);
89 useBIOS->setChecked(vjs.useJaguarBIOS);
90 useGPU->setChecked(vjs.GPUEnabled);
91 useDSP->setChecked(vjs.DSPEnabled);
92 useFullScreen->setChecked(vjs.fullscreen);
93 // generalTab->useHostAudio->setChecked(vjs.audioEnabled);
94 useFastBlitter->setChecked(vjs.useFastBlitter);
95 }
96
97
98 // Save / Update the settings from the tabs dialog
99 void GeneralTab::SetSettings(void)
100 {
101 // strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data());
102 // strcpy(vjs.CDBootPath, generalTab->edit2->text().toAscii().data());
103 strcpy(vjs.EEPROMPath, CheckForTrailingSlash(edit3->text()).toUtf8().data());
104 strcpy(vjs.ROMPath, CheckForTrailingSlash(edit4->text()).toUtf8().data());
105
106 vjs.useJaguarBIOS = useBIOS->isChecked();
107 vjs.GPUEnabled = useGPU->isChecked();
108 vjs.DSPEnabled = useDSP->isChecked();
109 vjs.fullscreen = useFullScreen->isChecked();
110 // vjs.audioEnabled = generalTab->useHostAudio->isChecked();
111 vjs.useFastBlitter = useFastBlitter->isChecked();
112 }
113
114
115 // Append a slash or a backslash at the end of the string
116 QString GeneralTab::CheckForTrailingSlash(QString s)
117 {
118 if (!s.endsWith('/') && !s.endsWith('\\'))
119 s.append('/');
120
121 return s;
122 }
123
124
125 #if 0
126 vjs.useJoystick = settings.value("useJoystick", false).toBool();
127 vjs.joyport = settings.value("joyport", 0).toInt();
128 vjs.frameSkip = settings.value("frameSkip", 0).toInt();
129 vjs.useJaguarBIOS = settings.value("useJaguarBIOS", false).toBool();
130 vjs.DSPEnabled = settings.value("DSPEnabled", false).toBool();
131 vjs.usePipelinedDSP = settings.value("usePipelinedDSP", false).toBool();
132 vjs.fullscreen = settings.value("fullscreen", false).toBool();
133 vjs.renderType = settings.value("renderType", 0).toInt();
134 strcpy(vjs.jagBootPath, settings.value("JagBootROM", "./bios/[BIOS] Atari Jaguar (USA, Europe).zip").toString().toAscii().data());
135 strcpy(vjs.CDBootPath, settings.value("CDBootROM", "./bios/jagcd.rom").toString().toAscii().data());
136 strcpy(vjs.EEPROMPath, settings.value("EEPROMs", "./eeproms").toString().toAscii().data());
137 strcpy(vjs.ROMPath, settings.value("ROMs", "./software").toString().toAscii().data());
138 #endif