[UI][Qt] More push to libCSPgui.so .
draw_thread.h
menu_metaclass.h
mainwidget.h
- display_about.h
- dropdown_jspage.h
)
if(WITH_JOYSTICK)
qt_main.cpp
menu_flags.cpp
menu_metaclass.cpp
- display_about.cpp
- dropdown_jspage.cpp
emu_thread.cpp
draw_thread.cpp
util_fd2.cpp
#include <string.h>
#include "emu.h"
#include "vm/vm.h"
+#include "menu_flags.h"
static int syslog_flag = 0;
static int log_cons = 0;
static int log_opened = FALSE;
static char log_sysname[256];
+extern class USING_FLAGS *using_flags;
extern "C"
{
#endif
void on_actionExit_triggered();
void do_release_emu_resources(void);
- void set_window_title();
void delete_joy_thread(void);
- void do_set_window_title(QString s);
void do_set_mouse_enable(bool flag);
void do_toggle_mouse(void);
//virtual void redraw_status_bar(void);
#include "vm.h"
#include "menu_flags.h"
+#ifndef USE_SOUND_VOLUME
+static const _TCHAR *sound_device_caption[] = {""};
+#endif
+#ifndef USE_JOY_BUTTON_CAPTIONS
+static const _TCHAR *joy_button_captions[] = {""};
+#endif
USING_FLAGS::USING_FLAGS()
{
max_draw_ranges = 0;
use_joystick = use_joy_button_captions = false;
+ num_joy_button_captions = 0;
use_laser_disc = false;
use_led_device = 0;
use_vertical_pixel_lines = false;
notify_key_down_lr_shift = false;
tape_binary_only = false;
+#if defined(DEVICE_NAME)
+ device_name = QString::fromUtf8(DEVICE_NAME);
+#else
+ device_name = QString::fromUtf8("");
+#endif
+#if defined(CONFIG_NAME)
+ config_name = QString::fromUtf8(CONFIG_NAME);
+#else
+ config_name = QString::fromUtf8("");
+#endif
machine_pasopia_variants = false;
#if defined(_PASOPIA7) || defined(_PASOPIA)
use_joystick = true;
#if defined(USE_JOY_BUTTON_CAPTIONS)
use_joy_button_captions = true;
+ num_joy_button_captions = sizeof(joy_button_captions) / sizeof(_TCHAR *);
#endif
#endif
#if defined(USE_LASER_DISC)
USING_FLAGS::~USING_FLAGS()
{
}
+
+const _TCHAR *USING_FLAGS::get_joy_button_captions(int num)
+{
+#ifdef USE_JOY_BUTTON_CAPTIONS
+ if((num < 0) || (num >= num_joy_button_captions)) {
+ return "";
+ } else {
+ return joy_button_captions[num];
+ }
+#else
+ return "";
+#endif
+}
+
+const _TCHAR *USING_FLAGS::get_sound_device_caption(int num)
+{
+#ifdef USE_SOUND_VOLUME
+ if((num < 0) || (num >= USE_SOUND_VOLUME)) {
+ return "";
+ } else {
+ return sound_device_caption[num];
+ }
+#else
+ return "";
+#endif
+}
+
#ifndef __CSP_QT_COMMON_MENU_FLAGS_H
#define __CSP_QT_COMMON_MENU_FLAGS_H
+#include <QString>
#include "common.h"
#ifndef _SCREEN_MODE_NUM
#define _SCREEN_MODE_NUM 32
class USING_FLAGS {
private:
+ QString config_name;
+ QString device_name;
// USE_* flags
bool use_access_lamp;
bool use_alt_f10_key;
bool use_joystick;
bool use_joy_button_captions;
-
+ int num_joy_button_captions;
bool use_laser_disc;
int use_led_device;
public:
USING_FLAGS();
~USING_FLAGS();
+ QString get_config_name() { return config_name; }
+ QString get_device_name() { return device_name; }
bool is_use_access_lamp() { return use_access_lamp; }
bool is_use_alt_f10_key() { return use_alt_f10_key; }
bool is_use_joystick() { return use_joystick; }
bool is_use_joy_button_captions() { return use_joy_button_captions; }
+ int get_num_joy_button_captions() { return num_joy_button_captions; }
bool is_use_laser_disc() {return use_laser_disc; }
int get_use_led_device() { return use_led_device; }
bool is_machine_has_pcengine() { return machine_has_pcengine; }
bool is_machine_sc3000() { return machine_sc3000; }
bool is_machine_z80tvgame() { return machine_z80tvgame; }
+ const _TCHAR *get_joy_button_captions(int num);
+ const _TCHAR *get_sound_device_caption(int num);
};
-#ifndef USE_SOUND_VOLUME
-static const _TCHAR sound_device_caption[] = {""};
-#endif
-#ifndef USE_JOY_BUTTON_CAPTIONS
-static const _TCHAR *joy_button_captions[] = {""};
-#endif
#endif //#ifndef __CSP_QT_COMMON_MENU_FLAGS_H
int window_mode_count;
-void Ui_MainWindow::set_window_title()
-{
- QString tmps;
- tmps = QString::fromUtf8("emu");
- tmps = tmps + QString::fromUtf8(CONFIG_NAME);
- tmps = tmps + QString::fromUtf8(" (");
- tmps = tmps + QString::fromUtf8(DEVICE_NAME);
- tmps = tmps + QString::fromUtf8(")");
- MainWindow->setWindowTitle(tmps);
-}
-
-void Ui_MainWindow::do_set_window_title(QString s)
-{
- QString tmps;
- tmps = QString::fromUtf8("emu");
- tmps = tmps + QString::fromUtf8(CONFIG_NAME);
- tmps = tmps + QString::fromUtf8(" (");
- if(!s.isEmpty()) {
- tmps = tmps + s;
- }
- tmps = tmps + QString::fromUtf8(")");
- MainWindow->setWindowTitle(tmps);
-}
-
void Ui_MainWindow::do_set_mouse_enable(bool flag)
{
#ifdef USE_MOUSE
#include "agar_logger.h"
#if defined(USE_BUBBLE1)
+extern EMU *emu;
#ifndef UPDATE_B77_LIST
#define UPDATE_B77_LIST(__d, lst) { \
QString __tmps; \
for(int iii = 0; iii < MAX_B77_BANKS; iii++) { \
__tmps = QString::fromUtf8(""); \
- if(iii < p_emu->b77_file[__d].bank_num) { \
- __tmps = QString::fromUtf8(p_emu->b77_file[__d].bubble_name[iii]); \
+ if(iii < emu->b77_file[__d].bank_num) { \
+ __tmps = QString::fromUtf8(emu->b77_file[__d].bubble_name[iii]); \
} \
lst << __tmps; \
} \
{
QString path;
if((num < 0) || (num >= using_flags->get_max_b77_banks())) return -1;
- path = QString::fromUtf8(p_emu->b77_file[drive].path);
+ path = QString::fromUtf8(emu->b77_file[drive].path);
menu_bubbles[drive]->do_select_inner_media(num);
- if(emu && p_emu->b77_file[drive].cur_bank != num) {
+ if(emu && emu->b77_file[drive].cur_bank != num) {
emit sig_open_bubble(drive, path, num);
- if(p_emu->is_bubble_casette_protected(drive)) {
+ if(emu->is_bubble_casette_protected(drive)) {
menu_bubbles[drive]->do_set_write_protect(true);
} else {
menu_bubbles[drive]->do_set_write_protect(false);
if(emu == NULL) return;
menu_bubbles[drv]->do_update_histories(listBubbles[drv]);
menu_bubbles[drv]->do_set_initialize_directory(config.initial_bubble_casette_dir);
- if(p_emu->is_bubble_casette_protected(drv)) {
+ if(emu->is_bubble_casette_protected(drv)) {
menu_bubbles[drv]->do_write_protect_media();
} else {
menu_bubbles[drv]->do_write_unprotect_media();
strncpy(path_shadow, fname.toLocal8Bit().constData(), PATH_MAX);
if(emu) {
emit sig_close_bubble(drv);
- //p_emu->LockVM();
+ //emu->LockVM();
emit sig_open_bubble(drv, fname, 0);
menu_bubbles[drv]->do_update_histories(listBubbles[drv]);
menu_bubbles[drv]->do_set_initialize_directory(config.initial_bubble_casette_dir);
menu_compactdisc.h
menu_binary.h
menu_bubble.h
-# display_about.h
+ display_about.h
display_text_document.h
dropdown_keyset.h
dropdown_joystick.h
dropdown_jsbutton.h
+ dropdown_jspage.h
dialog_set_key.h
dialog_set_key_combo.h
)
util_binary.cpp
util_bubble.cpp
display_statusbar.cpp
-# display_about.cpp
+ display_about.cpp
display_text_document.cpp
sound_dialog.cpp
dropdown_keyset.cpp
dropdown_joystick.cpp
dropdown_jsbutton.cpp
+ dropdown_jspage.cpp
dialog_set_key.cpp
dialog_set_key_combo.cpp
)
#include <QIODevice>
#include <QStringList>
-#include "menuclasses.h"
#include "display_about.h"
+#include "menu_flags.h"
+extern USING_FLAGS *using_flags;
Dlg_AboutCSP::Dlg_AboutCSP(QWidget *parent) : QWidget(parent)
{
titlearea = new QLabel(parent);
name = QString::fromUtf8("<div align=left><B><FONT SIZE=+1>Common Source Code Project</B></div>");
name.append(QString::fromUtf8("<div align=center>for <FONT SIZE=+1><B>"));
- name.append(QString::fromUtf8(DEVICE_NAME));
+ name.append(using_flags->get_device_name());
name.append(QString::fromUtf8("</B></FONT></div>"));
titlearea->setText(name);
titlearea->setAlignment(Qt::AlignRight);
QString title;
title = QString::fromUtf8("About emu");
- title.append(QString::fromUtf8(CONFIG_NAME));
+ title.append(using_flags->get_config_name());
if(parent == NULL) this->setWindowTitle(title);
}
#include "mainwidget_base.h"
#include "display_text_document.h"
+#include "menu_flags.h"
+extern USING_FLAGS * using_flags;
Dlg_BrowseText::Dlg_BrowseText(QString fname, bool internal, QWidget *parent) : QWidget(parent)
{
this->setLayout(VBox);
QString title;
-// title = QString::fromUtf8("emu");
-// title.append(QString::fromUtf8(CONFIG_NAME));
-// title.append(QString::fromUtf8(" / "));
+ title = QString::fromUtf8("emu");
+ title.append(using_flags->get_config_name());
+ title.append(QString::fromUtf8(" / "));
title.append(fname);
if(parent == NULL) this->setWindowTitle(title);
}
-#include "vm.h"
#include "dropdown_keyset.h"
#include "dropdown_jsbutton.h"
#include "dropdown_jspage.h"
#include <QApplication>
+#include "menu_flags.h"
+
+extern USING_FLAGS *using_flags;
CSP_DropDownJSPage::CSP_DropDownJSPage(QWidget *parent, QStringList *lst, int jsnum)
{
layout->addWidget(combo_js[2], 2, 2, Qt::AlignRight);
label_buttons = new QLabel(QApplication::translate("MainWindow", "<B>Physical Buttons:</B>", 0), this);
layout->addWidget(label_buttons, 4, 0, Qt::AlignLeft);
-#if defined(USE_JOY_BUTTON_CAPTIONS)
- int joybuttons = sizeof(joy_button_captions) / sizeof(_TCHAR *) - 4;
-#endif
+
+ int joybuttons = using_flags->get_num_joy_button_captions();
+
for(i = 0; i < 12; i++) {
-
-#if defined(USE_JOY_BUTTON_CAPTIONS)
if(joybuttons > i) {
-#endif
memset(tmps, 0x00, sizeof(char) * 20);
label_button[i] = new QLabel(this);
js_button[i] = new CSP_DropDownJSButton(this, lst, jsnum, i + 4);
-#if defined(USE_JOY_BUTTON_CAPTIONS)
- snprintf(tmps, 32, "<B>%s</B>", joy_button_captions[i + 4]);
-#else
- snprintf(tmps, 32, "<B>#%02d:</B>", i + 1);
-#endif
+ if(using_flags->is_use_joy_button_captions()) {
+ snprintf(tmps, 32, "<B>%s</B>", using_flags->get_joy_button_captions(i + 4));
+ } else {
+ snprintf(tmps, 32, "<B>#%02d:</B>", i + 1);
+ }
nm = QString::fromUtf8(tmps);
label_button[i]->setText(nm);
layout->addWidget(label_button[i], (i / 4) * 2 + 5 + 0, i % 4, Qt::AlignLeft);
layout->addWidget(js_button[i], (i / 4) * 2 + 5 + 1, i % 4, Qt::AlignLeft);
-#if defined(USE_JOY_BUTTON_CAPTIONS)
}
-#endif
}
this->setLayout(layout);
connect(this, SIGNAL(sig_select_js_button(int, int, int)), parent, SLOT(do_set_js_button(int, int, int)));
{
QString tmps;
tmps = QString::fromUtf8("emu");
+ tmps = tmps + using_flags->get_config_name();
+ tmps = tmps + QString::fromUtf8(" (");
+ tmps = tmps + using_flags->get_device_name();
+ tmps = tmps + QString::fromUtf8(")");
MainWindow->setWindowTitle(tmps);
}
{
QString tmps;
tmps = QString::fromUtf8("emu");
+ tmps = tmps + using_flags->get_config_name();
tmps = tmps + QString::fromUtf8(" (");
if(!s.isEmpty()) {
tmps = tmps + s;
save_pixmap_req = true;
QDateTime nowTime = QDateTime::currentDateTime();
QString tmps = QString::fromUtf8("Screen_Save_emu");
- //tmps = tmps + QString::fromUtf8(CONFIG_NAME);
+ tmps = tmps + using_flags->get_config_name();
tmps = tmps + QString::fromUtf8("_");
tmps = tmps + nowTime.toString(QString::fromUtf8("yyyy-MM-dd_hh-mm-ss.zzz"));
tmps = tmps + QString::fromUtf8(".png");
int ii;
int ij = 0;
for(ii = 0; ii < using_flags->get_use_sound_volume(); ii++) {
- QString lbl = QApplication::translate("Ui_SoundDialog", sound_device_caption[ii], 0);
+ QString lbl = QApplication::translate("Ui_SoundDialog", using_flags->get_sound_device_caption(ii), 0);
int l_val = config.sound_volume_l[ii];
int r_val = config.sound_volume_r[ii];