OSDN Git Service

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