Qt: Fix CD-ROM menu not updating after ejecting a CD from the guest
This commit is contained in:
@@ -61,7 +61,6 @@ add_library(plat STATIC
|
|||||||
|
|
||||||
add_library(ui STATIC
|
add_library(ui STATIC
|
||||||
qt_ui.cpp
|
qt_ui.cpp
|
||||||
qt_cdrom.c
|
|
||||||
|
|
||||||
qt_mainwindow.cpp
|
qt_mainwindow.cpp
|
||||||
qt_mainwindow.hpp
|
qt_mainwindow.hpp
|
||||||
|
@@ -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, <mgrca8@gmail.com>
|
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
|
||||||
*
|
|
||||||
* Copyright 2016-2018 Miran Grca.
|
|
||||||
* Copyright 2017-2018 Fred N. van Kempen.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#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);
|
|
||||||
}
|
|
@@ -521,6 +521,23 @@ MediaMenu::cdromReload(int index, int slot)
|
|||||||
ui_sb_update_tip(SB_CDROM | index);
|
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
|
void
|
||||||
MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||||
{
|
{
|
||||||
@@ -892,6 +909,12 @@ MediaMenu::getMediaOpenDirectory()
|
|||||||
// callbacks from 86box C code
|
// callbacks from 86box C code
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
void
|
||||||
|
plat_cdrom_ui_update(uint8_t id, uint8_t reload)
|
||||||
|
{
|
||||||
|
MediaMenu::ptr->cdromUpdateUi(id);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
zip_eject(uint8_t id)
|
zip_eject(uint8_t id)
|
||||||
{
|
{
|
||||||
|
@@ -45,6 +45,7 @@ public:
|
|||||||
void cdromMount(int i, const QString &filename);
|
void cdromMount(int i, const QString &filename);
|
||||||
void cdromEject(int i);
|
void cdromEject(int i);
|
||||||
void cdromReload(int index, int slot);
|
void cdromReload(int index, int slot);
|
||||||
|
void cdromUpdateUi(int i);
|
||||||
void updateImageHistory(int index, int slot, ui::MediaType type);
|
void updateImageHistory(int index, int slot, ui::MediaType type);
|
||||||
void clearImageHistory();
|
void clearImageHistory();
|
||||||
void cdromUpdateMenu(int i);
|
void cdromUpdateMenu(int i);
|
||||||
|
Reference in New Issue
Block a user