OSDN Git Service

[VM][General][Qt] Merge upstream 2015-12-31.
[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         retranslateMachineMenu();
86         retranslateUI_Help();
87         config_sound_device_type = config.sound_device_type;
88         
89         this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
90         
91         actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
92         
93         actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
94         
95         
96         //      actionStart_Record_Movie->setText(QApplication::translate("MainWindow", "Start Record Movie", 0));
97         //      actionStop_Record_Movie->setText(QApplication::translate("MainWindow", "Stop Record Movie", 0));
98         // 
99         menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0));
100         menuStretch_Mode->setTitle(QApplication::translate("MainWindow", "Stretch Mode", 0));
101         // PC88 Specified
102 #if defined(_PC8801MA)
103         menuCpuType->setTitle("CPU Frequency");
104         actionCpuType[0]->setText(QString::fromUtf8("8MHz"));
105         actionCpuType[1]->setText(QString::fromUtf8("4MHz"));
106         actionCpuType[2]->setText(QString::fromUtf8("8MHz (FE2/MC)"));
107 #else // _PC8001SR
108         menuCpuType->setTitle("CPU Frequency");
109         actionCpuType[0]->setText(QString::fromUtf8("4MHz"));
110         //menuCpuType->setVisible(false);
111         //actionCpuType[0]->setVisible(false);
112 #endif
113   
114 #if defined(_PC8801MA)
115         menuBootMode->setTitle("Machine Mode");
116         actionBootMode[0]->setText(QString::fromUtf8("N88-V1(S) Mode"));
117         actionBootMode[1]->setText(QString::fromUtf8("N88-V1(H) Mode"));        
118         actionBootMode[2]->setText(QString::fromUtf8("N88-V2 Mode"));
119         actionBootMode[3]->setText(QString::fromUtf8("N Mode (N80 compatible)"));
120 #elif defined(_PC8001SR)
121         menuBootMode->setTitle("Machine Mode");
122         actionBootMode[0]->setText(QString::fromUtf8("N80-V1     Mode"));
123         actionBootMode[1]->setText(QString::fromUtf8("N80-V2(SR) Mode"));       
124         actionBootMode[2]->setText(QString::fromUtf8("N Mode"));
125 #endif
126   
127 #if defined(SUPPORT_PC88_SB2)
128         menuSoundDevice->setTitle(QApplication::translate("MainWindow", "Sound Board", 0));
129         actionSoundDevice[0]->setText(QString::fromUtf8("PC-8801-23 (OPNA)"));
130         actionSoundDevice[1]->setText(QString::fromUtf8("PC-8801-11 (OPN)"));   
131         actionSoundDevice[2]->setText(QString::fromUtf8("Sound Board 2 (OPN + OPNA)"));   
132 #elif defined(SUPPORT_PC88_OPNA)
133         menuSoundDevice->setTitle(QApplication::translate("MainWindow", "Sound Board", 0));
134         actionSoundDevice[0]->setText(QString::fromUtf8("PC-8801-23 (OPNA)"));
135         actionSoundDevice[1]->setText(QString::fromUtf8("PC-8801-11 (OPN)"));
136 #endif
137 #ifdef USE_DEBUGGER
138         actionDebugger_1->setText(QApplication::translate("MainWindow", "Main CPU", 0));
139         actionDebugger_2->setText(QApplication::translate("MainWindow", "Sub  CPU", 0));
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         actionMemoryWait->setText(QApplication::translate("MainWindow", "Wait Memory", 0));
148 // End.
149 // 
150 //        menuRecord->setTitle(QApplication::translate("MainWindow", "Record", 0));
151 //        menuRecoad_as_movie->setTitle(QApplication::translate("MainWindow", "Recoad as movie", 0));
152         
153         menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
154         menuMachine->setTitle(QApplication::translate("MainWindow", "Machine", 0));
155   
156         menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
157         actionHelp_AboutQt->setText(QApplication::translate("MainWindow", "About Qt", 0));
158    // Set Labels
159   
160 } // retranslateUi
161
162
163 void META_MainWindow::setupUI_Emu(void)
164 {
165         menuCpuType = new QMenu(menuMachine);
166         menuCpuType->setObjectName(QString::fromUtf8("menuControl_CpuType"));
167 #if defined(_PC8801MA)
168         ConfigCPUTypes(3);
169 #else
170         ConfigCPUTypes(1);
171 #endif
172         menuMachine->addAction(menuCpuType->menuAction());
173
174         menuBootMode = new QMenu(menuMachine);
175         menuBootMode->setObjectName(QString::fromUtf8("menuControl_BootMode"));
176         menuMachine->addAction(menuBootMode->menuAction());
177 #if defined(_PC8801MA)
178         ConfigCPUBootMode(4);
179 #elif defined(_PC8001SR)
180         ConfigCPUBootMode(3);
181 #endif
182         actionMemoryWait = new Action_Control_88(this);
183         actionMemoryWait->setCheckable(true);
184         actionMemoryWait->setVisible(true);
185         actionMemoryWait->setChecked(false);
186    
187         menuMachine->addAction(actionMemoryWait);
188         if((config.dipswitch & 0x0001) != 0) actionMemoryWait->setChecked(true);
189         connect(actionMemoryWait, SIGNAL(toggled(bool)),
190                         actionMemoryWait->pc88_binds, SLOT(do_set_memory_wait(bool)));
191         connect(actionMemoryWait->pc88_binds, SIGNAL(sig_set_dipsw(int, bool)),
192                         this, SLOT(set_dipsw(int, bool)));
193 }
194
195
196 META_MainWindow::META_MainWindow(QWidget *parent) : Ui_MainWindow(parent)
197 {
198         config_sound_device_type = 0;
199         setupUI_Emu();
200         retranslateUi();
201 }
202
203
204 META_MainWindow::~META_MainWindow()
205 {
206 }
207
208 //QT_END_NAMESPACE
209
210
211