2 * Common Source code Project:
3 * Ui->Qt->MainWindow for X1TurboZ .
4 * (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
7 * Jan 14, 2015 : Initial, many of constructors were moved to qt/gui/menu_main.cpp.
10 #include <QtCore/QVariant>
12 #include "commonclasses.h"
13 #include "menuclasses.h"
16 #include "sound_dialog.h"
18 #include "../../vm/fm7/fm7_common.h"
23 Object_Menu_Control_7::Object_Menu_Control_7(QObject *parent) : Object_Menu_Control(parent)
27 Object_Menu_Control_7::~Object_Menu_Control_7()
31 #if defined(_FM8) || defined(_FM7) || defined(_FMNEW7)
32 void Object_Menu_Control_7::do_set_kanji_rom(bool flag)
35 config.dipswitch = config.dipswitch | FM7_DIPSW_CONNECT_KANJIROM;
37 config.dipswitch = config.dipswitch & ~FM7_DIPSW_CONNECT_KANJIROM;
43 void Object_Menu_Control_7::do_set_protect_ram(bool flag)
46 config.dipswitch = config.dipswitch | FM7_DIPSW_FM8_PROTECT_FD0F;
48 config.dipswitch = config.dipswitch & ~FM7_DIPSW_FM8_PROTECT_FD0F;
50 emit sig_emu_update_config();
53 void Object_Menu_Control_7::do_set_cyclesteal(bool flag)
56 config.dipswitch = config.dipswitch | FM7_DIPSW_CYCLESTEAL;
58 config.dipswitch = config.dipswitch & ~FM7_DIPSW_CYCLESTEAL;
60 emit sig_emu_update_config();
64 #if defined(_FM77AV_VARIANTS)
65 void Object_Menu_Control_7::do_set_hsync(bool flag)
68 config.dipswitch = config.dipswitch | FM7_DIPSW_SYNC_TO_HSYNC;
70 config.dipswitch = config.dipswitch & ~FM7_DIPSW_SYNC_TO_HSYNC;
75 void Action_Control_7::do_set_frameskip()
77 config.dipswitch &= 0xcfffffff;
78 config.dipswitch |= ((fm7_binds->getValue1() & 3) << 28);
81 Action_Control_7::Action_Control_7(QObject *parent) : Action_Control(parent)
83 fm7_binds = new Object_Menu_Control_7(parent);
84 fm7_binds->setValue1(0);
87 Action_Control_7::~Action_Control_7()
94 void META_MainWindow::do_set_extram(bool flag)
96 # if defined(_FM77AV40) || defined(_FM77AV40SX) || defined(_FM77AV40EX) || defined(_FM77AV20) || defined(_FM77_VARIANTS)
98 config.dipswitch |= FM7_DIPSW_EXTRAM;
100 config.dipswitch &= ~FM7_DIPSW_EXTRAM;
103 # if defined(_FM77AV_VARIANTS)
105 config.dipswitch |= FM7_DIPSW_EXTRAM_AV;
107 config.dipswitch &= ~FM7_DIPSW_EXTRAM_AV;
113 void META_MainWindow::retranslateVolumeLabels(Ui_SoundDialog *p)
117 void META_MainWindow::retranslateUi(void)
120 retranslateControlMenu("HOT START", true);
121 retranslateFloppyMenu(0, 0);
122 retranslateFloppyMenu(1, 1);
123 retranslateCMTMenu();
124 retranslateSoundMenu();
125 retranslateScreenMenu();
126 retranslateMachineMenu();
127 retranslateEmulatorMenu();
128 retranslateUI_Help();
130 this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
132 actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
133 #if defined(USE_PRINTER_TYPE)
134 actionPrintDevice[1]->setText(QApplication::translate("MainWindow", "Dempa Joystick with #1", 0));
135 actionPrintDevice[2]->setText(QApplication::translate("MainWindow", "Dempa Joystick with #2", 0));
138 actionDebugger_1->setText(QApplication::translate("MainWindow", "Debug Main CPU", 0));
139 actionDebugger_2->setText(QApplication::translate("MainWindow", "Debug Sub CPU", 0));
140 actionDebugger_3->setVisible(false);
142 // actionStart_Record_Movie->setText(QApplication::translate("MainWindow", "Start Record Movie", 0));
143 // actionStop_Record_Movie->setText(QApplication::translate("MainWindow", "Stop Record Movie", 0));
145 menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0));
148 menuFrameSkip->setTitle(QApplication::translate("MainWindow", "Frame skip", 0));
149 actionFrameSkip[0]->setText(QApplication::translate("MainWindow", "None", 0));
150 actionFrameSkip[1]->setText(QApplication::translate("MainWindow", "1 Frame", 0));
151 actionFrameSkip[2]->setText(QApplication::translate("MainWindow", "2 Frames", 0));
152 actionFrameSkip[3]->setText(QApplication::translate("MainWindow", "3 Frames", 0));
153 #if defined(_FM77AV_VARIANTS)
154 actionSyncToHsync->setText(QApplication::translate("MainWindow", "Sync to HSYNC", 0));
156 menuCpuType->setTitle(QApplication::translate("MainWindow", "CPU Frequency", 0));
157 actionCpuType[0]->setText(QString::fromUtf8("2MHz"));
158 actionCpuType[1]->setText(QString::fromUtf8("1.2MHz"));
160 menuBootMode->setTitle("BOOT Mode");
161 actionBootMode[0]->setText(QString::fromUtf8("BASIC"));
162 actionBootMode[1]->setText(QString::fromUtf8("DOS"));
163 #if defined(_FM77_VARIANTS)
164 actionBootMode[2]->setVisible(true);
165 actionBootMode[2]->setText(QString::fromUtf8("MMR"));
167 actionBootMode[2]->setText(QApplication::translate("MainWindow", "Bubble Casette", 0));
168 actionBootMode[3]->setText(QApplication::translate("MainWindow", "8Inch FD", 0));
170 actionBootMode[2]->setVisible(true);
171 actionBootMode[3]->setVisible(true);
172 #elif defined(_FM7) || defined(_FMNEW7)
173 actionBootMode[2]->setVisible(false);
176 #if defined(_FM8) || defined(_FM7) || defined(_FMNEW7)
177 actionKanjiRom->setText(QApplication::translate("MainWindow", "Kanji ROM(Need restart)", 0));
180 actionRamProtect->setText(QString::fromUtf8("BANK PROTECT($FD0F/hack)"));
181 #elif defined(_FM7) || defined(_FMNEW7)
182 actionCycleSteal->setText(QString::fromUtf8("Cycle Steal(hack)"));
184 actionCycleSteal->setText(QString::fromUtf8("Cycle Steal"));
186 menuSoundDevice->setTitle(QApplication::translate("MainWindow", "Sound Boards", 0));
187 #if defined(USE_SOUND_DEVICE_TYPE)
189 actionSoundDevice[0]->setVisible(true);
190 actionSoundDevice[1]->setVisible(true);
191 actionSoundDevice[0]->setText(QString::fromUtf8("Beep Only"));
192 actionSoundDevice[1]->setText(QString::fromUtf8("PSG (hack)"));
193 # elif defined(_FM77AV_VARIANTS)
194 actionSoundDevice[0]->setVisible(false);
195 actionSoundDevice[2]->setVisible(false);
196 actionSoundDevice[4]->setVisible(false);
197 actionSoundDevice[6]->setVisible(false);
198 actionSoundDevice[1]->setText(QString::fromUtf8("OPN"));
199 actionSoundDevice[3]->setText(QString::fromUtf8("OPN+WHG"));
200 actionSoundDevice[5]->setText(QString::fromUtf8("OPN+THG"));
201 actionSoundDevice[7]->setText(QString::fromUtf8("OPN+WHG+THG"));
203 actionSoundDevice[0]->setText(QString::fromUtf8("PSG"));
204 actionSoundDevice[1]->setText(QString::fromUtf8("PSG+OPN"));
205 actionSoundDevice[2]->setText(QString::fromUtf8("PSG+WHG"));
206 actionSoundDevice[3]->setText(QString::fromUtf8("PSG+OPN+WHG"));
207 actionSoundDevice[4]->setText(QString::fromUtf8("PSG+THG"));
208 actionSoundDevice[5]->setText(QString::fromUtf8("PSG+OPN+THG"));
209 actionSoundDevice[6]->setText(QString::fromUtf8("PSG+WHG+THG"));
210 actionSoundDevice[7]->setText(QString::fromUtf8("PSG+OPN+WHG+THG"));
214 # if defined(USE_DEVICE_TYPE)
215 menuDeviceType->setTitle(QApplication::translate("MainWindow", "Mouse", 0));
216 actionDeviceType[0]->setText(QApplication::translate("MainWindow", "none", 0));
217 actionDeviceType[1]->setText(QApplication::translate("MainWindow", "JS port1", 0));
218 actionDeviceType[2]->setText(QApplication::translate("MainWindow", "JS port2", 0));
220 # if defined(_FM77AV_VARIANTS) || defined(_FM77_VARIANTS)
221 actionExtRam->setText(QString::fromUtf8("Use Extra RAM (Need reboot)"));
224 menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
225 menuMachine->setTitle(QApplication::translate("MainWindow", "Machine", 0));
231 void META_MainWindow::setupUI_Emu(void)
235 menuFrameSkip = new QMenu(menuMachine);
236 menuFrameSkip->setObjectName(QString::fromUtf8("menuControl_FrameSkip"));
237 actionGroup_FrameSkip = new QActionGroup(this);
238 actionGroup_FrameSkip->setExclusive(true);
239 skip = (config.dipswitch >> 28) & 3;
240 for(i = 0; i < 4; i++) {
241 actionFrameSkip[i] = new Action_Control_7(this);
242 actionFrameSkip[i]->setCheckable(true);
243 actionFrameSkip[i]->setVisible(true);
244 actionFrameSkip[i]->fm7_binds->setValue1(i);
245 actionGroup_FrameSkip->addAction(actionFrameSkip[i]);
246 menuFrameSkip->addAction(actionFrameSkip[i]);
247 if(i == skip) actionFrameSkip[i]->setChecked(true);
248 connect(actionFrameSkip[i], SIGNAL(triggered()), actionFrameSkip[i], SLOT(do_set_frameskip()));
250 menuMachine->addAction(menuFrameSkip->menuAction());
252 menuCpuType = new QMenu(menuMachine);
253 menuCpuType->setObjectName(QString::fromUtf8("menuControl_CpuType"));
254 menuMachine->addAction(menuCpuType->menuAction());
256 menuBootMode = new QMenu(menuMachine);
257 menuBootMode->setObjectName(QString::fromUtf8("menuControl_BootMode"));
258 menuMachine->addAction(menuBootMode->menuAction());
261 ConfigCPUBootMode(4);
262 #elif defined(_FM77AV_VARIANTS)
263 ConfigCPUBootMode(2);
265 ConfigCPUBootMode(3);
267 #if defined(_FM8) || defined(_FM7) || defined(_FMNEW7)
268 actionKanjiRom = new Action_Control_7(this);
269 menuMachine->addAction(actionKanjiRom);
270 actionKanjiRom->setCheckable(true);
271 actionKanjiRom->setVisible(true);
272 if((config.dipswitch & FM7_DIPSW_CONNECT_KANJIROM) != 0) actionKanjiRom->setChecked(true);
273 connect(actionKanjiRom, SIGNAL(toggled(bool)),
274 actionKanjiRom->fm7_binds, SLOT(do_set_kanji_rom(bool)));
278 actionRamProtect = new Action_Control_7(this);
279 menuMachine->addAction(actionRamProtect);
280 actionRamProtect->setCheckable(true);
281 actionRamProtect->setVisible(true);
282 if((config.dipswitch & FM7_DIPSW_FM8_PROTECT_FD0F) != 0) actionRamProtect->setChecked(true);
283 connect(actionRamProtect, SIGNAL(toggled(bool)),
284 actionRamProtect->fm7_binds, SLOT(do_set_protect_ram(bool)));
285 connect(actionRamProtect->fm7_binds, SIGNAL(sig_emu_update_config()),
286 this, SLOT(do_emu_update_config()));
288 actionCycleSteal = new Action_Control_7(this);
289 menuMachine->addAction(actionCycleSteal);
290 actionCycleSteal->setCheckable(true);
291 actionCycleSteal->setVisible(true);
292 if((config.dipswitch & FM7_DIPSW_CYCLESTEAL) != 0) actionCycleSteal->setChecked(true);
293 connect(actionCycleSteal, SIGNAL(toggled(bool)),
294 actionCycleSteal->fm7_binds, SLOT(do_set_cyclesteal(bool)));
295 connect(actionCycleSteal->fm7_binds, SIGNAL(sig_emu_update_config()),
296 this, SLOT(do_emu_update_config()));
298 #if defined(_FM77AV_VARIANTS)
299 actionSyncToHsync = new Action_Control_7(this);
300 menuMachine->addAction(actionSyncToHsync);
301 actionSyncToHsync->setCheckable(true);
302 actionSyncToHsync->setVisible(true);
303 if((config.dipswitch & FM7_DIPSW_SYNC_TO_HSYNC) != 0) actionSyncToHsync->setChecked(true);
304 connect(actionSyncToHsync, SIGNAL(toggled(bool)),
305 actionSyncToHsync->fm7_binds, SLOT(do_set_hsync(bool)));
307 #if defined(_FM77_VARIANTS) || defined(_FM77AV_VARIANTS)
308 actionExtRam = new Action_Control_7(this);
309 menuMachine->addAction(actionExtRam);
310 actionExtRam->setCheckable(true);
311 actionExtRam->setVisible(true);
312 # if defined(_FM77AV40) || defined(_FM77AV40SX) || defined(_FM77AV40EX) || defined(_FM77_VARIANTS)
313 if((config.dipswitch & FM7_DIPSW_EXTRAM) != 0) actionExtRam->setChecked(true);
314 # elif defined(_FM77AV_VARIANTS)
315 if((config.dipswitch & FM7_DIPSW_EXTRAM_AV) != 0) actionExtRam->setChecked(true);
317 connect(actionExtRam, SIGNAL(toggled(bool)),
318 this, SLOT(do_set_extram(bool)));
323 META_MainWindow::META_MainWindow(QWidget *parent) : Ui_MainWindow(parent)
330 META_MainWindow::~META_MainWindow()