OSDN Git Service

[UI][Qt] Not liking config, using_flags directly.
[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", "OPNA", 0));
67                         p->setDeviceLabel(3, QApplication::translate("MainWindow", "OPN", 0));
68                         p->setSliderVisible(2, true);
69                         p->setSliderVisible(3, true);
70                         break;
71 #endif
72                 }
73                 
74         }
75 }
76
77 void META_MainWindow::retranslateUi(void)
78 {
79         const char *title="";
80         retranslateControlMenu(title, false);
81         retranslateFloppyMenu(0, 1);
82         retranslateFloppyMenu(1, 2);
83         retranslateCMTMenu();
84         retranslateSoundMenu();
85         retranslateScreenMenu();
86         retranslateMachineMenu();
87         retranslateEmulatorMenu();
88         retranslateUI_Help();
89         config_sound_device_type = config.sound_device_type;
90         
91         this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
92         
93         // PC88 Specified
94 #if defined(_PC8801MA)
95         menuCpuType->setTitle("CPU Frequency");
96         actionCpuType[0]->setText(QString::fromUtf8("8MHz"));
97         actionCpuType[1]->setText(QString::fromUtf8("4MHz"));
98         actionCpuType[2]->setText(QString::fromUtf8("8MHz (FE2/MC)"));
99 #else // _PC8001SR
100         menuCpuType->setTitle("CPU Frequency");
101         actionCpuType[0]->setText(QString::fromUtf8("4MHz"));
102         //menuCpuType->setVisible(false);
103         //actionCpuType[0]->setVisible(false);
104 #endif
105   
106 #if defined(_PC8801MA)
107         menuBootMode->setTitle("Machine Mode");
108         actionBootMode[0]->setText(QString::fromUtf8("N88-V1(S) Mode"));
109         actionBootMode[1]->setText(QString::fromUtf8("N88-V1(H) Mode"));        
110         actionBootMode[2]->setText(QString::fromUtf8("N88-V2 Mode"));
111         actionBootMode[3]->setText(QString::fromUtf8("N Mode (N80 compatible)"));
112 #elif defined(_PC8001SR)
113         menuBootMode->setTitle("Machine Mode");
114         actionBootMode[0]->setText(QString::fromUtf8("N80-V1     Mode"));
115         actionBootMode[1]->setText(QString::fromUtf8("N80-V2(SR) Mode"));       
116         actionBootMode[2]->setText(QString::fromUtf8("N Mode"));
117 #endif
118   
119 #if defined(SUPPORT_PC88_SB2)
120         menuSoundDevice->setTitle(QApplication::translate("MainWindow", "Sound Board", 0));
121         actionSoundDevice[0]->setText(QString::fromUtf8("PC-8801-23 (OPNA)"));
122         actionSoundDevice[1]->setText(QString::fromUtf8("PC-8801-11 (OPN)"));   
123         actionSoundDevice[2]->setText(QString::fromUtf8("Sound Board 2 (OPN + OPNA)"));   
124 #elif defined(SUPPORT_PC88_OPNA)
125         menuSoundDevice->setTitle(QApplication::translate("MainWindow", "Sound Board", 0));
126         actionSoundDevice[0]->setText(QString::fromUtf8("PC-8801-23 (OPNA)"));
127         actionSoundDevice[1]->setText(QString::fromUtf8("PC-8801-11 (OPN)"));
128 #endif
129 #ifdef USE_DEBUGGER
130         actionDebugger[0]->setText(QApplication::translate("MainWindow", "Main CPU", 0));
131 #if defined(_PC8001SR)  
132         actionDebugger[1]->setText(QApplication::translate("MainWindow", "PC-80S31K CPU", 0));
133 #else
134         actionDebugger[1]->setText(QApplication::translate("MainWindow", "Sub CPU", 0));
135 #endif  
136         actionDebugger[0]->setVisible(true);
137         actionDebugger[1]->setVisible(true);
138         
139         actionDebugger[2]->setVisible(false);
140         actionDebugger[3]->setVisible(false);
141 #endif  
142 #if defined(USE_DEVICE_TYPE)
143         actionDeviceType[0]->setText(QApplication::translate("MainWindow", "Joystick", 0));
144         actionDeviceType[1]->setText(QApplication::translate("MainWindow", "Bus Mouse", 0));
145         menuDeviceType->setTitle(QApplication::translate("MainWindow", "Joy Port", 0));
146 #endif
147 #if defined(USE_PRINTER)
148         actionPrintDevice[1]->setText(QString::fromUtf8("PC-PR201"));
149 #endif  
150         actionMemoryWait->setText(QApplication::translate("MainWindow", "Wait Memory", 0));
151 // End.
152    // Set Labels
153   
154 } // retranslateUi
155
156
157 void META_MainWindow::setupUI_Emu(void)
158 {
159         menuCpuType = new QMenu(menuMachine);
160         menuCpuType->setObjectName(QString::fromUtf8("menuControl_CpuType"));
161 #if defined(_PC8801MA)
162         ConfigCPUTypes(3);
163 #else
164         ConfigCPUTypes(1);
165 #endif
166         menuMachine->addAction(menuCpuType->menuAction());
167
168         menuBootMode = new QMenu(menuMachine);
169         menuBootMode->setObjectName(QString::fromUtf8("menuControl_BootMode"));
170         menuMachine->addAction(menuBootMode->menuAction());
171 #if defined(_PC8801MA)
172         ConfigCPUBootMode(4);
173 #elif defined(_PC8001SR)
174         ConfigCPUBootMode(3);
175 #endif
176         actionMemoryWait = new Action_Control_88(this, using_flags);
177         actionMemoryWait->setCheckable(true);
178         actionMemoryWait->setVisible(true);
179         actionMemoryWait->setChecked(false);
180    
181         menuMachine->addAction(actionMemoryWait);
182         if((config.dipswitch & 0x0001) != 0) actionMemoryWait->setChecked(true);
183         connect(actionMemoryWait, SIGNAL(toggled(bool)),
184                         actionMemoryWait->pc88_binds, SLOT(do_set_memory_wait(bool)));
185         connect(actionMemoryWait->pc88_binds, SIGNAL(sig_set_dipsw(int, bool)),
186                         this, SLOT(set_dipsw(int, bool)));
187 }
188
189
190 META_MainWindow::META_MainWindow(USING_FLAGS *p, QWidget *parent) : Ui_MainWindow(p, parent)
191 {
192         config_sound_device_type = 0;
193         setupUI_Emu();
194         retranslateUi();
195 }
196
197
198 META_MainWindow::~META_MainWindow()
199 {
200 }
201
202 //QT_END_NAMESPACE
203
204
205