• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revision7452825c4069f4db4ffdc731caa32a5468d678a2 (tree)
Time2018-12-17 19:05:43
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[UI][Qt][OOPS] Fix OOPs around mounting virtual D88/D77 image(s).

Change Summary

Incremental Difference

--- a/source/src/qt/common/CMakeLists.txt
+++ b/source/src/qt/common/CMakeLists.txt
@@ -27,7 +27,7 @@ set(QT_COMMON_BASE
2727 emu_thread_slots.cpp
2828 # util_fd2.cpp
2929 # util_hdd2.cpp
30-# util_bubble2.cpp
30+ util_bubble2.cpp
3131 util_main.cpp
3232 ../osd.cpp
3333 ../osd_wrapper.cpp
--- a/source/src/qt/common/emu_thread.cpp
+++ b/source/src/qt/common/emu_thread.cpp
@@ -677,7 +677,7 @@ bool EmuThreadClass::get_power_state(void)
677677 int EmuThreadClass::get_d88_file_cur_bank(int drive)
678678 {
679679 #ifdef USE_FLOPPY_DISK
680- if(drive > USE_FLOPPY_DISK) {
680+ if(drive < USE_FLOPPY_DISK) {
681681 QMutexLocker _locker(&uiMutex);
682682 return p_emu->d88_file[drive].cur_bank;
683683 }
@@ -688,7 +688,7 @@ int EmuThreadClass::get_d88_file_cur_bank(int drive)
688688 int EmuThreadClass::get_d88_file_bank_num(int drive)
689689 {
690690 #ifdef USE_FLOPPY_DISK
691- if(drive > USE_FLOPPY_DISK) {
691+ if(drive < USE_FLOPPY_DISK) {
692692 QMutexLocker _locker(&uiMutex);
693693 return p_emu->d88_file[drive].bank_num;
694694 }
@@ -701,7 +701,7 @@ QString EmuThreadClass::get_d88_file_disk_name(int drive, int banknum)
701701 {
702702 #ifdef USE_FLOPPY_DISK
703703 if(drive < 0) return QString::fromUtf8("");
704- if((drive < USE_FLOPPY_DISK) && (banknum < get_d88_file_cur_bank(drive))) {
704+ if((drive < USE_FLOPPY_DISK) && (banknum < get_d88_file_bank_num(drive))) {
705705 QMutexLocker _locker(&uiMutex);
706706 QString _n = QString::fromLocal8Bit((const char *)(&(p_emu->d88_file[drive].disk_name[banknum][0])));
707707 return _n;
--- a/source/src/qt/common/mainwidget.h
+++ b/source/src/qt/common/mainwidget.h
@@ -54,6 +54,13 @@ public:
5454 QString get_build_date();
5555
5656 public slots:
57+#if defined(USE_BUBBLE)
58+ int set_b77_slot(int drive, int num);
59+ void do_update_recent_bubble(int drv);
60+ int set_recent_bubble(int drv, int num);
61+ void _open_bubble(int drv, const QString fname);
62+ void eject_bubble(int drv);
63+#endif
5764 //#if defined(USE_FLOPPY_DISK)
5865 // void _open_disk(int drv, const QString fname);
5966 // void do_update_recent_disk(int);
--- a/source/src/qt/common/util_bubble2.cpp
+++ b/source/src/qt/common/util_bubble2.cpp
@@ -1,10 +1,11 @@
1-#include "mainwidget_base.h"
1+#include "mainwidget.h"
22 #include "commonclasses.h"
33 #include "menu_bubble.h"
44
55 #include "qt_dialogs.h"
66 //#include "csp_logger.h"
77
8+#if defined(USE_BUBBLE)
89
910 #ifndef UPDATE_B77_LIST
1011 #define UPDATE_B77_LIST(__d, lst) { \
@@ -20,7 +21,7 @@
2021 }
2122 #endif
2223
23-int Ui_MainWindowBase::set_b77_slot(int drive, int num)
24+int Ui_MainWindow::set_b77_slot(int drive, int num)
2425 {
2526 QString path;
2627 if((num < 0) || (num >= using_flags->get_max_b77_banks())) return -1;
@@ -38,7 +39,7 @@ int Ui_MainWindowBase::set_b77_slot(int drive, int num)
3839 return 0;
3940 }
4041
41-void Ui_MainWindowBase::do_update_recent_bubble(int drv)
42+void Ui_MainWindow::do_update_recent_bubble(int drv)
4243 {
4344 int i;
4445 menu_bubbles[drv]->do_update_histories(listBubbles[drv]);
@@ -51,7 +52,7 @@ void Ui_MainWindowBase::do_update_recent_bubble(int drv)
5152 }
5253
5354
54-int Ui_MainWindowBase::set_recent_bubble(int drv, int num)
55+int Ui_MainWindow::set_recent_bubble(int drv, int num)
5556 {
5657 QString s_path;
5758 char path_shadow[PATH_MAX];
@@ -79,7 +80,7 @@ int Ui_MainWindowBase::set_recent_bubble(int drv, int num)
7980 return 0;
8081 }
8182
82-void Ui_MainWindowBase::_open_bubble(int drv, const QString fname)
83+void Ui_MainWindow::_open_bubble(int drv, const QString fname)
8384 {
8485 char path_shadow[PATH_MAX];
8586 int i;
@@ -105,9 +106,11 @@ void Ui_MainWindowBase::_open_bubble(int drv, const QString fname)
105106 }
106107 }
107108
108-void Ui_MainWindowBase::eject_bubble(int drv)
109+void Ui_MainWindow::eject_bubble(int drv)
109110 {
110111 int i;
111112 emit sig_close_bubble(drv);
112113 menu_bubbles[drv]->do_clear_inner_media();
113114 }
115+
116+#endif
--- a/source/src/qt/common/util_fd2.cpp
+++ b/source/src/qt/common/util_fd2.cpp
@@ -4,9 +4,9 @@
44 #include "menu_disk.h"
55 #include "qt_dialogs.h"
66
7-
87 #include "menu_flags.h"
98
9+//#if defined(USE_FLOPPY_DISK)
1010
1111 #ifndef UPDATE_D88_LIST
1212 #define UPDATE_D88_LIST(__d, lst) { \
@@ -22,13 +22,16 @@
2222 }
2323 #endif
2424
25+
26+//extern DLL_PREFIX_I EMU *emu;
2527 int Ui_MainWindowBase::set_d88_slot(int drive, int num)
2628 {
2729 QString path;
2830 if((num < 0) || (num >= 64)) return -1;
29-#if 0
30- path = QString::fromUtf8(emu->d88_file[drive].path);
31+ //path = QString::fromUtf8(emu->d88_file[drive].path);
32+ path = hRunEmu->get_d88_file_path(drive);
3133 menu_fds[drive]->do_select_inner_media(num);
34+#if 0
3235 if(emu && emu->d88_file[drive].cur_bank != num) {
3336 emit sig_open_disk(drive, path, num);
3437 if(emu->is_floppy_disk_protected(drive)) {
@@ -38,19 +41,15 @@ int Ui_MainWindowBase::set_d88_slot(int drive, int num)
3841 }
3942 }
4043 #else
41- if(hRunEmu != NULL) {
42- path = hRunEmu->get_d88_file_path(drive);
43- menu_fds[drive]->do_select_inner_media(num);
44- if(hRunEmu->get_d88_file_cur_bank(drive) != num) {
45- emit sig_open_disk(drive, path, num);
46- if(hRunEmu->is_floppy_disk_protected(drive)) {
47- menu_fds[drive]->do_set_write_protect(true);
48- } else {
49- menu_fds[drive]->do_set_write_protect(false);
50- }
44+ if(hRunEmu->get_d88_file_cur_bank(drive) != num) {
45+ emit sig_open_disk(drive, path, num);
46+ if(hRunEmu->is_floppy_disk_protected(drive)) {
47+ menu_fds[drive]->do_set_write_protect(true);
48+ } else {
49+ menu_fds[drive]->do_set_write_protect(false);
5150 }
5251 }
53-#endif
52+#endif
5453 return 0;
5554 }
5655
@@ -99,7 +98,8 @@ int Ui_MainWindowBase::set_recent_disk(int drv, int num)
9998 if(using_flags->get_max_drive() >= 2) {
10099 strncpy(path_shadow, s_path.toLocal8Bit().constData(), PATH_MAX - 1);
101100 if(check_file_extension(path_shadow, ".d88") || check_file_extension(path_shadow, ".d77")) {
102- if(((drv & 1) == 0) && (drv + 1 < using_flags->get_max_drive()) && (1 < hRunEmu->get_d88_file_bank_num(drv))) {
101+ if(((drv & 1) == 0) && ((drv + 1) < using_flags->get_max_drive()) && (1 < hRunEmu->get_d88_file_bank_num(drv))) {
102+
103103 int drv2 = drv + 1;
104104 emit sig_close_disk(drv2);
105105 emit sig_open_disk(drv2, s_path, 1);
@@ -127,7 +127,6 @@ void Ui_MainWindowBase::_open_disk(int drv, const QString fname)
127127 strncpy(path_shadow, fname.toLocal8Bit().constData(), PATH_MAX - 1);
128128 // if(emu) {
129129 emit sig_close_disk(drv);
130- //emu->LockVM();
131130 emit sig_open_disk(drv, fname, 0);
132131 menu_fds[drv]->do_update_histories(listFDs[drv]);
133132 menu_fds[drv]->do_set_initialize_directory(p_config->initial_floppy_disk_dir);
@@ -143,7 +142,6 @@ void Ui_MainWindowBase::_open_disk(int drv, const QString fname)
143142 if(((drv & 1) == 0) && (drv + 1 < using_flags->get_max_drive()) && (1 < hRunEmu->get_d88_file_bank_num(drv))) {
144143 int drv2 = drv + 1;
145144 emit sig_close_disk(drv2);
146- //emu->LockVM();
147145 strncpy(path_shadow, fname.toLocal8Bit().constData(), PATH_MAX - 1);
148146 emit sig_open_disk(drv2, fname, 1);
149147 menu_fds[drv2]->do_update_histories(listFDs[drv2]);
@@ -155,4 +153,4 @@ void Ui_MainWindowBase::_open_disk(int drv, const QString fname)
155153 }
156154 }
157155
158-
156+//#endif
--- a/source/src/qt/common/util_hdd2.cpp
+++ b/source/src/qt/common/util_hdd2.cpp
@@ -9,6 +9,7 @@
99
1010 #include "menu_flags.h"
1111
12+//#if defined(USE_HARD_DISK)
1213 //extern USING_FLAGS *using_flags;
1314 void Ui_MainWindowBase::do_update_recent_hard_disk(int drv)
1415 {
@@ -57,4 +58,4 @@ void Ui_MainWindowBase::_open_hard_disk(int drv, const QString fname)
5758 menu_hdds[drv]->do_clear_inner_media();
5859 // }
5960 }
60-
61+//#endif
--- a/source/src/qt/gui/CMakeLists.txt
+++ b/source/src/qt/gui/CMakeLists.txt
@@ -1,6 +1,6 @@
11 message("* qt/gui")
22
3-set(THIS_LIB_VERSION 2.16.0)
3+set(THIS_LIB_VERSION 2.17.0)
44 #include(cotire)
55 #include(PrecompiledHeader)
66
@@ -118,7 +118,7 @@ set(s_qt_gui_srcs
118118 menu_flags_tmpl.cpp
119119 ../common/util_fd2.cpp
120120 ../common/util_hdd2.cpp
121- ../common/util_bubble2.cpp
121+# ../common/util_bubble2.cpp
122122 # qt_main.cpp
123123 )
124124 add_definitions(-D__GUI_LIBRARY_NAME=\"libCSPgui.${THIS_LIB_VERSION}\")
--- a/source/src/qt/gui/mainwidget_base.h
+++ b/source/src/qt/gui/mainwidget_base.h
@@ -620,15 +620,23 @@ public slots:
620620 int write_protect_fd(int drv, bool flag);
621621 void eject_fd(int drv);
622622 void eject_hard_disk(int drv);
623- // Bubble Casette
623+ // Bubble Casette
624624 int write_protect_bubble(int drv, bool flag);
625625
626- int set_b77_slot(int drive, int num);
627- void do_update_recent_bubble(int drv);
628- int set_recent_bubble(int drv, int num);
629- void _open_bubble(int drv, const QString fname);
630- void eject_bubble(int drv);
626+ virtual int set_b77_slot(int drive, int num) { return 0; }
627+ virtual void do_update_recent_bubble(int drv) { }
628+ virtual int set_recent_bubble(int drv, int num) { return 0; }
629+ virtual void _open_bubble(int drv, const QString fname) { }
630+ virtual void eject_bubble(int drv) { }
631+
632+ void _open_disk(int drv, const QString fname);
633+ void do_update_recent_disk(int);
634+ int set_d88_slot(int drive, int num);
635+ int set_recent_disk(int, int);
631636
637+ void _open_hard_disk(int drv, const QString fname);
638+ void do_update_recent_hard_disk(int);
639+ int set_recent_hard_disk(int, int);
632640
633641 void start_record_sound(bool rec);
634642 void set_freq(int);
@@ -685,15 +693,6 @@ public slots:
685693 void do_set_state_log_to_console(bool f);
686694 void do_set_state_log_to_syslog(bool f);
687695
688- // HDD
689- void _open_hard_disk(int drv, const QString fname);
690- void do_update_recent_hard_disk(int);
691- int set_recent_hard_disk(int, int);
692- // FDD
693- void _open_disk(int drv, const QString fname);
694- void do_update_recent_disk(int);
695- int set_d88_slot(int drive, int num);
696- int set_recent_disk(int, int);
697696
698697 signals:
699698 int message_changed(QString);
Show on old repository browser