OSDN Git Service

[UI][Qt] Not liking config, using_flags directly.
[csp-qt/common_source_project-fm7.git] / source / src / qt / gui / menu_main.cpp
index c5ae003..6f021ae 100644 (file)
 #include "menu_flags.h"
 
 extern EMU *emu;
-extern USING_FLAGS *using_flags;
+//extern USING_FLAGS *using_flags;
 
-Ui_MainWindowBase::Ui_MainWindowBase(QWidget *parent) : QMainWindow(parent)
+Ui_MainWindowBase::Ui_MainWindowBase(USING_FLAGS *p, QWidget *parent) : QMainWindow(parent)
 {
+       using_flags = p;
+       p_config = p->get_config_ptr();
        setupUi();
        createContextMenu();
 }
@@ -66,13 +68,13 @@ void Action_Control::do_set_string(QString s)
 
 void Ui_MainWindowBase::do_show_about(void)
 {
-       Dlg_AboutCSP *dlg = new Dlg_AboutCSP;
+       Dlg_AboutCSP *dlg = new Dlg_AboutCSP(using_flags);
        dlg->show();
 }
 
 void Ui_MainWindowBase::do_browse_document(QString fname)
 {
-       Dlg_BrowseText *dlg = new Dlg_BrowseText(fname);
+       Dlg_BrowseText *dlg = new Dlg_BrowseText(fname, using_flags);
        dlg->show();
 }
 
@@ -109,10 +111,10 @@ void Ui_MainWindowBase::setupUi(void)
                ConfigBubbleMenu();
        }
        ConfigEmulatorMenu();   
-       actionAbout = new Action_Control(this);
+       actionAbout = new Action_Control(this, using_flags);
        actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
    
-       graphicsView = new GLDrawClass(this);
+       graphicsView = new GLDrawClass(using_flags, this);
        graphicsView->setObjectName(QString::fromUtf8("graphicsView"));
        graphicsView->setMaximumSize(2560, 2560); // ?
        graphicsView->setMinimumSize(240, 192); // ?
@@ -189,7 +191,7 @@ void Ui_MainWindowBase::setupUi(void)
        menuMachine->setObjectName(QString::fromUtf8("menuMachine"));
 
        if(using_flags->is_use_mouse()) {
-               actionMouseEnable = new Action_Control(this);
+               actionMouseEnable = new Action_Control(this, using_flags);
                actionMouseEnable->setCheckable(true);
                actionMouseEnable->setVisible(true);
                actionMouseEnable->setChecked(false);
@@ -287,7 +289,7 @@ void Ui_MainWindowBase::setupUi(void)
        connect(actionAbout, SIGNAL(triggered()), this, SLOT(do_show_about()));
        menuHELP->addSeparator();
        
-       actionHelp_AboutQt = new Action_Control(this);
+       actionHelp_AboutQt = new Action_Control(this, using_flags);
        actionHelp_AboutQt->setObjectName(QString::fromUtf8("menuHelp_AboutQt"));
        menuHELP->addAction(actionHelp_AboutQt);
        menuHELP->addSeparator();
@@ -295,20 +297,20 @@ void Ui_MainWindowBase::setupUi(void)
        menuHelp_Readme->setObjectName(QString::fromUtf8("menuHelp_Readme_menu"));;
        menuHELP->addAction(menuHelp_Readme->menuAction());
 
-       actionHelp_README = new Action_Control(this);
+       actionHelp_README = new Action_Control(this, using_flags);
        actionHelp_README->setObjectName(QString::fromUtf8("menuHelp_README"));
        actionHelp_README->do_set_string(QString::fromUtf8("readme.txt"));
        connect(actionHelp_README, SIGNAL(triggered()), actionHelp_README, SLOT(do_send_string()));
        connect(actionHelp_README, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHelp_Readme->addAction(actionHelp_README);
        
-       actionHelp_README_QT = new Action_Control(this);
+       actionHelp_README_QT = new Action_Control(this, using_flags);
        actionHelp_README_QT->setObjectName(QString::fromUtf8("menuHelp_README_QT"));
        actionHelp_README_QT->do_set_string(QString::fromUtf8("readme.qt.txt"));
        menuHelp_Readme->addAction(actionHelp_README_QT);
        connect(actionHelp_README_QT, SIGNAL(triggered()), actionHelp_README_QT, SLOT(do_send_string()));
        connect(actionHelp_README_QT, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
-       actionHelp_README_Artane = new Action_Control(this);
+       actionHelp_README_Artane = new Action_Control(this, using_flags);
        actionHelp_README_Artane->setObjectName(QString::fromUtf8("menuHelp_README_Artane"));
        actionHelp_README_Artane->do_set_string(QString::fromUtf8("readme_by_artane.txt"));
        connect(actionHelp_README_Artane, SIGNAL(triggered()), actionHelp_README_Artane, SLOT(do_send_string()));
@@ -316,7 +318,7 @@ void Ui_MainWindowBase::setupUi(void)
        menuHelp_Readme->addAction(actionHelp_README_Artane);
        menuHelp_Readme->addSeparator();
        
-       actionHelp_README_BIOS = new Action_Control(this);
+       actionHelp_README_BIOS = new Action_Control(this, using_flags);
        actionHelp_README_BIOS->setObjectName(QString::fromUtf8("menuHelp_README_BIOS"));
        actionHelp_README_BIOS->do_set_string(QString::fromUtf8("bios_and_keys.txt"));
        connect(actionHelp_README_BIOS, SIGNAL(triggered()), actionHelp_README_BIOS, SLOT(do_send_string()));
@@ -324,7 +326,7 @@ void Ui_MainWindowBase::setupUi(void)
        menuHelp_Readme->addAction(actionHelp_README_BIOS);
        menuHelp_Readme->addSeparator();
        
-       actionHelp_README_MR_TANAM = new Action_Control(this);
+       actionHelp_README_MR_TANAM = new Action_Control(this, using_flags);
        actionHelp_README_MR_TANAM->setObjectName(QString::fromUtf8("menuHelp_README_MR_TANAM"));
        actionHelp_README_MR_TANAM->do_set_string(QString::fromUtf8("readme_by_mr_tanam.txt"));
        connect(actionHelp_README_MR_TANAM, SIGNAL(triggered()), actionHelp_README_MR_TANAM, SLOT(do_send_string()));
@@ -333,14 +335,14 @@ void Ui_MainWindowBase::setupUi(void)
        
        menuHelp_Readme->addSeparator();
        
-       actionHelp_README_FAQ = new Action_Control(this);
+       actionHelp_README_FAQ = new Action_Control(this, using_flags);
        actionHelp_README_FAQ->setObjectName(QString::fromUtf8("menuHelp_README_FAQ"));
        actionHelp_README_FAQ->do_set_string(QString::fromUtf8("FAQ.html"));
        connect(actionHelp_README_FAQ, SIGNAL(triggered()), actionHelp_README_FAQ, SLOT(do_send_string()));
        connect(actionHelp_README_FAQ, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHelp_Readme->addAction(actionHelp_README_FAQ);
 
-       actionHelp_README_FAQ_JP = new Action_Control(this);
+       actionHelp_README_FAQ_JP = new Action_Control(this, using_flags);
        actionHelp_README_FAQ_JP->setObjectName(QString::fromUtf8("menuHelp_README_FAQ_JP"));
        actionHelp_README_FAQ_JP->do_set_string(QString::fromUtf8("FAQ.ja.html"));
        connect(actionHelp_README_FAQ_JP, SIGNAL(triggered()), actionHelp_README_FAQ_JP, SLOT(do_send_string()));
@@ -348,14 +350,14 @@ void Ui_MainWindowBase::setupUi(void)
        menuHelp_Readme->addAction(actionHelp_README_FAQ_JP);
        menuHelp_Readme->addSeparator();
        
-       actionHelp_README_FM7 = new Action_Control(this);
+       actionHelp_README_FM7 = new Action_Control(this, using_flags);
        actionHelp_README_FM7->setObjectName(QString::fromUtf8("menuHelp_README_FM7"));
        actionHelp_README_FM7->do_set_string(QString::fromUtf8("readme_fm7.txt"));
        connect(actionHelp_README_FM7, SIGNAL(triggered()), actionHelp_README_FM7, SLOT(do_send_string()));
        connect(actionHelp_README_FM7, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHelp_Readme->addAction(actionHelp_README_FM7);
        
-       actionHelp_README_FM7_JP = new Action_Control(this);
+       actionHelp_README_FM7_JP = new Action_Control(this, using_flags);
        actionHelp_README_FM7_JP->setObjectName(QString::fromUtf8("menuHelp_README_FM7_JP"));
        actionHelp_README_FM7_JP->do_set_string(QString::fromUtf8("readme_fm7.jp.txt"));
        connect(actionHelp_README_FM7_JP, SIGNAL(triggered()), actionHelp_README_FM7_JP, SLOT(do_send_string()));
@@ -366,58 +368,58 @@ void Ui_MainWindowBase::setupUi(void)
        menuHelp_Histories->setObjectName(QString::fromUtf8("menuHelp_Histories"));;
        menuHELP->addAction(menuHelp_Histories->menuAction());
 
-       actionHelp_History = new Action_Control(this);
+       actionHelp_History = new Action_Control(this, using_flags);
        actionHelp_History->setObjectName(QString::fromUtf8("menuHelp_History"));
        actionHelp_History->do_set_string(QString::fromUtf8("history.txt"));
        connect(actionHelp_History, SIGNAL(triggered()), actionHelp_History, SLOT(do_send_string()));
        connect(actionHelp_History, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHelp_Histories->addAction(actionHelp_History);
        
-       actionHelp_History_Relnote = new Action_Control(this);
+       actionHelp_History_Relnote = new Action_Control(this, using_flags);
        actionHelp_History_Relnote->setObjectName(QString::fromUtf8("menuHelp_History_Relnote"));
        actionHelp_History_Relnote->do_set_string(QString::fromUtf8("RELEASENOTE.txt"));
        connect(actionHelp_History_Relnote, SIGNAL(triggered()), actionHelp_History_Relnote, SLOT(do_send_string()));
        connect(actionHelp_History_Relnote, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHelp_Histories->addAction(actionHelp_History_Relnote);
        
-       actionHelp_History_ChangeLog = new Action_Control(this);
+       actionHelp_History_ChangeLog = new Action_Control(this, using_flags);
        actionHelp_History_ChangeLog->setObjectName(QString::fromUtf8("menuHelp_History_ChangeLog"));
        actionHelp_History_ChangeLog->do_set_string(QString::fromUtf8("ChangeLog.txt"));
        connect(actionHelp_History_ChangeLog, SIGNAL(triggered()), actionHelp_History_ChangeLog, SLOT(do_send_string()));
        connect(actionHelp_History_ChangeLog, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHelp_Histories->addAction(actionHelp_History_ChangeLog);
 
-       actionHelp_History_MR_TANAM = new Action_Control(this);
+       actionHelp_History_MR_TANAM = new Action_Control(this, using_flags);
        actionHelp_History_MR_TANAM->setObjectName(QString::fromUtf8("menuHelp_History_MR_TANAM"));
        actionHelp_History_MR_TANAM->do_set_string(QString::fromUtf8("history_by_mr_tanam.txt"));
        connect(actionHelp_History_MR_TANAM, SIGNAL(triggered()), actionHelp_History_MR_TANAM, SLOT(do_send_string()));
        connect(actionHelp_History_MR_TANAM, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHelp_Histories->addAction(actionHelp_History_MR_TANAM);
        
-       actionHelp_License = new Action_Control(this);
+       actionHelp_License = new Action_Control(this, using_flags);
        actionHelp_License->setObjectName(QString::fromUtf8("menuHelp_License"));
        actionHelp_License->do_set_string(QString::fromUtf8("LICENSE.txt"));
        connect(actionHelp_License, SIGNAL(triggered()), actionHelp_License, SLOT(do_send_string()));
        connect(actionHelp_License, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHELP->addAction(actionHelp_License);
        
-       actionHelp_License_JP = new Action_Control(this);
+       actionHelp_License_JP = new Action_Control(this, using_flags);
        actionHelp_License_JP->setObjectName(QString::fromUtf8("menuHelp_License_JP"));
        actionHelp_License_JP->do_set_string(QString::fromUtf8("LICENSE.ja.txt"));
        connect(actionHelp_License_JP, SIGNAL(triggered()), actionHelp_License_JP, SLOT(do_send_string()));
        connect(actionHelp_License_JP, SIGNAL(sig_send_string(QString)), this, SLOT(do_browse_document(QString)));
        menuHELP->addAction(actionHelp_License_JP);
        
-       if(config.window_mode <= 0) config.window_mode = 0;
-       if(config.window_mode >= using_flags->get_screen_mode_num()) config.window_mode = using_flags->get_screen_mode_num() - 1;
+       if(using_flags->get_config_ptr()->window_mode <= 0) using_flags->get_config_ptr()->window_mode = 0;
+       if(using_flags->get_config_ptr()->window_mode >= using_flags->get_screen_mode_num()) using_flags->get_config_ptr()->window_mode = using_flags->get_screen_mode_num() - 1;
        w = using_flags->get_screen_width();
        h = using_flags->get_screen_height();
-       if(actionScreenSize[config.window_mode] != NULL) {
-               double nd = actionScreenSize[config.window_mode]->binds->getDoubleValue();
+       if(actionScreenSize[using_flags->get_config_ptr()->window_mode] != NULL) {
+               double nd = actionScreenSize[using_flags->get_config_ptr()->window_mode]->binds->getDoubleValue();
                w = (int)(nd * (double)w);
                h = (int)(nd * (double)h);
                if(using_flags->is_use_screen_rotate()) {
-                       if(config.rotate_type) {
+                       if(using_flags->get_config_ptr()->rotate_type) {
                                int tmp_w = w;
                                w = h;
                                h = tmp_w;
@@ -425,7 +427,7 @@ void Ui_MainWindowBase::setupUi(void)
                }
        } else {
                if(using_flags->is_use_screen_rotate()) {
-                       if(config.rotate_type) {
+                       if(using_flags->get_config_ptr()->rotate_type) {
                                w = 600;
                                h = 960;
                        } else {                   
@@ -445,9 +447,9 @@ void Ui_MainWindowBase::setupUi(void)
                }
        }
        this->set_screen_size(w, h);
-       this->set_screen_aspect(config.window_stretch_type);
-       if(actionScreenSize[config.window_mode] != NULL) {
-               double nd = actionScreenSize[config.window_mode]->binds->getDoubleValue();
+       this->set_screen_aspect(using_flags->get_config_ptr()->window_stretch_type);
+       if(actionScreenSize[using_flags->get_config_ptr()->window_mode] != NULL) {
+               double nd = actionScreenSize[using_flags->get_config_ptr()->window_mode]->binds->getDoubleValue();
                graphicsView->do_set_screen_multiply(nd);
        }
        if(using_flags->is_use_joystick()) {
@@ -483,7 +485,7 @@ void Ui_MainWindowBase::setupUi(void)
 
 void Ui_MainWindowBase::retranslateEmulatorMenu(void)
 {
-
+       int i;
        menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
        if(using_flags->is_use_joystick()) {
                action_SetupJoystick->setText(QApplication::translate("MainWindow", "Configure Joysticks", 0));
@@ -491,33 +493,47 @@ void Ui_MainWindowBase::retranslateEmulatorMenu(void)
        }
        action_SetupKeyboard->setText(QApplication::translate("MainWindow", "Configure Keyboard", 0));
        action_SetupKeyboard->setIcon(QIcon(":/icon_keyboard.png"));
+       action_SetupMovie->setText(QApplication::translate("MainWindow", "Configure movie encoding", 0));
+       
 }
+
 void Ui_MainWindowBase::CreateEmulatorMenu(void)
 {
        if(using_flags->is_use_joystick()) {
                menuEmulator->addAction(action_SetupJoystick);
        }
        menuEmulator->addAction(action_SetupKeyboard);
+       menuEmulator->addAction(action_SetupMovie);
 }
 
 void Ui_MainWindowBase::ConfigEmulatorMenu(void)
 {
+       int i;
+       QString tmps;
        if(using_flags->is_use_joystick()) {
-               action_SetupJoystick = new Action_Control(this);
+               action_SetupJoystick = new Action_Control(this, using_flags);
        }
-       action_SetupKeyboard = new Action_Control(this);
+       action_SetupKeyboard = new Action_Control(this, using_flags);
+
+       action_SetupMovie = new Action_Control(this, using_flags);
+  
 }
 
 void Ui_MainWindowBase::rise_joystick_dialog(void)
 {
        if(graphicsView != NULL) {
                QStringList *lst = graphicsView->getVKNames();
-               CSP_DropDownJoysticks *dlg = new CSP_DropDownJoysticks(NULL, lst);
+               CSP_DropDownJoysticks *dlg = new CSP_DropDownJoysticks(NULL, lst, using_flags);
                dlg->setWindowTitle(QApplication::translate("CSP_DropDownJoysticks", "Configure Joysticks", 0));
                dlg->show();
        }
 }
 
+void Ui_MainWindowBase::rise_movie_dialog(void)
+{
+
+}
+
 void Ui_MainWindowBase::rise_keyboard_dialog(void)
 {
        if(graphicsView != NULL) {
@@ -778,7 +794,7 @@ void Ui_MainWindowBase::OnWindowMove(void)
 void Ui_MainWindowBase::OnWindowResize(void)
 {
        if(emu) {
-               set_window(config.window_mode);
+               set_window(using_flags->get_config_ptr()->window_mode);
        }
 }