OSDN Git Service

a2c13f7f52c5f9a537e5d039035d3738e47cef31
[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 <QApplication>
13 #include <QMenu>
14
15 #include "commonclasses.h"
16 #include "menuclasses.h"
17 #include "emu.h"
18 #include "qt_main.h"
19 #include "sound_dialog.h"
20
21 //QT_BEGIN_NAMESPACE
22
23 extern config_t config;
24
25 Object_Menu_Control_88::Object_Menu_Control_88(QObject *parent, USING_FLAGS *p) : Object_Menu_Control(parent, p)
26 {
27 }
28
29 Object_Menu_Control_88::~Object_Menu_Control_88()
30 {
31 }
32
33
34 void Object_Menu_Control_88::do_set_memory_wait(bool flag)
35 {
36         emit sig_set_dipsw(0, flag);
37 }
38
39
40 Action_Control_88::Action_Control_88(QObject *parent, USING_FLAGS *p) : Action_Control(parent, p)
41 {
42         pc88_binds = new Object_Menu_Control_88(parent, p);
43         pc88_binds->setValue1(0);
44 }
45
46 Action_Control_88::~Action_Control_88()
47 {
48         delete pc88_binds;
49 }
50
51 void META_MainWindow::retranslateVolumeLabels(Ui_SoundDialog *p)
52 {
53         if(p != NULL) {
54                 p->setDeviceLabel(1, QApplication::translate("MenuPC88", "CMT", 0));
55                 switch(config_sound_device_type) {
56                 case 0:
57                         p->setDeviceLabel(2, QApplication::translate("MenuPC88", "OPNA", 0));
58                         p->setSliderVisible(2, true);
59                         p->setSliderVisible(3, false);
60                         break;
61                 case 1:
62                         p->setDeviceLabel(2, QApplication::translate("MenuPC88", "OPN", 0));
63                         p->setSliderVisible(2, true);
64                         p->setSliderVisible(3, false);
65                         break;
66 #ifdef SUPPORT_PC88_SB2
67                 case 2:
68                         p->setDeviceLabel(2, QApplication::translate("MenuPC88", "OPN", 0));
69                         p->setDeviceLabel(3, QApplication::translate("MenuPC88", "OPNA", 0));
70                         p->setSliderVisible(2, true);
71                         p->setSliderVisible(3, true);
72                         break;
73                 case 3:
74                         p->setDeviceLabel(2, QApplication::translate("MenuPC88", "OPN-1", 0));
75                         p->setDeviceLabel(3, QApplication::translate("MenuPC88", "OPN-2", 0));
76                         p->setSliderVisible(2, true);
77                         p->setSliderVisible(3, true);
78                         break;
79                 case 4:
80                         p->setDeviceLabel(2, QApplication::translate("MenuPC88", "OPNA-1", 0));
81                         p->setDeviceLabel(3, QApplication::translate("MenuPC88", "OPNA-2", 0));
82                         p->setSliderVisible(2, true);
83                         p->setSliderVisible(3, true);
84                         break;
85                 case 5:
86                         p->setDeviceLabel(2, QApplication::translate("MenuPC88", "OPNA", 0));
87                         p->setDeviceLabel(3, QApplication::translate("MenuPC88", "OPN", 0));
88                         p->setSliderVisible(2, true);
89                         p->setSliderVisible(3, true);
90                         break;
91 #endif
92                 }
93                 
94         }
95 }
96
97 void META_MainWindow::retranslateUi(void)
98 {
99         const char *title="";
100         Ui_MainWindowBase::retranslateUi();
101         retranslateControlMenu(title, false);
102         config_sound_device_type = config.sound_type;
103         
104         this->setWindowTitle(QApplication::translate("MenuPC88", "MainWindow", 0));
105         
106         // PC88 Specified
107         menuCpuType->setTitle(QApplication::translate("MenuPC88", "CPU Frequency", 0));
108 #if defined(_PC8801MA)
109         actionCpuType[0]->setText(QString::fromUtf8("8MHz"));
110         actionCpuType[1]->setText(QString::fromUtf8("4MHz"));
111         actionCpuType[2]->setText(QString::fromUtf8("8MHz (FE2/MC)"));
112 #else // _PC8001SR
113         actionCpuType[0]->setText(QString::fromUtf8("4MHz"));
114         //menuCpuType->setVisible(false);
115         //actionCpuType[0]->setVisible(false);
116 #endif
117   
118 #if defined(_PC8801MA)
119         menuBootMode->setTitle(QApplication::translate("MenuPC88", "Machine Mode", 0));
120         menuBootMode->setToolTipsVisible(true);
121         actionBootMode[0]->setText(QString::fromUtf8("N88-V1(S) Mode"));
122         actionBootMode[1]->setText(QString::fromUtf8("N88-V1(H) Mode"));        
123         actionBootMode[2]->setText(QString::fromUtf8("N88-V2 Mode"));
124         actionBootMode[3]->setText(QString::fromUtf8("N Mode (N80 compatible)"));
125         actionBootMode[0]->setToolTip(QApplication::translate("MenuPC88", "V1(Standard) Mode.\nYou can run softwares of PC-8801/mk2.", 0));
126         actionBootMode[1]->setToolTip(QApplication::translate("MenuPC88", "V1(High Speed) Mode.\nYou can run softwares of PC-8801/mk2 faster.", 0));    
127         actionBootMode[2]->setToolTip(QApplication::translate("MenuPC88", "V2 Mode.\nYou can run only softwares for PC-8801SR or later.", 0));
128         actionBootMode[3]->setToolTip(QApplication::translate("MenuPC88", "N Mode.\nYou can run softwares of PC-8001/mk2.", 0));
129 #elif defined(_PC8001SR)
130         menuBootMode->setTitle("Machine Mode");
131         menuBootMode->setToolTipsVisible(true);
132         actionBootMode[0]->setText(QString::fromUtf8("N80-V1     Mode"));
133         actionBootMode[1]->setText(QString::fromUtf8("N80-V2(SR) Mode"));       
134         actionBootMode[2]->setText(QString::fromUtf8("N Mode"));
135         actionBootMode[0]->setToolTip(QApplication::translate("MenuPC88", "V1 Mode.\nYou can run softwares of PC-8001/mk2.", 0));
136         actionBootMode[1]->setToolTip(QApplication::translate("MenuPC88", "V2 Mode.\nYou can run only softwares for PC-8001mk2SR or later.", 0));
137         actionBootMode[2]->setToolTip(QApplication::translate("MenuPC88", "N  Mode.\nYou can run only softwares for PC-8001.", 0));
138 #endif
139
140         menuSoundDevice->setTitle(QApplication::translate("MenuPC88", "Sound Boards", 0));
141 #if defined(SUPPORT_PC88_SB2)
142         menuSoundDevice->setTitle(QApplication::translate("MenuPC88", "Sound Board", 0));
143         actionSoundDevice[0]->setText(QString::fromUtf8("PC-8801-23 (OPNA)"));
144         actionSoundDevice[1]->setText(QString::fromUtf8("PC-8801-11 (OPN)"));   
145         actionSoundDevice[2]->setText(QString::fromUtf8("Sound Board 2 (OPN + OPNA)"));   
146         actionSoundDevice[3]->setText(QString::fromUtf8("Sound Board 2(OPN + OPN)"));   
147         actionSoundDevice[4]->setText(QString::fromUtf8("Sound Board 2 (OPNA + OPNA)"));   
148         actionSoundDevice[5]->setText(QString::fromUtf8("Sound Board 2 (OPNA + OPN)"));
149         actionSoundDevice[0]->setToolTip(QApplication::translate("MenuPC88", "PC-8801-23 (OPNA).", 0));
150         actionSoundDevice[1]->setToolTip(QApplication::translate("MenuPC88", "PC-8801-11 (OPN).", 0));   
151         actionSoundDevice[2]->setToolTip(QApplication::translate("MenuPC88", "Sound Board 2 (OPN + OPNA).", 0));   
152         actionSoundDevice[3]->setToolTip(QApplication::translate("MenuPC88", "Sound Board 2 (OPN + OPN).", 0));   
153         actionSoundDevice[4]->setToolTip(QApplication::translate("MenuPC88", "Sound Board 2 (OPNA + OPNA).", 0));   
154         actionSoundDevice[5]->setToolTip(QApplication::translate("MenuPC88", "Sound Board 2 (OPNA + OPN).", 0));   
155 #elif defined(SUPPORT_PC88_OPNA)
156         menuSoundDevice->setTitle(QApplication::translate("MenuPC88", "Sound Board", 0));
157         actionSoundDevice[0]->setText(QString::fromUtf8("PC-8801-23 (OPNA)"));
158         actionSoundDevice[1]->setText(QString::fromUtf8("PC-8801-11 (OPN)"));
159         actionSoundDevice[0]->setToolTip(QApplication::translate("MenuPC88", "PC-8801-23 (OPNA).", 0));
160         actionSoundDevice[1]->setToolTip(QApplication::translate("MenuPC88", "PC-8801-11 (OPN).", 0));
161 #endif
162 #ifdef USE_DEBUGGER
163         actionDebugger[0]->setText(QApplication::translate("MenuPC88", "Main CPU", 0));
164 #if defined(_PC8001SR)  
165         actionDebugger[1]->setText(QApplication::translate("MenuPC88", "PC-80S31K CPU", 0));
166 #else
167         actionDebugger[1]->setText(QApplication::translate("MenuPC88", "Sub CPU", 0));
168 #endif  
169         actionDebugger[0]->setVisible(true);
170         actionDebugger[1]->setVisible(true);
171         
172         actionDebugger[2]->setVisible(false);
173         actionDebugger[3]->setVisible(false);
174 #endif  
175 #if defined(USE_JOYSTICK_TYPE)
176         actionJoystickType[0]->setText(QApplication::translate("MenuPC88", "Joystick", 0));
177         actionJoystickType[1]->setText(QApplication::translate("MenuPC88", "Bus Mouse", 0));
178         actionJoystickType[0]->setToolTip(QApplication::translate("MenuPC88", "Connect joystick to JOY PORT.", 0));
179         actionJoystickType[1]->setToolTip(QApplication::translate("MenuPC88", "Connect bus-mouse to JOY PORT.", 0));
180         menuJoystickType->setTitle(QApplication::translate("MenuPC88", "Joy Port", 0));
181 #endif
182 #if defined(USE_PRINTER)
183         actionPrintDevice[1]->setText(QString::fromUtf8("PC-PR201"));
184         actionPrintDevice[1]->setToolTip(QApplication::translate("MenuPC88", "NEC PC-PR201 kanji serial printer.", 0));
185         actionPrintDevice[1]->setEnabled(false);
186 #endif
187         
188         actionMemoryWait->setText(QApplication::translate("MenuPC88", "Wait Memory", 0));
189         actionMemoryWait->setToolTip(QApplication::translate("MenuPC88", "Simulate waiting memory.", 0));
190 #if defined(USE_MONITOR_TYPE)
191         actionMonitorType[0]->setText(QApplication::translate("MenuPC88", "High Resolution", 0));
192         actionMonitorType[1]->setText(QApplication::translate("MenuPC88", "Standard", 0));
193 #endif
194 // End.
195    // Set Labels
196   
197 } // retranslateUi
198
199
200 void META_MainWindow::setupUI_Emu(void)
201 {
202 #if defined(USE_CPU_TYPE)
203         ConfigCPUTypes(USE_CPU_TYPE);
204 #endif
205
206 #if defined(_PC8801MA)
207         ConfigCPUBootMode(4);
208 #elif defined(_PC8001SR)
209         ConfigCPUBootMode(3);
210 #endif
211         actionMemoryWait = new Action_Control_88(this, using_flags);
212         actionMemoryWait->setCheckable(true);
213         actionMemoryWait->setVisible(true);
214         actionMemoryWait->setChecked(false);
215    
216         menuMachine->addAction(actionMemoryWait);
217         if((config.dipswitch & 0x0001) != 0) actionMemoryWait->setChecked(true);
218         connect(actionMemoryWait, SIGNAL(toggled(bool)),
219                         actionMemoryWait->pc88_binds, SLOT(do_set_memory_wait(bool)));
220         connect(actionMemoryWait->pc88_binds, SIGNAL(sig_set_dipsw(int, bool)),
221                         this, SLOT(set_dipsw(int, bool)));
222
223 }
224
225
226 META_MainWindow::META_MainWindow(USING_FLAGS *p, CSP_Logger *logger, QWidget *parent) : Ui_MainWindow(p, logger, parent)
227 {
228         config_sound_device_type = 0;
229         setupUI_Emu();
230         retranslateUi();
231 }
232
233
234 META_MainWindow::~META_MainWindow()
235 {
236 }
237
238 //QT_END_NAMESPACE
239
240
241