2 * Common Source code Project:
3 * Ui->Qt->gui->menu_main for generic.
4 * (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
7 * Jan 14, 2015 : Initial, moved from qt/x1turboz/MainWindow.cpp .
10 #include <QtCore/QVariant>
14 #include <QImageReader>
17 #include "commonclasses.h"
18 #include "display_about.h"
19 #include "display_text_document.h"
20 #include "mainwidget.h"
21 #include "menuclasses.h"
22 #include "qt_gldraw.h"
31 Ui_MainWindow::Ui_MainWindow(QWidget *parent) : QMainWindow(parent)
37 Ui_MainWindow::~Ui_MainWindow()
41 void Action_Control::do_check_grab_mouse(bool flag)
46 void Action_Control::do_send_string(void)
48 emit sig_send_string(bindString);
51 void Action_Control::do_set_string(QString s)
57 void Ui_MainWindow::do_show_about(void)
59 Dlg_AboutCSP *dlg = new Dlg_AboutCSP;
63 void Ui_MainWindow::do_browse_document(QString fname)
65 Dlg_BrowseText *dlg = new Dlg_BrowseText(fname);
70 void Ui_MainWindow::setupUi(void)
73 // QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
74 MainWindow = new QMainWindow();
75 if (MainWindow->objectName().isEmpty())
76 MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
77 //MainWindow->resize(1288, 862);
82 #if !defined(WITHOUT_SOUND)
85 #if defined(USE_BINARY_FILE1)
89 #if defined(USE_QD1) || defined(USE_QD2)
90 ConfigQuickDiskMenu();
94 #if defined(USE_CART1) || defined(USE_CART2)
98 actionAbout = new Action_Control(this);
99 actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
102 graphicsView = new GLDrawClass(this);
103 graphicsView->setObjectName(QString::fromUtf8("graphicsView"));
104 graphicsView->setMaximumSize(2560, 2560); // ?
105 graphicsView->setMinimumSize(240, 192); // ?
106 //#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)
107 this->setFocusProxy(graphicsView);
108 graphicsView->setAttribute(Qt::WA_InputMethodEnabled, false); // Disable [Zenkaku / Hankaku] with IM.
109 //graphicsView->setAttribute(Qt::WA_KeyboardFocusChange, false);
112 #if defined(USE_BITMAP)
115 MainWindow->setCentralWidget(graphicsView);
117 MainWindow->centralWidget()->adjustSize();
118 MainWindow->adjustSize();
119 //MainWindow->setAttribute(Qt::WA_InputMethodEnabled, false); // Disable [Zenkaku / Hankaku] with IM.
121 statusbar = new QStatusBar(this);
122 statusbar->setObjectName(QString::fromUtf8("statusbar"));
123 MainWindow->setStatusBar(statusbar);
126 menubar = new QMenuBar(this);
127 menubar->setObjectName(QString::fromUtf8("menubar"));
128 menubar->setGeometry(QRect(0, 0, 1288, 27));
129 menuControl = new QMenu(menubar);
130 menuControl->setObjectName(QString::fromUtf8("menuControl"));
131 menuState = new QMenu(menuControl);
132 menuState->setObjectName(QString::fromUtf8("menuState"));
133 menuCopy_Paste = new QMenu(menuControl);
134 menuCopy_Paste->setObjectName(QString::fromUtf8("menuCopy_Paste"));
135 menuCpu_Speed = new QMenu(menuControl);
136 menuCpu_Speed->setObjectName(QString::fromUtf8("menuCpu_Speed"));
137 menuDebugger = new QMenu(menuControl);
138 menuDebugger->setObjectName(QString::fromUtf8("menuDebugger"));
140 CreateFloppyMenu(0, 1);
143 CreateFloppyMenu(1, 2);
146 CreateFloppyMenu(2, 3);
149 CreateFloppyMenu(3, 4);
152 CreateFloppyMenu(4, 5);
155 CreateFloppyMenu(5, 6);
158 CreateFloppyMenu(6, 7);
161 CreateFloppyMenu(7, 8);
165 CreateQuickDiskMenu(0, 1);
168 CreateQuickDiskMenu(1, 2);
175 #if defined(USE_CART1)
176 CreateCartMenu(0, 1);
178 #if defined(USE_CART2)
179 CreateCartMenu(1, 2);
181 #if defined(USE_BINARY_FILE1)
182 CreateBinaryMenu(0, 1);
184 #if defined(USE_BINARY_FILE2)
185 CreateBinaryMenu(1, 2);
188 menuMachine = new QMenu(menubar);
189 menuMachine->setObjectName(QString::fromUtf8("menuMachine"));
190 actionMouseEnable = new Action_Control(this);
191 actionMouseEnable->setCheckable(true);
192 actionMouseEnable->setVisible(true);
193 actionMouseEnable->setChecked(false);
194 menuMachine->addAction(actionMouseEnable);
195 connect(actionMouseEnable, SIGNAL(toggled(bool)),
196 this, SLOT(do_set_mouse_enable(bool)));
197 connect(graphicsView, SIGNAL(sig_check_grab_mouse(bool)),
198 actionMouseEnable, SLOT(do_check_grab_mouse(bool)));
202 ConfigSoundDeviceType();
204 #if !defined(WITHOUT_SOUND)
205 menuSound = new QMenu(menubar);
206 menuSound->setObjectName(QString::fromUtf8("menuSound"));
208 menuEmulator = new QMenu(menubar);
209 menuEmulator->setObjectName(QString::fromUtf8("menuEmulator"));
210 menuHELP = new QMenu(menubar);
211 menuHELP->setObjectName(QString::fromUtf8("menuHELP"));
212 MainWindow->setMenuBar(menubar);
214 menubar->addAction(menuControl->menuAction());
215 connectActions_ControlMenu();
217 menubar->addAction(menuFD[0]->menuAction());
220 menubar->addAction(menuFD[1]->menuAction());
223 menubar->addAction(menuFD[2]->menuAction());
226 menubar->addAction(menuFD[3]->menuAction());
229 menubar->addAction(menuFD[4]->menuAction());
232 menubar->addAction(menuFD[5]->menuAction());
235 menubar->addAction(menuFD[6]->menuAction());
238 menubar->addAction(menuFD[7]->menuAction());
241 menubar->addAction(menuQD[0]->menuAction());
244 menubar->addAction(menuQD[1]->menuAction());
246 #if defined(USE_TAPE)
247 menubar->addAction(menuCMT->menuAction());
249 #if defined(USE_CART1)
250 menubar->addAction(menuCART[0]->menuAction());
252 #if defined(USE_CART2)
253 menubar->addAction(menuCART[1]->menuAction());
255 #if defined(USE_BINARY_FILE1)
256 menubar->addAction(menuBIN[0]->menuAction());
258 #if defined(USE_BINARY_FILE2)
259 menubar->addAction(menuBIN[1]->menuAction());
261 menubar->addAction(menuMachine->menuAction());
263 #if !defined(WITHOUT_SOUND)
264 menubar->addAction(menuSound->menuAction());
266 menubar->addAction(menuScreen->menuAction());
267 // menubar->addAction(menuRecord->menuAction());
268 menubar->addAction(menuEmulator->menuAction());
269 menubar->addAction(menuHELP->menuAction());
271 CreateFloppyPulldownMenu(0);
274 CreateFloppyPulldownMenu(1);
277 CreateFloppyPulldownMenu(2);
280 CreateFloppyPulldownMenu(3);
283 CreateFloppyPulldownMenu(4);
286 CreateFloppyPulldownMenu(5);
289 CreateFloppyPulldownMenu(6);
292 CreateFloppyPulldownMenu(7);
295 CreateCMTPulldownMenu();
298 CreateQuickDiskPulldownMenu(0);
301 CreateQuickDiskPulldownMenu(1);
303 #if defined(USE_CART1)
304 CreateCartPulldownMenu(0);
306 #if defined(USE_CART2)
307 CreateCartPulldownMenu(1);
309 #if defined(USE_BINARY_FILE1)
310 CreateBinaryPulldownMenu(0);
312 #if defined(USE_BINARY_FILE2)
313 CreateBinaryPulldownMenu(1);
315 #if !defined(WITHOUT_SOUND)
319 menuHELP->addAction(actionAbout);
320 connect(actionAbout, SIGNAL(triggered()), this, SLOT(do_show_about()));
321 menuHELP->addSeparator();
323 actionHelp_AboutQt = new Action_Control(this);
324 actionHelp_AboutQt->setObjectName(QString::fromUtf8("menuHelp_AboutQt"));
325 menuHELP->addAction(actionHelp_AboutQt);
326 menuHELP->addSeparator();
327 menuHelp_Readme = new QMenu(menuHELP);
328 menuHelp_Readme->setObjectName(QString::fromUtf8("menuHelp_Readme_menu"));;
329 menuHELP->addAction(menuHelp_Readme->menuAction());
331 actionHelp_README = new Action_Control(this);
332 actionHelp_README->setObjectName(QString::fromUtf8("menuHelp_README"));
333 actionHelp_README->do_set_string(QString::fromUtf8("readme.txt"));
334 connect(actionHelp_README, SIGNAL(triggered()), actionHelp_README, SLOT(do_send_string()));
335 connect(actionHelp_README, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
336 menuHelp_Readme->addAction(actionHelp_README);
338 actionHelp_README_QT = new Action_Control(this);
339 actionHelp_README_QT->setObjectName(QString::fromUtf8("menuHelp_README_QT"));
340 actionHelp_README_QT->do_set_string(QString::fromUtf8("readme.qt.txt"));
341 menuHelp_Readme->addAction(actionHelp_README_QT);
342 connect(actionHelp_README_QT, SIGNAL(triggered()), actionHelp_README_QT, SLOT(do_send_string()));
343 connect(actionHelp_README_QT, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
344 actionHelp_README_Artane = new Action_Control(this);
345 actionHelp_README_Artane->setObjectName(QString::fromUtf8("menuHelp_README_Artane"));
346 actionHelp_README_Artane->do_set_string(QString::fromUtf8("readme_by_artane.txt"));
347 connect(actionHelp_README_Artane, SIGNAL(triggered()), actionHelp_README_Artane, SLOT(do_send_string()));
348 connect(actionHelp_README_Artane, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
349 menuHelp_Readme->addAction(actionHelp_README_Artane);
350 menuHelp_Readme->addSeparator();
352 actionHelp_README_MR_TANAM = new Action_Control(this);
353 actionHelp_README_MR_TANAM->setObjectName(QString::fromUtf8("menuHelp_README_MR_TANAM"));
354 actionHelp_README_MR_TANAM->do_set_string(QString::fromUtf8("readme_by_mr_tanam.txt"));
355 connect(actionHelp_README_MR_TANAM, SIGNAL(triggered()), actionHelp_README_MR_TANAM, SLOT(do_send_string()));
356 connect(actionHelp_README_MR_TANAM, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
357 menuHelp_Readme->addAction(actionHelp_README_MR_TANAM);
359 menuHelp_Readme->addSeparator();
361 actionHelp_README_FM7 = new Action_Control(this);
362 actionHelp_README_FM7->setObjectName(QString::fromUtf8("menuHelp_README_FM7"));
363 actionHelp_README_FM7->do_set_string(QString::fromUtf8("readme_fm7.txt"));
364 connect(actionHelp_README_FM7, SIGNAL(triggered()), actionHelp_README_FM7, SLOT(do_send_string()));
365 connect(actionHelp_README_FM7, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
366 menuHelp_Readme->addAction(actionHelp_README_FM7);
368 actionHelp_README_FM7_JP = new Action_Control(this);
369 actionHelp_README_FM7_JP->setObjectName(QString::fromUtf8("menuHelp_README_FM7_JP"));
370 actionHelp_README_FM7_JP->do_set_string(QString::fromUtf8("readme_fm7.jp.txt"));
371 connect(actionHelp_README_FM7_JP, SIGNAL(triggered()), actionHelp_README_FM7_JP, SLOT(do_send_string()));
372 connect(actionHelp_README_FM7_JP, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
373 menuHelp_Readme->addAction(actionHelp_README_FM7_JP);
375 menuHelp_Histories = new QMenu(menuHELP);
376 menuHelp_Histories->setObjectName(QString::fromUtf8("menuHelp_Histories"));;
377 menuHELP->addAction(menuHelp_Histories->menuAction());
379 actionHelp_History = new Action_Control(this);
380 actionHelp_History->setObjectName(QString::fromUtf8("menuHelp_History"));
381 actionHelp_History->do_set_string(QString::fromUtf8("history.txt"));
382 connect(actionHelp_History, SIGNAL(triggered()), actionHelp_History, SLOT(do_send_string()));
383 connect(actionHelp_History, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
384 menuHelp_Histories->addAction(actionHelp_History);
386 actionHelp_History_Relnote = new Action_Control(this);
387 actionHelp_History_Relnote->setObjectName(QString::fromUtf8("menuHelp_History_Relnote"));
388 actionHelp_History_Relnote->do_set_string(QString::fromUtf8("RELEASENOTE.txt"));
389 connect(actionHelp_History_Relnote, SIGNAL(triggered()), actionHelp_History_Relnote, SLOT(do_send_string()));
390 connect(actionHelp_History_Relnote, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
391 menuHelp_Histories->addAction(actionHelp_History_Relnote);
393 actionHelp_History_ChangeLog = new Action_Control(this);
394 actionHelp_History_ChangeLog->setObjectName(QString::fromUtf8("menuHelp_History_ChangeLog"));
395 actionHelp_History_ChangeLog->do_set_string(QString::fromUtf8("ChangeLog.txt"));
396 connect(actionHelp_History_ChangeLog, SIGNAL(triggered()), actionHelp_History_ChangeLog, SLOT(do_send_string()));
397 connect(actionHelp_History_ChangeLog, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
398 menuHelp_Histories->addAction(actionHelp_History_ChangeLog);
400 actionHelp_History_MR_TANAM = new Action_Control(this);
401 actionHelp_History_MR_TANAM->setObjectName(QString::fromUtf8("menuHelp_History_MR_TANAM"));
402 actionHelp_History_MR_TANAM->do_set_string(QString::fromUtf8("history_by_mr_tanam.txt"));
403 connect(actionHelp_History_MR_TANAM, SIGNAL(triggered()), actionHelp_History_MR_TANAM, SLOT(do_send_string()));
404 connect(actionHelp_History_MR_TANAM, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
405 menuHelp_Histories->addAction(actionHelp_History_MR_TANAM);
407 actionHelp_License = new Action_Control(this);
408 actionHelp_License->setObjectName(QString::fromUtf8("menuHelp_License"));
409 actionHelp_License->do_set_string(QString::fromUtf8("LICENSE.txt"));
410 connect(actionHelp_License, SIGNAL(triggered()), actionHelp_License, SLOT(do_send_string()));
411 connect(actionHelp_License, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
412 menuHELP->addAction(actionHelp_License);
414 actionHelp_License_JP = new Action_Control(this);
415 actionHelp_License_JP->setObjectName(QString::fromUtf8("menuHelp_License_JP"));
416 actionHelp_License_JP->do_set_string(QString::fromUtf8("LICENSE.ja.txt"));
417 connect(actionHelp_License_JP, SIGNAL(triggered()), actionHelp_License_JP, SLOT(do_send_string()));
418 connect(actionHelp_License_JP, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
419 menuHELP->addAction(actionHelp_License_JP);
421 if(config.window_mode <= 0) config.window_mode = 0;
422 if(config.window_mode >= _SCREEN_MODE_NUM) config.window_mode = _SCREEN_MODE_NUM - 1;
425 if(actionScreenSize[config.window_mode] != NULL) {
426 double nd = actionScreenSize[config.window_mode]->binds->getDoubleValue();
427 w = (int)(nd * (double)w);
428 h = (int)(nd * (double)h);
429 #if defined(USE_SCREEN_ROTATE)
430 if(config.rotate_type) {
437 #if defined(USE_SCREEN_ROTATE)
438 if(config.rotate_type) {
448 graphicsView->setFixedSize(w, h);
449 this->set_screen_size(w, h);
450 this->set_screen_aspect(config.stretch_type);
451 QImageReader reader(":/default.ico");
452 QImage result = reader.read();
453 MainWindow->setWindowIcon(QPixmap::fromImage(result));
454 QMetaObject::connectSlotsByName(MainWindow);
458 void Ui_MainWindow::retranslateUI_Help(void)
460 menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
461 actionHelp_AboutQt->setText(QApplication::translate("MainWindow", "About Qt", 0));
462 actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
464 menuHelp_Readme->setTitle(QApplication::translate("MainWindow", "READMEs", 0));
466 actionHelp_README->setText(QApplication::translate("MainWindow", "General Document", 0));
467 actionHelp_README_QT->setText(QApplication::translate("MainWindow", "About Qt ports", 0));
468 actionHelp_README_Artane->setText(QApplication::translate("MainWindow", "About Qt ports (Japanese).", 0));
469 actionHelp_README_MR_TANAM->setText(QApplication::translate("MainWindow", "By Mr. tanam", 0));
470 actionHelp_README_FM7->setText(QApplication::translate("MainWindow", "About eFM-7/8/77/AV.", 0));
471 actionHelp_README_FM7_JP->setText(QApplication::translate("MainWindow", "About eFM-7/8/77/AV (Japanese).", 0));
473 menuHelp_Histories->setTitle(QApplication::translate("MainWindow", "Histories", 0));
474 actionHelp_History->setText(QApplication::translate("MainWindow", "General History", 0));
475 actionHelp_History_Relnote->setText(QApplication::translate("MainWindow", "Release Note", 0));
476 actionHelp_History_ChangeLog->setText(QApplication::translate("MainWindow", "Change Log", 0));
477 actionHelp_History_MR_TANAM->setText(QApplication::translate("MainWindow", "History by Tanam", 0));
479 actionHelp_License->setText(QApplication::translate("MainWindow", "Show License", 0));
480 actionHelp_License_JP->setText(QApplication::translate("MainWindow", "Show License (Japanese)", 0));
484 // You can Override this function: Re-define on foo/MainWindow.cpp.
485 // This code is example: by X1(TurboZ).
486 void Ui_MainWindow::retranslateUi(void)
488 retranslateControlMenu("NMI Reset", true);
489 retranslateFloppyMenu(0, 0);
490 retranslateFloppyMenu(1, 1);
491 retranslateCMTMenu();
492 #if !defined(WITHOUT_SOUND)
493 retranslateSoundMenu();
495 retranslateScreenMenu();
496 retranslateCartMenu(0, 1);
497 retranslateCartMenu(1, 2);
498 retranslateBinaryMenu(0, 1);
499 retranslateBinaryMenu(1, 2);
500 retranslateUI_Help();
502 this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
505 menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
506 menuMachine->setTitle(QApplication::translate("MainWindow", "Machine", 0));
509 void Ui_MainWindow::setCoreApplication(QApplication *p)
511 this->CoreApplication = p;
512 connect(actionExit_Emulator, SIGNAL(triggered()),
513 this->CoreApplication, SLOT(closeAllWindows())); // OnGuiExit()?
514 connect(actionHelp_AboutQt, SIGNAL(triggered()),
515 this->CoreApplication, SLOT(aboutQt()));