OSDN Git Service

[UI][VM][EMU] Add features around BUBBLE CASETTE.This is used by FM-8(and 7/77?)...
[csp-qt/common_source_project-fm7.git] / source / src / qt / gui / menu_main.cpp
1 /*
2  * Common Source code Project:
3  * Ui->Qt->gui->menu_main for generic.
4  * (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
5  *   License : GPLv2
6  *   History :
7  * Jan 14, 2015 : Initial, moved from qt/x1turboz/MainWindow.cpp .
8  */
9
10 #include <QtCore/QVariant>
11 #include <QtGui>
12 #include <QIcon>
13 #include <QImage>
14 #include <QImageReader>
15 #include <QPixmap>
16
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 "menu_disk.h"
23 #include "menu_cmt.h"
24 #include "menu_cart.h"
25 #include "menu_quickdisk.h"
26 #include "menu_binary.h"
27 #include "menu_compactdisc.h"
28 #include "menu_bubble.h"
29
30 #include "qt_gldraw.h"
31 #include "emu.h"
32 #include "qt_main.h"
33
34
35 extern EMU *emu;
36
37 QT_BEGIN_NAMESPACE
38
39 Ui_MainWindow::Ui_MainWindow(QWidget *parent) : QMainWindow(parent)
40 {
41         setupUi();
42         createContextMenu();
43 }
44
45 Ui_MainWindow::~Ui_MainWindow()
46 {
47         graphicsView->releaseKeyboard();
48 }
49
50
51 void Action_Control::do_check_grab_mouse(bool flag)
52 {
53         this->toggle();
54 }
55
56 void Action_Control::do_send_string(void)
57 {
58         emit sig_send_string(bindString);
59 }
60
61 void Action_Control::do_set_string(QString s)
62 {
63         bindString = s;
64 }
65
66
67 void Ui_MainWindow::do_show_about(void)
68 {
69         Dlg_AboutCSP *dlg = new Dlg_AboutCSP;
70         dlg->show();
71 }
72
73 void Ui_MainWindow::do_browse_document(QString fname)
74 {
75         Dlg_BrowseText *dlg = new Dlg_BrowseText(fname);
76         dlg->show();
77 }
78
79
80 void Ui_MainWindow::setupUi(void)
81 {
82         int w, h;
83         //   QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
84         MainWindow = new QMainWindow();
85         if (MainWindow->objectName().isEmpty())
86                 MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
87         //MainWindow->resize(1288, 862);
88    
89         ConfigControlMenu();
90         ConfigFloppyMenu();
91         ConfigCMTMenu();
92 #if !defined(WITHOUT_SOUND)     
93         ConfigSoundMenu();
94 #endif  
95 #if defined(USE_BINARY_FILE1)
96         ConfigBinaryMenu(); 
97 #endif
98
99 #if defined(USE_QD1) || defined(USE_QD2)
100         ConfigQuickDiskMenu();
101 #endif
102
103         ConfigScreenMenu();
104 #if defined(USE_CART1) || defined(USE_CART2)
105         ConfigCartMenu();
106 #endif
107 #if defined(USE_COMPACT_DISC)
108         ConfigCDROMMenu();
109 #endif  
110 #if defined(USE_BUBBLE1) || defined(USE_BUBBLE2)
111         ConfigBubbleMenu();
112 #endif  
113         ConfigEmulatorMenu();   
114         actionAbout = new Action_Control(this);
115         actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
116    
117         graphicsView = new GLDrawClass(this);
118         graphicsView->setObjectName(QString::fromUtf8("graphicsView"));
119         graphicsView->setMaximumSize(2560, 2560); // ?
120         graphicsView->setMinimumSize(240, 192); // ?
121         //graphicsView->grabKeyboard();
122         graphicsView->setAttribute(Qt::WA_InputMethodEnabled, false); // Disable [Zenkaku / Hankaku] with IM.
123         graphicsView->setAttribute(Qt::WA_KeyboardFocusChange, false); 
124         //graphicsView->setFocusPolicy(Qt::StrongFocus);
125         //this->setFocusPolicy(Qt::ClickFocus);
126    
127 #if defined(USE_BITMAP)
128         bitmapImage = NULL;
129 #endif   
130         MainWindow->setCentralWidget(graphicsView);
131         MainWindow->setFocusProxy(graphicsView);
132         
133         MainWindow->centralWidget()->adjustSize();
134         MainWindow->adjustSize();
135
136         statusbar = new QStatusBar(this);
137         statusbar->setObjectName(QString::fromUtf8("statusbar"));
138         MainWindow->setStatusBar(statusbar);
139         initStatusBar();
140         
141         menubar = new QMenuBar(this);
142         menubar->setObjectName(QString::fromUtf8("menubar"));
143         menubar->setGeometry(QRect(0, 0, 1288, 27));
144         menuControl = new QMenu(menubar);
145         menuControl->setObjectName(QString::fromUtf8("menuControl"));
146         menuState = new QMenu(menuControl);
147         menuState->setObjectName(QString::fromUtf8("menuState"));
148 #ifdef USE_AUTO_KEY
149         menuCopy_Paste = new QMenu(menuControl);
150         menuCopy_Paste->setObjectName(QString::fromUtf8("menuCopy_Paste"));
151 #endif  
152         menuCpu_Speed = new QMenu(menuControl);
153         menuCpu_Speed->setObjectName(QString::fromUtf8("menuCpu_Speed"));
154         menuDebugger = new QMenu(menuControl);
155         menuDebugger->setObjectName(QString::fromUtf8("menuDebugger"));
156 #ifdef USE_FD1  
157         CreateFloppyMenu(0, 1);
158 #endif
159 #ifdef USE_FD2  
160         CreateFloppyMenu(1, 2);
161 #endif
162 #ifdef USE_FD3  
163         CreateFloppyMenu(2, 3);
164 #endif
165 #ifdef USE_FD4  
166         CreateFloppyMenu(3, 4);
167 #endif
168 #ifdef USE_FD5  
169         CreateFloppyMenu(4, 5);
170 #endif
171 #ifdef USE_FD6  
172         CreateFloppyMenu(5, 6);
173 #endif
174 #ifdef USE_FD7  
175         CreateFloppyMenu(6, 7);
176 #endif
177 #ifdef USE_FD8  
178         CreateFloppyMenu(7, 8);
179 #endif
180
181 #if defined(USE_QD1)
182         CreateQuickDiskMenu(0, 1);
183 #endif
184 #if defined(USE_QD2)
185         CreateQuickDiskMenu(1, 2);
186 #endif
187 #ifdef USE_TAPE
188         CreateCMTMenu();
189 #endif
190
191         CreateScreenMenu();
192 #if defined(USE_CART1)
193         CreateCartMenu(0, 1);
194 #endif
195 #if defined(USE_CART2)
196         CreateCartMenu(1, 2);
197 #endif
198 #if defined(USE_BINARY_FILE1)
199         CreateBinaryMenu(0, 1);
200 #endif
201 #if defined(USE_BINARY_FILE2)
202         CreateBinaryMenu(1, 2);
203 #endif
204 #if defined(USE_COMPACT_DISC)
205         CreateCDROMMenu();
206 #endif
207 #if defined(USE_BUBBLE1)
208         CreateBubbleMenu(0, 1);
209 #endif  
210 #if defined(USE_BUBBLE2)
211         CreateBubbleMenu(1, 2);
212 #endif  
213 #if defined(USE_BUBBLE3)
214         CreateBubbleMenu(2, 3);
215 #endif  
216 #if defined(USE_BUBBLE4)
217         CreateBubbleMenu(3, 4);
218 #endif  
219 #if defined(USE_BUBBLE5)
220         CreateBubbleMenu(4, 5);
221 #endif  
222 #if defined(USE_BUBBLE6)
223         CreateBubbleMenu(5, 6);
224 #endif  
225 #if defined(USE_BUBBLE7)
226         CreateBubbleMenu(6, 7);
227 #endif  
228 #if defined(USE_BUBBLE8)
229         CreateBubbleMenu(7, 8);
230 #endif  
231         connect(this, SIGNAL(sig_update_screen(void)), graphicsView, SLOT(update(void)));
232         //connect(this, SIGNAL(sig_update_screen(void)), graphicsView, SLOT(updateGL(void)));
233
234         menuMachine = new QMenu(menubar);
235         menuMachine->setObjectName(QString::fromUtf8("menuMachine"));
236 #ifdef USE_MOUSE
237         actionMouseEnable = new Action_Control(this);
238         actionMouseEnable->setCheckable(true);
239         actionMouseEnable->setVisible(true);
240         actionMouseEnable->setChecked(false);
241         menuMachine->addAction(actionMouseEnable);
242         connect(actionMouseEnable, SIGNAL(toggled(bool)),
243                 this, SLOT(do_set_mouse_enable(bool)));
244         connect(graphicsView, SIGNAL(sig_check_grab_mouse(bool)),
245                 actionMouseEnable, SLOT(do_check_grab_mouse(bool)));
246 #endif  
247         ConfigDeviceType();
248         ConfigDriveType();
249         ConfigSoundDeviceType();
250         ConfigPrinterType();
251
252 #if !defined(WITHOUT_SOUND)     
253         menuSound = new QMenu(menubar);
254         menuSound->setObjectName(QString::fromUtf8("menuSound"));
255 #endif
256         menuEmulator = new QMenu(menubar);
257         menuEmulator->setObjectName(QString::fromUtf8("menuEmulator"));
258         
259         menuHELP = new QMenu(menubar);
260         menuHELP->setObjectName(QString::fromUtf8("menuHELP"));
261         MainWindow->setMenuBar(menubar);
262
263         menubar->addAction(menuControl->menuAction());
264         connectActions_ControlMenu();
265 #if defined(USE_FD1)
266         menubar->addAction(menu_fds[0]->menuAction());
267 #endif
268 #if defined(USE_FD2)
269         menubar->addAction(menu_fds[1]->menuAction());
270 #endif
271 #if defined(USE_FD3)
272         menubar->addAction(menu_fds[2]->menuAction());
273 #endif
274 #if defined(USE_FD4)
275         menubar->addAction(menu_fds[3]->menuAction());
276 #endif
277 #if defined(USE_FD5)
278         menubar->addAction(menu_fds[4]->menuAction());
279 #endif
280 #if defined(USE_FD6)
281         menubar->addAction(menu_fds[5]->menuAction());
282 #endif
283 #if defined(USE_FD7)
284         menubar->addAction(menu_fds[6]->menuAction());
285 #endif
286 #if defined(USE_FD8)
287         menubar->addAction(menu_fds[7]->menuAction());
288 #endif
289 #if defined(USE_QD1)
290         menubar->addAction(menu_QDs[0]->menuAction());
291 #endif
292 #if defined(USE_QD2)
293         menubar->addAction(menu_QDs[1]->menuAction());
294 #endif
295 #if defined(USE_TAPE)
296         menubar->addAction(menu_CMT->menuAction());
297 #endif
298 #if defined(USE_CART1)
299         menubar->addAction(menu_Cart[0]->menuAction());
300 #endif
301 #if defined(USE_CART2)
302         menubar->addAction(menu_Cart[1]->menuAction());
303 #endif
304 #if defined(USE_BINARY_FILE1)
305         menubar->addAction(menu_BINs[0]->menuAction());
306 #endif
307 #if defined(USE_BINARY_FILE2)
308         menubar->addAction(menu_BINs[1]->menuAction());
309 #endif
310 #if defined(USE_COMPACT_DISC)
311         menubar->addAction(menu_CDROM->menuAction());
312 #endif
313 #if defined(USE_LASER_DISC)
314         menubar->addAction(menu_LaserDisc->menuAction());
315 #endif
316         menubar->addAction(menuMachine->menuAction());
317         
318 #if !defined(WITHOUT_SOUND)     
319         menubar->addAction(menuSound->menuAction());
320 #endif   
321 #if defined(USE_BUBBLE1)
322         menubar->addAction(menu_bubbles[0]->menuAction());
323 #endif
324 #if defined(USE_BUBBLE2)
325         menubar->addAction(menu_bubbles[1]->menuAction());
326 #endif
327 #if defined(USE_BUBBLE3)
328         menubar->addAction(menu_bubbles[2]->menuAction());
329 #endif
330 #if defined(USE_BUBBLE4)
331         menubar->addAction(menu_bubbles[3]->menuAction());
332 #endif
333 #if defined(USE_BUBBLE5)
334         menubar->addAction(menu_bubbles[4]->menuAction());
335 #endif
336 #if defined(USE_BUBBLE6)
337         menubar->addAction(menu_bubbles[5]->menuAction());
338 #endif
339 #if defined(USE_BUBBLE7)
340         menubar->addAction(menu_bubbles[6]->menuAction());
341 #endif
342 #if defined(USE_BUBBLE8)
343         menubar->addAction(menu_bubbles[7]->menuAction());
344 #endif
345
346         menubar->addAction(menuScreen->menuAction());
347 //      menubar->addAction(menuRecord->menuAction());
348         menubar->addAction(menuEmulator->menuAction());
349         menubar->addAction(menuHELP->menuAction());
350 #if defined(USE_QD1)
351         CreateQuickDiskPulldownMenu(0);
352 #endif
353 #if defined(USE_QD2)
354         CreateQuickDiskPulldownMenu(1);
355 #endif
356 #if defined(USE_BINARY_FILE1)
357         CreateBinaryPulldownMenu(0);
358 #endif
359 #if defined(USE_BINARY_FILE2)
360         CreateBinaryPulldownMenu(1);
361 #endif
362 #if !defined(WITHOUT_SOUND)     
363         CreateSoundMenu();
364 #endif
365         CreateEmulatorMenu();
366   
367         menuHELP->addAction(actionAbout);
368         connect(actionAbout, SIGNAL(triggered()), this, SLOT(do_show_about()));
369         menuHELP->addSeparator();
370         
371         actionHelp_AboutQt = new Action_Control(this);
372         actionHelp_AboutQt->setObjectName(QString::fromUtf8("menuHelp_AboutQt"));
373         menuHELP->addAction(actionHelp_AboutQt);
374         menuHELP->addSeparator();
375         menuHelp_Readme = new QMenu(menuHELP);
376         menuHelp_Readme->setObjectName(QString::fromUtf8("menuHelp_Readme_menu"));;
377         menuHELP->addAction(menuHelp_Readme->menuAction());
378
379         actionHelp_README = new Action_Control(this);
380         actionHelp_README->setObjectName(QString::fromUtf8("menuHelp_README"));
381         actionHelp_README->do_set_string(QString::fromUtf8("readme.txt"));
382         connect(actionHelp_README, SIGNAL(triggered()), actionHelp_README, SLOT(do_send_string()));
383         connect(actionHelp_README, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
384         menuHelp_Readme->addAction(actionHelp_README);
385         
386         actionHelp_README_QT = new Action_Control(this);
387         actionHelp_README_QT->setObjectName(QString::fromUtf8("menuHelp_README_QT"));
388         actionHelp_README_QT->do_set_string(QString::fromUtf8("readme.qt.txt"));
389         menuHelp_Readme->addAction(actionHelp_README_QT);
390         connect(actionHelp_README_QT, SIGNAL(triggered()), actionHelp_README_QT, SLOT(do_send_string()));
391         connect(actionHelp_README_QT, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
392         actionHelp_README_Artane = new Action_Control(this);
393         actionHelp_README_Artane->setObjectName(QString::fromUtf8("menuHelp_README_Artane"));
394         actionHelp_README_Artane->do_set_string(QString::fromUtf8("readme_by_artane.txt"));
395         connect(actionHelp_README_Artane, SIGNAL(triggered()), actionHelp_README_Artane, SLOT(do_send_string()));
396         connect(actionHelp_README_Artane, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
397         menuHelp_Readme->addAction(actionHelp_README_Artane);
398         menuHelp_Readme->addSeparator();
399         
400         actionHelp_README_BIOS = new Action_Control(this);
401         actionHelp_README_BIOS->setObjectName(QString::fromUtf8("menuHelp_README_BIOS"));
402         actionHelp_README_BIOS->do_set_string(QString::fromUtf8("bios_and_keys.txt"));
403         connect(actionHelp_README_BIOS, SIGNAL(triggered()), actionHelp_README_BIOS, SLOT(do_send_string()));
404         connect(actionHelp_README_BIOS, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
405         menuHelp_Readme->addAction(actionHelp_README_BIOS);
406         menuHelp_Readme->addSeparator();
407         
408         actionHelp_README_MR_TANAM = new Action_Control(this);
409         actionHelp_README_MR_TANAM->setObjectName(QString::fromUtf8("menuHelp_README_MR_TANAM"));
410         actionHelp_README_MR_TANAM->do_set_string(QString::fromUtf8("readme_by_mr_tanam.txt"));
411         connect(actionHelp_README_MR_TANAM, SIGNAL(triggered()), actionHelp_README_MR_TANAM, SLOT(do_send_string()));
412         connect(actionHelp_README_MR_TANAM, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
413         menuHelp_Readme->addAction(actionHelp_README_MR_TANAM);
414         
415         menuHelp_Readme->addSeparator();
416         
417         actionHelp_README_FAQ = new Action_Control(this);
418         actionHelp_README_FAQ->setObjectName(QString::fromUtf8("menuHelp_README_FAQ"));
419         actionHelp_README_FAQ->do_set_string(QString::fromUtf8("FAQ.html"));
420         connect(actionHelp_README_FAQ, SIGNAL(triggered()), actionHelp_README_FAQ, SLOT(do_send_string()));
421         connect(actionHelp_README_FAQ, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
422         menuHelp_Readme->addAction(actionHelp_README_FAQ);
423
424         actionHelp_README_FAQ_JP = new Action_Control(this);
425         actionHelp_README_FAQ_JP->setObjectName(QString::fromUtf8("menuHelp_README_FAQ_JP"));
426         actionHelp_README_FAQ_JP->do_set_string(QString::fromUtf8("FAQ.ja.html"));
427         connect(actionHelp_README_FAQ_JP, SIGNAL(triggered()), actionHelp_README_FAQ_JP, SLOT(do_send_string()));
428         connect(actionHelp_README_FAQ_JP, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
429         menuHelp_Readme->addAction(actionHelp_README_FAQ_JP);
430         menuHelp_Readme->addSeparator();
431         
432         actionHelp_README_FM7 = new Action_Control(this);
433         actionHelp_README_FM7->setObjectName(QString::fromUtf8("menuHelp_README_FM7"));
434         actionHelp_README_FM7->do_set_string(QString::fromUtf8("readme_fm7.txt"));
435         connect(actionHelp_README_FM7, SIGNAL(triggered()), actionHelp_README_FM7, SLOT(do_send_string()));
436         connect(actionHelp_README_FM7, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
437         menuHelp_Readme->addAction(actionHelp_README_FM7);
438         
439         actionHelp_README_FM7_JP = new Action_Control(this);
440         actionHelp_README_FM7_JP->setObjectName(QString::fromUtf8("menuHelp_README_FM7_JP"));
441         actionHelp_README_FM7_JP->do_set_string(QString::fromUtf8("readme_fm7.jp.txt"));
442         connect(actionHelp_README_FM7_JP, SIGNAL(triggered()), actionHelp_README_FM7_JP, SLOT(do_send_string()));
443         connect(actionHelp_README_FM7_JP, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
444         menuHelp_Readme->addAction(actionHelp_README_FM7_JP);
445
446         menuHelp_Histories = new QMenu(menuHELP);
447         menuHelp_Histories->setObjectName(QString::fromUtf8("menuHelp_Histories"));;
448         menuHELP->addAction(menuHelp_Histories->menuAction());
449
450         actionHelp_History = new Action_Control(this);
451         actionHelp_History->setObjectName(QString::fromUtf8("menuHelp_History"));
452         actionHelp_History->do_set_string(QString::fromUtf8("history.txt"));
453         connect(actionHelp_History, SIGNAL(triggered()), actionHelp_History, SLOT(do_send_string()));
454         connect(actionHelp_History, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
455         menuHelp_Histories->addAction(actionHelp_History);
456         
457         actionHelp_History_Relnote = new Action_Control(this);
458         actionHelp_History_Relnote->setObjectName(QString::fromUtf8("menuHelp_History_Relnote"));
459         actionHelp_History_Relnote->do_set_string(QString::fromUtf8("RELEASENOTE.txt"));
460         connect(actionHelp_History_Relnote, SIGNAL(triggered()), actionHelp_History_Relnote, SLOT(do_send_string()));
461         connect(actionHelp_History_Relnote, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
462         menuHelp_Histories->addAction(actionHelp_History_Relnote);
463         
464         actionHelp_History_ChangeLog = new Action_Control(this);
465         actionHelp_History_ChangeLog->setObjectName(QString::fromUtf8("menuHelp_History_ChangeLog"));
466         actionHelp_History_ChangeLog->do_set_string(QString::fromUtf8("ChangeLog.txt"));
467         connect(actionHelp_History_ChangeLog, SIGNAL(triggered()), actionHelp_History_ChangeLog, SLOT(do_send_string()));
468         connect(actionHelp_History_ChangeLog, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
469         menuHelp_Histories->addAction(actionHelp_History_ChangeLog);
470
471         actionHelp_History_MR_TANAM = new Action_Control(this);
472         actionHelp_History_MR_TANAM->setObjectName(QString::fromUtf8("menuHelp_History_MR_TANAM"));
473         actionHelp_History_MR_TANAM->do_set_string(QString::fromUtf8("history_by_mr_tanam.txt"));
474         connect(actionHelp_History_MR_TANAM, SIGNAL(triggered()), actionHelp_History_MR_TANAM, SLOT(do_send_string()));
475         connect(actionHelp_History_MR_TANAM, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
476         menuHelp_Histories->addAction(actionHelp_History_MR_TANAM);
477         
478         actionHelp_License = new Action_Control(this);
479         actionHelp_License->setObjectName(QString::fromUtf8("menuHelp_License"));
480         actionHelp_License->do_set_string(QString::fromUtf8("LICENSE.txt"));
481         connect(actionHelp_License, SIGNAL(triggered()), actionHelp_License, SLOT(do_send_string()));
482         connect(actionHelp_License, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
483         menuHELP->addAction(actionHelp_License);
484         
485         actionHelp_License_JP = new Action_Control(this);
486         actionHelp_License_JP->setObjectName(QString::fromUtf8("menuHelp_License_JP"));
487         actionHelp_License_JP->do_set_string(QString::fromUtf8("LICENSE.ja.txt"));
488         connect(actionHelp_License_JP, SIGNAL(triggered()), actionHelp_License_JP, SLOT(do_send_string()));
489         connect(actionHelp_License_JP, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
490         menuHELP->addAction(actionHelp_License_JP);
491         
492         if(config.window_mode <= 0) config.window_mode = 0;
493         if(config.window_mode >= _SCREEN_MODE_NUM) config.window_mode = _SCREEN_MODE_NUM - 1;
494         w = SCREEN_WIDTH;
495         h = SCREEN_HEIGHT;
496         if(actionScreenSize[config.window_mode] != NULL) {
497                 double nd = actionScreenSize[config.window_mode]->binds->getDoubleValue();
498                 w = (int)(nd * (double)w);
499                 h = (int)(nd * (double)h);
500 #if defined(USE_SCREEN_ROTATE)
501                 if(config.rotate_type) {
502                         int tmp_w = w;
503                         w = h;
504                         h = tmp_w;
505                 }
506 #endif     
507         } else {
508 #if defined(USE_SCREEN_ROTATE)
509                 if(config.rotate_type) {
510                         w = 600;
511                         h = 960;
512                 } else 
513 #endif
514                 {                  
515                         w = 1280;
516                         h = 800;
517                 }
518         }
519         graphicsView->setFixedSize(w, h);
520         for(int i = 0; i < _SCREEN_MODE_NUM; i++) {
521                 if(actionScreenSize[i] != NULL) {
522                         connect(actionScreenSize[i]->binds, SIGNAL(sig_screen_multiply(float)),
523                                 graphicsView, SLOT(do_set_screen_multiply(float)));
524                 }
525         }
526         this->set_screen_size(w, h);
527         this->set_screen_aspect(config.window_stretch_type);
528         if(actionScreenSize[config.window_mode] != NULL) {
529                 double nd = actionScreenSize[config.window_mode]->binds->getDoubleValue();
530                 graphicsView->do_set_screen_multiply(nd);
531         }
532 #if defined(USE_JOYSTICK)
533         connect(action_SetupJoystick, SIGNAL(triggered()), this, SLOT(rise_joystick_dialog()));
534 #endif  
535         connect(action_SetupKeyboard, SIGNAL(triggered()), this, SLOT(rise_keyboard_dialog()));
536            
537         QImageReader reader(":/default.ico");
538         QImage result = reader.read();
539
540         MainWindow->setWindowIcon(QPixmap::fromImage(result));
541         QString tmps;
542         tmps = QString::fromUtf8("emu");
543         tmps = tmps + QString::fromUtf8(CONFIG_NAME);
544         tmps = tmps + QString::fromUtf8(" (");
545         tmps = tmps + QString::fromUtf8(DEVICE_NAME);
546         tmps = tmps + QString::fromUtf8(")");
547         MainWindow->setWindowTitle(tmps);
548         
549 //      QIcon WindowIcon;
550         InsertIcon = QApplication::style()->standardIcon(QStyle::SP_FileDialogStart);
551         EjectIcon  = QIcon(":/icon_eject.png");
552         StopIcon = QIcon(":/icon_process_stop.png");
553         RecordSoundIcon = QIcon(":/icon_record_to_wav.png");
554         ResetIcon = QApplication::style()->standardIcon(QStyle::SP_BrowserReload);
555
556         VolumeMutedIcon = QIcon(":/icon_volume_muted.png");
557         VolumeLowIcon = QIcon(":/icon_volume_low.png");
558         VolumeMidIcon = QIcon(":/icon_volume_mid.png");
559         VolumeHighIcon = QIcon(":/icon_volume_high.png");
560         
561         ExitIcon = QIcon(":/icon_exit.png");
562
563         QMetaObject::connectSlotsByName(MainWindow);
564 } // setupUi
565
566 void Ui_MainWindow::do_set_window_title(QString s)
567 {
568         QString tmps;
569         tmps = QString::fromUtf8("emu");
570         tmps = tmps + QString::fromUtf8(CONFIG_NAME);
571         tmps = tmps + QString::fromUtf8(" (");
572         if(!s.isEmpty()) {
573                 tmps = tmps + s;
574         }
575         tmps = tmps + QString::fromUtf8(")");
576         MainWindow->setWindowTitle(tmps);
577 }
578
579 // Emulator
580 #include "dropdown_joystick.h"
581 #include "dialog_set_key.h"
582
583 void Ui_MainWindow::retranslateEmulatorMenu(void)
584 {
585
586         menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
587 #if defined(USE_JOYSTICK)
588         action_SetupJoystick->setText(QApplication::translate("MainWindow", "Configure Joysticks", 0));
589         action_SetupJoystick->setIcon(QIcon(":/icon_gamepad.png"));
590 #endif  
591         action_SetupKeyboard->setText(QApplication::translate("MainWindow", "Configure Keyboard", 0));
592         action_SetupKeyboard->setIcon(QIcon(":/icon_keyboard.png"));
593 }
594 void Ui_MainWindow::CreateEmulatorMenu(void)
595 {
596 #if defined(USE_JOYSTICK)
597         menuEmulator->addAction(action_SetupJoystick);
598 #endif  
599         menuEmulator->addAction(action_SetupKeyboard);
600 }
601
602 void Ui_MainWindow::ConfigEmulatorMenu(void)
603 {
604 #if defined(USE_JOYSTICK)
605         action_SetupJoystick = new Action_Control(this);
606 #endif  
607         action_SetupKeyboard = new Action_Control(this);
608 }
609
610 #if defined(USE_JOYSTICK)
611 void Ui_MainWindow::rise_joystick_dialog(void)
612 {
613         if(graphicsView != NULL) {
614                 QStringList *lst = graphicsView->getVKNames();
615                 CSP_DropDownJoysticks *dlg = new CSP_DropDownJoysticks(NULL, lst);
616                 dlg->setWindowTitle(QApplication::translate("CSP_DropDownJoysticks", "Configure Joysticks", 0));
617                 dlg->show();
618         }
619 }
620 #endif  
621
622 void Ui_MainWindow::rise_keyboard_dialog(void)
623 {
624         if(graphicsView != NULL) {
625                 CSP_KeySetDialog *dlg = new CSP_KeySetDialog(NULL, graphicsView);
626                 dlg->setWindowTitle(QApplication::translate("KeySetDialog", "Configure Keyboard", 0));
627                 dlg->show();
628         }
629 }
630 // Retranslate
631 void Ui_MainWindow::retranslateUI_Help(void)
632 {
633         menuHELP->setTitle(QApplication::translate("MainWindow", "Help", 0));
634         actionHelp_AboutQt->setText(QApplication::translate("MainWindow", "About Qt", 0));
635         actionHelp_AboutQt->setIcon(QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton));
636         
637         actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
638         actionAbout->setIcon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion));
639
640         menuHelp_Readme->setTitle(QApplication::translate("MainWindow", "READMEs", 0));
641         
642         actionHelp_README->setText(QApplication::translate("MainWindow", "General Document", 0));
643         actionHelp_README_QT->setText(QApplication::translate("MainWindow", "About Qt ports", 0));
644         actionHelp_README_Artane->setText(QApplication::translate("MainWindow", "About Qt ports (Japanese).", 0));
645         actionHelp_README_MR_TANAM->setText(QApplication::translate("MainWindow", "By Mr. tanam", 0));
646         actionHelp_README_FM7->setText(QApplication::translate("MainWindow", "About eFM-7/8/77/AV.", 0));
647         actionHelp_README_FM7_JP->setText(QApplication::translate("MainWindow", "About eFM-7/8/77/AV (Japanese).", 0));
648         actionHelp_README_FAQ->setText(QApplication::translate("MainWindow", "FAQs(English)", 0));
649         actionHelp_README_FAQ_JP->setText(QApplication::translate("MainWindow", "FAQs(Japanese)", 0));
650         actionHelp_README_BIOS->setText(QApplication::translate("MainWindow", "BIOS and Key assigns", 0));
651
652         menuHelp_Histories->setTitle(QApplication::translate("MainWindow", "Histories", 0));
653         actionHelp_History->setText(QApplication::translate("MainWindow", "General History", 0));
654         actionHelp_History_Relnote->setText(QApplication::translate("MainWindow", "Release Note", 0));
655         actionHelp_History_ChangeLog->setText(QApplication::translate("MainWindow", "Change Log", 0));
656         actionHelp_History_MR_TANAM->setText(QApplication::translate("MainWindow", "History by Tanam", 0));
657
658         actionHelp_License->setText(QApplication::translate("MainWindow", "Show License", 0));
659         actionHelp_License_JP->setText(QApplication::translate("MainWindow", "Show License (Japanese)", 0));
660         
661 }
662
663 // You can Override this function: Re-define on foo/MainWindow.cpp.
664 // This code is example: by X1(TurboZ).
665 void Ui_MainWindow::retranslateMachineMenu(void)
666 {
667         int i;
668         QString tmps;
669         QString tmps2;
670         menuMachine->setTitle(QApplication::translate("MainWindow", "Machine", 0));
671 #if defined(USE_DEVICE_TYPE)
672         menuDeviceType->setTitle(QApplication::translate("MainWindow", "Device Type", 0));
673         for(i = 0; i < USE_DEVICE_TYPE; i++) {
674                 tmps2.setNum(i + 1);
675                 tmps = QString::fromUtf8("Machine Device ") + tmps2;
676                 actionDeviceType[i]->setText(tmps); 
677         }
678 #endif
679 #if defined(USE_SOUND_DEVICE_TYPE)
680         menuSoundDevice->setTitle(QApplication::translate("MainWindow", "Sound Cards", 0));
681         for(i = 0; i < USE_SOUND_DEVICE_TYPE; i++) {
682                 tmps2.setNum(i + 1);
683                 tmps = QString::fromUtf8("Sound Device ") + tmps2;
684                 actionSoundDevice[i]->setText(tmps); 
685         }
686 #endif
687 #if defined(USE_DRIVE_TYPE)
688         menuDriveType->setTitle(QApplication::translate("MainWindow", "Drive Type", 0));
689         for(i = 0; i < USE_DRIVE_TYPE; i++) {
690                 tmps2.setNum(i + 1);
691                 tmps = QString::fromUtf8("Drive Type ") + tmps2;
692                 actionDriveType[i]->setText(tmps); 
693         }
694 #endif
695 #if defined(USE_PRINTER)
696         menuPrintDevice->setTitle(QApplication::translate("MainWindow", "Printer (Need RESET)", 0));
697         i = 1;
698         actionPrintDevice[0]->setText(QApplication::translate("MainWindow", "Dump to File", 0));
699   #if defined(USE_PRINTER_TYPE)
700         for(i = 1; i < (USE_PRINTER_TYPE - 1); i++) {
701                 tmps2.setNum(i + 1);
702                 tmps = QApplication::translate("MainWindow", "Printer", 0) + tmps2;
703                 actionPrintDevice[i]->setText(tmps); 
704         }
705    #endif
706         actionPrintDevice[i]->setText(QApplication::translate("MainWindow", "Not Connect", 0));
707 #endif
708 }
709 void Ui_MainWindow::retranslateUi(void)
710 {
711         retranslateControlMenu("NMI Reset",  true);
712         retranslateFloppyMenu(0, 0);
713         retranslateFloppyMenu(1, 1);
714         retranslateCMTMenu();
715 #if !defined(WITHOUT_SOUND)     
716         retranslateSoundMenu();
717 #endif   
718         retranslateScreenMenu();
719         retranslateCartMenu(0, 1);
720         retranslateCartMenu(1, 2);
721         retranslateCDROMMenu();
722         
723         retranslateBinaryMenu(0, 1);
724         retranslateBinaryMenu(1, 2);
725
726         retranslateBubbleMenu(0, 1);
727         retranslateBubbleMenu(1, 2);
728         retranslateMachineMenu();
729         retranslateEmulatorMenu();
730         retranslateUI_Help();
731    
732 } // retranslateUi
733
734 void Ui_MainWindow::setCoreApplication(QApplication *p)
735 {
736         this->CoreApplication = p;
737         connect(actionExit_Emulator, SIGNAL(triggered()),
738                         this->CoreApplication, SLOT(closeAllWindows())); // OnGuiExit()?  
739         connect(actionHelp_AboutQt, SIGNAL(triggered()),
740                         this->CoreApplication, SLOT(aboutQt()));
741         
742 }
743 QT_END_NAMESPACE