diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index e189ec569..422989a44 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -61,7 +61,6 @@ add_library(plat STATIC add_library(ui STATIC qt_ui.cpp - qt_cdrom.c qt_mainwindow.cpp qt_mainwindow.hpp diff --git a/src/qt/qt_cdrom.c b/src/qt/qt_cdrom.c deleted file mode 100644 index 1facae486..000000000 --- a/src/qt/qt_cdrom.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 86Box A hypervisor and IBM PC system emulator that specializes in - * running old operating systems and software designed for IBM - * PC systems and compatibles from 1981 through fairly recent - * system designs based on the PCI bus. - * - * This file is part of the 86Box distribution. - * - * Handle the platform-side of CDROM/ZIP/MO drives. - * - * - * - * Authors: Miran Grca, - * Fred N. van Kempen, - * - * Copyright 2016-2018 Miran Grca. - * Copyright 2017-2018 Fred N. van Kempen. - */ - -#include -#include -#include -#include -#include -#include <86box/86box.h> -#include <86box/config.h> -#include <86box/timer.h> -#include <86box/device.h> -#include <86box/cassette.h> -#include <86box/cartridge.h> -#include <86box/fdd.h> -#include <86box/hdd.h> -#include <86box/scsi_device.h> -#include <86box/cdrom.h> -#include <86box/mo.h> -#include <86box/zip.h> -#include <86box/scsi_disk.h> -#include <86box/plat.h> -#include <86box/ui.h> - -void -plat_cdrom_ui_update(uint8_t id, uint8_t reload) -{ - cdrom_t *drv = &cdrom[id]; - - if (drv->host_drive == 0) { - ui_sb_update_icon_state(SB_CDROM | id, 1); - } else { - ui_sb_update_icon_state(SB_CDROM | id, 0); - } - - // media_menu_update_cdrom(id); - ui_sb_update_tip(SB_CDROM | id); -} diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index 541e31190..2365fb728 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -521,6 +521,23 @@ MediaMenu::cdromReload(int index, int slot) ui_sb_update_tip(SB_CDROM | index); } +void +MediaMenu::cdromUpdateUi(int i) +{ + cdrom_t *drv = &cdrom[i]; + + if (drv->host_drive == 0) { + mhm.addImageToHistory(i, ui::MediaType::Optical, drv->prev_image_path, QString()); + ui_sb_update_icon_state(SB_CDROM | i, 1); + } else { + mhm.addImageToHistory(i, ui::MediaType::Optical, drv->prev_image_path, drv->image_path); + ui_sb_update_icon_state(SB_CDROM | i, 0); + } + + cdromUpdateMenu(i); + ui_sb_update_tip(SB_CDROM | i); +} + void MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) { @@ -892,6 +909,12 @@ MediaMenu::getMediaOpenDirectory() // callbacks from 86box C code extern "C" { +void +plat_cdrom_ui_update(uint8_t id, uint8_t reload) +{ + MediaMenu::ptr->cdromUpdateUi(id); +} + void zip_eject(uint8_t id) { diff --git a/src/qt/qt_mediamenu.hpp b/src/qt/qt_mediamenu.hpp index 57fd8dfc2..03d046847 100644 --- a/src/qt/qt_mediamenu.hpp +++ b/src/qt/qt_mediamenu.hpp @@ -45,6 +45,7 @@ public: void cdromMount(int i, const QString &filename); void cdromEject(int i); void cdromReload(int index, int slot); + void cdromUpdateUi(int i); void updateImageHistory(int index, int slot, ui::MediaType type); void clearImageHistory(); void cdromUpdateMenu(int i);