• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

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


Commit MetaInfo

Revision39d689132ec5ddbbd7c4dc11595dab724068bdc0 (tree)
Zeit2023-02-07 03:50:10
AutorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[UI][Qt][EMU][MENU] More improve around floppy disk menus.

Ändern Zusammenfassung

Diff

--- a/source/src/emu.cpp
+++ b/source/src/emu.cpp
@@ -2378,6 +2378,10 @@ void EMU::update_media()
23782378 drv,
23792379 EMU_MESSAGE_TYPE::MEDIA_MOUNTED,
23802380 floppy_disk_status[drv].path);
2381+ osdcall_int(EMU_MEDIA_TYPE::FLOPPY_DISK,
2382+ drv,
2383+ EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT,
2384+ (is_floppy_disk_protected(drv)) ? UINT64_MAX : 0);
23812385 }
23822386 }
23832387 #endif
@@ -2505,6 +2509,10 @@ void EMU::restore_media()
25052509 drv,
25062510 EMU_MESSAGE_TYPE::MEDIA_MOUNTED,
25072511 floppy_disk_status[drv].path);
2512+ osdcall_int(EMU_MEDIA_TYPE::FLOPPY_DISK,
2513+ drv,
2514+ EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT,
2515+ (is_floppy_disk_protected(drv)) ? UINT64_MAX : 0);
25082516 }
25092517 }
25102518 #endif
@@ -2702,6 +2710,10 @@ void EMU::open_floppy_disk(int drv, const _TCHAR* file_path, int bank)
27022710 drv,
27032711 EMU_MESSAGE_TYPE::MEDIA_REMOVED,
27042712 0);
2713+ osdcall_int(EMU_MEDIA_TYPE::FLOPPY_DISK,
2714+ drv,
2715+ EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT,
2716+ 0);
27052717 } else if(floppy_disk_status[drv].wait_count == 0) {
27062718 vm->open_floppy_disk(drv, file_path, bank & EMU_MEDIA_TYPE::EMU_SLOT_MASK);
27072719 #if USE_FLOPPY_DISK > 1
@@ -2713,6 +2725,10 @@ void EMU::open_floppy_disk(int drv, const _TCHAR* file_path, int bank)
27132725 drv,
27142726 EMU_MESSAGE_TYPE::MEDIA_MOUNTED,
27152727 (_TCHAR *)file_path);
2728+ osdcall_int(EMU_MEDIA_TYPE::FLOPPY_DISK,
2729+ drv,
2730+ EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT,
2731+ (is_floppy_disk_protected(drv)) ? UINT64_MAX : 0);
27162732 }
27172733 my_tcscpy_s(floppy_disk_status[drv].path, _MAX_PATH, file_path);
27182734 floppy_disk_status[drv].bank = bank;
@@ -2737,6 +2753,10 @@ void EMU::close_floppy_disk(int drv)
27372753 drv,
27382754 EMU_MESSAGE_TYPE::MEDIA_REMOVED,
27392755 0);
2756+ osdcall_int(EMU_MEDIA_TYPE::FLOPPY_DISK,
2757+ drv,
2758+ EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT,
2759+ 0);
27402760 }
27412761 }
27422762
@@ -2763,6 +2783,10 @@ void EMU::is_floppy_disk_protected(int drv, bool value)
27632783 if(drv < USE_FLOPPY_DISK) {
27642784 vm->is_floppy_disk_protected(drv, value);
27652785 }
2786+ osdcall_int(EMU_MEDIA_TYPE::FLOPPY_DISK,
2787+ drv,
2788+ EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT,
2789+ (is_floppy_disk_protected(drv)) ? UINT64_MAX : 0);
27662790 }
27672791
27682792 bool EMU::is_floppy_disk_protected(int drv)
--- a/source/src/osdcall_types.h
+++ b/source/src/osdcall_types.h
@@ -49,6 +49,7 @@ namespace EMU_MESSAGE_TYPE {
4949 MEDIA_REMOVED,
5050 MEDIA_SUSPENDED,
5151 VIRT_MEDIA_SELECTED,
52+ MEDIA_WRITE_PROTECT,
5253 MESSAGE_END
5354 };
5455 }
--- a/source/src/qt/common/emu_thread.cpp
+++ b/source/src/qt/common/emu_thread.cpp
@@ -49,8 +49,7 @@ EmuThreadClass::EmuThreadClass(Ui_MainWindowBase *rootWindow, std::shared_ptr<US
4949 connect(this, SIGNAL(sig_open_cmt_load(int, QString)), MainWindow, SLOT(do_open_read_cmt(int, QString)));
5050 connect(this, SIGNAL(sig_open_cmt_write(int, QString)), MainWindow, SLOT(do_open_write_cmt(int, QString)));
5151 connect(this, SIGNAL(sig_open_fd(int, QString)), MainWindow, SLOT(_open_disk(int, QString)));
52- connect(this, SIGNAL(sig_update_d88_list(int, int)), MainWindow, SLOT(do_update_d88_list(int, int)));
53- connect(this, SIGNAL(sig_open_d88_fd(int, QString, int)), this, SLOT(do_open_disk(int, QString, int)));
52+
5453 connect(this, SIGNAL(sig_open_quick_disk(int, QString)), MainWindow, SLOT(_open_quick_disk(int, QString)));
5554 connect(this, SIGNAL(sig_open_bubble(int, QString)), MainWindow, SLOT(_open_bubble(int, QString)));
5655 connect(this, SIGNAL(sig_open_b77_bubble(int, QString, int)), this, SLOT(do_open_bubble_casette(int, QString, int)));
@@ -59,8 +58,7 @@ EmuThreadClass::EmuThreadClass(Ui_MainWindowBase *rootWindow, std::shared_ptr<US
5958 connect(this, SIGNAL(sig_open_laser_disc(int, QString)), MainWindow, SLOT(do_open_laserdisc(int, QString)));
6059
6160 connect(this, SIGNAL(sig_open_hdd(int, QString)), MainWindow, SLOT(_open_hard_disk(int, QString)));
62-
63- connect(this, SIGNAL(sig_set_d88_num(int, int)), MainWindow, SLOT(set_d88_slot(int, int)));
61+
6462 connect(this, SIGNAL(sig_set_b77_num(int, int)), MainWindow, SLOT(set_b77_slot(int, int)));
6563
6664 p_osd->setParent(this);
@@ -381,42 +379,6 @@ void EmuThreadClass::doWork(const QString &params)
381379 run_frames = p_emu->run();
382380 total_frames += run_frames;
383381 // After frame, delayed open
384-#if 0 /* TRY: Move to EMU:: */
385- if(using_flags.get() != nullptr) {
386- for(int i = 0; i < using_flags->get_max_drive(); i++) {
387- if(fd_open_wait_count[i] > 0) {
388- fd_open_wait_count[i] -= run_frames;
389- if(fd_open_wait_count[i] <= 0) {
390- do_open_disk(i, fd_reserved_path[i], fd_reserved_bank[i]);
391- fd_reserved_path[i].clear();
392- fd_reserved_bank[i] = 0;
393- fd_open_wait_count[i] = 0;
394- }
395- }
396- }
397- }
398-#else
399- if(using_flags.get() != nullptr) {
400- for(int i = 0; i < using_flags->get_max_drive(); i++) {
401- if(fd_open_wait_count[i] > 0) {
402- fd_open_wait_count[i] -= run_frames;
403- if(fd_open_wait_count[i] <= 0) {
404- if(p_emu->is_floppy_disk_inserted(i)) {
405- int bank = p_emu->d88_file[i].cur_bank;
406- emit sig_change_virtual_media(CSP_DockDisks_Domain_FD, i, fd_reserved_path[i]);
407- emit sig_update_recent_disk(i);
408- emit sig_update_d88_list(i, bank);
409- fd_reserved_path[i].clear();
410- //fd_reserved_bank[i] = 0;
411- fd_open_wait_count[i] = 0;
412- } else {
413- fd_open_wait_count[i] = (int)(get_emu_frame_rate() * 0.2);
414- }
415- }
416- }
417- }
418- }
419-#endif
420382 if(!(half_count)) {
421383 led_data = 0x00;
422384
--- a/source/src/qt/common/emu_thread_slots.cpp
+++ b/source/src/qt/common/emu_thread_slots.cpp
@@ -498,7 +498,7 @@ void EmuThreadClassBase::do_stop_auto_key(void)
498498 }
499499 }
500500
501-void EmuThreadClassBase::do_write_protect_disk(int drv, bool flag)
501+void EmuThreadClassBase::do_write_protect_floppy_disk(int drv, bool flag)
502502 {
503503 //QMutexLocker _locker(&uiMutex);
504504 std::shared_ptr<USING_FLAGS> p = using_flags;
@@ -542,25 +542,28 @@ void EmuThreadClassBase::do_open_floppy_disk(int drv, QString path, int bank)
542542 fd_reserved_path[drv] = path;
543543 }
544544
545-// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
546-void EmuThreadClassBase::done_select_d88(int drive, int slot)
545+
546+void EmuThreadClassBase::do_select_floppy_disk_d88(int drive, int slot)
547547 {
548548 if(p_emu == nullptr) return;
549-
549+
550+ int bank_num = p_emu->d88_file[drive].bank_num;
551+ if(bank_num <= 0) return;
552+
553+ std::shared_ptr<USING_FLAGS>p = using_flags;
554+ if(p.get() == nullptr) return;
555+ if(p->get_max_d88_banks() <= slot) slot = p->get_max_d88_banks() - 1;
550556 if(slot < 0) return;
551- if(slot >= 64) return;
552- if(p_emu->d88_file[drive].bank_num < 0) return;
553- if(p_emu->d88_file[drive].bank_num >= 64) return;
554- if(p_emu->d88_file[drive].bank_num <= slot) return;
555- p_emu->d88_file[drive].cur_bank = slot;
556- emit sig_ui_select_d88(drive, slot);
557+ if(bank_num <= slot) return;
557558
558- _TCHAR tmpname[128] = {0};
559- my_strcpy_s(tmpname, 127, p_emu->d88_file[drive].disk_name[slot]);
560- QString tmps = QString::fromLocal8Bit(tmpname);
561- emit sig_change_virtual_media(CSP_DockDisks_Domain_FD, drive, tmps);
559+ if((p_emu->is_floppy_disk_inserted(drive)) &&
560+ (slot != p_emu->d88_file[drive].cur_bank)) {
561+ QString path = get_d88_file_path(drive);
562+ do_open_floppy_disk(drive, path, slot);
563+ }
562564 }
563565
566+
564567 void EmuThreadClassBase::do_play_tape(int drv, QString name)
565568 {
566569 if(using_flags->is_use_tape()) {
--- a/source/src/qt/common/qt_utils.cpp
+++ b/source/src/qt/common/qt_utils.cpp
@@ -160,20 +160,24 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m)
160160 }
161161 }
162162 #if defined(USE_FLOPPY_DISK)
163- connect(this, SIGNAL(sig_write_protect_floppy_disk(int, bool)), hRunEmu, SLOT(do_write_protect_disk(int, bool)));
163+ connect(this, SIGNAL(sig_write_protect_floppy_disk(int, bool)), hRunEmu, SLOT(do_write_protect_floppy_disk(int, bool)));
164164 connect(this, SIGNAL(sig_open_floppy_disk(int, QString, int)), hRunEmu, SLOT(do_open_floppy_disk(int, QString, int)));
165165 connect(this, SIGNAL(sig_close_floppy_disk(int)), hRunEmu, SLOT(do_close_floppy_disk(int)));
166- connect(hRunEmu, SIGNAL(sig_update_recent_disk(int)), this, SLOT(do_update_recent_disk(int)));
167166 //connect(hRunEmu, SIGNAL(sig_change_osd_fd(int, QString)), this, SLOT(do_change_osd_fd(int, QString)));
168167 connect(p_osd, SIGNAL(sig_ui_floppy_insert_history(int, QString, quint64)),
169168 this, SLOT(do_ui_floppy_insert_history(int, QString, quint64)),
170169 Qt::QueuedConnection);
170+ connect(p_osd, SIGNAL(sig_floppy_disk_write_protect(int, quint64)),
171+ this, SLOT(do_ui_write_protect_floppy_disk(int, quint64)),
172+ Qt::QueuedConnection);
171173
172174 drvs = USE_FLOPPY_DISK;
173175 for(int ii = 0; ii < drvs; ii++) {
174- menu_fds[ii]->setEmu(emu);
175- connect(menu_fds[ii], SIGNAL(sig_update_inner_fd(int ,QStringList , class Action_Control **, QStringList , int, bool)),
176- this, SLOT(do_update_inner_fd(int ,QStringList , class Action_Control **, QStringList , int, bool)));
176+ if(menu_fds[ii] != nullptr) {
177+ connect(menu_fds[ii], SIGNAL(sig_set_inner_slot(int, int)),
178+ hRunEmu, SLOT(do_select_floppy_disk_d88(int, int)),
179+ Qt::QueuedConnection);
180+ }
177181 }
178182 #endif
179183 #if defined(USE_HARD_DISK)
@@ -227,7 +231,6 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m)
227231 //connect(hRunEmu, SIGNAL(sig_change_osd_bubble(int, QString)), this, SLOT(do_change_osd_bubble(int, QString)));
228232 drvs = USE_BUBBLE;
229233 for(int ii = 0; ii < drvs; ii++) {
230- menu_bubbles[ii]->setEmu(emu);
231234 connect(menu_bubbles[ii],
232235 SIGNAL(sig_update_inner_bubble(int ,QStringList , class Action_Control **, QStringList , int, bool)),
233236 this,
--- a/source/src/qt/common/util_fd2.cpp
+++ b/source/src/qt/common/util_fd2.cpp
@@ -24,43 +24,22 @@
2424
2525
2626 //extern DLL_PREFIX_I EMU *emu;
27-int Ui_MainWindowBase::set_d88_slot(int drive, int num)
28-{
29- QString path;
30- if((num < 0) || (num >= 64)) return -1;
31- //path = QString::fromUtf8(emu->d88_file[drive].path);
32- path = hRunEmu->get_d88_file_path(drive);
33- menu_fds[drive]->do_select_inner_media(num);
34-
35- if(hRunEmu->get_d88_file_cur_bank(drive) != num) {
36- emit sig_close_floppy_disk(drive);
37- emit sig_open_floppy_disk(drive, path, num & EMU_MEDIA_TYPE::EMU_SLOT_MASK);
38- if(hRunEmu->is_floppy_disk_protected(drive)) {
39- menu_fds[drive]->do_set_write_protect(true);
40- } else {
41- menu_fds[drive]->do_set_write_protect(false);
42- }
43- }
44- return 0;
45-}
4627
47-void Ui_MainWindowBase::do_update_recent_disk(int drv)
28+void Ui_MainWindowBase::do_ui_write_protect_floppy_disk(int drive, quint64 flag)
4829 {
49- if(hRunEmu == NULL) return;
50- menu_fds[drv]->do_update_histories(listFDs[drv]);
51- menu_fds[drv]->do_set_initialize_directory(p_config->initial_floppy_disk_dir);
52- if(hRunEmu != NULL) {
53-// if(hRunEmu->get_d88_file_cur_bank(drv) != num) {
54- if(hRunEmu->is_floppy_disk_protected(drv)) {
55- menu_fds[drv]->do_set_write_protect(true);
56- } else {
57- menu_fds[drv]->do_set_write_protect(false);
58- }
59-// }
30+ if(drive < 0) return;
31+
32+ std::shared_ptr<USING_FLAGS>p = using_flags;
33+ if(p.get() == nullptr) return;
34+ if(!(p->is_use_fd()) || (p->get_max_drive() <= drive)) return;
35+ if(menu_fds[drive] != nullptr) return;
36+
37+ if(flag != 0) {
38+ menu_fds[drive]->do_set_write_protect(true);
39+ } else {
40+ menu_fds[drive]->do_set_write_protect(false);
6041 }
6142 }
62-
63-
6443 extern const _TCHAR* DLL_PREFIX_I get_parent_dir(const _TCHAR* file);
6544
6645 int Ui_MainWindowBase::set_recent_disk(int drv, int num)
@@ -100,6 +79,7 @@ void Ui_MainWindowBase::do_ui_floppy_insert_history(int drv, QString fname, quin
10079 UPDATE_D88_LIST(drv, listD88[drv]);
10180 }
10281 menu_fds[drv]->do_update_inner_media(listD88[drv], bank & EMU_MEDIA_TYPE::EMU_SLOT_MASK);
82+
10383 }
10484
10585 void Ui_MainWindowBase::_open_disk(int drv, const QString fname)
@@ -125,6 +105,18 @@ void Ui_MainWindowBase::_open_disk(int drv, const QString fname)
125105 }
126106 }
127107
108+void Ui_MainWindowBase::do_set_write_protect_floppy_disk(int drive, bool flag)
109+{
110+ if(drive < 0) return;
111+ if(menu_fds[drive] == nullptr) return;
112+
113+ std::shared_ptr<USING_FLAGS>p = using_flags;
114+ if(p.get() == nullptr) return;
115+ if(!(p->is_use_fd()) || (p->get_max_drive() <= drive)) return;
116+
117+ menu_fds[drive]->do_set_write_protect(flag);
118+}
119+
128120 void Ui_MainWindowBase::do_update_d88_list(int drv, int bank)
129121 {
130122 // UPDATE_D88_LIST(drv, listD88[drv]);
--- a/source/src/qt/gui/emu_thread_tmpl.cpp
+++ b/source/src/qt/gui/emu_thread_tmpl.cpp
@@ -393,7 +393,7 @@ int EmuThreadClassBase::parse_command_queue(QStringList _l, int _begin)
393393 const _TCHAR *path_shadow = (const _TCHAR *)(fileInfo.absoluteFilePath().toLocal8Bit().constData());
394394 if(_dom_type == QString::fromUtf8("vFloppyDisk")) {
395395 if(check_file_extension(path_shadow, ".d88") || check_file_extension(path_shadow, ".d77")) {
396- emit sig_open_d88_fd(_dom_num, fileInfo.absoluteFilePath(), _slot);
396+
397397 emit sig_change_virtual_media(CSP_DockDisks_Domain_FD, _dom_num, fileInfo.absoluteFilePath());;
398398 } else {
399399 emit sig_open_fd(_dom_num, fileInfo.absoluteFilePath());
@@ -566,7 +566,7 @@ QString EmuThreadClassBase::get_d88_file_path(int drive)
566566
567567 if(drive < using_flags->get_max_drive()) {
568568 QMutexLocker _locker(&uiMutex);
569- QString _n = QString::fromUtf8((const char *)(&(p_emu->d88_file[drive].path)));
569+ QString _n = QString::fromLocal8Bit((const char *)(&(p_emu->d88_file[drive].path)));
570570 return _n;
571571 }
572572
--- a/source/src/qt/gui/emu_thread_tmpl.h
+++ b/source/src/qt/gui/emu_thread_tmpl.h
@@ -283,7 +283,7 @@ public slots:
283283 void do_set_display_size(int w, int h, int ww, int wh);
284284 void moved_mouse(double x, double y, double globalx, double globaly);
285285
286- void do_write_protect_disk(int drv, bool flag);
286+ void do_write_protect_floppy_disk(int drv, bool flag);
287287 void do_close_floppy_disk(int);
288288 void do_open_floppy_disk(int, QString, int);
289289
@@ -325,9 +325,9 @@ public slots:
325325 void set_romakana(bool flag);
326326 void do_close_debugger(void);
327327
328+
329+ void do_select_floppy_disk_d88(int drive, int slot);
328330 // Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI (menu_foo[bar]))
329- void done_select_d88(int drive, int slot);
330-
331331 void done_open_tape(int drive, QString path);
332332 void done_close_tape(int drive);
333333
@@ -362,7 +362,6 @@ signals:
362362 int sig_screen_size(int, int);
363363 int sig_finished(void);
364364 int sig_mouse_enable(bool);
365- int sig_update_recent_disk(int);
366365 int sig_update_recent_hard_disk(int);
367366
368367 int sig_change_osd(int, int, QString);
@@ -398,13 +397,11 @@ signals:
398397 int sig_open_cdrom(int, QString);
399398 int sig_open_laser_disc(int, QString);
400399
401- int sig_set_d88_num(int, int);
402400 int sig_set_b77_num(int, int);
403401
404402 // From emu_thread_slots.cpp .
405403 int sig_set_draw_fps(double);
406404 int sig_draw_one_turn(bool);
407- int sig_update_d88_list(int, int);
408405
409406 // Signal from (EMU:: -> OSD:: ->) EMU_THREAD -> GUI(menu_foo[bar])
410407 int sig_ui_update_floppy_list(int, QStringList);
--- a/source/src/qt/gui/mainwidget_base.h
+++ b/source/src/qt/gui/mainwidget_base.h
@@ -835,7 +835,7 @@ public slots:
835835 void do_push_apss_rewind_tape(int drive);
836836 void set_cmt_sound(bool);
837837
838- int write_protect_fd(int drv, bool flag);
838+ int do_emu_write_protect_floppy_disk(int drv, bool flag);
839839 void eject_fd(int drv);
840840 void eject_hard_disk(int drv);
841841 virtual void do_create_d88_media(int drv, quint8 media_type, QString name) { }
@@ -852,9 +852,8 @@ public slots:
852852 virtual void eject_bubble(int drv) { }
853853
854854 void _open_disk(int drv, const QString fname);
855- void do_update_recent_disk(int);
856- int set_d88_slot(int drive, int num);
857855 int set_recent_disk(int, int);
856+ void do_set_write_protect_floppy_disk(int drive, bool flag);
858857
859858 void _open_hard_disk(int drv, const QString fname);
860859 void do_update_recent_hard_disk(int);
@@ -909,6 +908,7 @@ public slots:
909908 void do_update_floppy_history(int drive, QStringList lst);
910909 void do_insert_floppy_history(int drive, QString path);
911910 void do_ui_floppy_insert_history(int drv, QString fname, quint64 bank);
911+ void do_ui_write_protect_floppy_disk(int drv, quint64 flag);
912912
913913 void do_set_emulate_cursor_as(void);
914914 void do_set_logging_fdc(bool onoff);
--- a/source/src/qt/gui/menu_disk.cpp
+++ b/source/src/qt/gui/menu_disk.cpp
@@ -207,9 +207,8 @@ void Menu_FDClass::connect_menu_device_sub(void)
207207
208208 connect(this, SIGNAL(sig_eject_media(int)), p_wid, SLOT(eject_fd(int)));
209209
210- connect(this, SIGNAL(sig_write_protect_media(int, bool)), p_wid, SLOT(write_protect_fd(int, bool)));
210+ connect(this, SIGNAL(sig_write_protect_media(int, bool)), p_wid, SLOT(do_emu_write_protect_floppy_disk(int, bool)));
211211 connect(this, SIGNAL(sig_set_recent_media(int, int)), p_wid, SLOT(set_recent_disk(int, int)));
212- connect(this, SIGNAL(sig_set_inner_slot(int, int)), p_wid, SLOT(set_d88_slot(int, int)));
213212 }
214213
215214 void Menu_FDClass::retranslate_pulldown_menu_device_sub(void)
--- a/source/src/qt/gui/menu_metaclass.cpp
+++ b/source/src/qt/gui/menu_metaclass.cpp
@@ -31,7 +31,6 @@ Menu_MetaClass::Menu_MetaClass(QMenuBar *root_entry, QString desc, std::shared_p
3131 menu_root = root_entry;
3232
3333 //p_emu = ep;
34- p_emu = NULL;
3534 using_flags = p;
3635 p_config = p->get_config_ptr();
3736
@@ -315,6 +314,9 @@ void Menu_MetaClass::do_clear_inner_media(void)
315314 action_select_media_list[ii]->setVisible(false);
316315 }
317316 }
317+ if(action_select_media_list[0] != nullptr) {
318+ action_select_media_list[0]->setChecked(true);
319+ }
318320 }
319321 }
320322
@@ -322,8 +324,6 @@ void Menu_MetaClass::do_clear_inner_media(void)
322324 void Menu_MetaClass::do_update_inner_media(QStringList lst, int num)
323325 {
324326 QString tmps;
325- if(num < 0) return;
326-
327327 if(use_d88_menus) {
328328 //inner_media_list.clear();
329329 do_clear_inner_media();
@@ -333,21 +333,17 @@ void Menu_MetaClass::do_update_inner_media(QStringList lst, int num)
333333 for(auto _l = lst.begin(); _l != lst.end(); ++_l) {
334334 if(count >= _n) break;
335335 //inner_media_list.push_back((*_l));
336+ //printf("do_update_inner_media: num=%d count=%d val=%s\n", num, count, (*_l).toLocal8Bit().constData());
336337 if(action_select_media_list[count] != nullptr) {
337338 action_select_media_list[count]->setText((*_l));
338- action_select_media_list[count]->setChecked((count == num) ? true : false);
339+ if(count == num) {
340+ action_select_media_list[count]->setChecked(true);
341+ }
339342 action_select_media_list[count]->setVisible(true);
340343 }
341344 count++;
342345 }
343- if((num >= count) || (num < 0)) {
344- if(action_select_media_list[0] != nullptr) {
345- action_select_media_list[0]->setChecked(true);
346- }
347- }
348346 }
349-
350- //emit sig_update_inner_fd(media_drive, inner_media_list, action_select_media_list, lst , num, use_d88_menus);
351347 }
352348
353349 void Menu_MetaClass::do_update_inner_media_bubble(QStringList lst, int num)
@@ -580,6 +576,6 @@ void Menu_MetaClass::retranslateUi(void)
580576
581577 void Menu_MetaClass::setEmu(EMU_TEMPLATE *p)
582578 {
583- p_emu = p;
579+
584580 }
585581
--- a/source/src/qt/gui/menu_metaclass.h
+++ b/source/src/qt/gui/menu_metaclass.h
@@ -51,7 +51,6 @@ protected:
5151 std::shared_ptr<USING_FLAGS> using_flags;
5252 QWidget *p_wid;
5353 QMenuBar *menu_root;
54- EMU_TEMPLATE *p_emu;
5554 config_t *p_config;
5655
5756 QMenu *menu_inner_media;
@@ -144,8 +143,6 @@ signals:
144143 int sig_set_recent_media(int, int);
145144 int sig_set_inner_slot(int, int);
146145 int sig_insert_media(int);
147- int sig_update_inner_fd(int drv, QStringList base, class Action_Control **action_select_media_list,
148- QStringList lst, int num, bool use_d88_menus);
149146 int sig_update_inner_bubble(int drv, QStringList base, class Action_Control **action_select_media_list,
150147 QStringList lst, int num, bool use_d88_menus);
151148 int sig_emu_update_config();
--- a/source/src/qt/gui/util_fd.cpp
+++ b/source/src/qt/gui/util_fd.cpp
@@ -21,9 +21,13 @@
2121 //extern class EMU *emu;
2222
2323
24-int Ui_MainWindowBase::write_protect_fd(int drv, bool flag)
24+int Ui_MainWindowBase::do_emu_write_protect_floppy_disk(int drv, bool flag)
2525 {
26- if((drv < 0) || (drv >= using_flags->get_max_drive())) return -1;
26+ std::shared_ptr<USING_FLAGS> p = using_flags;
27+ if(p.get() == nullptr) return -1;
28+
29+ if((drv < 0) || (drv >= p->get_max_drive())) return -1;
30+
2731 emit sig_write_protect_floppy_disk(drv, flag);
2832 return 0;
2933 }
--- a/source/src/qt/osd_base.cpp
+++ b/source/src/qt/osd_base.cpp
@@ -709,7 +709,13 @@ void OSD_BASE::int_message_from_emu(EMU_MEDIA_TYPE::type_t media_type, int drive
709709 // Below are update message to UI.
710710 return; // ToDo: Implement
711711 }
712-// switch(media_type) {
713-// case EMU_MEDIA_TYPE::BINARY:
714-// }
712+ switch(_type) {
713+ case EMU_MEDIA_TYPE::FLOPPY_DISK :
714+ switch(message_type) {
715+ case EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT :
716+ emit sig_floppy_disk_write_protect(drive, data);
717+ break;
718+ }
719+ break;
720+ }
715721 }
--- a/source/src/qt/osd_base.h
+++ b/source/src/qt/osd_base.h
@@ -770,6 +770,7 @@ signals:
770770
771771 // To GUI 20230125 K.O
772772 int sig_ui_floppy_insert_history(int, QString, quint64);
773+ int sig_floppy_disk_write_protect(int, quint64);
773774 };
774775
775776 QT_END_NAMESPACE
Show on old repository browser