#include "emu_utils.h"
#include "qt_dialogs.h"
#include "emu.h"
+#include "agar_logger.h"
QT_BEGIN_NAMESPACE
-void Object_Menu_Control::start_play_cmt_(void) {
- emit sig_insert_fd(false);
+void Object_Menu_Control::start_insert_play_cmt(void) {
+ printf("%d", play);
+ emit sig_insert_play_cmt(play);
}
-void Object_Menu_Control::eject_fd(void) {
- emit sig_eject_fd(drive);
+void Object_Menu_Control::eject_cmt(void) {
+ emit sig_eject_cmt();
}
-void Object_Menu_Control::on_d88_slot(void) {
- emit set_d88_slot(drive, s_num);
+void Object_Menu_Control::on_recent_cmt(){
+ emit sig_recent_cmt(s_num);
}
-void Object_Menu_Control::on_recent_disk(void){
- emit set_recent_disk(drive, s_num);
+void Object_Menu_Control::do_set_write_protect_cmt(void) {
+ write_protect = true;
+ emit sig_set_write_protect_cmt(write_protect);
}
+void Object_Menu_Control::do_unset_write_protect_cmt(void) {
+ write_protect = false;
+ emit sig_set_write_protect_cmt(write_protect);
+}
+
// Common Routine
-
-#ifdef USE_FD1
-int Ui_MainWindow::set_d88_slot(int drive, int num)
+#ifdef USE_TAPE
+void Ui_MainWindow::do_write_protect_cmt(bool flag)
{
- if((num < 0) || (num >= MAX_D88_BANKS)) return;
- if(emu && emu->d88_file[drive].cur_bank != num) {
- emu->open_disk(drive, emu->d88_file[drive].path, emu->d88_file[drive].bank[num].offset);
- emu->d88_file[drive].cur_bank = num;
- }
+ write_protect = flag;
}
-int Ui_MainWindow::set_recent_disk(int drive, int num)
+
+int Ui_MainWindow::set_recent_cmt(int num)
{
std::string path;
int i;
if((num < 0) || (num >= MAX_HISTORY)) return;
- path = config.recent_disk_path[drive][num];
+ path = config.recent_tape_path[num];
for(int i = num; i > 0; i--) {
- strcpy(config.recent_disk_path[drive][i], config.recent_disk_path[drive][i - 1]);
+ strcpy(config.recent_tape_path[i], config.recent_tape_path[i - 1]);
}
- strcpy(config.recent_disk_path[drive][0], path.c_str());
+ strcpy(config.recent_tape_path[0], path.c_str());
if(emu) {
- open_disk(drive, path.c_str(), 0);
+ AGAR_DebugLog(AGAR_LOG_DEBUG, "Tape: Open READ");
+ emu->play_tape(path.c_str()); // Play Readonly, to safety.
}
for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_FD[drive][i] != NULL) {
- action_Recent_List_FD[drive][i]->setText(config.recent_disk_path[drive][i]);
+ if(action_Recent_List_CMT[i] != NULL) {
+ action_Recent_List_CMT[i]->setText(config.recent_tape_path[i]);
//emit action_Recent_List_FD[drive][i]->changed();
}
}
ext = "*.wav;*.cas";
#endif
desc1 = play ? "Data Recorder Tape [Play]" : "Data Recorder Tape [Rec]";
+ if(play) {
+ dlg.setWindowTitle("Open Tape");
+ } else {
+ dlg.setWindowTitle("Record Tape");
+ }
desc2 = desc1 + " (" + ext.toLower() + ")";
desc1 = desc1 + " (" + ext.toUpper() + ")";
- if(config.initial_disk_dir != NULL) {
- dirname = config.initial_disk_dir;
+ if(config.initial_tape_dir != NULL) {
+ dirname = config.initial_tape_dir;
} else {
char app[PATH_MAX];
QDir df;
}
QStringList filter;
filter << desc1 << desc2;
- dlg.param->setDrive(drv);
- dlg.setDirectory(dirname);
+ dlg.param->setRecMode(play);
dlg.setNameFilters(filter);
- QObject::connect(&dlg, SIGNAL(fileSelected(QString)), this, SLOT(_start_play_cmt(QString)));
- QObject::connect(dlg.param, SIGNAL(do_open_disk(bool, QString)), this, SLOT(_open_cmt(bool, QString)));
+ QObject::connect(&dlg, SIGNAL(fileSelected(QString)), dlg.param, SLOT(_open_cmt(QString)));
+ QObject::connect(dlg.param, SIGNAL(do_open_cmt(bool, QString)), this, SLOT(_open_cmt(bool, QString)));
dlg.show();
dlg.exec();
return;
#endif
-void Ui_MainWindow::_open_disk(int drv, const QString fname)
+void Ui_MainWindow::set_wave_shaper(bool f)
{
- char path_shadow[PATH_MAX];
- int i;
-
-#ifdef USE_FD1
-
- if(fname.length() <= 0) return;
- strncpy(path_shadow, fname.toUtf8().constData(), PATH_MAX);
- UPDATE_HISTORY(path_shadow, config.recent_disk_path[drv]);
-// get_parent_dir(path_shadow);
- strcpy(config.initial_disk_dir, path_shadow);
- // Update List
- open_disk(drv, path_shadow, 0);
- if((actionGroup_D88_Image_FD[drv] != NULL) && (emu != NULL)){
- for(i = 0; i < emu->d88_file[drv].bank_num; i++) {
- if(action_D88_ListImage_FD[drv][i] != NULL) {
- action_D88_ListImage_FD[drv][i]->setText(emu->d88_file[drv].bank[i].name);
- action_D88_ListImage_FD[drv][i]->setVisible(true);
- //emit action_D88_ListImage_FD[drv][i]->changed();
- }
- }
- for(; i < MAX_D88_BANKS; i++) {
- if(action_D88_ListImage_FD[drv][i] != NULL) {
- //actionSelect_D88_Image_FD[drv][i]->setText(emu->d88_file[drv].bank[i].name);
- action_D88_ListImage_FD[drv][i]->setVisible(false);
- //emit action_D88_ListImage_FD[drv][i]->changed();
- }
- }
- actionSelect_D88_Image_FD[drv][0].setChecked(true);
- }
- for(i = 0; i < MAX_HISTORY; i++) {
- if(action_Recent_List_FD[drv][i] != NULL) {
- action_Recent_List_FD[drv][i]->setText(QString::fromUtf8(config.recent_disk_path[drv][i]));
- //actiont_Recent_List_FD[drv][i]->changed();
- }
- }
+ config.wave_shaper = f;
+}
+bool Ui_MainWindow::get_wave_shaper(void)
+{
+ if(config.wave_shaper == 0) return false;
+ return true;
+}
-#endif
+void Ui_MainWindow::set_direct_load_from_mzt(bool f)
+{
+ config.direct_load_mzt = f;
+}
+bool Ui_MainWindow::get_direct_load_mzt(void)
+{
+ if(config.direct_load_mzt == 0) return false;
+ return true;
}
-void Ui_MainWindow::_open_cart(int drv, const QString fname)
+#ifdef USE_TAPE_BUTTON
+void Ui_MainWindow::OnPushPlayButton(void)
{
- char path_shadow[PATH_MAX];
-#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]);
- get_parent_dir(path_shadow);
- strcpy(config.initial_cart_dir, path_shadow);
-
- if(emu) emu->open_cart(drv, path_shadow);
-#endif
+ if(emu) emu->push_play();
+}
+void Ui_MainWindow::OnPushStopButton(void)
+{
+ if(emu) emu->push_stop();
}
+#endif
+
void Ui_MainWindow::_open_cmt(bool mode, const QString path)
{
char path_shadow[PATH_MAX];
UPDATE_HISTORY(path_shadow, config.recent_tape_path);
get_parent_dir(path_shadow);
strcpy(config.initial_tape_dir, path_shadow);
- if(play != 0) {
+ // Copy filename again.
+ strncpy(path_shadow, path.toUtf8().constData(), PATH_MAX);
+ if((play != false) || (write_protect != false)) {
+ AGAR_DebugLog(AGAR_LOG_DEBUG, "Tape: Open READ : filename = %s", path_shadow);
emu->play_tape(path_shadow);
} else {
- emu->rec_tape(path_shadow);
+ AGAR_DebugLog(AGAR_LOG_DEBUG, "Tape: Open Write : filename = %s", path_shadow);
+ emu->rec_tape(path_shadow);
}
#endif
}
-void Ui_MainWindow::eject_fd(int drv)
+void Ui_MainWindow::eject_cmt(void)
{
- close_disk(drv);
+ if(emu) emu->close_tape();
}
-void Ui_MainWindow::CreateFloppyMenu(Ui_MainWindow *p, int drv, int drv_base)
+void Ui_MainWindow::CreateCMTMenu(Ui_MainWindow *p)
{
- QString drv_base_name = QString::number(drv_base);
- menuFD[drv] = new QMenu(menubar);
- menuFD[drv]->setObjectName(QString::fromUtf8("menuFD", -1) + drv_base_name);
- menuWrite_Protection_FD[drv] = new QMenu(menuFD[drv]);
- menuWrite_Protection_FD[drv]->setObjectName(QString::fromUtf8("menuWrite_Protection_FD", -1) + drv_base_name);
+ menuCMT = new QMenu(menubar);
+ menuCMT->setObjectName(QString::fromUtf8("menuCMT", -1));
+ menuWrite_Protection_CMT = new QMenu(menuCMT);
+ menuWrite_Protection_CMT->setObjectName(QString::fromUtf8("menuWrite_Protection_CMT", -1));
+ //CreateCMTPulldownMenu(p);
}
-void Ui_MainWindow::CreateFloppyPulldownMenu(Ui_MainWindow *p, int drv)
+void Ui_MainWindow::CreateCMTPulldownMenu(Ui_MainWindow *p)
{
- menuFD[drv]->addAction(actionInsert_FD[drv]);
- menuFD[drv]->addAction(actionEject_FD[drv]);
- menuFD[drv]->addSeparator();
- menuFD_Recent[drv] = new QMenu(menuFD[drv]);
- menuFD_Recent[drv]->setObjectName(QString::fromUtf8("Recent_FD", -1) + QString::number(drv));
- menuFD[drv]->addAction(menuFD_Recent[drv]->menuAction());
- // menuFD[drv]->addAction(actionRecent_Opened_FD[0]);
+ menuCMT->addAction(actionInsert_CMT);
+ menuCMT->addAction(actionEject_CMT);
+ menuCMT->addSeparator();
+ menuCMT->addAction(actionPlay_Start);
+ menuCMT->addAction(actionPlay_Stop);
+
+ menuCMT->addSeparator();
+ menuCMT_Recent = new QMenu(menuCMT);
+ menuCMT_Recent->setObjectName(QString::fromUtf8("Recent_CMT", -1));
+ menuCMT->addAction(menuCMT_Recent->menuAction());
+ // menuCMT->addAction(actionRecent_Opened_FD[0]);
{
int ii;
for(ii = 0; ii < MAX_HISTORY; ii++) {
- menuFD_Recent[drv]->addAction(action_Recent_List_FD[drv][ii]);
- action_Recent_List_FD[drv][ii]->setVisible(true);
+ menuCMT_Recent->addAction(action_Recent_List_CMT[ii]);
+ action_Recent_List_CMT[ii]->setVisible(true);
}
}
- menuFD[drv]->addSeparator();
- menuFD_D88[drv] = new QMenu(menuFD[drv]);
- menuFD_D88[drv]->setObjectName(QString::fromUtf8("D88_FD", -1) + QString::number(drv));
- menuFD[drv]->addAction(menuFD_D88[drv]->menuAction());
- // menuFD[drv]->addAction(actionSelect_D88_Image_FD[0]);
- {
- int ii;
- for(ii = 0; ii < MAX_D88_BANKS; ii++) {
- menuFD_D88[drv]->addAction(action_D88_ListImage_FD[drv][ii]);
- action_D88_ListImage_FD[drv][ii]->setVisible(false);
- }
-
- }
-
- menuFD[drv]->addSeparator();
- // menuFD[drv]->addAction(menuWrite_Protection_FD1->menuAction());
- menuWrite_Protection_FD[drv]->addAction(actionProtection_ON_FD[drv]);
- menuWrite_Protection_FD[drv]->addAction(actionProtection_OFF_FD[drv]);
+ menuCMT->addSeparator();
+ menuCMT->addAction(menuWrite_Protection_CMT->menuAction());
+ menuWrite_Protection_CMT->addAction(actionProtection_ON_CMT);
+ menuWrite_Protection_CMT->addAction(actionProtection_OFF_CMT);
}
-void Ui_MainWindow::ConfigFloppyMenuSub(Ui_MainWindow *p, int drv)
+void Ui_MainWindow::ConfigCMTMenuSub(Ui_MainWindow *p)
{
- QString drive_name = QString::number(drv);
- actionInsert_FD[drv] = new Action_Control(p);
- actionInsert_FD[drv]->setObjectName(QString::fromUtf8("actionInsert_FD") + drive_name);
- actionInsert_FD[drv]->binds->setDrive(0);
- actionInsert_FD[drv]->binds->setNumber(0);
+ actionInsert_CMT = new Action_Control(p);
+ actionInsert_CMT->setObjectName(QString::fromUtf8("actionInsert_CMT"));
+ actionInsert_CMT->binds->setPlay(true);
+ actionInsert_CMT->binds->setNumber(0);
- actionEject_FD[drv] = new Action_Control(p);
- actionEject_FD[drv]->setObjectName(QString::fromUtf8("actionEject_FD") + drive_name);
- actionEject_FD[drv]->binds->setDrive(0);
- actionEject_FD[drv]->binds->setNumber(0);
+ actionEject_CMT = new Action_Control(p);
+ actionEject_CMT->setObjectName(QString::fromUtf8("actionEject_CMT"));
+ actionEject_CMT->binds->setPlay(true);
+
+ actionPlay_Start = new Action_Control(p);
+ actionPlay_Start->setObjectName(QString::fromUtf8("actionPlay_Start"));
+ actionPlay_Start->binds->setPlay(true);
+
+ actionPlay_Stop = new Action_Control(p);
+ actionPlay_Stop->setObjectName(QString::fromUtf8("actionPlay_Stop"));
+ actionPlay_Stop->binds->setPlay(true);
+
+ actionRecording = new Action_Control(p);
+ actionRecording->setObjectName(QString::fromUtf8("actionRecording"));
+ actionRecording->binds->setPlay(false);
+ actionRecording->binds->setNumber(0);
- actionGroup_Opened_FD[drv] = new QActionGroup(p);
- actionRecent_Opened_FD[drv] = new Action_Control(p);
- actionRecent_Opened_FD[drv]->setObjectName(QString::fromUtf8("actionRecent_Opened_FD") + drive_name);
- actionRecent_Opened_FD[drv]->binds->setDrive(0);
- actionRecent_Opened_FD[drv]->binds->setNumber(0);
+ actionGroup_Opened_CMT = new QActionGroup(p);
+ actionRecent_Opened_CMT = new Action_Control(p);
+ actionRecent_Opened_CMT->setObjectName(QString::fromUtf8("actionRecent_Opened_CMT"));
+ actionRecent_Opened_CMT->binds->setPlay(true);
{
int ii;
- actionGroup_D88_Image_FD[drv] = new QActionGroup(p);
- actionGroup_D88_Image_FD[drv]->setExclusive(true);
+ actionGroup_Opened_CMT = new QActionGroup(p);
+ actionGroup_Opened_CMT->setExclusive(true);
- actionSelect_D88_Image_FD[drv] = new Action_Control(p);
- actionSelect_D88_Image_FD[drv]->setObjectName(QString::fromUtf8("actionSelect_D88_Image_FD") + drive_name);
- actionSelect_D88_Image_FD[drv]->binds->setDrive(0);
- actionSelect_D88_Image_FD[drv]->binds->setNumber(0);
- for(ii = 0; ii < MAX_D88_BANKS; ii++) {
- action_D88_ListImage_FD[drv][ii] = new Action_Control(p);
- action_D88_ListImage_FD[drv][ii]->binds->setDrive(0);
- action_D88_ListImage_FD[drv][ii]->binds->setNumber(ii);
- actionGroup_D88_Image_FD[drv]->addAction(action_D88_ListImage_FD[drv][ii]);
- connect(action_D88_ListImage_FD[drv][ii], SIGNAL(triggered()),
- action_D88_ListImage_FD[drv][ii]->binds, SLOT(on_d88_slot()));
- connect(action_D88_ListImage_FD[drv][ii]->binds, SIGNAL(set_d88_slot(int, int)),
- this, SLOT(set_d88_slot(int, int)));
+ actionRecent_Opened_CMT = new Action_Control(p);
+ actionRecent_Opened_CMT->setObjectName(QString::fromUtf8("actionSelect_Recent_CMT"));
+ actionRecent_Opened_CMT->binds->setPlay(true); // For safety
+ for(ii = 0; ii < MAX_HISTORY; ii++) {
+ action_Recent_List_CMT[ii] = new Action_Control(p);
+ action_Recent_List_CMT[ii]->binds->setPlay(true);
+ action_Recent_List_CMT[ii]->binds->setNumber(ii);
+ action_Recent_List_CMT[ii]->setText(QString::fromUtf8(config.recent_tape_path[ii]));
+ actionGroup_Opened_CMT->addAction(action_Recent_List_CMT[ii]);
+ connect(action_Recent_List_CMT[ii], SIGNAL(triggered()),
+ action_Recent_List_CMT[ii]->binds, SLOT(on_recent_cmt()));
+ connect(action_Recent_List_CMT[ii]->binds, SIGNAL(sig_recent_cmt(int)),
+ this, SLOT(set_recent_cmt(int)));
}
}
+
{
int ii;
- actionGroup_Opened_FD[drv] = new QActionGroup(p);
- actionGroup_Opened_FD[drv]->setExclusive(true);
+ actionProtection_ON_CMT = new Action_Control(p);
+ actionProtection_ON_CMT->setObjectName(QString::fromUtf8("actionProtection_ON_CMT"));
+ actionProtection_ON_CMT->setCheckable(true);
+ actionProtection_ON_CMT->setChecked(true);
+ actionProtection_OFF_CMT = new Action_Control(p);
+ actionProtection_OFF_CMT->setObjectName(QString::fromUtf8("actionProtection_OFF_CMT"));
+ actionProtection_OFF_CMT->setCheckable(true);
+ actionProtection_OFF_CMT->setChecked(false);
+ connect(actionProtection_OFF_CMT, SIGNAL(triggered()), actionProtection_OFF_CMT->binds, SLOT(do_unset_write_protect_cmt()));
+ connect(actionProtection_OFF_CMT->binds, SIGNAL(sig_set_write_protect_cmt(bool)), this, SLOT(do_write_protect_cmt(bool)));
+
+ connect(actionProtection_ON_CMT, SIGNAL(triggered()), actionProtection_ON_CMT->binds, SLOT(do_set_write_protect_cmt()));
+ connect(actionProtection_ON_CMT->binds, SIGNAL(sig_set_write_protect_cmt(bool)), this, SLOT(do_write_protect_cmt(bool)));
+
+ actionGroup_Protect_CMT = new QActionGroup(p);
+ //actionGroup_Protect_CMT->setExclusive(true);
+ actionGroup_Protect_CMT->addAction(actionProtection_ON_CMT);
+ actionGroup_Protect_CMT->addAction(actionProtection_OFF_CMT);
+ actionProtection_ON_CMT->setActionGroup(actionGroup_Protect_CMT);
+ actionProtection_OFF_CMT->setActionGroup(actionGroup_Protect_CMT);
- actionRecent_Opened_FD[drv] = new Action_Control(p);
- actionRecent_Opened_FD[drv]->setObjectName(QString::fromUtf8("actionSelect_Recent_FD") + drive_name);
- actionRecent_Opened_FD[drv]->binds->setDrive(0);
- actionRecent_Opened_FD[drv]->binds->setNumber(0);
- for(ii = 0; ii < MAX_HISTORY; ii++) {
- action_Recent_List_FD[drv][ii] = new Action_Control(p);
- action_Recent_List_FD[drv][ii]->binds->setDrive(0);
- action_Recent_List_FD[drv][ii]->binds->setNumber(ii);
- action_Recent_List_FD[drv][ii]->setText(QString::fromUtf8(config.recent_disk_path[drv][ii]));
- actionGroup_Opened_FD[drv]->addAction(action_Recent_List_FD[drv][ii]);
- connect(action_Recent_List_FD[drv][ii], SIGNAL(triggered()),
- action_Recent_List_FD[drv][ii]->binds, SLOT(on_recent_disk()));
- connect(action_Recent_List_FD[drv][ii]->binds, SIGNAL(set_recent_disk(int, int)),
- this, SLOT(set_recent_disk(int, int)));
- }
}
- actionProtection_ON_FD[drv] = new Action_Control(p);
- actionProtection_ON_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_ON_FD") + drive_name);
- actionProtection_ON_FD[drv]->setCheckable(true);
- actionProtection_ON_FD[drv]->setChecked(true);
- actionProtection_OFF_FD[drv] = new Action_Control(p);
- actionProtection_OFF_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_OFF_FD1") + drive_name);
- actionProtection_OFF_FD[drv]->setCheckable(true);
-
- connect(actionInsert_FD[drv], SIGNAL(triggered()), actionInsert_FD[drv]->binds, SLOT(insert_fd()));
- connect(actionInsert_FD[drv]->binds, SIGNAL(sig_insert_fd(int)), this, SLOT(open_disk_dialog(int)));
- connect(actionEject_FD[drv], SIGNAL(triggered()), actionEject_FD[drv]->binds, SLOT(eject_fd()));
- connect(actionEject_FD[drv]->binds, SIGNAL(sig_eject_fd(int)), this, SLOT(eject_fd(int)));
+ connect(actionRecording, SIGNAL(triggered()), actionRecording->binds, SLOT(start_insert_play_cmt()));
+ connect(actionRecording->binds, SIGNAL(sig_insert_play_cmt(bool)), this, SLOT(open_cmt_dialog(bool)));
+ connect(actionInsert_CMT, SIGNAL(triggered()), actionInsert_CMT->binds, SLOT(start_insert_play_cmt()));
+ connect(actionInsert_CMT->binds, SIGNAL(sig_insert_play_cmt(bool)), this, SLOT(open_cmt_dialog(bool)));
+ connect(actionEject_CMT, SIGNAL(triggered()), actionEject_CMT->binds, SLOT(eject_cmt()));
// Translate Menu
}
-void Ui_MainWindow::retranslateFloppyMenu(Ui_MainWindow *p, int drv, int basedrv)
+void Ui_MainWindow::retranslateCMTMenu(Ui_MainWindow *p)
{
- QString drive_name = (QApplication::translate("MainWindow", "Floppy ", 0, QApplication::UnicodeUTF8));
- drive_name += QString::number(basedrv);
-
- if((drv < 0) || (drv >= 8)) return;
- actionInsert_FD[drv]->setText(QApplication::translate("MainWindow", "Insert", 0, QApplication::UnicodeUTF8));
- actionEject_FD[drv]->setText(QApplication::translate("MainWindow", "Eject", 0, QApplication::UnicodeUTF8));
+ actionInsert_CMT->setText(QApplication::translate("MainWindow", "Insert", 0, QApplication::UnicodeUTF8));
+ actionEject_CMT->setText(QApplication::translate("MainWindow", "Eject", 0, QApplication::UnicodeUTF8));
- menuFD_Recent[drv]->setTitle(QApplication::translate("MainWindow", "Recent Opened", 0, QApplication::UnicodeUTF8));
- menuFD_D88[drv]->setTitle(QApplication::translate("MainWindow", "Select D88 Image", 0, QApplication::UnicodeUTF8));
+ menuCMT_Recent->setTitle(QApplication::translate("MainWindow", "Recent Opened", 0, QApplication::UnicodeUTF8));
- actionProtection_ON_FD[drv]->setText(QApplication::translate("MainWindow", "Protection ON", 0, QApplication::UnicodeUTF8));
- actionProtection_OFF_FD[drv]->setText(QApplication::translate("MainWindow", "Protection OFF", 0, QApplication::UnicodeUTF8));
+ actionProtection_ON_CMT->setText(QApplication::translate("MainWindow", "Protection ON", 0, QApplication::UnicodeUTF8));
+ actionProtection_OFF_CMT->setText(QApplication::translate("MainWindow", "Protection OFF", 0, QApplication::UnicodeUTF8));
- menuFD[drv]->setTitle(QApplication::translate("MainWindow", drive_name.toUtf8().constData() , 0, QApplication::UnicodeUTF8));
- menuWrite_Protection_FD[drv]->setTitle(QApplication::translate("MainWindow", "Write Protection", 0, QApplication::UnicodeUTF8));
+ menuCMT->setTitle(QApplication::translate("MainWindow", "Casette tape" , 0, QApplication::UnicodeUTF8));
+ menuWrite_Protection_CMT->setTitle(QApplication::translate("MainWindow", "Write Protection", 0, QApplication::UnicodeUTF8));
}
-void Ui_MainWindow::ConfigFloppyMenu(Ui_MainWindow *p)
+void Ui_MainWindow::ConfigCMTMenu(Ui_MainWindow *p)
{
-#if defined(USE_FD1)
- ConfigFloppyMenuSub(p, 0);
-#endif
-#if defined(USE_FD2)
- ConfigFloppyMenuSub(p, 1);
-#endif
-#if defined(USE_FD3)
- ConfigFloppyMenuSub(p, 2);
-#endif
-#if defined(USE_FD4)
- ConfigFloppyMenuSub(p, 3);
-#endif
-#if defined(USE_FD5)
- ConfigFloppyMenuSub(p, 4);
-#endif
-#if defined(USE_FD6)
- ConfigFloppyMenuSub(p, 5);
-#endif
-#if defined(USE_FD7)
- ConfigFloppyMenuSub(p, 6);
-#endif
-#if defined(USE_FD8)
- ConfigFloppyMenuSub(p, 7);
+#if defined(USE_TAPE)
+ write_protect = true;
+ ConfigCMTMenuSub(p);
#endif
}
QT_BEGIN_NAMESPACE
void Object_Menu_Control::insert_fd(void) {
+ //write_protect = false; // Right? On D88, May be writing entry exists.
emit sig_insert_fd(drive);
}
void Object_Menu_Control::eject_fd(void) {
+ write_protect = false;
emit sig_eject_fd(drive);
}
void Object_Menu_Control::on_d88_slot(void) {
emit set_d88_slot(drive, s_num);
}
void Object_Menu_Control::on_recent_disk(void){
+ // write_protect = false; // Right? On D88, May be writing entry exists.
emit set_recent_disk(drive, s_num);
}
-
+void Object_Menu_Control::write_protect_fd(void) {
+ write_protect = true;
+ emit sig_write_protect_fd(drive, write_protect);
+}
+void Object_Menu_Control::no_write_protect_fd(void) {
+ write_protect = false;
+ emit sig_write_protect_fd(drive, write_protect);
+}
// Common Routine
-
+int Ui_MainWindow::write_protect_fd(int drv, bool flag)
+{
+ if((drv < 0) || (drv >= MAX_FD)) return;
+ if(emu) {
+ emu->write_protect_fd(drv, flag);
+ }
+}
#ifdef USE_FD1
+
+
int Ui_MainWindow::set_d88_slot(int drive, int num)
{
if((num < 0) || (num >= MAX_D88_BANKS)) return;
if(emu && emu->d88_file[drive].cur_bank != num) {
emu->open_disk(drive, emu->d88_file[drive].path, emu->d88_file[drive].bank[num].offset);
+ if(emu->is_write_protected_fd(drive)) {
+ actionProtection_ON_FD[drive]->setChecked(true);
+ } else {
+ actionProtection_OFF_FD[drive]->setChecked(true);
+ }
emu->d88_file[drive].cur_bank = num;
}
}
strcpy(config.recent_disk_path[drive][0], path.c_str());
if(emu) {
open_disk(drive, path.c_str(), 0);
+ if(emu->is_write_protected_fd(drive)) {
+ actionProtection_ON_FD[drive]->setChecked(true);
+ } else {
+ actionProtection_OFF_FD[drive]->setChecked(true);
+ }
}
for(i = 0; i < MAX_HISTORY; i++) {
if(action_Recent_List_FD[drive][i] != NULL) {
QString desc2;
CSP_DiskDialog dlg;
QString dirname;
+
+ dlg.setWindowTitle("Open Floppy Disk");
+
desc2 = desc1 + " (" + ext.toLower() + ")";
desc1 = desc1 + " (" + ext.toUpper() + ")";
if(config.initial_disk_dir != NULL) {
dlg.param->setDrive(drv);
dlg.setDirectory(dirname);
- dlg.setNameFilters(filter);
+ dlg.setNameFilters(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(_open_disk(int, QString)));
dlg.show();
//actiont_Recent_List_FD[drv][i]->changed();
}
}
+ if(emu->is_write_protected_fd(drv)) {
+ actionProtection_ON_FD[drv]->setChecked(true);
+ } else {
+ actionProtection_OFF_FD[drv]->setChecked(true);
+ }
#endif
}
#endif
}
-void Ui_MainWindow::_open_cmt(bool mode, const QString path)
-{
- char path_shadow[PATH_MAX];
- int play;
-
- play = (mode == false)? 0 : 1;
-#ifdef USE_TAPE
- if(path.length() <= 0) return;
- strncpy(path_shadow, path.toUtf8().constData(), PATH_MAX);
- UPDATE_HISTORY(path_shadow, config.recent_tape_path);
- get_parent_dir(path_shadow);
- strcpy(config.initial_tape_dir, path_shadow);
- if(play != 0) {
- emu->play_tape(path_shadow);
- } else {
- emu->rec_tape(path_shadow);
- }
-#endif
-}
void Ui_MainWindow::eject_fd(int drv)
{
}
menuFD[drv]->addSeparator();
- // menuFD[drv]->addAction(menuWrite_Protection_FD1->menuAction());
+ menuFD[drv]->addAction(menuWrite_Protection_FD[drv]->menuAction());
menuWrite_Protection_FD[drv]->addAction(actionProtection_ON_FD[drv]);
menuWrite_Protection_FD[drv]->addAction(actionProtection_OFF_FD[drv]);
this, SLOT(set_recent_disk(int, int)));
}
}
-
- actionProtection_ON_FD[drv] = new Action_Control(p);
- actionProtection_ON_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_ON_FD") + drive_name);
- actionProtection_ON_FD[drv]->setCheckable(true);
- actionProtection_ON_FD[drv]->setChecked(true);
- actionProtection_OFF_FD[drv] = new Action_Control(p);
- actionProtection_OFF_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_OFF_FD1") + drive_name);
- actionProtection_OFF_FD[drv]->setCheckable(true);
+ {
+ int ii;
+ actionGroup_Protect_FD[drv] = new QActionGroup(p);
+ actionGroup_Protect_FD[drv]->setExclusive(true);
+ actionProtection_ON_FD[drv] = new Action_Control(p);
+ actionProtection_ON_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_ON_FD") + drive_name);
+ actionProtection_ON_FD[drv]->setCheckable(true);
+ actionProtection_ON_FD[drv]->setChecked(true);
+ actionProtection_ON_FD[drv]->binds->setDrive(drv);
+ actionProtection_ON_FD[drv]->binds->setNumber(0);
+ actionProtection_OFF_FD[drv] = new Action_Control(p);
+ actionProtection_OFF_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_OFF_FD") + drive_name);
+ actionProtection_OFF_FD[drv]->setCheckable(true);
+ actionProtection_OFF_FD[drv]->binds->setDrive(drv);
+ actionProtection_OFF_FD[drv]->binds->setNumber(0);
+
+ actionGroup_Protect_FD[drv]->addAction(actionProtection_ON_FD[drv]);
+ actionGroup_Protect_FD[drv]->addAction(actionProtection_OFF_FD[drv]);
+
+ connect(actionProtection_ON_FD[drv], SIGNAL(triggered()), actionProtection_ON_FD[drv]->binds, SLOT(write_protect_fd()));
+ connect(actionProtection_ON_FD[drv]->binds, SIGNAL(sig_write_protect_fd(int, bool)), this, SLOT(write_protect_fd(int, bool)));
+ connect(actionProtection_OFF_FD[drv], SIGNAL(triggered()), actionProtection_OFF_FD[drv]->binds, SLOT(no_write_protect_fd()));
+ connect(actionProtection_OFF_FD[drv]->binds, SIGNAL(sig_write_protect_fd(int, bool)), this, SLOT(write_protect_fd(int, bool)));
+ }
+
connect(actionInsert_FD[drv], SIGNAL(triggered()), actionInsert_FD[drv]->binds, SLOT(insert_fd()));
connect(actionInsert_FD[drv]->binds, SIGNAL(sig_insert_fd(int)), this, SLOT(open_disk_dialog(int)));