OSDN Git Service

2e5cbac77530e1e453b4e72d94daa39e76de5777
[csp-qt/common_source_project-fm7.git] / source / src / qt / machines / pc8801 / MainWindow.cpp
1 /*
2  * Common Source code Project:
3  * Ui->Qt->MainWindow for X1TurboZ .
4  * (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
5  *   License : GPLv2
6  *   History :
7  * Jan 14, 2015 : Initial, many of constructors were moved to qt/gui/menu_main.cpp.
8  */
9
10 #include <QVariant>
11 #include <QtGui>
12 #include "commonclasses.h"
13 #include "menuclasses.h"
14 #include "emu.h"
15 #include "qt_main.h"
16 #include "sound_dialog.h"
17
18 //QT_BEGIN_NAMESPACE
19
20
21 Object_Menu_Control_88::Object_Menu_Control_88(QObject *parent) : Object_Menu_Control(parent)
22 {
23 }
24
25 Object_Menu_Control_88::~Object_Menu_Control_88()
26 {
27 }
28
29
30
31 void Object_Menu_Control_88::do_set_memory_wait(bool flag)
32 {
33         emit sig_set_dipsw(0, flag);
34 }
35
36
37 Action_Control_88::Action_Control_88(QObject *parent) : Action_Control(parent)
38 {
39         pc88_binds = new Object_Menu_Control_88(parent);
40         pc88_binds->setValue1(0);
41 }
42
43 Action_Control_88::~Action_Control_88()
44 {
45         delete pc88_binds;
46 }
47
48 void META_MainWindow::retranslateVolumeLabels(Ui_SoundDialog *p)
49 {
50         if(p != NULL) {
51                 p->setDeviceLabel(1, QApplication::translate("MainWindow", "CMT", 0));
52                 switch(config_sound_device_type) {
53                 case 0:
54                         p->setDeviceLabel(2, QApplication::translate("MainWindow", "OPNA", 0));
55                         p->setSliderVisible(2, true);
56                         p->setSliderVisible(3, false);
57                         break;
58                 case 1:
59                         p->setDeviceLabel(2, QApplication::translate("MainWindow", "OPN", 0));
60                         p->setSliderVisible(2, true);
61                         p->setSliderVisible(3, false);
62                         break;
63 #ifdef SUPPORT_PC88_SB2
64                 case 2:
65                         p->setDeviceLabel(2, QApplication::translate("MainWindow", "OPNA", 0));
66                         p->setDeviceLabel(3, QApplication::translate("MainWindow", "OPN", 0));
67                         p->setSliderVisible(2, true);
68                         p->setSliderVisible(3, true);
69                         break;
70 #endif
71                 }
72            
73         }
74 }
75
76 void META_MainWindow::retranslateUi(void)
77 {
78   const char *title="";
79   retranslateControlMenu(title, false);
80   retranslateFloppyMenu(0, 1);
81   retranslateFloppyMenu(1, 2);
82   retranslateCMTMenu();
83   retranslateSoundMenu();
84   retranslateScreenMenu();
85         retranslateUI_Help();
86   config_sound_device_type = config.sound_device_type;
87
88   this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
89   
90   actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
91   
92   actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
93   
94
95    //   actionStart_Record_Movie->setText(QApplication::translate("MainWindow", "Start Record Movie", 0));
96   //      actionStop_Record_Movie->setText(QApplication::translate("MainWindow", "Stop Record Movie", 0));
97   // 
98   menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0));
99   menuStretch_Mode->setTitle(QApplication::translate("MainWindow", "Stretch Mode", 0));
100   // PC88 Specified
101 #if defined(_PC8801MA)
102   menuCpuType->setTitle("CPU Frequency");
103   actionCpuType[0]->setText(QString::fromUtf8("8MHz"));
104   actionCpuType[1]->setText(QString::fromUtf8("4MHz"));
105   actionCpuType[2]->setText(QString::fromUtf8("8MHz (FE2/MC)"));
106 #else // _PC8001SR
107   menuCpuType->setTitle("CPU Frequency");
108   actionCpuType[0]->setText(QString::fromUtf8("4MHz"));
109   //menuCpuType->setVisible(false);
110   //actionCpuType[0]->setVisible(false);
111 #endif
112   
113 #if defined(_PC8801MA)
114   menuBootMode->setTitle("Machine Mode");
115   actionBootMode[0]->setText(QString::fromUtf8("N88-V1(S) Mode"));
116   actionBootMode[1]->setText(QString::fromUtf8("N88-V1(H) Mode"));      
117   actionBootMode[2]->setText(QString::fromUtf8("N88-V2 Mode"));
118   actionBootMode[3]->setText(QString::fromUtf8("N Mode (N80 compatible)"));
119 #elif defined(_PC8001SR)
120   menuBootMode->setTitle("Machine Mode");
121   actionBootMode[0]->setText(QString::fromUtf8("N80-V1     Mode"));
122   actionBootMode[1]->setText(QString::fromUtf8("N80-V2(SR) Mode"));     
123   actionBootMode[2]->setText(QString::fromUtf8("N Mode"));
124 #endif
125
126 #if defined(SUPPORT_PC88_SB2)
127    menuSoundDevice->setTitle(QApplication::translate("MainWindow", "Sound Board", 0));
128    actionSoundDevice[0]->setText(QString::fromUtf8("PC-8801-23 (OPNA)"));
129    actionSoundDevice[1]->setText(QString::fromUtf8("PC-8801-11 (OPN)"));   
130    actionSoundDevice[2]->setText(QString::fromUtf8("Sound Board 2 (OPN + OPNA)"));   
131 #elif defined(SUPPORT_PC88_OPNA)
132    menuSoundDevice->setTitle(QApplication::translate("MainWindow", "Sound Board", 0));
133    actionSoundDevice[0]->setText(QString::fromUtf8("PC-8801-23 (OPNA)"));
134    actionSoundDevice[1]->setText(QString::fromUtf8("PC-8801-11 (OPN)"));
135 #endif
136 #ifdef USE_DEBUGGER
137         actionDebugger_1->setText(QApplication::translate("MainWindow", "Main CPU", 0));
138         actionDebugger_2->setText(QApplication::translate("MainWindow", "Sub  CPU", 0));
139         actionDebugger_3->setVisible(false);
140 #endif  
141 #if defined(USE_DEVICE_TYPE)
142         actionDeviceType[0]->setText(QApplication::translate("MainWindow", "Joystick", 0));
143         actionDeviceType[1]->setText(QApplication::translate("MainWindow", "Bus Mouse", 0));
144         menuDeviceType->setTitle(QApplication::translate("MainWindow", "Joy Port", 0));
145 #endif
146         actionMemoryWait->setText(QApplication::translate("MainWindow", "Wait Memory", 0));
147 // End.
148 // 
149 //        menuRecord->setTitle(QApplication::translate("MainWindow", "Record", 0));
150 //        menuRecoad_as_movie->setTitle(QApplication::translate("MainWindow", "Recoad as movie", 0));
151         
152         menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
153         menuMachine->setTitle(QApplication::translate("MainWindow", "Machine", 0));
154   
155         menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
156         actionHelp_AboutQt->setText(QApplication::translate("MainWindow", "About Qt", 0));
157    // Set Labels
158   
159 } // retranslateUi
160
161
162 void META_MainWindow::setupUI_Emu(void)
163 {
164    menuCpuType = new QMenu(menuMachine);
165    menuCpuType->setObjectName(QString::fromUtf8("menuControl_CpuType"));
166 #if defined(_PC8801MA)
167    ConfigCPUTypes(3);
168 #else
169    ConfigCPUTypes(1);
170 #endif
171    menuMachine->addAction(menuCpuType->menuAction());
172
173    menuBootMode = new QMenu(menuMachine);
174    menuBootMode->setObjectName(QString::fromUtf8("menuControl_BootMode"));
175    menuMachine->addAction(menuBootMode->menuAction());
176 #if defined(_PC8801MA)
177    ConfigCPUBootMode(4);
178 #elif defined(_PC8001SR)
179    ConfigCPUBootMode(3);
180 #endif
181         actionMemoryWait = new Action_Control_88(this);
182         actionMemoryWait->setCheckable(true);
183         actionMemoryWait->setVisible(true);
184         actionMemoryWait->setChecked(false);
185    
186         menuMachine->addAction(actionMemoryWait);
187         if((config.dipswitch & 0x0001) != 0) actionMemoryWait->setChecked(true);
188         connect(actionMemoryWait, SIGNAL(toggled(bool)),
189                 actionMemoryWait->pc88_binds, SLOT(do_set_memory_wait(bool)));
190         connect(actionMemoryWait->pc88_binds, SIGNAL(sig_set_dipsw(int, bool)),
191                  this, SLOT(set_dipsw(int, bool)));
192    
193         
194 #if defined(SUPPORT_PC88_OPNA) || defined(SUPPORT_PC88_SB2)
195 #endif
196 }
197
198
199 META_MainWindow::META_MainWindow(QWidget *parent) : Ui_MainWindow(parent)
200 {
201    config_sound_device_type = 0;
202    setupUI_Emu();
203    retranslateUi();
204 }
205
206
207 META_MainWindow::~META_MainWindow()
208 {
209 }
210
211 //QT_END_NAMESPACE
212
213
214