Common Source Code Project for Qt (a.k.a for FM-7).
Revision | 39d689132ec5ddbbd7c4dc11595dab724068bdc0 (tree) |
---|---|
Zeit | 2023-02-07 03:50:10 |
Autor | K.Ohta <whatisthis.sowhat@gmai...> |
Commiter | K.Ohta |
[UI][Qt][EMU][MENU] More improve around floppy disk menus.
@@ -2378,6 +2378,10 @@ void EMU::update_media() | ||
2378 | 2378 | drv, |
2379 | 2379 | EMU_MESSAGE_TYPE::MEDIA_MOUNTED, |
2380 | 2380 | 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); | |
2381 | 2385 | } |
2382 | 2386 | } |
2383 | 2387 | #endif |
@@ -2505,6 +2509,10 @@ void EMU::restore_media() | ||
2505 | 2509 | drv, |
2506 | 2510 | EMU_MESSAGE_TYPE::MEDIA_MOUNTED, |
2507 | 2511 | 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); | |
2508 | 2516 | } |
2509 | 2517 | } |
2510 | 2518 | #endif |
@@ -2702,6 +2710,10 @@ void EMU::open_floppy_disk(int drv, const _TCHAR* file_path, int bank) | ||
2702 | 2710 | drv, |
2703 | 2711 | EMU_MESSAGE_TYPE::MEDIA_REMOVED, |
2704 | 2712 | 0); |
2713 | + osdcall_int(EMU_MEDIA_TYPE::FLOPPY_DISK, | |
2714 | + drv, | |
2715 | + EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT, | |
2716 | + 0); | |
2705 | 2717 | } else if(floppy_disk_status[drv].wait_count == 0) { |
2706 | 2718 | vm->open_floppy_disk(drv, file_path, bank & EMU_MEDIA_TYPE::EMU_SLOT_MASK); |
2707 | 2719 | #if USE_FLOPPY_DISK > 1 |
@@ -2713,6 +2725,10 @@ void EMU::open_floppy_disk(int drv, const _TCHAR* file_path, int bank) | ||
2713 | 2725 | drv, |
2714 | 2726 | EMU_MESSAGE_TYPE::MEDIA_MOUNTED, |
2715 | 2727 | (_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); | |
2716 | 2732 | } |
2717 | 2733 | my_tcscpy_s(floppy_disk_status[drv].path, _MAX_PATH, file_path); |
2718 | 2734 | floppy_disk_status[drv].bank = bank; |
@@ -2737,6 +2753,10 @@ void EMU::close_floppy_disk(int drv) | ||
2737 | 2753 | drv, |
2738 | 2754 | EMU_MESSAGE_TYPE::MEDIA_REMOVED, |
2739 | 2755 | 0); |
2756 | + osdcall_int(EMU_MEDIA_TYPE::FLOPPY_DISK, | |
2757 | + drv, | |
2758 | + EMU_MESSAGE_TYPE::MEDIA_WRITE_PROTECT, | |
2759 | + 0); | |
2740 | 2760 | } |
2741 | 2761 | } |
2742 | 2762 |
@@ -2763,6 +2783,10 @@ void EMU::is_floppy_disk_protected(int drv, bool value) | ||
2763 | 2783 | if(drv < USE_FLOPPY_DISK) { |
2764 | 2784 | vm->is_floppy_disk_protected(drv, value); |
2765 | 2785 | } |
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); | |
2766 | 2790 | } |
2767 | 2791 | |
2768 | 2792 | bool EMU::is_floppy_disk_protected(int drv) |
@@ -49,6 +49,7 @@ namespace EMU_MESSAGE_TYPE { | ||
49 | 49 | MEDIA_REMOVED, |
50 | 50 | MEDIA_SUSPENDED, |
51 | 51 | VIRT_MEDIA_SELECTED, |
52 | + MEDIA_WRITE_PROTECT, | |
52 | 53 | MESSAGE_END |
53 | 54 | }; |
54 | 55 | } |
@@ -49,8 +49,7 @@ EmuThreadClass::EmuThreadClass(Ui_MainWindowBase *rootWindow, std::shared_ptr<US | ||
49 | 49 | connect(this, SIGNAL(sig_open_cmt_load(int, QString)), MainWindow, SLOT(do_open_read_cmt(int, QString))); |
50 | 50 | connect(this, SIGNAL(sig_open_cmt_write(int, QString)), MainWindow, SLOT(do_open_write_cmt(int, QString))); |
51 | 51 | 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 | + | |
54 | 53 | connect(this, SIGNAL(sig_open_quick_disk(int, QString)), MainWindow, SLOT(_open_quick_disk(int, QString))); |
55 | 54 | connect(this, SIGNAL(sig_open_bubble(int, QString)), MainWindow, SLOT(_open_bubble(int, QString))); |
56 | 55 | 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 | ||
59 | 58 | connect(this, SIGNAL(sig_open_laser_disc(int, QString)), MainWindow, SLOT(do_open_laserdisc(int, QString))); |
60 | 59 | |
61 | 60 | 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 | + | |
64 | 62 | connect(this, SIGNAL(sig_set_b77_num(int, int)), MainWindow, SLOT(set_b77_slot(int, int))); |
65 | 63 | |
66 | 64 | p_osd->setParent(this); |
@@ -381,42 +379,6 @@ void EmuThreadClass::doWork(const QString ¶ms) | ||
381 | 379 | run_frames = p_emu->run(); |
382 | 380 | total_frames += run_frames; |
383 | 381 | // 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 | |
420 | 382 | if(!(half_count)) { |
421 | 383 | led_data = 0x00; |
422 | 384 |
@@ -498,7 +498,7 @@ void EmuThreadClassBase::do_stop_auto_key(void) | ||
498 | 498 | } |
499 | 499 | } |
500 | 500 | |
501 | -void EmuThreadClassBase::do_write_protect_disk(int drv, bool flag) | |
501 | +void EmuThreadClassBase::do_write_protect_floppy_disk(int drv, bool flag) | |
502 | 502 | { |
503 | 503 | //QMutexLocker _locker(&uiMutex); |
504 | 504 | std::shared_ptr<USING_FLAGS> p = using_flags; |
@@ -542,25 +542,28 @@ void EmuThreadClassBase::do_open_floppy_disk(int drv, QString path, int bank) | ||
542 | 542 | fd_reserved_path[drv] = path; |
543 | 543 | } |
544 | 544 | |
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) | |
547 | 547 | { |
548 | 548 | 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; | |
550 | 556 | 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; | |
557 | 558 | |
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 | + } | |
562 | 564 | } |
563 | 565 | |
566 | + | |
564 | 567 | void EmuThreadClassBase::do_play_tape(int drv, QString name) |
565 | 568 | { |
566 | 569 | if(using_flags->is_use_tape()) { |
@@ -160,20 +160,24 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m) | ||
160 | 160 | } |
161 | 161 | } |
162 | 162 | #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))); | |
164 | 164 | connect(this, SIGNAL(sig_open_floppy_disk(int, QString, int)), hRunEmu, SLOT(do_open_floppy_disk(int, QString, int))); |
165 | 165 | 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))); | |
167 | 166 | //connect(hRunEmu, SIGNAL(sig_change_osd_fd(int, QString)), this, SLOT(do_change_osd_fd(int, QString))); |
168 | 167 | connect(p_osd, SIGNAL(sig_ui_floppy_insert_history(int, QString, quint64)), |
169 | 168 | this, SLOT(do_ui_floppy_insert_history(int, QString, quint64)), |
170 | 169 | 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); | |
171 | 173 | |
172 | 174 | drvs = USE_FLOPPY_DISK; |
173 | 175 | 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 | + } | |
177 | 181 | } |
178 | 182 | #endif |
179 | 183 | #if defined(USE_HARD_DISK) |
@@ -227,7 +231,6 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m) | ||
227 | 231 | //connect(hRunEmu, SIGNAL(sig_change_osd_bubble(int, QString)), this, SLOT(do_change_osd_bubble(int, QString))); |
228 | 232 | drvs = USE_BUBBLE; |
229 | 233 | for(int ii = 0; ii < drvs; ii++) { |
230 | - menu_bubbles[ii]->setEmu(emu); | |
231 | 234 | connect(menu_bubbles[ii], |
232 | 235 | SIGNAL(sig_update_inner_bubble(int ,QStringList , class Action_Control **, QStringList , int, bool)), |
233 | 236 | this, |
@@ -24,43 +24,22 @@ | ||
24 | 24 | |
25 | 25 | |
26 | 26 | //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 | -} | |
46 | 27 | |
47 | -void Ui_MainWindowBase::do_update_recent_disk(int drv) | |
28 | +void Ui_MainWindowBase::do_ui_write_protect_floppy_disk(int drive, quint64 flag) | |
48 | 29 | { |
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); | |
60 | 41 | } |
61 | 42 | } |
62 | - | |
63 | - | |
64 | 43 | extern const _TCHAR* DLL_PREFIX_I get_parent_dir(const _TCHAR* file); |
65 | 44 | |
66 | 45 | 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 | ||
100 | 79 | UPDATE_D88_LIST(drv, listD88[drv]); |
101 | 80 | } |
102 | 81 | menu_fds[drv]->do_update_inner_media(listD88[drv], bank & EMU_MEDIA_TYPE::EMU_SLOT_MASK); |
82 | + | |
103 | 83 | } |
104 | 84 | |
105 | 85 | void Ui_MainWindowBase::_open_disk(int drv, const QString fname) |
@@ -125,6 +105,18 @@ void Ui_MainWindowBase::_open_disk(int drv, const QString fname) | ||
125 | 105 | } |
126 | 106 | } |
127 | 107 | |
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 | + | |
128 | 120 | void Ui_MainWindowBase::do_update_d88_list(int drv, int bank) |
129 | 121 | { |
130 | 122 | // UPDATE_D88_LIST(drv, listD88[drv]); |
@@ -393,7 +393,7 @@ int EmuThreadClassBase::parse_command_queue(QStringList _l, int _begin) | ||
393 | 393 | const _TCHAR *path_shadow = (const _TCHAR *)(fileInfo.absoluteFilePath().toLocal8Bit().constData()); |
394 | 394 | if(_dom_type == QString::fromUtf8("vFloppyDisk")) { |
395 | 395 | 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 | + | |
397 | 397 | emit sig_change_virtual_media(CSP_DockDisks_Domain_FD, _dom_num, fileInfo.absoluteFilePath());; |
398 | 398 | } else { |
399 | 399 | emit sig_open_fd(_dom_num, fileInfo.absoluteFilePath()); |
@@ -566,7 +566,7 @@ QString EmuThreadClassBase::get_d88_file_path(int drive) | ||
566 | 566 | |
567 | 567 | if(drive < using_flags->get_max_drive()) { |
568 | 568 | 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))); | |
570 | 570 | return _n; |
571 | 571 | } |
572 | 572 |
@@ -283,7 +283,7 @@ public slots: | ||
283 | 283 | void do_set_display_size(int w, int h, int ww, int wh); |
284 | 284 | void moved_mouse(double x, double y, double globalx, double globaly); |
285 | 285 | |
286 | - void do_write_protect_disk(int drv, bool flag); | |
286 | + void do_write_protect_floppy_disk(int drv, bool flag); | |
287 | 287 | void do_close_floppy_disk(int); |
288 | 288 | void do_open_floppy_disk(int, QString, int); |
289 | 289 |
@@ -325,9 +325,9 @@ public slots: | ||
325 | 325 | void set_romakana(bool flag); |
326 | 326 | void do_close_debugger(void); |
327 | 327 | |
328 | + | |
329 | + void do_select_floppy_disk_d88(int drive, int slot); | |
328 | 330 | // Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI (menu_foo[bar])) |
329 | - void done_select_d88(int drive, int slot); | |
330 | - | |
331 | 331 | void done_open_tape(int drive, QString path); |
332 | 332 | void done_close_tape(int drive); |
333 | 333 |
@@ -362,7 +362,6 @@ signals: | ||
362 | 362 | int sig_screen_size(int, int); |
363 | 363 | int sig_finished(void); |
364 | 364 | int sig_mouse_enable(bool); |
365 | - int sig_update_recent_disk(int); | |
366 | 365 | int sig_update_recent_hard_disk(int); |
367 | 366 | |
368 | 367 | int sig_change_osd(int, int, QString); |
@@ -398,13 +397,11 @@ signals: | ||
398 | 397 | int sig_open_cdrom(int, QString); |
399 | 398 | int sig_open_laser_disc(int, QString); |
400 | 399 | |
401 | - int sig_set_d88_num(int, int); | |
402 | 400 | int sig_set_b77_num(int, int); |
403 | 401 | |
404 | 402 | // From emu_thread_slots.cpp . |
405 | 403 | int sig_set_draw_fps(double); |
406 | 404 | int sig_draw_one_turn(bool); |
407 | - int sig_update_d88_list(int, int); | |
408 | 405 | |
409 | 406 | // Signal from (EMU:: -> OSD:: ->) EMU_THREAD -> GUI(menu_foo[bar]) |
410 | 407 | int sig_ui_update_floppy_list(int, QStringList); |
@@ -835,7 +835,7 @@ public slots: | ||
835 | 835 | void do_push_apss_rewind_tape(int drive); |
836 | 836 | void set_cmt_sound(bool); |
837 | 837 | |
838 | - int write_protect_fd(int drv, bool flag); | |
838 | + int do_emu_write_protect_floppy_disk(int drv, bool flag); | |
839 | 839 | void eject_fd(int drv); |
840 | 840 | void eject_hard_disk(int drv); |
841 | 841 | virtual void do_create_d88_media(int drv, quint8 media_type, QString name) { } |
@@ -852,9 +852,8 @@ public slots: | ||
852 | 852 | virtual void eject_bubble(int drv) { } |
853 | 853 | |
854 | 854 | void _open_disk(int drv, const QString fname); |
855 | - void do_update_recent_disk(int); | |
856 | - int set_d88_slot(int drive, int num); | |
857 | 855 | int set_recent_disk(int, int); |
856 | + void do_set_write_protect_floppy_disk(int drive, bool flag); | |
858 | 857 | |
859 | 858 | void _open_hard_disk(int drv, const QString fname); |
860 | 859 | void do_update_recent_hard_disk(int); |
@@ -909,6 +908,7 @@ public slots: | ||
909 | 908 | void do_update_floppy_history(int drive, QStringList lst); |
910 | 909 | void do_insert_floppy_history(int drive, QString path); |
911 | 910 | void do_ui_floppy_insert_history(int drv, QString fname, quint64 bank); |
911 | + void do_ui_write_protect_floppy_disk(int drv, quint64 flag); | |
912 | 912 | |
913 | 913 | void do_set_emulate_cursor_as(void); |
914 | 914 | void do_set_logging_fdc(bool onoff); |
@@ -207,9 +207,8 @@ void Menu_FDClass::connect_menu_device_sub(void) | ||
207 | 207 | |
208 | 208 | connect(this, SIGNAL(sig_eject_media(int)), p_wid, SLOT(eject_fd(int))); |
209 | 209 | |
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))); | |
211 | 211 | 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))); | |
213 | 212 | } |
214 | 213 | |
215 | 214 | void Menu_FDClass::retranslate_pulldown_menu_device_sub(void) |
@@ -31,7 +31,6 @@ Menu_MetaClass::Menu_MetaClass(QMenuBar *root_entry, QString desc, std::shared_p | ||
31 | 31 | menu_root = root_entry; |
32 | 32 | |
33 | 33 | //p_emu = ep; |
34 | - p_emu = NULL; | |
35 | 34 | using_flags = p; |
36 | 35 | p_config = p->get_config_ptr(); |
37 | 36 |
@@ -315,6 +314,9 @@ void Menu_MetaClass::do_clear_inner_media(void) | ||
315 | 314 | action_select_media_list[ii]->setVisible(false); |
316 | 315 | } |
317 | 316 | } |
317 | + if(action_select_media_list[0] != nullptr) { | |
318 | + action_select_media_list[0]->setChecked(true); | |
319 | + } | |
318 | 320 | } |
319 | 321 | } |
320 | 322 |
@@ -322,8 +324,6 @@ void Menu_MetaClass::do_clear_inner_media(void) | ||
322 | 324 | void Menu_MetaClass::do_update_inner_media(QStringList lst, int num) |
323 | 325 | { |
324 | 326 | QString tmps; |
325 | - if(num < 0) return; | |
326 | - | |
327 | 327 | if(use_d88_menus) { |
328 | 328 | //inner_media_list.clear(); |
329 | 329 | do_clear_inner_media(); |
@@ -333,21 +333,17 @@ void Menu_MetaClass::do_update_inner_media(QStringList lst, int num) | ||
333 | 333 | for(auto _l = lst.begin(); _l != lst.end(); ++_l) { |
334 | 334 | if(count >= _n) break; |
335 | 335 | //inner_media_list.push_back((*_l)); |
336 | + //printf("do_update_inner_media: num=%d count=%d val=%s\n", num, count, (*_l).toLocal8Bit().constData()); | |
336 | 337 | if(action_select_media_list[count] != nullptr) { |
337 | 338 | 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 | + } | |
339 | 342 | action_select_media_list[count]->setVisible(true); |
340 | 343 | } |
341 | 344 | count++; |
342 | 345 | } |
343 | - if((num >= count) || (num < 0)) { | |
344 | - if(action_select_media_list[0] != nullptr) { | |
345 | - action_select_media_list[0]->setChecked(true); | |
346 | - } | |
347 | - } | |
348 | 346 | } |
349 | - | |
350 | - //emit sig_update_inner_fd(media_drive, inner_media_list, action_select_media_list, lst , num, use_d88_menus); | |
351 | 347 | } |
352 | 348 | |
353 | 349 | void Menu_MetaClass::do_update_inner_media_bubble(QStringList lst, int num) |
@@ -580,6 +576,6 @@ void Menu_MetaClass::retranslateUi(void) | ||
580 | 576 | |
581 | 577 | void Menu_MetaClass::setEmu(EMU_TEMPLATE *p) |
582 | 578 | { |
583 | - p_emu = p; | |
579 | + | |
584 | 580 | } |
585 | 581 |
@@ -51,7 +51,6 @@ protected: | ||
51 | 51 | std::shared_ptr<USING_FLAGS> using_flags; |
52 | 52 | QWidget *p_wid; |
53 | 53 | QMenuBar *menu_root; |
54 | - EMU_TEMPLATE *p_emu; | |
55 | 54 | config_t *p_config; |
56 | 55 | |
57 | 56 | QMenu *menu_inner_media; |
@@ -144,8 +143,6 @@ signals: | ||
144 | 143 | int sig_set_recent_media(int, int); |
145 | 144 | int sig_set_inner_slot(int, int); |
146 | 145 | 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); | |
149 | 146 | int sig_update_inner_bubble(int drv, QStringList base, class Action_Control **action_select_media_list, |
150 | 147 | QStringList lst, int num, bool use_d88_menus); |
151 | 148 | int sig_emu_update_config(); |
@@ -21,9 +21,13 @@ | ||
21 | 21 | //extern class EMU *emu; |
22 | 22 | |
23 | 23 | |
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) | |
25 | 25 | { |
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 | + | |
27 | 31 | emit sig_write_protect_floppy_disk(drv, flag); |
28 | 32 | return 0; |
29 | 33 | } |
@@ -709,7 +709,13 @@ void OSD_BASE::int_message_from_emu(EMU_MEDIA_TYPE::type_t media_type, int drive | ||
709 | 709 | // Below are update message to UI. |
710 | 710 | return; // ToDo: Implement |
711 | 711 | } |
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 | + } | |
715 | 721 | } |
@@ -770,6 +770,7 @@ signals: | ||
770 | 770 | |
771 | 771 | // To GUI 20230125 K.O |
772 | 772 | int sig_ui_floppy_insert_history(int, QString, quint64); |
773 | + int sig_floppy_disk_write_protect(int, quint64); | |
773 | 774 | }; |
774 | 775 | |
775 | 776 | QT_END_NAMESPACE |