void CSP_DiskParams::_open_disk(QString s)
{
int d = getDrive();
- AGAR_DebugLog(AGAR_LOG_INFO, "Try to open disk: %s", s.toLocal8Bit().constData());
+ AGAR_DebugLog(AGAR_LOG_INFO, "Try to open media image: %s", s.toLocal8Bit().constData());
AGAR_DebugLog(AGAR_LOG_INFO, "Drive = %d\n", d);
emit do_open_disk(d, s);
}
menu_metaclass.h
menu_disk.h
menu_cmt.h
+ menu_cart.h
+ menu_quickdisk.h
+ menu_binary.h
display_about.h
display_text_document.h
)
class Menu_MetaClass;
class Menu_FDClass;
class Menu_CMTClass;
+class Menu_CartClass;
+class Menu_QDClass;
+class Menu_BinaryClass;
#ifndef _SCREEN_MODE_NUM
#define _SCREEN_MODE_NUM 32
#endif
#if defined(USE_CART1) || defined(USE_CART2)
- QActionGroup *actionGroup_Opened_CART[2];
- class Action_Control *actionRecent_Opened_CART[2];
- class Action_Control *action_Recent_List_CART[2][MAX_HISTORY];
- class Action_Control *actionInsert_CART[2];
- class Action_Control *actionEject_CART[2];
- QStringList listCarts[2];
+ QStringList listCARTs[2];
#endif
#if defined(USE_QD1) || defined(USE_QD2)
- QActionGroup *actionGroup_Opened_QD[2];
- QActionGroup *actionGroup_Protect_QD[2];
- class Action_Control *actionRecent_Opened_QD[2];
- class Action_Control *action_Recent_List_QD[2][MAX_HISTORY];
- class Action_Control *actionInsert_QD[2];
- class Action_Control *actionEject_QD[2];
- class Action_Control *actionProtection_ON_QD[2];
- class Action_Control *actionProtection_OFF_QD[2];
QStringList listQDs[2];
#endif
#ifdef USE_TAPE
QStringList listLaserDisc;
#endif
#if defined(USE_BINARY_FILE1)
- QActionGroup *actionGroup_Opened_BIN[8];
- QActionGroup *actionGroup_Protect_BIN[8]; // Is needed?
- class Action_Control *actionRecent_Opened_BIN[8];
- class Action_Control *action_Recent_List_BIN[8][MAX_HISTORY];
- class Action_Control *actionLoad_BIN[8];
- class Action_Control *actionSave_BIN[8];
- QStringList listBinary[8];
+ QStringList listBINs[8];
#endif
// Screen
QActionGroup *actionGroup_Stretch;
QMenu *menuCopy_Paste;
QMenu *menuCpu_Speed;
QMenu *menuDebugger;
-#if defined(USE_CART1) || defined(USE_CART2)
- QMenu *menuCART[8];
- QMenu *menuCART_Recent[8];
-#endif
+
#if defined(USE_FD1) || defined(USE_FD2) || defined(USE_FD3) || defined(USE_FD4) || \
defined(USE_FD5) || defined(USE_FD6) || defined(USE_FD7) || defined(USE_FD8)
Menu_FDClass *menu_fds[MAX_FD];
QStringList listD88[MAX_FD];
#endif
#if defined(USE_QD1) || defined(USE_QD2)
- QMenu *menuQD[2];
- QMenu *menuQD_Recent[2];
- QMenu *menuWrite_Protection_QD[2];
+ Menu_QDClass *menu_QDs[2];
#endif
#ifdef USE_TAPE
Menu_CMTClass *menu_CMT;
#endif
+#ifdef USE_CART1
+ Menu_CartClass *menu_Cart[2];
+#endif
#ifdef USE_LASER_DISC
QMenu *menuLD;
QMenu *menuLD_Recent;
#endif
#if defined(USE_BINARY_FILE1)
- QMenu *menuBIN[8];
- QMenu *menuBIN_Recent[8];
+ Menu_BinaryClass *menu_BINs[8];
#endif
QMenu *menuScreen;
QMenu *menuStretch_Mode;
void do_update_recent_disk(int);
#endif
#ifdef USE_CART1
- void open_cart_dialog(int);
void eject_cart(int);
void set_recent_cart(int, int);
#endif
void ConfigBinaryMenuSub(int drv);
int set_recent_binary_load(int drv, int num);
int set_recent_binary_save(int drv, int num);
- void _open_binary(int drive, const QString fname, bool load);
+ void _open_binary_load(int drive, const QString fname);
+ void _open_binary_save(int drive, const QString fname);
#endif
//#ifdef USE_QD1
/*
- * UI->Qt->MainWindow : Binary Menu.
+ * Qt / Tape Menu, Utilities
* (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
- * License: GPLv2
- *
- * History:
- * Jan 24, 2014 : Moved from some files.
+ * License : GPLv2
+ * History :
+ * Jan 13 2015 : Start
*/
-//#include "menuclasses.h"
#include "commonclasses.h"
#include "mainwidget.h"
+#include "menu_binary.h"
+
#include "emu_utils.h"
#include "qt_dialogs.h"
#include "emu.h"
-#include "agar_logger.h"
-#ifdef USE_BINARY_FILE1
-void Object_Menu_Control::on_recent_binary_load(void){
- // write_protect = false; // Right? On D88, May be writing entry exists.
- emit set_recent_binary_load(drive, s_num);
-}
-void Object_Menu_Control::on_recent_binary_save(void){
- // write_protect = false; // Right? On D88, May be writing entry exists.
- emit set_recent_binary_save(drive, s_num);
+Menu_BinaryClass::Menu_BinaryClass(EMU *ep, QMenuBar *root_entry, QString desc, QWidget *parent, int drv) : Menu_MetaClass(ep, root_entry, desc, parent, drv)
+{
+ use_write_protect = false;
+ use_d88_menus = false;
}
-void Object_Menu_Control::_open_binary(QString s){
- bool load = this->isPlay();
- int d = this->getDrive();
- emit sig_open_binary_file(d, s, load);
-}
-void Object_Menu_Control::insert_binary_load(void) {
- emit sig_open_binary(getDrive(), true);
-}
-void Object_Menu_Control::insert_binary_save(void) {
- emit sig_open_binary(getDrive(), false);
+Menu_BinaryClass::~Menu_BinaryClass()
+{
}
-#endif
-
-QT_BEGIN_NAMESPACE
-#if defined(USE_BINARY_FILE1)
-void Ui_MainWindow::open_binary_dialog(int drive, bool load)
+void Menu_BinaryClass::create_pulldown_menu_device_sub(void)
{
- QString ext;
- QString desc1;
- QString desc2;
- CSP_DiskDialog dlg;
- QString dirname;
-
-#if defined(_TK80BS) || defined(_TK80)
- ext = "*.ram *.bin *.tk8";
-#else
- ext = "*.ram *.bin";
-#endif
-#if defined(_PASOPIA) || defined(PASOPIA7)
- desc1 = "RAM Pack Cartridge";
-#else
- desc1 = "Memory Dump";
-#endif
- desc2.number(drive + 1);
- desc2 = QString::fromUtf8("Open binary image on #") + desc2;
- dlg.setWindowTitle(desc2);
-
- //desc2 = desc1 + " (" + ext.toLower() + ")";
- //desc1 = desc1 + " (" + ext.toUpper() + ")";
- desc2 = desc1 + " (" + ext.toLower() + " " + ext.toUpper() + ")";
+ int ii;
+ action_saving = new Action_Control(p_wid);
+ action_saving->setVisible(true);
+ action_saving->setCheckable(false);
- if(config.initial_binary_dir != NULL) {
- dirname = QString::fromUtf8(config.initial_binary_dir);
- } else {
- char app[PATH_MAX];
- QDir df;
- dirname = df.currentPath();
- strncpy(app, dirname.toUtf8().constData(), PATH_MAX);
- dirname = get_parent_dir(app);
+ menu_history_save = new QMenu(this);
+ menu_history_save->setObjectName(QString::fromUtf8("menu_history_save_") + object_desc);
+
+ {
+ QString tmps;
+ action_group_save_recent = new QActionGroup(p_wid);
+ action_group_save_recent->setExclusive(true);
+
+ for(ii = 0; ii < MAX_HISTORY; ii++) {
+ tmps = history.value(ii, "");
+ action_recent_save_list[ii] = new Action_Control(p_wid);
+ action_recent_save_list[ii]->binds->setDrive(media_drive);
+ action_recent_save_list[ii]->binds->setNumber(ii);
+
+ action_recent_save_list[ii]->setText(tmps);
+ action_group_save_recent->addAction(action_recent_save_list[ii]);
+ if(!tmps.isEmpty()) {
+ action_recent_save_list[ii]->setVisible(true);
+ } else {
+ action_recent_save_list[ii]->setVisible(false);
+ }
+ }
}
- QStringList filter;
- filter << desc2;
- dlg.param->setDrive(drive);
- dlg.param->setPlay(load);
-
- dlg.setDirectory(dirname);
- dlg.setNameFilters(filter);
- QObject::connect(&dlg, SIGNAL(fileSelected(QString)), dlg.param, SLOT(_open_binary(QString)));
- QObject::connect(dlg.param, SIGNAL(sig_open_binary_file(int, QString, bool)),
- this, SLOT(_open_binary(int, QString, bool)));
- dlg.show();
- dlg.exec();
- return;
+
+ for(ii = 0; ii < MAX_HISTORY; ii++) menu_history_save->addAction(action_recent_save_list[ii]);
}
-void Ui_MainWindow::CreateBinaryMenu(int drv, int drv_base)
-{
- QString drv_base_name = QString::number(drv_base);
- menuBIN[drv] = new QMenu(menubar);
- menuBIN[drv]->setObjectName(QString::fromUtf8("menuBIN", -1) + drv_base_name);
+void Menu_BinaryClass::do_open_media_save(int drv, QString name) {
+ emit sig_open_media_save(drv, name);
+}
+
+void Menu_BinaryClass::do_open_recent_media_save(int drv, int slot) {
+ emit sig_set_recent_media_save(drv, slot);
}
-void Ui_MainWindow::CreateBinaryPulldownMenu(int drv)
+void Menu_BinaryClass::do_update_histories(QStringList lst)
{
- menuBIN[drv]->addAction(actionLoad_BIN[drv]);
- menuBIN[drv]->addAction(actionSave_BIN[drv]);
- menuBIN[drv]->addSeparator();
- menuBIN_Recent[drv] = new QMenu(menuBIN[drv]);
- menuBIN_Recent[drv]->setObjectName(QString::fromUtf8("Recent_BIN", -1) + QString::number(drv));
- menuBIN[drv]->addAction(menuBIN_Recent[drv]->menuAction());
- {
- int ii;
- for(ii = 0; ii < MAX_HISTORY; ii++) {
- menuBIN_Recent[drv]->addAction(action_Recent_List_BIN[drv][ii]);
- action_Recent_List_BIN[drv][ii]->setVisible(true);
- }
+ int ii;
+ QString tmps;
+
+ Menu_MetaClass::do_update_histories(lst);
+
+ for(ii = 0; ii < MAX_HISTORY; ii++) {
+ tmps = QString::fromUtf8("");
+ if(ii < lst.size()) tmps = lst.value(ii);
+ action_recent_save_list[ii]->setText(tmps);
+ if(!tmps.isEmpty()) {
+ action_recent_save_list[ii]->setVisible(true);
+ } else {
+ action_recent_save_list[ii]->setVisible(false);
+ }
}
}
-void Ui_MainWindow::ConfigBinaryMenuSub(int drv)
+
+
+void Menu_BinaryClass::connect_menu_device_sub(void)
{
- QString drive_name = QString::number(drv);
- //AGAR_DebugLog(AGAR_LOG_DEBUG, "Create: %d\n", drv);
-
- actionLoad_BIN[drv] = new Action_Control(this);
- actionLoad_BIN[drv]->setObjectName(QString::fromUtf8("actionLoad_BIN") + drive_name);
- actionLoad_BIN[drv]->binds->setDrive(drv);
- actionLoad_BIN[drv]->binds->setNumber(1);
-
- actionSave_BIN[drv] = new Action_Control(this);
- actionSave_BIN[drv]->setObjectName(QString::fromUtf8("actionSave_BIN") + drive_name);
- actionSave_BIN[drv]->binds->setDrive(drv);
- actionSave_BIN[drv]->binds->setNumber(0);
-
- actionGroup_Opened_BIN[drv] = new QActionGroup(this);
- actionRecent_Opened_BIN[drv] = new Action_Control(this);
- actionRecent_Opened_BIN[drv]->setObjectName(QString::fromUtf8("actionRecent_Opened_BIN") + drive_name);
- actionRecent_Opened_BIN[drv]->binds->setDrive(drv);
- actionRecent_Opened_BIN[drv]->binds->setNumber(0);
-
- {
- int ii;
- actionGroup_Opened_BIN[drv] = new QActionGroup(this);
- actionGroup_Opened_BIN[drv]->setExclusive(true);
-
- actionRecent_Opened_BIN[drv] = new Action_Control(this);
- actionRecent_Opened_BIN[drv]->setObjectName(QString::fromUtf8("actionSelect_Recent_BIN") + drive_name);
- actionRecent_Opened_BIN[drv]->binds->setDrive(drv);
- actionRecent_Opened_BIN[drv]->binds->setNumber(0);
- for(ii = 0; ii < MAX_HISTORY; ii++) {
- action_Recent_List_BIN[drv][ii] = new Action_Control(this);
- action_Recent_List_BIN[drv][ii]->binds->setDrive(drv);
- action_Recent_List_BIN[drv][ii]->binds->setNumber(ii);
- action_Recent_List_BIN[drv][ii]->setText(QString::fromUtf8(config.recent_binary_path[drv][ii]));
- actionGroup_Opened_BIN[drv]->addAction(action_Recent_List_BIN[drv][ii]);
- connect(action_Recent_List_BIN[drv][ii], SIGNAL(triggered()),
- action_Recent_List_BIN[drv][ii]->binds, SLOT(on_recent_binary_load()));
- connect(action_Recent_List_BIN[drv][ii]->binds, SIGNAL(set_recent_binary_load(int, int)),
- this, SLOT(set_recent_binary_load(int, int)));
- }
+#ifdef USE_BINARY_FILE1
+ int ii;
+ this->addAction(action_saving);
+ this->addSeparator();
+ this->addAction(menu_history_save->menuAction());
+
+ action_eject->setVisible(false);
+ for(ii = 0; ii < MAX_HISTORY; ii++) {
+ connect(action_recent_save_list[ii], SIGNAL(triggered()),
+ action_recent_save_list[ii]->binds, SLOT(on_recent_binary_save()));
+ connect(action_recent_save_list[ii]->binds, SIGNAL(set_recent_binary_save(int, int)),
+ this, SLOT(do_open_recent_media_save(int, int)));
}
-
- connect(actionLoad_BIN[drv], SIGNAL(triggered()), actionLoad_BIN[drv]->binds, SLOT(insert_binary_load()));
- connect(actionLoad_BIN[drv]->binds, SIGNAL(sig_open_binary(int, bool)), this, SLOT(open_binary_dialog(int, bool)));
- connect(actionSave_BIN[drv], SIGNAL(triggered()), actionSave_BIN[drv]->binds, SLOT(insert_binary_save()));
- connect(actionSave_BIN[drv]->binds, SIGNAL(sig_open_binary(int, bool)), this, SLOT(open_binary_dialog(int, bool)));
- // Translate Menu
+ connect(action_saving, SIGNAL(triggered()), this, SLOT(do_open_save_dialog()));
+ connect(this, SIGNAL(sig_set_recent_media(int, int)), p_wid, SLOT(set_recent_binary_load(int, int)));
+ connect(this, SIGNAL(sig_set_recent_media_save(int, int)), p_wid, SLOT(set_recent_binary_save(int, int)));
+
+ connect(this, SIGNAL(sig_open_media(int, QString)), p_wid, SLOT(_open_binary_load(int, QString)));
+ connect(this, SIGNAL(sig_open_media_save(int, QString)), p_wid, SLOT(_open_binary_save(int, QString)));
+#endif
}
-#endif
-void Ui_MainWindow::retranslateBinaryMenu(int drv, int basedrv)
+
+
+void Menu_BinaryClass::do_open_save_dialog()
{
-#if defined(USE_BINARY_FILE1)
- QString drive_name = (QApplication::translate("MainWindow", "Binary", 0));
- drive_name += QString::number(basedrv);
-
- if((drv < 0) || (drv >= 8)) return;
- actionLoad_BIN[drv]->setText(QApplication::translate("MainWindow", "Load", 0));
- actionSave_BIN[drv]->setText(QApplication::translate("MainWindow", "Save", 0));
-
- menuBIN_Recent[drv]->setTitle(QApplication::translate("MainWindow", "Recent Opened", 0));
-
- menuBIN[drv]->setTitle(QApplication::translate("MainWindow", drive_name.toUtf8().constData() , 0));
-#endif
+ CSP_DiskDialog dlg;
+
+ if(initial_dir.isEmpty()) {
+ QDir dir;
+ char app[PATH_MAX];
+ initial_dir = dir.currentPath();
+ strncpy(app, initial_dir.toLocal8Bit().constData(), PATH_MAX);
+ initial_dir = QString::fromLocal8Bit(get_parent_dir(app));
+ }
+ dlg.setOption(QFileDialog::ReadOnly, false);
+ dlg.setAcceptMode(QFileDialog::AcceptSave);
+ dlg.param->setDrive(media_drive);
+ dlg.param->setPlay(false);
+ dlg.setWindowTitle(QApplication::translate("MainWindow", "Save Binary", 0));
+ dlg.setDirectory(initial_dir);
+ //dlg.setNameFilters(ext_rec_filter);
+ //dlg.setWindowTitle(desc_rec);
+ dlg.setNameFilters(ext_filter);
+
+ QObject::connect(&dlg, SIGNAL(fileSelected(QString)),
+ dlg.param, SLOT(_open_disk(QString)));
+ QObject::connect(dlg.param, SIGNAL(do_open_disk(int, QString)),
+ this, SLOT(do_open_media_save(int, QString)));
+ dlg.show();
+ dlg.exec();
+ return;
}
-void Ui_MainWindow::ConfigBinaryMenu(void)
+void Menu_BinaryClass::retranslate_pulldown_menu_device_sub(void)
{
-
-#if defined(USE_BINARY_FILE1)
- ConfigBinaryMenuSub(0);
-#endif
-#if defined(USE_BINARY_FILE2)
- ConfigBinaryMenuSub(1);
-#endif
+ action_insert->setText(QApplication::translate("MainWindow", "Load", 0));
+ action_saving->setText(QApplication::translate("MainWindow", "Save", 0));
+ menu_history_save->setTitle(QApplication::translate("MainWindow", "Recently Saved", 0));
+ menu_history->setTitle(QApplication::translate("MainWindow", "Recently Loaded", 0));
}
-QT_END_NAMESPACE
--- /dev/null
+/*
+ * Menu_MetaClass : Defines
+ * (C) 2015 by K.Ohta <whatisthis.sowhat _at_ gmail.com>
+ * Please use this file as templete.
+ */
+
+
+#ifndef _CSP_QT_MENU_BINARY_CLASSES_H
+#define _CSP_QT_MENU_BINARY_CLASSES_H
+
+#include "menu_metaclass.h"
+
+QT_BEGIN_NAMESPACE
+
+class Menu_BinaryClass: public Menu_MetaClass {
+ Q_OBJECT
+protected:
+ QActionGroup *action_group_save_recent;
+ class Action_Control *action_recent_save_list[MAX_HISTORY];
+ class Action_Control *action_saving;
+
+ QMenu *menu_history_save;
+public:
+ Menu_BinaryClass(EMU *ep, QMenuBar *root_entry, QString desc, QWidget *parent = 0, int drv = 0);
+ ~Menu_BinaryClass();
+ void create_pulldown_menu_device_sub();
+ void connect_menu_device_sub(void);
+ void retranslate_pulldown_menu_device_sub(void);
+public slots:
+ void do_open_recent_media_save(int drv, int slot);
+ void do_open_media_save(int drv, QString name);
+ void do_open_save_dialog();
+ void do_update_histories(QStringList lst);
+signals:
+ void sig_open_media_save(int, QString);
+ void sig_set_recent_media_save(int, int);
+};
+
+QT_END_NAMESPACE
+
+#endif
//#include "menuclasses.h"
#include "commonclasses.h"
#include "mainwidget.h"
+#include "menu_metaclass.h"
+#include "menu_cart.h"
+
#include "emu_utils.h"
#include "qt_dialogs.h"
#include "emu.h"
#include "agar_logger.h"
-#ifdef USE_CART1
-void Object_Menu_Control::insert_cart(void) {
- emit sig_insert_cart(getDrive());
-}
-void Object_Menu_Control::eject_cart(void) {
- write_protect = false;
- emit sig_eject_cart(getDrive());
-}
-void Object_Menu_Control::on_recent_cart(void){
- emit set_recent_cart(drive, s_num);
-}
-#endif
-
-QT_BEGIN_NAMESPACE
-#if defined(USE_CART1) || defined(USE_CART2)
-
-void Ui_MainWindow::open_cart_dialog(int drive)
+Menu_CartClass::Menu_CartClass(EMU *ep, QMenuBar *root_entry, QString desc, QWidget *parent, int drv) : Menu_MetaClass(ep, root_entry, desc, parent, drv)
{
- QString ext;
- QString desc1;
- QString desc2;
- CSP_DiskDialog dlg;
- QString dirname;
-#if defined(_GAMEGEAR)
- ext = "*.rom *.bin *.gg *.col";
- desc1 = "Game Cartridge";
-#elif defined(_MASTERSYSTEM)
- ext = "*.rom *.bin *.sms";
- desc1 = "Game Cartridge";
-#elif defined(_PC6001) || defined(_PC6001MK2) || defined(_PC6001MK2SR) || defined(_PC6601) || defined(_PC6601SR)
- ext = "*.rom *.bin *.60";
- desc1 = "Game Cartridge";
-#elif defined(_PCENGINE) || defined(_X1TWIN)
- ext = "*.rom *.bin *.pce";
- desc1 = "HuCARD";
-#elif defined(_Z80TVGAME)
- ext = "*.rom *.bin *.hex";
- desc1 = "GameData";
-#else
- ext = "*.rom *.bin";
- desc1 = "Game Cartridge";
-#endif
- desc2.number(drive + 1);
- desc2 = QString::fromUtf8("Open Cartridge on #") + desc2;
- dlg.setWindowTitle(desc2);
-
- desc2 = desc1 + " (" + ext.toLower() + " " + ext.toUpper() +")";
- //desc1 = desc1 + " (" + ext.toUpper() + ")";
-
- if(config.initial_cart_dir != NULL) {
- dirname = QString::fromUtf8(config.initial_cart_dir);
- } else {
- char app[PATH_MAX];
- QDir df;
- dirname = df.currentPath();
- strncpy(app, dirname.toUtf8().constData(), PATH_MAX);
- dirname = get_parent_dir(app);
- }
- QStringList filter;
- //filter << desc1 << desc2;
- filter << desc2;
- dlg.param->setDrive(drive);
- dlg.setDirectory(dirname);
- dlg.setNameFilters(filter);
- QObject::connect(&dlg, SIGNAL(fileSelected(QString)), dlg.param, SLOT(_open_cart(QString)));
- QObject::connect(dlg.param, SIGNAL(sig_open_cart(int, QString)), this, SLOT(_open_cart(int, QString)));
- dlg.show();
- dlg.exec();
- return;
+ use_write_protect = false;
+ use_d88_menus = false;
}
-#endif
-void Ui_MainWindow::CreateCartMenu(int drv, int drv_base)
+Menu_CartClass::~Menu_CartClass()
{
-#ifdef USE_CART1
- QString drv_base_name = QString::number(drv_base);
- menuCART[drv] = new QMenu(menubar);
- menuCART[drv]->setObjectName(QString::fromUtf8("menuCART", -1) + drv_base_name);
-#endif
}
-void Ui_MainWindow::CreateCartPulldownMenu(int drv)
+void Menu_CartClass::create_pulldown_menu_device_sub(void)
{
-#ifdef USE_CART1
- menuCART[drv]->addAction(actionInsert_CART[drv]);
- menuCART[drv]->addAction(actionEject_CART[drv]);
- menuCART[drv]->addSeparator();
- menuCART_Recent[drv] = new QMenu(menuCART[drv]);
- menuCART_Recent[drv]->setObjectName(QString::fromUtf8("Recent_CART", -1) + QString::number(drv));
- menuCART[drv]->addAction(menuCART_Recent[drv]->menuAction());
- {
- int ii;
- for(ii = 0; ii < MAX_HISTORY; ii++) {
- menuCART_Recent[drv]->addAction(action_Recent_List_CART[drv][ii]);
- action_Recent_List_CART[drv][ii]->setVisible(true);
- }
- }
-#endif
}
-void Ui_MainWindow::ConfigCartMenuSub(int drv)
+
+void Menu_CartClass::connect_menu_device_sub(void)
{
-#ifdef USE_CART1
- QString drive_name = QString::number(drv);
- //AGAR_DebugLog(AGAR_LOG_DEBUG, "Create: %d\n", drv);
-
- actionInsert_CART[drv] = new Action_Control(this);
- actionInsert_CART[drv]->setObjectName(QString::fromUtf8("actionInsert_CART") + drive_name);
- actionInsert_CART[drv]->binds->setDrive(drv);
- actionInsert_CART[drv]->binds->setNumber(0);
-
- actionEject_CART[drv] = new Action_Control(this);
- actionEject_CART[drv]->setObjectName(QString::fromUtf8("actionEject_CART") + drive_name);
- actionEject_CART[drv]->binds->setDrive(drv);
- actionEject_CART[drv]->binds->setNumber(0);
-
- actionGroup_Opened_CART[drv] = new QActionGroup(this);
- actionRecent_Opened_CART[drv] = new Action_Control(this);
- actionRecent_Opened_CART[drv]->setObjectName(QString::fromUtf8("actionRecent_Opened_CART") + drive_name);
- actionRecent_Opened_CART[drv]->binds->setDrive(drv);
- actionRecent_Opened_CART[drv]->binds->setNumber(0);
-
- {
- int ii;
- actionGroup_Opened_CART[drv] = new QActionGroup(this);
- actionGroup_Opened_CART[drv]->setExclusive(true);
-
- actionRecent_Opened_CART[drv] = new Action_Control(this);
- actionRecent_Opened_CART[drv]->setObjectName(QString::fromUtf8("actionSelect_Recent_CART") + drive_name);
- actionRecent_Opened_CART[drv]->binds->setDrive(drv);
- actionRecent_Opened_CART[drv]->binds->setNumber(0);
- for(ii = 0; ii < MAX_HISTORY; ii++) {
- action_Recent_List_CART[drv][ii] = new Action_Control(this);
- action_Recent_List_CART[drv][ii]->binds->setDrive(drv);
- action_Recent_List_CART[drv][ii]->binds->setNumber(ii);
- action_Recent_List_CART[drv][ii]->setText(QString::fromUtf8(config.recent_cart_path[drv][ii]));
- actionGroup_Opened_CART[drv]->addAction(action_Recent_List_CART[drv][ii]);
- connect(action_Recent_List_CART[drv][ii], SIGNAL(triggered()),
- action_Recent_List_CART[drv][ii]->binds, SLOT(on_recent_cart()));
- connect(action_Recent_List_CART[drv][ii]->binds, SIGNAL(set_recent_cart(int, int)),
- this, SLOT(set_recent_cart(int, int)));
- }
- }
- connect(actionInsert_CART[drv], SIGNAL(triggered()), actionInsert_CART[drv]->binds, SLOT(insert_cart()));
- connect(actionInsert_CART[drv]->binds, SIGNAL(sig_insert_cart(int)), this, SLOT(open_cart_dialog(int)));
-
- connect(actionEject_CART[drv], SIGNAL(triggered()), actionEject_CART[drv]->binds, SLOT(eject_cart()));
- connect(actionEject_CART[drv]->binds, SIGNAL(sig_eject_cart(int)), this, SLOT(eject_cart(int)));
- // Translate Menu
-#endif
+ connect(this, SIGNAL(sig_open_media(int, QString)), p_wid, SLOT(_open_cart(int, QString)));
+ connect(this, SIGNAL(sig_eject_media(int)), p_wid, SLOT(eject_cart(int)));
+ connect(this, SIGNAL(sig_set_recent_media(int, int)), p_wid, SLOT(set_recent_cart(int, int)));
}
-void Ui_MainWindow::retranslateCartMenu(int drv, int basedrv)
+void Menu_CartClass::retranslate_pulldown_menu_device_sub(void)
{
-#ifdef USE_CART1
+ int drv = media_drive;
QString drive_name = (QApplication::translate("MainWindow", "Cartridge ", 0));
- drive_name += QString::number(basedrv);
+ drive_name += QString::number(drv);
if((drv < 0) || (drv >= 8)) return;
- actionInsert_CART[drv]->setText(QApplication::translate("MainWindow", "Insert", 0));
- actionEject_CART[drv]->setText(QApplication::translate("MainWindow", "Eject", 0));
+ action_insert->setText(QApplication::translate("MainWindow", "Insert", 0));
+ action_eject->setText(QApplication::translate("MainWindow", "Eject", 0));
- menuCART_Recent[drv]->setTitle(QApplication::translate("MainWindow", "Recent Opened", 0));
- menuCART[drv]->setTitle(QApplication::translate("MainWindow", drive_name.toUtf8().constData() , 0));
-#endif
+ menu_history->setTitle(QApplication::translate("MainWindow", "Recent Opened", 0));
+ this->setTitle(QApplication::translate("MainWindow", drive_name.toUtf8().constData() , 0));
}
-
-void Ui_MainWindow::ConfigCartMenu(void)
-{
-#if defined(USE_CART1)
- ConfigCartMenuSub(0);
-#endif
-#if defined(USE_CART2)
- ConfigCartMenuSub(1);
-#endif
-}
-
-QT_END_NAMESPACE
--- /dev/null
+/*
+ * Menu_CartClass : Defines
+ * (C) 2015 by K.Ohta <whatisthis.sowhat _at_ gmail.com>
+ * History: 2015-11-13: Initial
+ */
+
+
+#ifndef _CSP_QT_MENU_CART_CLASSES_H
+#define _CSP_QT_MENU_CART_CLASSES_H
+
+#include "menu_metaclass.h"
+
+QT_BEGIN_NAMESPACE
+
+class Menu_CartClass: public Menu_MetaClass {
+ Q_OBJECT
+protected:
+public:
+ Menu_CartClass(EMU *ep, QMenuBar *root_entry, QString desc, QWidget *parent = 0, int drv = 0);
+ ~Menu_CartClass();
+ void create_pulldown_menu_device_sub();
+ void connect_menu_device_sub(void);
+ void retranslate_pulldown_menu_device_sub(void);
+};
+
+QT_END_NAMESPACE
+
+#endif
#include "menuclasses.h"
#include "menu_disk.h"
#include "menu_cmt.h"
+#include "menu_cart.h"
+#include "menu_quickdisk.h"
+#include "menu_binary.h"
#include "qt_gldraw.h"
#include "emu.h"
menubar->addAction(menu_fds[7]->menuAction());
#endif
#if defined(USE_QD1)
- menubar->addAction(menuQD[0]->menuAction());
+ menubar->addAction(menu_QDs[0]->menuAction());
#endif
#if defined(USE_QD2)
- menubar->addAction(menuQD[1]->menuAction());
+ menubar->addAction(menu_QDs[1]->menuAction());
#endif
#if defined(USE_TAPE)
menubar->addAction(menu_CMT->menuAction());
#endif
#if defined(USE_CART1)
- menubar->addAction(menuCART[0]->menuAction());
+ menubar->addAction(menu_Cart[0]->menuAction());
#endif
#if defined(USE_CART2)
- menubar->addAction(menuCART[1]->menuAction());
+ menubar->addAction(menu_Cart[1]->menuAction());
#endif
#if defined(USE_BINARY_FILE1)
- menubar->addAction(menuBIN[0]->menuAction());
+ menubar->addAction(menu_BINs[0]->menuAction());
#endif
#if defined(USE_BINARY_FILE2)
- menubar->addAction(menuBIN[1]->menuAction());
+ menubar->addAction(menu_BINs[1]->menuAction());
#endif
menubar->addAction(menuMachine->menuAction());
// menubar->addAction(menuRecord->menuAction());
menubar->addAction(menuEmulator->menuAction());
menubar->addAction(menuHELP->menuAction());
-#if defined(USE_FD1)
- CreateFloppyPulldownMenu(0);
-#endif
-#if defined(USE_FD2)
- CreateFloppyPulldownMenu(1);
-#endif
-#if defined(USE_FD3)
- CreateFloppyPulldownMenu(2);
-#endif
-#if defined(USE_FD4)
- CreateFloppyPulldownMenu(3);
-#endif
-#if defined(USE_FD5)
- CreateFloppyPulldownMenu(4);
-#endif
-#if defined(USE_FD6)
- CreateFloppyPulldownMenu(5);
-#endif
-#if defined(USE_FD7)
- CreateFloppyPulldownMenu(6);
-#endif
-#if defined(USE_FD8)
- CreateFloppyPulldownMenu(7);
-#endif
-#ifdef USE_TAPE
- CreateCMTPulldownMenu();
-#endif
#if defined(USE_QD1)
CreateQuickDiskPulldownMenu(0);
#endif
#if defined(USE_QD2)
CreateQuickDiskPulldownMenu(1);
#endif
-#if defined(USE_CART1)
- CreateCartPulldownMenu(0);
-#endif
-#if defined(USE_CART2)
- CreateCartPulldownMenu(1);
-#endif
#if defined(USE_BINARY_FILE1)
CreateBinaryPulldownMenu(0);
#endif
strncpy(app, initial_dir.toLocal8Bit().constData(), PATH_MAX);
initial_dir = QString::fromLocal8Bit(get_parent_dir(app));
}
+ dlg.setOption(QFileDialog::ReadOnly, false);
+ dlg.setAcceptMode(QFileDialog::AcceptSave);
dlg.param->setDrive(media_drive);
+ dlg.param->setPlay(true);
dlg.setDirectory(initial_dir);
dlg.setNameFilters(ext_filter);
menu_write_protect->setTitle(QApplication::translate("MainWindow", "Write protection", 0));
action_write_protect_on->setText(QApplication::translate("MainWindow", "On", 0));
action_write_protect_off->setText(QApplication::translate("MainWindow", "Off", 0));
- } else {
- menu_write_protect->setVisible(false);
- action_write_protect_on->setVisible(false);
- action_write_protect_off->setVisible(false);
- }
+ }
+
#if defined(USE_FD1)
if(use_d88_menus) {
menu_inner_media->setTitle(QApplication::translate("MainWindow", "Select D88 image", 0));
* (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
* LIcense: GPLv2
* History: Jan 10, 2015 (MAYBE) : Initial.
+ * Nov 13, 2015 : Integrate to Menu_MetaClass.
*/
#include "commonclasses.h"
#include "mainwidget.h"
-//#include "menuclasses.h"
+#include "menu_quickdisk.h"
+
#include "emu_utils.h"
#include "qt_dialogs.h"
#include "emu.h"
-QT_BEGIN_NAMESPACE
-#if defined(USE_QD1) || defined(USE_QD2)
-void Object_Menu_Control::insert_Qd(void) {
- //write_protect = false; // Right? On D88, May be writing entry exists.
- emit sig_insert_Qd(drive);
-}
-void Object_Menu_Control::eject_Qd(void) {
- write_protect = false;
- emit sig_eject_Qd(drive);
-}
-void Object_Menu_Control::on_recent_quick_disk(void){
- // write_protect = false; // Right? On D88, May be writing entry exists.
- emit set_recent_quick_disk(drive, s_num);
-}
-void CSP_FileParams::_open_quick_disk(QString s){
- // write_protect = false; // Right? On D88, May be writing entry exists.
- emit do_open_quick_disk(getDrive(), s);
-}
-void Object_Menu_Control::write_protect_Qd(void) {
- write_protect = true;
- emit sig_write_protect_Qd(drive, write_protect);
-}
-void Object_Menu_Control::no_write_protect_Qd(void) {
- write_protect = false;
- emit sig_write_protect_Qd(drive, write_protect);
+Menu_QDClass::Menu_QDClass(EMU *ep, QMenuBar *root_entry, QString desc, QWidget *parent, int drv) : Menu_MetaClass(ep, root_entry, desc, parent, drv)
+{
+ use_write_protect = true;
}
-#endif
-// Common Routine
-void Ui_MainWindow::open_quick_disk_dialog(int drv)
+Menu_QDClass::~Menu_QDClass()
{
-#ifdef USE_QD1
- QString ext = "*.mzt *.q20 *.qdf";
- QString desc1 = "Quick DIsk";
- QString desc2;
- CSP_DiskDialog dlg;
- QString dirname;
-
- dlg.setWindowTitle("Open Quick Disk");
-
- desc2 = desc1 + " (" + ext.toLower() + " " + ext.toUpper() + ")";
- //desc2 = desc1 + " (" + ext.toLower() + ")";
- //desc1 = desc1 + " (" + ext.toUpper() + ")";
- if(config.initial_disk_dir != NULL) {
- dirname = config.initial_quickdisk_dir;
- } else {
- char app[_MAX_PATH];
- QDir df;
- dirname = df.currentPath();
- strncpy(app, dirname.toUtf8().constData(), _MAX_PATH);
- dirname = get_parent_dir(app);
- }
- QStringList filter;
- filter << desc2;
-
- dlg.param->setDrive(drv);
- dlg.setDirectory(dirname);
- dlg.setNameFilters(filter);
- QObject::connect(&dlg, SIGNAL(fileSelected(QString)),
- dlg.param, SLOT(_open_quick_disk(QString)));
- QObject::connect(dlg.param, SIGNAL(do_open_quick_disk(int, QString)),
- this, SLOT(_open_quick_disk(int, QString)));
- dlg.show();
- dlg.exec();
- return;
-#endif
}
-void Ui_MainWindow::CreateQuickDiskMenu(int drv, int drv_base)
+void Menu_QDClass::create_pulldown_menu_device_sub(void)
{
-#ifdef USE_QD1
- QString drv_base_name = QString::number(drv_base);
- menuQD[drv] = new QMenu(menubar);
- menuQD[drv]->setObjectName(QString::fromUtf8("menuQD", -1) + drv_base_name);
- menuWrite_Protection_QD[drv] = new QMenu(menuQD[drv]);
- menuWrite_Protection_QD[drv]->setObjectName(QString::fromUtf8("menuWrite_Protection_QD", -1) + drv_base_name);
-#endif
}
-void Ui_MainWindow::CreateQuickDiskPulldownMenu(int drv)
+
+void Menu_QDClass::connect_menu_device_sub(void)
{
-#ifdef USE_QD1
- menuQD[drv]->addAction(actionInsert_QD[drv]);
- menuQD[drv]->addAction(actionEject_QD[drv]);
- menuQD[drv]->addSeparator();
- menuQD_Recent[drv] = new QMenu(menuQD[drv]);
- menuQD_Recent[drv]->setObjectName(QString::fromUtf8("Recent_QD", -1) + QString::number(drv));
- menuQD[drv]->addAction(menuQD_Recent[drv]->menuAction());
- // menuQD[drv]->addAction(actionRecent_Opened_QD[0]);
- {
- int ii;
- for(ii = 0; ii < MAX_HISTORY; ii++) {
- menuQD_Recent[drv]->addAction(action_Recent_List_QD[drv][ii]);
- action_Recent_List_QD[drv][ii]->setVisible(true);
- }
- }
- menuQD[drv]->addSeparator();
- menuQD[drv]->addAction(menuWrite_Protection_QD[drv]->menuAction());
- menuWrite_Protection_QD[drv]->addAction(actionProtection_ON_QD[drv]);
- menuWrite_Protection_QD[drv]->addAction(actionProtection_OFF_QD[drv]);
-#endif
+ this->addSeparator();
+
+ connect(this, SIGNAL(sig_open_media(int, QString)), p_wid, SLOT(_open_quick_disk(int, QString)));
+ connect(this, SIGNAL(sig_eject_media(int)), p_wid, SLOT(eject_Qd(int)));
+ connect(this, SIGNAL(sig_write_protect_media(int, bool)), p_wid, SLOT(write_protect_Qd(int, bool)));
+ connect(this, SIGNAL(sig_set_recent_media(int, int)), p_wid, SLOT(set_recent_quick_disk(int, int)));
}
-void Ui_MainWindow::ConfigQuickDiskMenuSub(int drv)
+void Menu_QDClass::retranslate_pulldown_menu_device_sub(void)
{
-#ifdef USE_QD1
- QString drive_name = QString::number(drv);
-
- actionInsert_QD[drv] = new Action_Control(this);
- actionInsert_QD[drv]->setObjectName(QString::fromUtf8("actionInsert_QD") + drive_name);
- actionInsert_QD[drv]->binds->setDrive(drv);
- actionInsert_QD[drv]->binds->setNumber(0);
- actionEject_QD[drv] = new Action_Control(this);
- actionEject_QD[drv]->setObjectName(QString::fromUtf8("actionEject_QD") + drive_name);
- actionEject_QD[drv]->binds->setDrive(drv);
- actionEject_QD[drv]->binds->setNumber(0);
-
- actionGroup_Opened_QD[drv] = new QActionGroup(this);
- actionRecent_Opened_QD[drv] = new Action_Control(this);
- actionRecent_Opened_QD[drv]->setObjectName(QString::fromUtf8("actionRecent_Opened_QD") + drive_name);
- actionRecent_Opened_QD[drv]->binds->setDrive(drv);
- actionRecent_Opened_QD[drv]->binds->setNumber(0);
-
- {
- int ii;
- actionGroup_Opened_QD[drv] = new QActionGroup(this);
- actionGroup_Opened_QD[drv]->setExclusive(true);
-
- actionRecent_Opened_QD[drv] = new Action_Control(this);
- actionRecent_Opened_QD[drv]->setObjectName(QString::fromUtf8("actionSelect_Recent_QD") + drive_name);
- actionRecent_Opened_QD[drv]->binds->setDrive(drv);
- actionRecent_Opened_QD[drv]->binds->setNumber(0);
- for(ii = 0; ii < MAX_HISTORY; ii++) {
- action_Recent_List_QD[drv][ii] = new Action_Control(this);
- action_Recent_List_QD[drv][ii]->binds->setDrive(drv);
- action_Recent_List_QD[drv][ii]->binds->setNumber(ii);
- action_Recent_List_QD[drv][ii]->setText(QString::fromUtf8(config.recent_quickdisk_path[drv][ii]));
- actionGroup_Opened_QD[drv]->addAction(action_Recent_List_QD[drv][ii]);
- connect(action_Recent_List_QD[drv][ii], SIGNAL(triggered()),
- action_Recent_List_QD[drv][ii]->binds, SLOT(on_recent_quick_disk()));
- connect(action_Recent_List_QD[drv][ii]->binds, SIGNAL(set_recent_quick_disk(int, int)),
- this, SLOT(set_recent_quick_disk(int, int)));
- }
- }
- {
- int ii;
- actionGroup_Protect_QD[drv] = new QActionGroup(this);
- actionGroup_Protect_QD[drv]->setExclusive(true);
- actionProtection_ON_QD[drv] = new Action_Control(this);
- actionProtection_ON_QD[drv]->setObjectName(QString::fromUtf8("actionProtection_ON_QD") + drive_name);
- actionProtection_ON_QD[drv]->setCheckable(true);
- actionProtection_ON_QD[drv]->setChecked(true);
- actionProtection_ON_QD[drv]->binds->setDrive(drv);
- actionProtection_ON_QD[drv]->binds->setNumber(0);
- actionProtection_OFF_QD[drv] = new Action_Control(this);
- actionProtection_OFF_QD[drv]->setObjectName(QString::fromUtf8("actionProtection_OFF_QD") + drive_name);
- actionProtection_OFF_QD[drv]->setCheckable(true);
- actionProtection_OFF_QD[drv]->binds->setDrive(drv);
- actionProtection_OFF_QD[drv]->binds->setNumber(1);
-
- actionGroup_Protect_QD[drv]->addAction(actionProtection_ON_QD[drv]);
- actionGroup_Protect_QD[drv]->addAction(actionProtection_OFF_QD[drv]);
-
- connect(actionProtection_ON_QD[drv], SIGNAL(triggered()),
- actionProtection_ON_QD[drv]->binds, SLOT(write_protect_Qd()));
- connect(actionProtection_ON_QD[drv]->binds, SIGNAL(sig_write_protect_Qd(int, bool)),
- this, SLOT(write_protect_Qd(int, bool)));
- connect(actionProtection_OFF_QD[drv], SIGNAL(triggered()),
- actionProtection_OFF_QD[drv]->binds, SLOT(no_write_protect_Qd()));
- connect(actionProtection_OFF_QD[drv]->binds, SIGNAL(sig_write_protect_Qd(int, bool)),
- this, SLOT(write_protect_Qd(int, bool)));
- }
- connect(actionInsert_QD[drv], SIGNAL(triggered()), actionInsert_QD[drv]->binds, SLOT(insert_Qd()));
- connect(actionInsert_QD[drv]->binds, SIGNAL(sig_insert_Qd(int)), this, SLOT(open_quick_disk_dialog(int)));
- connect(actionEject_QD[drv], SIGNAL(triggered()), actionEject_QD[drv]->binds, SLOT(eject_Qd()));
- connect(actionEject_QD[drv]->binds, SIGNAL(sig_eject_Qd(int)), this, SLOT(eject_Qd(int)));
- // Translate Menu
-#endif
}
-void Ui_MainWindow::retranslateQuickDiskMenu(int drv, int basedrv)
-{
-#ifdef USE_QD1
- QString drive_name = (QApplication::translate("MainWindow", "Quick Disk ", 0));
- drive_name += QString::number(basedrv);
-
- if((drv < 0) || (drv >= 2)) return;
- actionInsert_QD[drv]->setText(QApplication::translate("MainWindow", "Insert", 0));
- actionEject_QD[drv]->setText(QApplication::translate("MainWindow", "Eject", 0));
- menuQD_Recent[drv]->setTitle(QApplication::translate("MainWindow", "Recent Opened", 0));
-
- actionProtection_ON_QD[drv]->setText(QApplication::translate("MainWindow", "Protection ON", 0));
- actionProtection_OFF_QD[drv]->setText(QApplication::translate("MainWindow", "Protection OFF", 0));
- menuQD[drv]->setTitle(QApplication::translate("MainWindow", drive_name.toUtf8().constData() , 0));
- menuWrite_Protection_QD[drv]->setTitle(QApplication::translate("MainWindow", "Write Protection", 0));
-#endif
-}
-
-void Ui_MainWindow::ConfigQuickDiskMenu(void)
-{
-#if defined(USE_QD1)
- ConfigQuickDiskMenuSub(0);
-#endif
-#if defined(USE_QD2)
- ConfigQuickDiskMenuSub(1);
-#endif
-}
-QT_END_NAMESPACE
--- /dev/null
+/*
+ * Menu_QDClass : Defines
+ * (C) 2015 by K.Ohta <whatisthis.sowhat _at_ gmail.com>
+ * Please use this file as templete.
+ */
+
+
+#ifndef _CSP_QT_MENU_QD_CLASSES_H
+#define _CSP_QT_MENU_QD_CLASSES_H
+
+#include "menu_metaclass.h"
+
+QT_BEGIN_NAMESPACE
+
+class Menu_QDClass: public Menu_MetaClass {
+ Q_OBJECT
+protected:
+public:
+ Menu_QDClass(EMU *ep, QMenuBar *root_entry, QString desc, QWidget *parent = 0, int drv = 0);
+ ~Menu_QDClass();
+ void create_pulldown_menu_device_sub();
+ void connect_menu_device_sub(void);
+ void retranslate_pulldown_menu_device_sub(void);
+};
+
+QT_END_NAMESPACE
+
+#endif
#include "emu.h"
#include "agar_logger.h"
-QT_BEGIN_NAMESPACE
+#include "menu_binary.h"
+
+#ifdef USE_BINARY_FILE1
+void Object_Menu_Control::on_recent_binary_load(void){
+ // write_protect = false; // Right? On D88, May be writing entry exists.
+ emit set_recent_binary_load(drive, s_num);
+}
+void Object_Menu_Control::on_recent_binary_save(void){
+ // write_protect = false; // Right? On D88, May be writing entry exists.
+ emit set_recent_binary_save(drive, s_num);
+}
+
+void Object_Menu_Control::_open_binary(QString s){
+ bool load = this->isPlay();
+ int d = this->getDrive();
+ emit sig_open_binary_file(d, s, load);
+}
+void Object_Menu_Control::insert_binary_load(void) {
+ emit sig_open_binary(getDrive(), true);
+}
+void Object_Menu_Control::insert_binary_save(void) {
+ emit sig_open_binary(getDrive(), false);
+}
+#endif
#if defined(USE_BINARY_FILE1)
int Ui_MainWindow::set_recent_binary_load(int drv, int num)
s_path = QString::fromUtf8(config.recent_binary_path[drv][num]);
strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
- UPDATE_HISTORY(path_shadow, config.recent_binary_path[drv]);
+ UPDATE_HISTORY(path_shadow, config.recent_binary_path[drv], listBINs[drv]);
strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
get_parent_dir(path_shadow);
//strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
emit sig_load_binary(drv, s_path);
- for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_BIN[drv][i] != NULL) {
- action_Recent_List_BIN[drv][i]->setText(QString::fromUtf8(config.recent_binary_path[drv][i]));
- }
- }
+ menu_BINs[drv]->do_update_histories(listBINs[drv]);
+ menu_BINs[drv]->do_set_initialize_directory(config.initial_binary_dir);
return 0;
}
s_path = QString::fromUtf8(config.recent_binary_path[drv][num]);
strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
- UPDATE_HISTORY(path_shadow, config.recent_binary_path[drv]);
+ UPDATE_HISTORY(path_shadow, config.recent_binary_path[drv], listBINs[drv]);
strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
get_parent_dir(path_shadow);
//strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
emit sig_save_binary(drv, s_path);
- for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_BIN[drv][i] != NULL) {
- action_Recent_List_BIN[drv][i]->setText(QString::fromUtf8(config.recent_binary_path[drv][i]));
- //actiont_Recent_List_FD[drv][i]->changed();
- }
- }
+ menu_BINs[drv]->do_update_histories(listBINs[drv]);
+ menu_BINs[drv]->do_set_initialize_directory(config.initial_binary_dir);
return 0;
}
-void Ui_MainWindow::_open_binary(int drv, const QString fname, bool load)
+void Ui_MainWindow::_open_binary_load(int drv, const QString fname)
+{
+ char path_shadow[PATH_MAX];
+ int i;
+ if(fname.length() <= 0) return;
+ drv = drv & 7;
+ strncpy(path_shadow, fname.toUtf8().constData(), PATH_MAX);
+ UPDATE_HISTORY(path_shadow, config.recent_binary_path[drv], listBINs[drv]);
+ get_parent_dir(path_shadow);
+ strcpy(config.initial_binary_dir, path_shadow);
+ // Update List
+ emit sig_load_binary(drv, fname);
+
+ menu_BINs[drv]->do_update_histories(listBINs[drv]);
+ menu_BINs[drv]->do_set_initialize_directory(config.initial_binary_dir);
+}
+
+void Ui_MainWindow::_open_binary_save(int drv, const QString fname)
{
char path_shadow[PATH_MAX];
int i;
if(fname.length() <= 0) return;
drv = drv & 7;
strncpy(path_shadow, fname.toUtf8().constData(), PATH_MAX);
- UPDATE_HISTORY(path_shadow, config.recent_binary_path[drv]);
+ UPDATE_HISTORY(path_shadow, config.recent_binary_path[drv], listBINs[drv]);
get_parent_dir(path_shadow);
strcpy(config.initial_binary_dir, path_shadow);
// Update List
- if(load) {
- emit sig_load_binary(drv, fname);
- } else {
- emit sig_save_binary(drv, fname);
- }
- for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_BIN[drv][i] != NULL) {
- action_Recent_List_BIN[drv][i]->setText(QString::fromUtf8(config.recent_binary_path[drv][i]));
- }
- }
+ emit sig_save_binary(drv, fname);
+
+ menu_BINs[drv]->do_update_histories(listBINs[drv]);
+ menu_BINs[drv]->do_set_initialize_directory(config.initial_binary_dir);
}
#endif
+#if defined(USE_BINARY_FILE1)
+
+void Ui_MainWindow::open_binary_dialog(int drive, bool load)
+{
+ return;
+}
-QT_END_NAMESPACE
+void Ui_MainWindow::CreateBinaryMenu(int drv, int drv_base)
+{
+ QString drv_base_name = QString::number(drv_base);
+ QString ext, desc1;
+# if defined(_TK80BS) || defined(_TK80)
+ ext = "*.ram *.bin *.tk8";
+# else
+ ext = "*.ram *.bin";
+# endif
+# if defined(_PASOPIA) || defined(PASOPIA7)
+ desc1 = "RAM Pack Cartridge";
+# else
+ desc1 = "Memory Dump";
+# endif
+ menu_BINs[drv] = new Menu_BinaryClass(emu, menubar, QString::fromUtf8("Obj_Binary"), this, drv);
+ menu_BINs[drv]->create_pulldown_menu();
+
+ menu_BINs[drv]->do_clear_inner_media();
+ menu_BINs[drv]->do_add_media_extension(ext, desc1);
+ SETUP_HISTORY(config.recent_binary_path[drv], listBINs[drv]);
+ menu_BINs[drv]->do_update_histories(listBINs[drv]);
+ menu_BINs[drv]->do_set_initialize_directory(config.initial_binary_dir);
+ listBINs[drv].clear();
+
+ QString name = QString::fromUtf8("Binary");
+ QString tmpv;
+ tmpv.setNum(drv_base);
+ name.append(tmpv);
+ menu_BINs[drv]->setTitle(name);
+
+}
+
+void Ui_MainWindow::CreateBinaryPulldownMenu(int drv)
+{
+}
+
+void Ui_MainWindow::ConfigBinaryMenuSub(int drv)
+{
+ // Translate Menu
+}
+#endif
+
+void Ui_MainWindow::retranslateBinaryMenu(int drv, int basedrv)
+{
+#if defined(USE_BINARY_FILE1)
+ QString drive_name = (QApplication::translate("MainWindow", "Binary", 0));
+ drive_name += QString::number(basedrv);
+
+ if((drv < 0) || (drv >= 8)) return;
+ menu_BINs[drv]->setTitle(QApplication::translate("MainWindow", drive_name.toUtf8().constData() , 0));
+ menu_BINs[drv]->retranslateUi();
+#endif
+}
+
+void Ui_MainWindow::ConfigBinaryMenu(void)
+{
+
+#if defined(USE_BINARY_FILE1)
+ ConfigBinaryMenuSub(0);
+#endif
+#if defined(USE_BINARY_FILE2)
+ ConfigBinaryMenuSub(1);
+#endif
+}
#include "mainwidget.h"
#include "commonclasses.h"
-//#include "menuclasses.h"
+#include "menu_cart.h"
#include "emu_utils.h"
#include "qt_dialogs.h"
#include "emu.h"
#include "agar_logger.h"
-QT_BEGIN_NAMESPACE
+
+#ifdef USE_CART1
+void Object_Menu_Control::insert_cart(void) {
+ emit sig_insert_cart(getDrive());
+}
+void Object_Menu_Control::eject_cart(void) {
+ write_protect = false;
+ emit sig_eject_cart(getDrive());
+}
+void Object_Menu_Control::on_recent_cart(void){
+ emit set_recent_cart(drive, s_num);
+}
+#endif
void Ui_MainWindow::_open_cart(int drv, const QString fname)
{
#ifdef USE_CART1
if(fname.length() <= 0) return;
strncpy(path_shadow, fname.toUtf8().constData(), PATH_MAX);
- UPDATE_HISTORY(path_shadow, config.recent_cart_path[drv]);
+ UPDATE_HISTORY(path_shadow, config.recent_cart_path[drv], listCARTs[drv]);
get_parent_dir(path_shadow);
strcpy(config.initial_cart_dir, path_shadow);
+ menu_Cart[drv]->do_update_histories(listCARTs[drv]);
+ menu_Cart[drv]->do_set_initialize_directory(config.initial_cart_dir);
- //strncpy(path_shadow, fname.toUtf8().constData(), PATH_MAX);
- for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_CART[drv][i] != NULL) {
- action_Recent_List_CART[drv][i]->setText(QString::fromUtf8(config.recent_cart_path[drv][i]));
- //actiont_Recent_List_FD[drv][i]->changed();
- }
- }
-
emit sig_close_cart(drv);
emit sig_open_cart(drv, fname);
#endif
s_path = QString::fromUtf8(config.recent_cart_path[drv][num]);
strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
- UPDATE_HISTORY(path_shadow, config.recent_cart_path[drv]);
+ UPDATE_HISTORY(path_shadow, config.recent_cart_path[drv], listCARTs[drv]);
strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
get_parent_dir(path_shadow);
strcpy(config.initial_cart_dir, path_shadow);
- //strncpy(path_shadow, s_path.toUtf8().constData(), PATH_MAX);
+ menu_Cart[drv]->do_update_histories(listCARTs[drv]);
+ menu_Cart[drv]->do_set_initialize_directory(config.initial_cart_dir);
eject_cart(drv);
emit sig_open_cart(drv, s_path);
- for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_CART[drv][i] != NULL) {
- action_Recent_List_CART[drv][i]->setText(QString::fromUtf8(config.recent_cart_path[drv][i]));
- //actiont_Recent_List_FD[drv][i]->changed();
- }
- }
}
#endif
+void Ui_MainWindow::CreateCartMenu(int drv, int drv_base)
+{
+#ifdef USE_CART1
+ QString ext;
+ QString desc;
+
+ QString drv_base_name = QString::number(drv_base);
+
+#if defined(_GAMEGEAR)
+ ext = "*.rom *.bin *.gg *.col";
+ desc = "Game Cartridge";
+#elif defined(_MASTERSYSTEM)
+ ext = "*.rom *.bin *.sms";
+ desc = "Game Cartridge";
+#elif defined(_PC6001) || defined(_PC6001MK2) || defined(_PC6001MK2SR) || defined(_PC6601) || defined(_PC6601SR)
+ ext = "*.rom *.bin *.60";
+ desc = "Game Cartridge";
+#elif defined(_PCENGINE) || defined(_X1TWIN)
+ ext = "*.rom *.bin *.pce";
+ desc = "HuCARD";
+#elif defined(_Z80TVGAME)
+ ext = "*.rom *.bin *.hex";
+ desc = "GameData";
+#else
+ ext = "*.rom *.bin";
+ desc = "Game Cartridge";
+#endif
+
+ menu_Cart[drv] = new Menu_CartClass(emu, menubar, QString::fromUtf8("Obj_Cart"), this, drv);
+ menu_Cart[drv]->create_pulldown_menu();
+
+ menu_Cart[drv]->do_clear_inner_media();
+ menu_Cart[drv]->do_add_media_extension(ext, desc);
+ SETUP_HISTORY(config.recent_cart_path[drv], listCARTs[drv]);
+ menu_Cart[drv]->do_update_histories(listCARTs[drv]);
+ menu_Cart[drv]->do_set_initialize_directory(config.initial_disk_dir);
+
+ QString name = QString::fromUtf8("Cart");
+ QString tmpv;
+ tmpv.setNum(drv_base);
+ name.append(tmpv);
+ menu_Cart[drv]->setTitle(name);
+#endif
+}
+
+void Ui_MainWindow::CreateCartPulldownMenu(int drv)
+{
+}
+
+void Ui_MainWindow::ConfigCartMenuSub(int drv)
+{
+}
+
+void Ui_MainWindow::retranslateCartMenu(int drv, int basedrv)
+{
+#ifdef USE_CART1
+ menu_Cart[drv]->retranslateUi();
+#endif
+}
+
+void Ui_MainWindow::ConfigCartMenu(void)
+{
+#if defined(USE_CART1)
+ ConfigCartMenuSub(0);
+#endif
+#if defined(USE_CART2)
+ ConfigCartMenuSub(1);
+#endif
+}
void Ui_MainWindow::CreateCMTMenu(void)
{
#if defined(USE_TAPE)
+ QString ext_play;
+ QString ext_rec;
+ QString desc_play;
+ QString desc_rec;
+
listCMT.clear();
- //CreateCMTPulldownMenu(p);
+ menu_CMT = new Menu_CMTClass(emu, menubar, "Object_CMT_Menu", this, 0);
+ menu_CMT->setObjectName(QString::fromUtf8("menuCMT", -1));
+
+ menu_CMT->create_pulldown_menu();
+ // Translate Menu
+ SETUP_HISTORY(config.recent_tape_path, listCMT);
+ menu_CMT->do_set_write_protect(false);
+ menu_CMT->do_update_histories(listCMT);
+ menu_CMT->do_set_initialize_directory(config.initial_tape_dir);
+
+#if defined(_PC6001) || defined(_PC6001MK2) || defined(_PC6001MK2SR) || defined(_PC6601) || defined(_PC6601SR)
+ ext_play = "*.wav *.p6 *.cas";
+ ext_rec = "*.wav *.p6 *.cas";
+#elif defined(_PC8001SR) || defined(_PC8801MA) || defined(_PC98DO)
+ ext_play = "*.cas *.cmt *.n80 *.t88";
+ ext_rec = "*.cas *.cmt";
+#elif defined(_MZ80A) || defined(_MZ80K) || defined(_MZ1200) || defined(_MZ700) || defined(_MZ800) || defined(_MZ1500)
+ ext_play = "*.wav *.cas *.mzt *.m12 *.t77";
+ ext_rec = "*.wav *.cas";
+#elif defined(_MZ80B) || defined(_MZ2000) || defined(_MZ2200)
+ ext_play = "*.wav *.cas *.mzt *.mti *.mtw *.dat";
+ ext_rec = "*.wav *.cas";
+#elif defined(_X1) || defined(_X1TWIN) || defined(_X1TURBO) || defined(_X1TURBOZ)
+ ext_play = "*.wav *.cas *.tap *.t77";
+ ext_rec = "*.wav *.cas";
+#elif defined(_FM8) || defined(_FM7) || defined(_FMNEW7) || defined(_FM77_VARIANTS) || defined(_FM77AV_VARIANTS)
+ ext_play = "*.wav *.t77";
+ ext_rec = "*.wav *.t77";
+#elif defined(TAPE_BINARY_ONLY)
+ ext_play = "*.cas *.cmt";
+ ext_rec = "*.cas *.cmt";
+#else
+ ext_play = "*.wav *.cas";
+ ext_rec = "*.wav *.cas";
+#endif
+ desc_play = "Data Recorder Tape [Play]";
+ desc_rec = "Data Recorder Tape [Rec]";
+
+ menu_CMT->do_add_media_extension(ext_play, desc_play);
+ menu_CMT->do_add_rec_media_extension(ext_rec, desc_rec);
#endif // USE_TAPE
}
void Ui_MainWindow::ConfigCMTMenuSub(void)
{
-#if defined(USE_TAPE)
- QString ext_play;
- QString ext_rec;
- QString desc_play;
- QString desc_rec;
-
- menu_CMT = new Menu_CMTClass(emu, menubar, "Object_CMT_Menu", this, 0);
- menu_CMT->setObjectName(QString::fromUtf8("menuCMT", -1));
-
- menu_CMT->create_pulldown_menu();
- // Translate Menu
- SETUP_HISTORY(config.recent_tape_path, listCMT);
- menu_CMT->do_set_write_protect(false);
- menu_CMT->do_update_histories(listCMT);
- menu_CMT->do_set_initialize_directory(config.initial_tape_dir);
-
-#if defined(_PC6001) || defined(_PC6001MK2) || defined(_PC6001MK2SR) || defined(_PC6601) || defined(_PC6601SR)
- ext_play = "*.wav *.p6 *.cas";
- ext_rec = "*.wav *.p6 *.cas";
-#elif defined(_PC8001SR) || defined(_PC8801MA) || defined(_PC98DO)
- ext_play = "*.cas *.cmt *.n80 *.t88";
- ext_rec = "*.cas *.cmt";
-#elif defined(_MZ80A) || defined(_MZ80K) || defined(_MZ1200) || defined(_MZ700) || defined(_MZ800) || defined(_MZ1500)
- ext_play = "*.wav *.cas *.mzt *.m12 *.t77";
- ext_rec = "*.wav *.cas";
-#elif defined(_MZ80B) || defined(_MZ2000) || defined(_MZ2200)
- ext_play = "*.wav *.cas *.mzt *.mti *.mtw *.dat";
- ext_rec = "*.wav *.cas";
-#elif defined(_X1) || defined(_X1TWIN) || defined(_X1TURBO) || defined(_X1TURBOZ)
- ext_play = "*.wav *.cas *.tap *.t77";
- ext_rec = "*.wav *.cas";
-#elif defined(_FM8) || defined(_FM7) || defined(_FMNEW7) || defined(_FM77_VARIANTS) || defined(_FM77AV_VARIANTS)
- ext_play = "*.wav *.t77";
- ext_rec = "*.wav *.t77";
-#elif defined(TAPE_BINARY_ONLY)
- ext_play = "*.cas *.cmt";
- ext_rec = "*.cas *.cmt";
-#else
- ext_play = "*.wav *.cas";
- ext_rec = "*.wav *.cas";
-#endif
- desc_play = "Data Recorder Tape [Play]";
- desc_rec = "Data Recorder Tape [Rec]";
-
- menu_CMT->do_add_media_extension(ext_play, desc_play);
- menu_CMT->do_add_rec_media_extension(ext_rec, desc_rec);
-#endif // USE_TAPE
}
void Ui_MainWindow::do_open_read_cmt(int dummy, QString path)
void Ui_MainWindow::ConfigFloppyMenuSub(int drv)
{
-#if defined(USE_FD1)
-// {
-// QString ext = "*.d88 *.d77 *.1dd *.td0 *.imd *.dsk *.fdi *.hdm *.tfd *.xdf *.2d *.sf7 *.img *.ima *.vfd";
-// QString desc1 = "Floppy Disk";
-// menu_fds[drv] = new Menu_FDClass(emu, menubar, QString::fromUtf8("Floppy"), this, drv);
-// menu_fds[drv]->create_pulldown_menu();
-//
-// menu_fds[drv]->do_clear_inner_media();
-// menu_fds[drv]->do_add_media_extension(ext, desc1);
-// SETUP_HISTORY(config.recent_disk_path[drv], listFDs[drv]);
-// menu_fds[drv]->do_update_histories(listFDs[drv]);
-// menu_fds[drv]->do_set_initialize_directory(config.initial_disk_dir);
-// listD88[drv].clear();
-// }
-#endif
}
void Ui_MainWindow::retranslateFloppyMenu(int drv, int basedrv)
#include "qt_dialogs.h"
#include "emu.h"
#include "agar_logger.h"
+#include "menu_quickdisk.h"
+
+#if defined(USE_QD1) || defined(USE_QD2)
+void Object_Menu_Control::insert_Qd(void) {
+ //write_protect = false; // Right? On D88, May be writing entry exists.
+ emit sig_insert_Qd(drive);
+}
+void Object_Menu_Control::eject_Qd(void) {
+ write_protect = false;
+ emit sig_eject_Qd(drive);
+}
+void Object_Menu_Control::on_recent_quick_disk(void){
+ // write_protect = false; // Right? On D88, May be writing entry exists.
+ emit set_recent_quick_disk(drive, s_num);
+}
+void CSP_FileParams::_open_quick_disk(QString s){
+ // write_protect = false; // Right? On D88, May be writing entry exists.
+ emit do_open_quick_disk(getDrive(), s);
+}
+void Object_Menu_Control::write_protect_Qd(void) {
+ write_protect = true;
+ emit sig_write_protect_Qd(drive, write_protect);
+}
+void Object_Menu_Control::no_write_protect_Qd(void) {
+ write_protect = false;
+ emit sig_write_protect_Qd(drive, write_protect);
+}
+#endif
+
+
+void Ui_MainWindow::CreateQuickDiskPulldownMenu(int drv)
+{
+}
+
+void Ui_MainWindow::ConfigQuickDiskMenuSub(int drv)
+{
+}
+
+
+// Common Routine
+void Ui_MainWindow::open_quick_disk_dialog(int drv)
+{
+#ifdef USE_QD1
+ QString ext = "*.mzt *.q20 *.qdf";
+ QString desc1 = "Quick DIsk";
+ QString desc2;
+ CSP_DiskDialog dlg;
+ QString dirname;
+
+ dlg.setWindowTitle("Open Quick Disk");
+
+ desc2 = desc1 + " (" + ext.toLower() + " " + ext.toUpper() + ")";
+ //desc2 = desc1 + " (" + ext.toLower() + ")";
+ //desc1 = desc1 + " (" + ext.toUpper() + ")";
+ if(config.initial_disk_dir != NULL) {
+ dirname = config.initial_quickdisk_dir;
+ } else {
+ char app[_MAX_PATH];
+ QDir df;
+ dirname = df.currentPath();
+ strncpy(app, dirname.toUtf8().constData(), _MAX_PATH);
+ dirname = get_parent_dir(app);
+ }
+ QStringList filter;
+ filter << desc2;
+
+ dlg.param->setDrive(drv);
+ dlg.setDirectory(dirname);
+ dlg.setNameFilters(filter);
+ QObject::connect(&dlg, SIGNAL(fileSelected(QString)),
+ dlg.param, SLOT(_open_quick_disk(QString)));
+ QObject::connect(dlg.param, SIGNAL(do_open_quick_disk(int, QString)),
+ this, SLOT(_open_quick_disk(int, QString)));
+ dlg.show();
+ dlg.exec();
+ return;
+#endif
+}
int Ui_MainWindow::write_protect_Qd(int drv, bool flag)
{
#ifdef USE_QD1
if((drv < 0) || (drv >= MAX_QD)) return -1;
emit sig_write_protect_quickdisk(drv, flag);
- //if(emu) {
- // emu->write_protect_Qd(drv, flag);
- //}
#endif
return 0;
}
if((num < 0) || (num >= MAX_HISTORY)) return -1;
s_path = QString::fromUtf8(config.recent_quickdisk_path[drv][num]);
strncpy(path_shadow, s_path.toUtf8().constData(), _MAX_PATH);
- UPDATE_HISTORY(path_shadow, config.recent_quickdisk_path[drv]);
+ UPDATE_HISTORY(path_shadow, config.recent_quickdisk_path[drv], listQDs[drv]);
strncpy(path_shadow, s_path.toUtf8().constData(), _MAX_PATH);
get_parent_dir(path_shadow);
emit sig_close_quickdisk(drv);
emit sig_open_quickdisk(drv, s_path);
- //if(emu->is_write_protected_Qd(drive)) {
- // actionProtection_ON_QD[drive]->setChecked(true);
- // } else {
- actionProtection_OFF_QD[drv]->setChecked(true);
-
- for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_QD[drv][i] != NULL) {
- action_Recent_List_QD[drv][i]->setText(QString::fromUtf8(config.recent_quickdisk_path[drv][i]));
- }
- }
+ menu_QDs[drv]->do_update_histories(listQDs[drv]);
+ menu_QDs[drv]->do_set_initialize_directory(config.initial_quickdisk_dir);
+ //if(emu->get_quickdisk_protected(drv)) {
+ // menu_QDs[drv]->do_write_protect_media();
+ //} else {
+ // menu_QDs[drv]->do_write_unprotect_media();
+ //}
#endif
return 0;
}
if(fname.length() <= 0) return;
strncpy(path_shadow, s_name.toUtf8().constData(), _MAX_PATH);
- for(i = MAX_HISTORY - 1; i > 0; i--) {
- strncpy(config.recent_quickdisk_path[drv][i], config.recent_quickdisk_path[drv][i -1], _MAX_PATH);
- }
- strncpy(config.recent_quickdisk_path[drv][0], path_shadow, _MAX_PATH);
-
+ UPDATE_HISTORY(path_shadow, config.recent_quickdisk_path[drv], listQDs[drv]);
+
strncpy(path_shadow, s_name.toUtf8().constData(), _MAX_PATH);
get_parent_dir(path_shadow);
strncpy(config.initial_quickdisk_dir, path_shadow, _MAX_PATH);
emit sig_close_quickdisk(drv);
emit sig_open_quickdisk(drv, s_name);
-
- // Update List
- for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_QD[drv][i] != NULL) {
- action_Recent_List_QD[drv][i]->setText(QString::fromUtf8(config.recent_quickdisk_path[drv][i]));
- }
- }
- // if(emu->is_write_protected_Qd(drv)) {
- // actionProtection_ON_QD[drv]->setChecked(true);
- // } else {
- actionProtection_OFF_QD[drv]->setChecked(true);
- // }
+ menu_QDs[drv]->do_update_histories(listQDs[drv]);
+ menu_QDs[drv]->do_set_initialize_directory(config.initial_quickdisk_dir);
+ //if(emu->get_quickdisk_protected(drv)) {
+ // menu_QDs[drv]->do_write_protect_media();
+ //} else {
+ // menu_QDs[drv]->do_write_unprotect_media();
+ //}
#endif
}
-
-
void Ui_MainWindow::eject_Qd(int drv)
{
#ifdef USE_QD1
#endif
}
+void Ui_MainWindow::CreateQuickDiskMenu(int drv, int drv_base)
+{
+#ifdef USE_QD1
+ {
+ QString ext = "*.mzt *.q20 *.qdf";
+ QString desc1 = "Quick DIsk";
+ menu_QDs[drv] = new Menu_QDClass(emu, menubar, QString::fromUtf8("Obj_QuickDisk"), this, drv);
+ menu_QDs[drv]->create_pulldown_menu();
+
+ menu_QDs[drv]->do_clear_inner_media();
+ menu_QDs[drv]->do_add_media_extension(ext, desc1);
+ SETUP_HISTORY(config.recent_quickdisk_path[drv], listQDs[drv]);
+ menu_QDs[drv]->do_update_histories(listQDs[drv]);
+ menu_QDs[drv]->do_set_initialize_directory(config.initial_disk_dir);
+
+ QString name = QString::fromUtf8("Quick Disk");
+ QString tmpv;
+ tmpv.setNum(drv_base);
+ name.append(tmpv);
+ menu_QDs[drv]->setTitle(name);
+ }
+#endif
+}
+
+void Ui_MainWindow::retranslateQuickDiskMenu(int drv, int basedrv)
+{
+#ifdef USE_QD1
+ if((drv < 0) || (drv >= 2)) return;
+ QString drive_name = (QApplication::translate("MainWindow", "Quick Disk ", 0));
+ drive_name += QString::number(basedrv);
+
+ menu_QDs[drv]->retranslateUi();
+ menu_QDs[drv]->setTitle(QApplication::translate("MainWindow", drive_name.toUtf8().constData() , 0));
+#endif
+}
+
+void Ui_MainWindow::ConfigQuickDiskMenu(void)
+{
+#if defined(USE_QD1)
+ ConfigQuickDiskMenuSub(0);
+#endif
+#if defined(USE_QD2)
+ ConfigQuickDiskMenuSub(1);
+#endif
+}
#include "emu.h"
#include "qt_main.h"
-//QT_BEGIN_NAMESPACE
-
-
-
void META_MainWindow::setupUI_Emu(void)
{
- menuMachine->setVisible(false);
+ menuMachine->setVisible(false);
}
void META_MainWindow::retranslateUi(void)
{
- retranslateControlMenu("Reset", true);
- retranslateFloppyMenu(0, 1);
- retranslateFloppyMenu(1, 2);
- retranslateFloppyMenu(2, 3);
- retranslateFloppyMenu(3, 4);
+ retranslateControlMenu("Reset", true);
+ retranslateFloppyMenu(0, 1);
+ retranslateFloppyMenu(1, 2);
+ retranslateFloppyMenu(2, 3);
+ retranslateFloppyMenu(3, 4);
#if defined(USE_QD1)
- retranslateQuickDiskMenu(0,0);
+ retranslateQuickDiskMenu(0,0);
#endif
- retranslateCMTMenu();
- retranslateSoundMenu();
- retranslateScreenMenu();
+ retranslateCMTMenu();
+ retranslateSoundMenu();
+ retranslateScreenMenu();
retranslateUI_Help();
- this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
-
- actionReset->setText(QApplication::translate("MainWindow", "IPL Reset", 0));
- actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
-
- actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
-
-
- // actionStart_Record_Movie->setText(QApplication::translate("MainWindow", "Start Record Movie", 0));
- // actionStop_Record_Movie->setText(QApplication::translate("MainWindow", "Stop Record Movie", 0));
-
- menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0));
- menuStretch_Mode->setTitle(QApplication::translate("MainWindow", "Stretch Mode", 0));
+ this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
+
+ actionReset->setText(QApplication::translate("MainWindow", "IPL Reset", 0));
+ actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
+ actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
+
+ // actionStart_Record_Movie->setText(QApplication::translate("MainWindow", "Start Record Movie", 0));
+ // actionStop_Record_Movie->setText(QApplication::translate("MainWindow", "Stop Record Movie", 0));
+ menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0));
+ menuStretch_Mode->setTitle(QApplication::translate("MainWindow", "Stretch Mode", 0));
// menuRecord->setTitle(QApplication::translate("MainWindow", "Record", 0));
// menuRecoad_as_movie->setTitle(QApplication::translate("MainWindow", "Recoad as movie", 0));
- menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
-
- menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
+ menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
+
+ menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
actionHelp_AboutQt->setText(QApplication::translate("MainWindow", "About Qt", 0));
- // Set Labels
+ // Set Labels
} // retranslateUi
META_MainWindow::META_MainWindow(QWidget *parent) : Ui_MainWindow(parent)
{
- setupUI_Emu();
- retranslateUi();
+ setupUI_Emu();
+ retranslateUi();
}
Action_Control_MZ700::Action_Control_MZ700(QObject *parent) : Action_Control(parent)
{
- mz_binds = new Object_Menu_Control_MZ700(parent);
+ mz_binds = new Object_Menu_Control_MZ700(parent);
}
Action_Control_MZ700::~Action_Control_MZ700(){
- delete mz_binds;
+ delete mz_binds;
}
Object_Menu_Control_MZ700::Object_Menu_Control_MZ700(QObject *parent) : Object_Menu_Control(parent)
void Object_Menu_Control_MZ700::do_monitor_type(void)
{
- emit sig_monitor_type(getValue1());
+ emit sig_monitor_type(getValue1());
}
void META_MainWindow::set_monitor_type(int num)
{
#ifdef USE_MONITOR_TYPE
- if((num < 0) || (num >= USE_MONITOR_TYPE)) return;
- if(emu) {
- config.monitor_type = num;
- emu->LockVM();
- emu->update_config();
- emu->UnlockVM();
- }
+ if((num < 0) || (num >= USE_MONITOR_TYPE)) return;
+ if(emu) {
+ config.monitor_type = num;
+ emu->LockVM();
+ emu->update_config();
+ emu->UnlockVM();
+ }
#endif
}
if(config.monitor_type == ii) actionMonitorType[ii]->setChecked(true);
menuMonitorType->addAction(actionMonitorType[ii]);
connect(actionMonitorType[ii], SIGNAL(triggered()),
- actionMonitorType[ii]->mz_binds, SLOT(do_monitor_type()));
+ actionMonitorType[ii]->mz_binds, SLOT(do_monitor_type()));
connect(actionMonitorType[ii]->mz_binds, SIGNAL(sig_monitor_type(int)),
- this, SLOT(set_monitor_type(int)));
+ this, SLOT(set_monitor_type(int)));
}
}
#endif
void META_MainWindow::retranslateUi(void)
{
- retranslateControlMenu(" ", true);
- retranslateFloppyMenu(0, 0);
- retranslateFloppyMenu(1, 1);
- retranslateQuickDiskMenu(0, 0);
- retranslateCMTMenu();
- retranslateSoundMenu();
- retranslateScreenMenu();
+ retranslateControlMenu(" ", true);
+ retranslateFloppyMenu(0, 0);
+ retranslateFloppyMenu(1, 1);
+ retranslateQuickDiskMenu(0, 0);
+ retranslateCMTMenu();
+ retranslateSoundMenu();
+ retranslateScreenMenu();
retranslateUI_Help();
-
- this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
-
-
- actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
+
+ this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
+ actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
- actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
+ actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
-
- // actionStart_Record_Movie->setText(QApplication::translate("MainWindow", "Start Record Movie", 0));
- // actionStop_Record_Movie->setText(QApplication::translate("MainWindow", "Stop Record Movie", 0));
-
-#if defined(USE_QD1)
- menuQD[0]->setTitle(QApplication::translate("MainWindow", "QD1", 0));
- menuWrite_Protection_QD[0]->setTitle(QApplication::translate("MainWindow", "Write Protection", 0));
-#endif
-#if defined(USE_QD2)
- menuQD[1]->setTitle(QApplication::translate("MainWindow", "QD2", 0));
- menuWrite_Protection_QD[1]->setTitle(QApplication::translate("MainWindow", "Write Protection", 0));
-#endif
#if defined(_MZ800)
menuBootMode->setTitle("BOOT Mode");
actionBootMode[0]->setText(QString::fromUtf8("MZ-800"));
actionMonitorType[0]->setText(QApplication::translate("MainWindow", "Color", 0));
actionMonitorType[1]->setText(QApplication::translate("MainWindow", "Monochrome", 0));
menuMachine->setTitle(QApplication::translate("MainWindow", "Machine", 0));;
-
+
#endif
menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0));
menuStretch_Mode->setTitle(QApplication::translate("MainWindow", "Stretch Mode", 0));
-
-// menuRecord->setTitle(QApplication::translate("MainWindow", "Record", 0));
-// menuRecoad_as_movie->setTitle(QApplication::translate("MainWindow", "Recoad as movie", 0));
-
- menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
+ menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
- menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
+ menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
actionHelp_AboutQt->setText(QApplication::translate("MainWindow", "About Qt", 0));
- // Set Labels
+ // Set Labels
} // retranslateUi
META_MainWindow::META_MainWindow(QWidget *parent) : Ui_MainWindow(parent)
{
- setupUI_Emu();
- retranslateUi();
+ setupUI_Emu();
+ retranslateUi();
}
#include "emu.h"
#include "qt_main.h"
-//QT_BEGIN_NAMESPACE
-
-
-
-
-
-
void META_MainWindow::setupUI_Emu(void)
{
- menuMachine->setVisible(false);
+ menuMachine->setVisible(false);
}
void META_MainWindow::retranslateUi(void)
{
- retranslateControlMenu(" ", true);
- retranslateFloppyMenu(0, 1);
- retranslateFloppyMenu(1, 2);
- retranslateFloppyMenu(2, 3);
- retranslateFloppyMenu(3, 4);
- retranslateCMTMenu();
- retranslateSoundMenu();
- retranslateScreenMenu();
+ retranslateControlMenu(" ", true);
+ retranslateFloppyMenu(0, 1);
+ retranslateFloppyMenu(1, 2);
+ retranslateFloppyMenu(2, 3);
+ retranslateFloppyMenu(3, 4);
+ retranslateCMTMenu();
+ retranslateSoundMenu();
+ retranslateScreenMenu();
retranslateUI_Help();
-
- this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
-
- actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
-
- actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
-
-
- // actionStart_Record_Movie->setText(QApplication::translate("MainWindow", "Start Record Movie", 0));
- // actionStop_Record_Movie->setText(QApplication::translate("MainWindow", "Stop Record Movie", 0));
-
- menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0));
- menuStretch_Mode->setTitle(QApplication::translate("MainWindow", "Stretch Mode", 0));
+ this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
+
+ actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
+
+ actionAbout->setText(QApplication::translate("MainWindow", "About...", 0));
+
+ // actionStart_Record_Movie->setText(QApplication::translate("MainWindow", "Start Record Movie", 0));
+ // actionStop_Record_Movie->setText(QApplication::translate("MainWindow", "Stop Record Movie", 0));
+
+ menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0));
+ menuStretch_Mode->setTitle(QApplication::translate("MainWindow", "Stretch Mode", 0));
// menuRecord->setTitle(QApplication::translate("MainWindow", "Record", 0));
// menuRecoad_as_movie->setTitle(QApplication::translate("MainWindow", "Recoad as movie", 0));
- menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
-
- menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
+ menuEmulator->setTitle(QApplication::translate("MainWindow", "Emulator", 0));
+
+ menuHELP->setTitle(QApplication::translate("MainWindow", "HELP", 0));
actionHelp_AboutQt->setText(QApplication::translate("MainWindow", "About Qt", 0));
- // Set Labels
+ // Set Labels
} // retranslateUi
META_MainWindow::META_MainWindow(QWidget *parent) : Ui_MainWindow(parent)
{
- setupUI_Emu();
- retranslateUi();
+ setupUI_Emu();
+ retranslateUi();
}