OSDN Git Service

9bca9fc62850f8e6e50f763e90058c950b132816
[csp-qt/common_source_project-fm7.git] / source / src / qt / gui / commonclasses.h
1 /*
2  * Qt -> GUI -> CommonClasses
3  * commonclasses.h
4  * (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
5  * Licence : GPLv2
6  * History : Jan 13 2015 : Split from x1turboz / menuclasses.h
7  */
8
9 #ifndef _CSP_QT_GUI_COMMONCLASSES_H
10 #define _CSP_QT_GUI_COMMONCLASSES_H
11
12 #include <QtCore/QVariant>
13 #include <QtGui/QAction>
14 #include <QtGui/QApplication>
15 #include <QtGui/QButtonGroup>
16 #include <QtGui/QGraphicsView>
17 #include <QtGui/QHeaderView>
18 #include <QtGui/QMainWindow>
19 #include <QtGui/QMenu>
20 #include <QtGui/QMenuBar>
21 #include <QtGui/QStatusBar>
22 #include <QtGui/QWidget>
23 #include <QtGui/QIconSet>
24
25 #include "simd_types.h"
26 #include "common.h"
27 #include "config.h"
28 #include "emu.h"
29 //#include "qt_main.h"
30 #include "qt_gldraw.h"
31
32
33 extern class EMU* emu;
34
35 QT_BEGIN_NAMESPACE
36 typedef class Object_Menu_Control: public QObject {
37         Q_OBJECT
38 public:
39 //   explicit Object_Menu_Control(QObject *parent = 0);
40         Object_Menu_Control(QObject *parent) : QObject(parent){
41                 bindValue = 0;
42                 drive = 0;
43                 s_num = 0;
44                 height = 0;
45                 width = 0;
46                 play = true; // Read
47                 write_protect = false; // Enable to write
48         }
49         Object_Menu_Control() {}
50 private:
51         int bindValue;
52         int drive;
53         int s_num;
54         int width;
55         int height;
56         bool play;
57         bool write_protect;
58 signals:
59         int on_boot_mode(int);   
60         int on_cpu_type(int);   
61         int on_cpu_power(int); 
62         int on_open_debugger(int);
63         
64         int sig_insert_fd(int);
65         int sig_eject_fd(int);
66         int set_d88_slot(int, int);
67         int set_recent_disk(int, int);
68         int sig_write_protect_fd(int, bool);
69
70 #if defined(USE_QD1) || defined(USE_QD2)
71         int set_recent_quick_disk(int, int);
72         int sig_write_protect_Qd(int, bool);
73         int sig_eject_Qd(int);
74         int sig_insert_Qd(int);
75 #endif
76    
77         int sig_insert_play_cmt(bool);
78         int sig_eject_cmt(void);
79         int sig_recent_cmt(int);
80         int sig_set_write_protect_cmt(bool);
81 #ifdef USE_CART1
82         int sig_insert_cart(int);
83         int sig_eject_cart(int);
84         int set_recent_cart(int, int);
85 #endif
86 #if defined(USE_BINARY_FILE1)
87         int sig_open_binary_file(int, QString, bool);
88         int sig_open_binary(int, bool);
89         int set_recent_binary_load(int, int);
90         int set_recent_binary_save(int, int);
91 #endif
92         int sig_freq(int);
93         int sig_latency(int);
94         int sig_sounddevice(int);
95         int sig_set_dipsw(int, bool);
96         int sig_screen_aspect(int);
97         int sig_screen_size(int, int);
98 public slots:
99         void set_boot_mode(void);
100         void set_cpu_type(void);
101         void set_cpupower(void);
102         void open_debugger(void);
103         void do_set_write_protect_cmt(void);
104         void do_unset_write_protect_cmt(void);
105         void insert_fd(void);
106         void eject_fd(void);
107         void on_d88_slot(void);
108         void on_recent_disk(void);
109         void write_protect_fd(void);
110         void no_write_protect_fd(void);
111      
112         void set_screen_aspect(void);
113         void set_screen_size(void);
114      
115 #if defined(USE_QD1) || defined(USE_QD2)
116         void insert_Qd(void);
117         void eject_Qd(void);
118         void on_recent_quick_disk(void);
119         void write_protect_Qd(void);
120         void no_write_protect_Qd(void);
121 #endif
122 #if defined(USE_BINARY_FILE1)
123         void on_recent_binary_load(void);
124         void on_recent_binary_save(void);
125         void _open_binary(QString s);
126         void insert_binary_load(void);
127         void insert_binary_save(void);
128 #endif
129         void start_insert_play_cmt(void);
130         void eject_cmt(void);
131         void on_recent_cmt(void);
132    
133         void on_set_freq(void);
134         void on_set_latency(void);
135 #ifdef USE_CART1
136         void insert_cart(void);
137         void eject_cart(void);
138         void on_recent_cart(void);
139 #endif
140      
141  public:
142         void setValue1(int v) {bindValue = v;}
143         int getValue1(void) {return bindValue;}
144         void setDrive(int num) { drive = num;}
145         int getDrive(void) { return drive;}
146         void setNumber(int num) { s_num = num;}
147         int getNumber(void) { return s_num;}
148         
149         bool isPlay(void) { return play; }
150         void setPlay(bool b) { play = b; }
151    
152         bool isWriteProtect(void) { return write_protect; }
153         void setWriteProtect(bool b) {write_protect = b;}
154         void setSize(int w, int h) { width = w, height = h;}
155         void getSize(int *w, int *h) {
156                 if((w == NULL) || (h == NULL)) return;
157                 *w = width;
158                 *h = height;
159         }
160 } Object_Menu_Control ;
161
162 typedef class Action_Control: public QAction {
163         Q_OBJECT
164   protected:
165         //    virtual void addedTo ( QWidget * actionWidget, QWidget * container ){}
166         //   virtual void addedTo ( int index, QPopupMenu * menu ){}
167  public:
168         Object_Menu_Control *binds;
169         Action_Control (QObject *parent) : QAction(parent) {
170                 binds = new Object_Menu_Control(parent);
171         }
172         ~Action_Control() {
173                 delete binds;
174         }
175 signals:
176         int  quit_emu_thread(void);
177 } ActionControl;
178 QT_END_NAMESPACE
179
180 #endif
181
182
183