2022-02-07 15:00:02 +06:00
|
|
|
/*
|
2023-01-08 14:25:18 +01:00
|
|
|
* 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.
|
2022-02-07 15:00:02 +06:00
|
|
|
*
|
2023-01-08 14:25:18 +01:00
|
|
|
* This file is part of the 86Box distribution.
|
2022-02-07 15:00:02 +06:00
|
|
|
*
|
2023-01-08 14:25:18 +01:00
|
|
|
* Joystick configuration UI module.
|
2022-02-07 15:00:02 +06:00
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
2023-01-08 14:25:18 +01:00
|
|
|
* Authors: Joakim L. Gilje <jgilje@jgilje.net>
|
2022-02-07 15:00:02 +06:00
|
|
|
* Cacodemon345
|
|
|
|
|
*
|
2023-01-08 14:25:18 +01:00
|
|
|
* Copyright 2021 Joakim L. Gilje
|
|
|
|
|
* Copyright 2021-2022 Cacodemon345
|
2022-02-07 15:00:02 +06:00
|
|
|
*/
|
2021-11-28 20:49:05 +01:00
|
|
|
#include "qt_machinestatus.hpp"
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
#include <86box/hdd.h>
|
|
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/86box.h>
|
|
|
|
|
#include <86box/device.h>
|
|
|
|
|
#include <86box/cartridge.h>
|
|
|
|
|
#include <86box/cassette.h>
|
|
|
|
|
#include <86box/cdrom.h>
|
2023-01-07 23:48:45 +01:00
|
|
|
#include <86box/cdrom_interface.h>
|
2021-11-28 20:49:05 +01:00
|
|
|
#include <86box/fdd.h>
|
|
|
|
|
#include <86box/hdc.h>
|
|
|
|
|
#include <86box/scsi.h>
|
|
|
|
|
#include <86box/scsi_device.h>
|
|
|
|
|
#include <86box/zip.h>
|
|
|
|
|
#include <86box/mo.h>
|
|
|
|
|
#include <86box/plat.h>
|
|
|
|
|
#include <86box/machine.h>
|
2022-08-21 16:55:47 +02:00
|
|
|
#include <86box/thread.h>
|
2021-11-28 20:49:05 +01:00
|
|
|
#include <86box/network.h>
|
|
|
|
|
#include <86box/ui.h>
|
2022-07-13 01:04:01 +02:00
|
|
|
#include <86box/machine_status.h>
|
2025-03-07 00:36:09 +06:00
|
|
|
#include <86box/config.h>
|
2025-04-02 01:10:21 +06:00
|
|
|
|
|
|
|
|
extern volatile int fdcinited;
|
2021-11-28 20:49:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#include <QIcon>
|
|
|
|
|
#include <QPicture>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QTimer>
|
2021-11-30 22:06:41 +01:00
|
|
|
#include <QStatusBar>
|
2021-12-14 00:31:55 +06:00
|
|
|
#include <QMenu>
|
2022-02-09 10:21:20 +06:00
|
|
|
#include <QScreen>
|
2021-12-14 00:31:55 +06:00
|
|
|
|
|
|
|
|
#include "qt_mediamenu.hpp"
|
|
|
|
|
#include "qt_mainwindow.hpp"
|
|
|
|
|
#include "qt_soundgain.hpp"
|
2021-12-28 16:47:10 +06:00
|
|
|
#include "qt_progsettings.hpp"
|
2025-03-29 00:13:10 +01:00
|
|
|
#include "qt_iconindicators.hpp"
|
2021-11-28 20:49:05 +01:00
|
|
|
|
2021-12-01 11:15:42 +06:00
|
|
|
#include <array>
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
extern MainWindow *main_window;
|
2021-12-14 00:31:55 +06:00
|
|
|
|
2024-09-18 09:38:47 +02:00
|
|
|
static bool sbar_initialized = false;
|
|
|
|
|
|
2021-11-28 20:49:05 +01:00
|
|
|
namespace {
|
2022-11-19 08:49:04 -05:00
|
|
|
struct PixmapSetActive {
|
|
|
|
|
QPixmap normal;
|
|
|
|
|
QPixmap active;
|
2025-03-29 00:13:10 +01:00
|
|
|
void load(const QIcon &icon);
|
|
|
|
|
};
|
|
|
|
|
struct PixmapSetDisabled {
|
|
|
|
|
QPixmap normal;
|
|
|
|
|
QPixmap disabled;
|
|
|
|
|
void load(const QIcon &icon);
|
2022-11-19 08:49:04 -05:00
|
|
|
};
|
|
|
|
|
struct PixmapSetEmpty {
|
|
|
|
|
QPixmap normal;
|
|
|
|
|
QPixmap empty;
|
2025-03-29 00:13:10 +01:00
|
|
|
void load(const QIcon &icon);
|
2022-11-19 08:49:04 -05:00
|
|
|
};
|
|
|
|
|
struct PixmapSetEmptyActive {
|
|
|
|
|
QPixmap normal;
|
|
|
|
|
QPixmap active;
|
|
|
|
|
QPixmap empty;
|
|
|
|
|
QPixmap empty_active;
|
2025-03-29 00:13:10 +01:00
|
|
|
void load(const QIcon &icon);
|
2022-11-19 08:49:04 -05:00
|
|
|
};
|
|
|
|
|
struct Pixmaps {
|
|
|
|
|
PixmapSetEmpty cartridge;
|
|
|
|
|
PixmapSetEmptyActive cassette;
|
|
|
|
|
PixmapSetEmptyActive floppy_disabled;
|
|
|
|
|
PixmapSetEmptyActive floppy_525;
|
|
|
|
|
PixmapSetEmptyActive floppy_35;
|
|
|
|
|
PixmapSetEmptyActive cdrom;
|
|
|
|
|
PixmapSetEmptyActive zip;
|
|
|
|
|
PixmapSetEmptyActive mo;
|
|
|
|
|
PixmapSetActive hd;
|
|
|
|
|
PixmapSetEmptyActive net;
|
2025-03-29 00:13:10 +01:00
|
|
|
PixmapSetDisabled sound;
|
2022-11-19 08:49:04 -05:00
|
|
|
};
|
2022-07-13 01:04:01 +02:00
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
struct StateActive {
|
|
|
|
|
std::unique_ptr<QLabel> label;
|
|
|
|
|
PixmapSetActive *pixmaps = nullptr;
|
|
|
|
|
bool active = false;
|
2022-07-13 01:04:01 +02:00
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void setActive(bool b)
|
|
|
|
|
{
|
|
|
|
|
if (!label || b == active)
|
|
|
|
|
return;
|
|
|
|
|
active = b;
|
2022-07-13 01:04:01 +02:00
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
refresh();
|
|
|
|
|
}
|
2021-11-28 20:49:05 +01:00
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void refresh()
|
|
|
|
|
{
|
|
|
|
|
if (!label)
|
|
|
|
|
return;
|
|
|
|
|
label->setPixmap(active ? pixmaps->active : pixmaps->normal);
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
2022-11-19 08:49:04 -05:00
|
|
|
};
|
|
|
|
|
struct StateEmpty {
|
|
|
|
|
std::unique_ptr<QLabel> label;
|
|
|
|
|
PixmapSetEmpty *pixmaps = nullptr;
|
|
|
|
|
bool empty = false;
|
2021-11-28 20:49:05 +01:00
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void setEmpty(bool e)
|
|
|
|
|
{
|
|
|
|
|
if (!label || e == empty)
|
|
|
|
|
return;
|
|
|
|
|
empty = e;
|
|
|
|
|
|
|
|
|
|
refresh();
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void refresh()
|
|
|
|
|
{
|
|
|
|
|
if (!label)
|
|
|
|
|
return;
|
|
|
|
|
label->setPixmap(empty ? pixmaps->empty : pixmaps->normal);
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
2022-11-19 08:49:04 -05:00
|
|
|
};
|
|
|
|
|
struct StateEmptyActive {
|
|
|
|
|
std::unique_ptr<QLabel> label;
|
|
|
|
|
PixmapSetEmptyActive *pixmaps = nullptr;
|
|
|
|
|
bool empty = false;
|
|
|
|
|
bool active = false;
|
|
|
|
|
|
|
|
|
|
void setActive(bool b)
|
|
|
|
|
{
|
|
|
|
|
if (!label || b == active)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
active = b;
|
|
|
|
|
refresh();
|
|
|
|
|
}
|
|
|
|
|
void setEmpty(bool b)
|
|
|
|
|
{
|
|
|
|
|
if (!label || b == empty)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
empty = b;
|
|
|
|
|
refresh();
|
|
|
|
|
}
|
|
|
|
|
void refresh()
|
|
|
|
|
{
|
|
|
|
|
if (!label)
|
|
|
|
|
return;
|
|
|
|
|
if (empty) {
|
|
|
|
|
label->setPixmap(active ? pixmaps->empty_active : pixmaps->empty);
|
|
|
|
|
} else {
|
|
|
|
|
label->setPixmap(active ? pixmaps->active : pixmaps->normal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static QSize pixmap_size(16, 16);
|
2025-03-29 00:13:10 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PixmapSetEmpty::load(const QIcon &icon)
|
|
|
|
|
{
|
|
|
|
|
normal = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, None);
|
|
|
|
|
empty = getIconWithIndicator(icon, pixmap_size, QIcon::Disabled, None);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
2025-03-29 00:13:10 +01:00
|
|
|
PixmapSetActive::load(const QIcon &icon)
|
2022-11-19 08:49:04 -05:00
|
|
|
{
|
2025-03-29 00:13:10 +01:00
|
|
|
normal = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, None);
|
|
|
|
|
active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Active);
|
2022-11-19 08:49:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2025-03-29 00:13:10 +01:00
|
|
|
PixmapSetDisabled::load(const QIcon &icon)
|
2022-11-19 08:49:04 -05:00
|
|
|
{
|
2025-03-29 00:13:10 +01:00
|
|
|
normal = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, None);
|
|
|
|
|
disabled = getIconWithIndicator(icon, pixmap_size, QIcon::Disabled, Disabled);
|
2022-11-19 08:49:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2025-03-29 00:13:10 +01:00
|
|
|
PixmapSetEmptyActive::load(const QIcon &icon)
|
2022-11-19 08:49:04 -05:00
|
|
|
{
|
2025-03-29 00:13:10 +01:00
|
|
|
normal = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, None);
|
|
|
|
|
active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Active);
|
|
|
|
|
empty = getIconWithIndicator(icon, pixmap_size, QIcon::Disabled, None);
|
|
|
|
|
empty_active = getIconWithIndicator(icon, pixmap_size, QIcon::Disabled, Active);
|
2022-11-19 08:49:04 -05:00
|
|
|
}
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct MachineStatus::States {
|
|
|
|
|
Pixmaps pixmaps;
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
States(QObject *parent)
|
|
|
|
|
{
|
2025-03-29 00:13:10 +01:00
|
|
|
pixmaps.cartridge.load(QIcon(":/settings/qt/icons/cartridge.ico"));
|
|
|
|
|
pixmaps.cassette.load(QIcon(":/settings/qt/icons/cassette.ico"));
|
2025-03-28 23:13:23 +01:00
|
|
|
pixmaps.floppy_disabled.normal = QIcon(":/settings/qt/icons/floppy_disabled.ico").pixmap(pixmap_size);
|
2022-11-19 08:49:04 -05:00
|
|
|
pixmaps.floppy_disabled.active = pixmaps.floppy_disabled.normal;
|
|
|
|
|
pixmaps.floppy_disabled.empty = pixmaps.floppy_disabled.normal;
|
2021-11-28 20:49:05 +01:00
|
|
|
pixmaps.floppy_disabled.empty_active = pixmaps.floppy_disabled.normal;
|
2025-03-29 00:13:10 +01:00
|
|
|
pixmaps.floppy_525.load(QIcon(":/settings/qt/icons/floppy_525.ico"));
|
|
|
|
|
pixmaps.floppy_35.load(QIcon(":/settings/qt/icons/floppy_35.ico"));
|
|
|
|
|
pixmaps.cdrom.load(QIcon(":/settings/qt/icons/cdrom.ico"));
|
|
|
|
|
pixmaps.zip.load(QIcon(":/settings/qt/icons/zip.ico"));
|
|
|
|
|
pixmaps.mo.load(QIcon(":/settings/qt/icons/mo.ico"));
|
|
|
|
|
pixmaps.hd.load(QIcon(":/settings/qt/icons/hard_disk.ico"));
|
|
|
|
|
pixmaps.net.load(QIcon(":/settings/qt/icons/network.ico"));
|
|
|
|
|
pixmaps.sound.load(QIcon(":/settings/qt/icons/sound.ico"));
|
2021-11-28 20:49:05 +01:00
|
|
|
|
|
|
|
|
cartridge[0].pixmaps = &pixmaps.cartridge;
|
|
|
|
|
cartridge[1].pixmaps = &pixmaps.cartridge;
|
2022-11-19 08:49:04 -05:00
|
|
|
cassette.pixmaps = &pixmaps.cassette;
|
|
|
|
|
for (auto &f : fdd) {
|
2021-11-28 20:49:05 +01:00
|
|
|
f.pixmaps = &pixmaps.floppy_disabled;
|
|
|
|
|
}
|
2022-11-19 08:49:04 -05:00
|
|
|
for (auto &c : cdrom) {
|
2021-11-28 20:49:05 +01:00
|
|
|
c.pixmaps = &pixmaps.cdrom;
|
|
|
|
|
}
|
2022-11-19 08:49:04 -05:00
|
|
|
for (auto &z : zip) {
|
2021-11-28 20:49:05 +01:00
|
|
|
z.pixmaps = &pixmaps.zip;
|
|
|
|
|
}
|
2022-11-19 08:49:04 -05:00
|
|
|
for (auto &m : mo) {
|
2021-11-28 20:49:05 +01:00
|
|
|
m.pixmaps = &pixmaps.mo;
|
|
|
|
|
}
|
2022-11-19 08:49:04 -05:00
|
|
|
for (auto &h : hdds) {
|
2021-11-28 20:49:05 +01:00
|
|
|
h.pixmaps = &pixmaps.hd;
|
|
|
|
|
}
|
2022-11-19 08:49:04 -05:00
|
|
|
for (auto &n : net) {
|
2022-08-27 19:08:28 +02:00
|
|
|
n.pixmaps = &pixmaps.net;
|
|
|
|
|
}
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
std::array<StateEmpty, 2> cartridge;
|
|
|
|
|
StateEmptyActive cassette;
|
|
|
|
|
std::array<StateEmptyActive, FDD_NUM> fdd;
|
|
|
|
|
std::array<StateEmptyActive, CDROM_NUM> cdrom;
|
|
|
|
|
std::array<StateEmptyActive, ZIP_NUM> zip;
|
|
|
|
|
std::array<StateEmptyActive, MO_NUM> mo;
|
|
|
|
|
std::array<StateActive, HDD_BUS_USB> hdds;
|
2022-08-28 13:56:24 +02:00
|
|
|
std::array<StateEmptyActive, NET_CARD_MAX> net;
|
2022-11-19 08:49:04 -05:00
|
|
|
std::unique_ptr<ClickableLabel> sound;
|
|
|
|
|
std::unique_ptr<QLabel> text;
|
2021-11-28 20:49:05 +01:00
|
|
|
};
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
MachineStatus::MachineStatus(QObject *parent)
|
|
|
|
|
: QObject(parent)
|
|
|
|
|
, refreshTimer(new QTimer(this))
|
2021-11-28 20:49:05 +01:00
|
|
|
{
|
|
|
|
|
d = std::make_unique<MachineStatus::States>(this);
|
2025-03-07 05:21:16 +05:00
|
|
|
soundMenu = nullptr;
|
2022-07-13 01:04:01 +02:00
|
|
|
connect(refreshTimer, &QTimer::timeout, this, &MachineStatus::refreshIcons);
|
|
|
|
|
refreshTimer->start(75);
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
|
2021-11-30 22:06:41 +01:00
|
|
|
MachineStatus::~MachineStatus() = default;
|
2021-11-28 20:49:05 +01:00
|
|
|
|
2025-03-07 00:36:09 +06:00
|
|
|
void
|
2025-04-11 05:26:01 +05:00
|
|
|
MachineStatus::setSoundMenu(QMenu* menu)
|
2025-03-07 00:36:09 +06:00
|
|
|
{
|
2025-04-11 05:26:01 +05:00
|
|
|
soundMenu = menu;
|
2025-03-07 00:36:09 +06:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
bool
|
|
|
|
|
MachineStatus::hasCassette()
|
|
|
|
|
{
|
2021-12-03 11:38:00 +01:00
|
|
|
return cassette_enable > 0 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
bool
|
|
|
|
|
MachineStatus::hasIDE()
|
|
|
|
|
{
|
2024-05-03 17:02:13 +02:00
|
|
|
return (machine_has_flags(machine, MACHINE_IDE_QUAD) > 0) || other_ide_present;
|
2021-12-03 11:38:00 +01:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
bool
|
|
|
|
|
MachineStatus::hasSCSI()
|
|
|
|
|
{
|
2024-05-03 17:02:13 +02:00
|
|
|
return (machine_has_flags(machine, MACHINE_SCSI) > 0) || other_scsi_present;
|
2021-12-03 11:38:00 +01:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::iterateFDD(const std::function<void(int)> &cb)
|
|
|
|
|
{
|
2025-04-02 01:10:21 +06:00
|
|
|
if (!fdcinited)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-12-03 11:38:00 +01:00
|
|
|
for (int i = 0; i < FDD_NUM; ++i) {
|
|
|
|
|
if (fdd_get_type(i) != 0) {
|
|
|
|
|
cb(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::iterateCDROM(const std::function<void(int)> &cb)
|
|
|
|
|
{
|
2024-07-20 03:08:04 -04:00
|
|
|
auto hdc_name = QString(hdc_get_internal_name(hdc_current[0]));
|
2021-12-03 11:38:00 +01:00
|
|
|
for (size_t i = 0; i < CDROM_NUM; i++) {
|
|
|
|
|
/* Could be Internal or External IDE.. */
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) && !hasIDE() &&
|
|
|
|
|
(hdc_name.left(3) != QStringLiteral("ide")) &&
|
|
|
|
|
(hdc_name.left(5) != QStringLiteral("xtide")) &&
|
|
|
|
|
(hdc_name.left(5) != QStringLiteral("mcide")))
|
2021-12-03 11:38:00 +01:00
|
|
|
continue;
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((cdrom[i].bus_type == CDROM_BUS_SCSI) && !hasSCSI() &&
|
|
|
|
|
(scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) &&
|
|
|
|
|
(scsi_card_current[2] == 0) && (scsi_card_current[3] == 0))
|
2021-12-03 11:38:00 +01:00
|
|
|
continue;
|
2023-01-07 23:48:45 +01:00
|
|
|
if ((cdrom[i].bus_type == CDROM_BUS_MITSUMI) && (cdrom_interface_current == 0))
|
|
|
|
|
continue;
|
2021-12-03 11:38:00 +01:00
|
|
|
if (cdrom[i].bus_type != 0) {
|
|
|
|
|
cb(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::iterateZIP(const std::function<void(int)> &cb)
|
|
|
|
|
{
|
2024-07-20 03:08:04 -04:00
|
|
|
auto hdc_name = QString(hdc_get_internal_name(hdc_current[0]));
|
2021-12-03 11:38:00 +01:00
|
|
|
for (size_t i = 0; i < ZIP_NUM; i++) {
|
|
|
|
|
/* Could be Internal or External IDE.. */
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((zip_drives[i].bus_type == ZIP_BUS_ATAPI) && !hasIDE() &&
|
|
|
|
|
(hdc_name.left(3) != QStringLiteral("ide")) &&
|
|
|
|
|
(hdc_name.left(5) != QStringLiteral("xtide")) &&
|
|
|
|
|
(hdc_name.left(5) != QStringLiteral("mcide")))
|
2021-12-03 11:38:00 +01:00
|
|
|
continue;
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && !hasSCSI() &&
|
|
|
|
|
(scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) &&
|
|
|
|
|
(scsi_card_current[2] == 0) && (scsi_card_current[3] == 0))
|
2021-12-03 11:38:00 +01:00
|
|
|
continue;
|
|
|
|
|
if (zip_drives[i].bus_type != 0) {
|
|
|
|
|
cb(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::iterateMO(const std::function<void(int)> &cb)
|
|
|
|
|
{
|
2024-07-20 03:08:04 -04:00
|
|
|
auto hdc_name = QString(hdc_get_internal_name(hdc_current[0]));
|
2021-12-03 11:38:00 +01:00
|
|
|
for (size_t i = 0; i < MO_NUM; i++) {
|
|
|
|
|
/* Could be Internal or External IDE.. */
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((mo_drives[i].bus_type == MO_BUS_ATAPI) && !hasIDE() &&
|
|
|
|
|
(hdc_name.left(3) != QStringLiteral("ide")) &&
|
|
|
|
|
(hdc_name.left(5) != QStringLiteral("xtide")) &&
|
|
|
|
|
(hdc_name.left(5) != QStringLiteral("mcide")))
|
2021-12-03 11:38:00 +01:00
|
|
|
continue;
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((mo_drives[i].bus_type == MO_BUS_SCSI) && !hasSCSI() &&
|
|
|
|
|
(scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) &&
|
|
|
|
|
(scsi_card_current[2] == 0) && (scsi_card_current[3] == 0))
|
2021-12-03 11:38:00 +01:00
|
|
|
continue;
|
|
|
|
|
if (mo_drives[i].bus_type != 0) {
|
|
|
|
|
cb(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::iterateNIC(const std::function<void(int)> &cb)
|
|
|
|
|
{
|
2022-08-27 19:08:28 +02:00
|
|
|
for (int i = 0; i < NET_CARD_MAX; i++) {
|
|
|
|
|
if (network_dev_available(i)) {
|
|
|
|
|
cb(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
static int
|
2025-01-28 16:26:28 +01:00
|
|
|
hdd_count(const int bus_type)
|
2022-11-19 08:49:04 -05:00
|
|
|
{
|
2021-11-28 20:49:05 +01:00
|
|
|
int c = 0;
|
|
|
|
|
|
2023-05-29 01:30:51 -04:00
|
|
|
for (uint8_t i = 0; i < HDD_NUM; i++) {
|
2025-01-28 16:26:28 +01:00
|
|
|
if (hdd[i].bus_type == bus_type) {
|
2021-11-28 20:49:05 +01:00
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-29 01:30:51 -04:00
|
|
|
return c;
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
|
2024-09-18 09:38:47 +02:00
|
|
|
void
|
|
|
|
|
MachineStatus::refreshEmptyIcons()
|
|
|
|
|
{
|
|
|
|
|
/* Check if icons are initialized. */
|
|
|
|
|
if (!sbar_initialized)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < FDD_NUM; ++i)
|
|
|
|
|
d->fdd[i].setEmpty(machine_status.fdd[i].empty);
|
|
|
|
|
for (size_t i = 0; i < CDROM_NUM; ++i)
|
|
|
|
|
d->cdrom[i].setEmpty(machine_status.cdrom[i].empty);
|
|
|
|
|
for (size_t i = 0; i < ZIP_NUM; i++)
|
|
|
|
|
d->zip[i].setEmpty(machine_status.zip[i].empty);
|
|
|
|
|
for (size_t i = 0; i < MO_NUM; i++)
|
|
|
|
|
d->mo[i].setEmpty(machine_status.mo[i].empty);
|
|
|
|
|
|
|
|
|
|
d->cassette.setEmpty(machine_status.cassette.empty);
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < NET_CARD_MAX; i++)
|
|
|
|
|
d->net[i].setEmpty(machine_status.net[i].empty);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; ++i)
|
|
|
|
|
d->cartridge[i].setEmpty(machine_status.cartridge[i].empty);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::refreshIcons()
|
|
|
|
|
{
|
2022-12-09 22:13:15 +02:00
|
|
|
/* Check if icons should show activity. */
|
|
|
|
|
if (!update_icons)
|
|
|
|
|
return;
|
|
|
|
|
|
2024-09-18 09:38:47 +02:00
|
|
|
for (size_t i = 0; i < FDD_NUM; ++i)
|
2022-07-13 01:04:01 +02:00
|
|
|
d->fdd[i].setActive(machine_status.fdd[i].active);
|
|
|
|
|
for (size_t i = 0; i < CDROM_NUM; ++i) {
|
|
|
|
|
d->cdrom[i].setActive(machine_status.cdrom[i].active);
|
2024-07-14 20:42:50 +02:00
|
|
|
if (machine_status.cdrom[i].active)
|
|
|
|
|
ui_sb_update_icon(SB_CDROM | i, 0);
|
2022-07-13 01:04:01 +02:00
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < ZIP_NUM; i++) {
|
|
|
|
|
d->zip[i].setActive(machine_status.zip[i].active);
|
2024-07-14 20:42:50 +02:00
|
|
|
if (machine_status.zip[i].active)
|
|
|
|
|
ui_sb_update_icon(SB_ZIP | i, 0);
|
2022-07-13 01:04:01 +02:00
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < MO_NUM; i++) {
|
|
|
|
|
d->mo[i].setActive(machine_status.mo[i].active);
|
2024-07-14 20:42:50 +02:00
|
|
|
if (machine_status.mo[i].active)
|
|
|
|
|
ui_sb_update_icon(SB_MO | i, 0);
|
2022-07-13 01:04:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < HDD_BUS_USB; i++) {
|
|
|
|
|
d->hdds[i].setActive(machine_status.hdd[i].active);
|
2024-07-14 20:42:50 +02:00
|
|
|
if (machine_status.hdd[i].active)
|
|
|
|
|
ui_sb_update_icon(SB_HDD | i, 0);
|
2022-07-13 01:04:01 +02:00
|
|
|
}
|
|
|
|
|
|
2024-09-18 09:38:47 +02:00
|
|
|
for (size_t i = 0; i < NET_CARD_MAX; i++)
|
2022-08-27 19:08:28 +02:00
|
|
|
d->net[i].setActive(machine_status.net[i].active);
|
2022-07-13 01:04:01 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-09 22:13:15 +02:00
|
|
|
void
|
|
|
|
|
MachineStatus::clearActivity()
|
|
|
|
|
{
|
|
|
|
|
for (auto &fdd : d->fdd)
|
|
|
|
|
fdd.setActive(false);
|
|
|
|
|
for (auto &cdrom : d->cdrom)
|
|
|
|
|
cdrom.setActive(false);
|
|
|
|
|
for (auto &zip : d->zip)
|
|
|
|
|
zip.setActive(false);
|
|
|
|
|
for (auto &mo : d->mo)
|
|
|
|
|
mo.setActive(false);
|
|
|
|
|
for (auto &hdd : d->hdds)
|
|
|
|
|
hdd.setActive(false);
|
|
|
|
|
for (auto &net : d->net)
|
|
|
|
|
net.setActive(false);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::refresh(QStatusBar *sbar)
|
|
|
|
|
{
|
|
|
|
|
bool has_mfm = machine_has_flags(machine, MACHINE_MFM) > 0;
|
|
|
|
|
bool has_xta = machine_has_flags(machine, MACHINE_XTA) > 0;
|
2021-12-14 13:53:56 +01:00
|
|
|
bool has_esdi = machine_has_flags(machine, MACHINE_ESDI) > 0;
|
2021-11-28 20:49:05 +01:00
|
|
|
|
2023-11-10 23:23:18 +05:00
|
|
|
int c_mfm = hdd_count(HDD_BUS_MFM);
|
|
|
|
|
int c_esdi = hdd_count(HDD_BUS_ESDI);
|
|
|
|
|
int c_xta = hdd_count(HDD_BUS_XTA);
|
|
|
|
|
int c_ide = hdd_count(HDD_BUS_IDE);
|
|
|
|
|
int c_atapi = hdd_count(HDD_BUS_ATAPI);
|
|
|
|
|
int c_scsi = hdd_count(HDD_BUS_SCSI);
|
2021-11-28 20:49:05 +01:00
|
|
|
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->removeWidget(d->cassette.label.get());
|
|
|
|
|
for (int i = 0; i < 2; ++i) {
|
|
|
|
|
sbar->removeWidget(d->cartridge[i].label.get());
|
|
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < FDD_NUM; ++i) {
|
|
|
|
|
sbar->removeWidget(d->fdd[i].label.get());
|
|
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < CDROM_NUM; i++) {
|
|
|
|
|
sbar->removeWidget(d->cdrom[i].label.get());
|
|
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < ZIP_NUM; i++) {
|
|
|
|
|
sbar->removeWidget(d->zip[i].label.get());
|
|
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < MO_NUM; i++) {
|
|
|
|
|
sbar->removeWidget(d->mo[i].label.get());
|
|
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < HDD_BUS_USB; i++) {
|
|
|
|
|
sbar->removeWidget(d->hdds[i].label.get());
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
2022-08-27 19:08:28 +02:00
|
|
|
for (size_t i = 0; i < NET_CARD_MAX; i++) {
|
|
|
|
|
sbar->removeWidget(d->net[i].label.get());
|
|
|
|
|
}
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->removeWidget(d->sound.get());
|
2021-11-28 20:49:05 +01:00
|
|
|
|
|
|
|
|
if (cassette_enable) {
|
2021-12-14 00:31:55 +06:00
|
|
|
d->cassette.label = std::make_unique<ClickableLabel>();
|
2021-11-28 20:49:05 +01:00
|
|
|
d->cassette.setEmpty(QString(cassette_fname).isEmpty());
|
2022-07-13 01:04:01 +02:00
|
|
|
d->cassette.refresh();
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->cassette.label.get(), &ClickableLabel::clicked, [](QPoint pos) {
|
2021-12-24 00:15:30 +06:00
|
|
|
MediaMenu::ptr->cassetteMenu->popup(pos - QPoint(0, MediaMenu::ptr->cassetteMenu->sizeHint().height()));
|
2021-12-14 00:31:55 +06:00
|
|
|
});
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->cassette.label.get(), &ClickableLabel::dropped, [](QString str) {
|
2022-05-24 12:01:11 +06:00
|
|
|
MediaMenu::ptr->cassetteMount(str, false);
|
|
|
|
|
});
|
2021-12-14 00:31:55 +06:00
|
|
|
d->cassette.label->setToolTip(MediaMenu::ptr->cassetteMenu->title());
|
2022-05-24 12:01:11 +06:00
|
|
|
d->cassette.label->setAcceptDrops(true);
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->addWidget(d->cassette.label.get());
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
|
2021-12-14 13:53:56 +01:00
|
|
|
if (machine_has_cartridge(machine)) {
|
2021-11-28 20:49:05 +01:00
|
|
|
for (int i = 0; i < 2; ++i) {
|
2021-12-24 00:15:30 +06:00
|
|
|
d->cartridge[i].label = std::make_unique<ClickableLabel>();
|
2021-11-28 20:49:05 +01:00
|
|
|
d->cartridge[i].setEmpty(QString(cart_fns[i]).isEmpty());
|
2022-07-13 01:04:01 +02:00
|
|
|
d->cartridge[i].refresh();
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->cartridge[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) {
|
2021-12-24 00:15:30 +06:00
|
|
|
MediaMenu::ptr->cartridgeMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->cartridgeMenus[i]->sizeHint().height()));
|
2021-12-14 00:31:55 +06:00
|
|
|
});
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->cartridge[i].label.get(), &ClickableLabel::dropped, [i](QString str) {
|
2022-05-24 12:01:11 +06:00
|
|
|
MediaMenu::ptr->cartridgeMount(i, str);
|
|
|
|
|
});
|
2021-12-14 00:31:55 +06:00
|
|
|
d->cartridge[i].label->setToolTip(MediaMenu::ptr->cartridgeMenus[i]->title());
|
2022-05-24 12:01:11 +06:00
|
|
|
d->cartridge[i].label->setAcceptDrops(true);
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->addWidget(d->cartridge[i].label.get());
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-03 11:38:00 +01:00
|
|
|
iterateFDD([this, sbar](int i) {
|
|
|
|
|
int t = fdd_get_type(i);
|
|
|
|
|
if (t == 0) {
|
|
|
|
|
d->fdd[i].pixmaps = &d->pixmaps.floppy_disabled;
|
|
|
|
|
} else if (t >= 1 && t <= 6) {
|
|
|
|
|
d->fdd[i].pixmaps = &d->pixmaps.floppy_525;
|
|
|
|
|
} else {
|
|
|
|
|
d->fdd[i].pixmaps = &d->pixmaps.floppy_35;
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
2021-12-14 00:31:55 +06:00
|
|
|
d->fdd[i].label = std::make_unique<ClickableLabel>();
|
2021-12-03 11:38:00 +01:00
|
|
|
d->fdd[i].setEmpty(QString(floppyfns[i]).isEmpty());
|
|
|
|
|
d->fdd[i].setActive(false);
|
2022-07-13 01:04:01 +02:00
|
|
|
d->fdd[i].refresh();
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->fdd[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) {
|
2021-12-24 00:15:30 +06:00
|
|
|
MediaMenu::ptr->floppyMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->floppyMenus[i]->sizeHint().height()));
|
2021-12-14 00:31:55 +06:00
|
|
|
});
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->fdd[i].label.get(), &ClickableLabel::dropped, [i](QString str) {
|
2022-05-24 02:14:45 +06:00
|
|
|
MediaMenu::ptr->floppyMount(i, str, false);
|
|
|
|
|
});
|
2021-12-14 00:31:55 +06:00
|
|
|
d->fdd[i].label->setToolTip(MediaMenu::ptr->floppyMenus[i]->title());
|
2022-05-24 02:14:45 +06:00
|
|
|
d->fdd[i].label->setAcceptDrops(true);
|
2021-12-03 11:38:00 +01:00
|
|
|
sbar->addWidget(d->fdd[i].label.get());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
iterateCDROM([this, sbar](int i) {
|
2021-12-14 00:31:55 +06:00
|
|
|
d->cdrom[i].label = std::make_unique<ClickableLabel>();
|
2024-05-20 02:15:17 +02:00
|
|
|
d->cdrom[i].setEmpty(QString(cdrom[i].image_path).isEmpty());
|
2021-12-03 11:38:00 +01:00
|
|
|
d->cdrom[i].setActive(false);
|
2022-07-13 01:04:01 +02:00
|
|
|
d->cdrom[i].refresh();
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->cdrom[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) {
|
2021-12-24 00:15:30 +06:00
|
|
|
MediaMenu::ptr->cdromMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->cdromMenus[i]->sizeHint().height()));
|
2021-12-14 00:31:55 +06:00
|
|
|
});
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->cdrom[i].label.get(), &ClickableLabel::dropped, [i](QString str) {
|
2022-05-24 02:14:45 +06:00
|
|
|
MediaMenu::ptr->cdromMount(i, str);
|
|
|
|
|
});
|
2021-12-14 00:31:55 +06:00
|
|
|
d->cdrom[i].label->setToolTip(MediaMenu::ptr->cdromMenus[i]->title());
|
2022-05-24 02:14:45 +06:00
|
|
|
d->cdrom[i].label->setAcceptDrops(true);
|
2021-12-03 11:38:00 +01:00
|
|
|
sbar->addWidget(d->cdrom[i].label.get());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
iterateZIP([this, sbar](int i) {
|
2021-12-14 00:31:55 +06:00
|
|
|
d->zip[i].label = std::make_unique<ClickableLabel>();
|
2021-12-03 11:38:00 +01:00
|
|
|
d->zip[i].setEmpty(QString(zip_drives[i].image_path).isEmpty());
|
|
|
|
|
d->zip[i].setActive(false);
|
2022-07-13 01:04:01 +02:00
|
|
|
d->zip[i].refresh();
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->zip[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) {
|
2021-12-24 00:15:30 +06:00
|
|
|
MediaMenu::ptr->zipMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->zipMenus[i]->sizeHint().height()));
|
2021-12-14 00:31:55 +06:00
|
|
|
});
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->zip[i].label.get(), &ClickableLabel::dropped, [i](QString str) {
|
2022-05-24 02:14:45 +06:00
|
|
|
MediaMenu::ptr->zipMount(i, str, false);
|
|
|
|
|
});
|
2021-12-14 00:31:55 +06:00
|
|
|
d->zip[i].label->setToolTip(MediaMenu::ptr->zipMenus[i]->title());
|
2022-05-24 02:14:45 +06:00
|
|
|
d->zip[i].label->setAcceptDrops(true);
|
2021-12-03 11:38:00 +01:00
|
|
|
sbar->addWidget(d->zip[i].label.get());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
iterateMO([this, sbar](int i) {
|
2021-12-14 00:31:55 +06:00
|
|
|
d->mo[i].label = std::make_unique<ClickableLabel>();
|
2021-12-03 11:38:00 +01:00
|
|
|
d->mo[i].setEmpty(QString(mo_drives[i].image_path).isEmpty());
|
|
|
|
|
d->mo[i].setActive(false);
|
2022-07-13 01:04:01 +02:00
|
|
|
d->mo[i].refresh();
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->mo[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) {
|
2021-12-24 00:15:30 +06:00
|
|
|
MediaMenu::ptr->moMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->moMenus[i]->sizeHint().height()));
|
2021-12-14 00:31:55 +06:00
|
|
|
});
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->mo[i].label.get(), &ClickableLabel::dropped, [i](QString str) {
|
2022-05-24 02:14:45 +06:00
|
|
|
MediaMenu::ptr->moMount(i, str, false);
|
|
|
|
|
});
|
2021-12-14 00:31:55 +06:00
|
|
|
d->mo[i].label->setToolTip(MediaMenu::ptr->moMenus[i]->title());
|
2022-05-24 02:14:45 +06:00
|
|
|
d->mo[i].label->setAcceptDrops(true);
|
2021-12-03 11:38:00 +01:00
|
|
|
sbar->addWidget(d->mo[i].label.get());
|
|
|
|
|
});
|
2021-11-28 20:49:05 +01:00
|
|
|
|
2022-08-27 19:08:28 +02:00
|
|
|
iterateNIC([this, sbar](int i) {
|
|
|
|
|
d->net[i].label = std::make_unique<ClickableLabel>();
|
2022-08-28 13:56:24 +02:00
|
|
|
d->net[i].setEmpty(!network_is_connected(i));
|
2022-08-27 19:08:28 +02:00
|
|
|
d->net[i].setActive(false);
|
|
|
|
|
d->net[i].refresh();
|
|
|
|
|
d->net[i].label->setToolTip(MediaMenu::ptr->netMenus[i]->title());
|
2022-11-19 08:49:04 -05:00
|
|
|
connect((ClickableLabel *) d->net[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) {
|
2022-08-27 19:08:28 +02:00
|
|
|
MediaMenu::ptr->netMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->netMenus[i]->sizeHint().height()));
|
|
|
|
|
});
|
|
|
|
|
sbar->addWidget(d->net[i].label.get());
|
|
|
|
|
});
|
|
|
|
|
|
2024-07-20 03:08:04 -04:00
|
|
|
auto hdc_name = QString(hdc_get_internal_name(hdc_current[0]));
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((has_mfm || (hdc_name.left(5) == QStringLiteral("st506"))) && (c_mfm > 0)) {
|
2021-11-30 22:06:41 +01:00
|
|
|
d->hdds[HDD_BUS_MFM].label = std::make_unique<QLabel>();
|
2021-11-28 20:49:05 +01:00
|
|
|
d->hdds[HDD_BUS_MFM].setActive(false);
|
2022-07-13 01:04:01 +02:00
|
|
|
d->hdds[HDD_BUS_MFM].refresh();
|
2024-03-20 18:52:51 +05:00
|
|
|
d->hdds[HDD_BUS_MFM].label->setToolTip(tr("Hard disk (%1)").arg("MFM/RLL"));
|
2025-04-21 16:13:11 +06:00
|
|
|
auto tooltip = d->hdds[HDD_BUS_MFM].label->toolTip();
|
|
|
|
|
tooltip.append("\n");
|
|
|
|
|
for (int i = 0; i < HDD_NUM; i++) {
|
|
|
|
|
if (hdd[i].bus_type == HDD_BUS_MFM && hdd[i].fn[0] != 0) {
|
2025-04-21 17:25:12 +06:00
|
|
|
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
|
2025-04-21 16:13:11 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->hdds[HDD_BUS_MFM].label->setToolTip(tooltip);
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->addWidget(d->hdds[HDD_BUS_MFM].label.get());
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((has_esdi || (hdc_name.left(4) == QStringLiteral("esdi"))) && (c_esdi > 0)) {
|
2021-11-30 22:06:41 +01:00
|
|
|
d->hdds[HDD_BUS_ESDI].label = std::make_unique<QLabel>();
|
2021-11-28 20:49:05 +01:00
|
|
|
d->hdds[HDD_BUS_ESDI].setActive(false);
|
2022-07-13 01:04:01 +02:00
|
|
|
d->hdds[HDD_BUS_ESDI].refresh();
|
2024-03-20 18:52:51 +05:00
|
|
|
d->hdds[HDD_BUS_ESDI].label->setToolTip(tr("Hard disk (%1)").arg("ESDI"));
|
2025-04-21 16:13:11 +06:00
|
|
|
auto tooltip = d->hdds[HDD_BUS_ESDI].label->toolTip();
|
|
|
|
|
tooltip.append("\n");
|
|
|
|
|
for (int i = 0; i < HDD_NUM; i++) {
|
|
|
|
|
if (hdd[i].bus_type == HDD_BUS_ESDI && hdd[i].fn[0] != 0) {
|
2025-04-21 17:25:12 +06:00
|
|
|
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
|
2025-04-21 16:13:11 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->hdds[HDD_BUS_ESDI].label->setToolTip(tooltip);
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->addWidget(d->hdds[HDD_BUS_ESDI].label.get());
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((has_xta || (hdc_name.left(3) == QStringLiteral("xta"))) && (c_xta > 0)) {
|
2021-11-30 22:06:41 +01:00
|
|
|
d->hdds[HDD_BUS_XTA].label = std::make_unique<QLabel>();
|
2021-11-28 20:49:05 +01:00
|
|
|
d->hdds[HDD_BUS_XTA].setActive(false);
|
2022-07-13 01:04:01 +02:00
|
|
|
d->hdds[HDD_BUS_XTA].refresh();
|
2024-03-20 18:52:51 +05:00
|
|
|
d->hdds[HDD_BUS_XTA].label->setToolTip(tr("Hard disk (%1)").arg("XTA"));
|
2025-04-21 16:13:11 +06:00
|
|
|
auto tooltip = d->hdds[HDD_BUS_XTA].label->toolTip();
|
|
|
|
|
tooltip.append("\n");
|
|
|
|
|
for (int i = 0; i < HDD_NUM; i++) {
|
|
|
|
|
if (hdd[i].bus_type == HDD_BUS_XTA && hdd[i].fn[0] != 0) {
|
2025-04-21 17:25:12 +06:00
|
|
|
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
|
2025-04-21 16:13:11 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->hdds[HDD_BUS_XTA].label->setToolTip(tooltip);
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->addWidget(d->hdds[HDD_BUS_XTA].label.get());
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
2024-03-02 12:50:06 +01:00
|
|
|
if (hasIDE() || (hdc_name.left(5) == QStringLiteral("xtide")) ||
|
|
|
|
|
(hdc_name.left(5) == QStringLiteral("mcide")) ||
|
|
|
|
|
(hdc_name.left(3) == QStringLiteral("ide"))) {
|
2023-11-10 23:23:18 +05:00
|
|
|
if (c_ide > 0) {
|
|
|
|
|
d->hdds[HDD_BUS_IDE].label = std::make_unique<QLabel>();
|
|
|
|
|
d->hdds[HDD_BUS_IDE].setActive(false);
|
|
|
|
|
d->hdds[HDD_BUS_IDE].refresh();
|
2024-03-20 18:52:51 +05:00
|
|
|
d->hdds[HDD_BUS_IDE].label->setToolTip(tr("Hard disk (%1)").arg("IDE"));
|
2025-04-21 16:13:11 +06:00
|
|
|
auto tooltip = d->hdds[HDD_BUS_IDE].label->toolTip();
|
|
|
|
|
tooltip.append("\n");
|
|
|
|
|
for (int i = 0; i < HDD_NUM; i++) {
|
|
|
|
|
if (hdd[i].bus_type == HDD_BUS_IDE && hdd[i].fn[0] != 0) {
|
2025-04-21 17:25:12 +06:00
|
|
|
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
|
2025-04-21 16:13:11 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->hdds[HDD_BUS_IDE].label->setToolTip(tooltip);
|
2023-11-10 23:23:18 +05:00
|
|
|
sbar->addWidget(d->hdds[HDD_BUS_IDE].label.get());
|
|
|
|
|
}
|
|
|
|
|
if (c_atapi > 0) {
|
|
|
|
|
d->hdds[HDD_BUS_ATAPI].label = std::make_unique<QLabel>();
|
|
|
|
|
d->hdds[HDD_BUS_ATAPI].setActive(false);
|
|
|
|
|
d->hdds[HDD_BUS_ATAPI].refresh();
|
2024-03-20 18:52:51 +05:00
|
|
|
d->hdds[HDD_BUS_ATAPI].label->setToolTip(tr("Hard disk (%1)").arg("ATAPI"));
|
2025-04-21 16:13:11 +06:00
|
|
|
auto tooltip = d->hdds[HDD_BUS_ATAPI].label->toolTip();
|
|
|
|
|
tooltip.append("\n");
|
|
|
|
|
for (int i = 0; i < HDD_NUM; i++) {
|
|
|
|
|
if (hdd[i].bus_type == HDD_BUS_ATAPI && hdd[i].fn[0] != 0) {
|
2025-04-21 17:25:12 +06:00
|
|
|
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
|
2025-04-21 16:13:11 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->hdds[HDD_BUS_ATAPI].label->setToolTip(tooltip);
|
2023-11-10 23:23:18 +05:00
|
|
|
sbar->addWidget(d->hdds[HDD_BUS_ATAPI].label.get());
|
|
|
|
|
}
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
2024-03-02 12:50:06 +01:00
|
|
|
if ((hasSCSI() ||
|
|
|
|
|
(scsi_card_current[0] != 0) || (scsi_card_current[1] != 0) ||
|
|
|
|
|
(scsi_card_current[2] != 0) || (scsi_card_current[3] != 0)) &&
|
|
|
|
|
(c_scsi > 0)) {
|
2021-11-30 22:06:41 +01:00
|
|
|
d->hdds[HDD_BUS_SCSI].label = std::make_unique<QLabel>();
|
2021-11-28 20:49:05 +01:00
|
|
|
d->hdds[HDD_BUS_SCSI].setActive(false);
|
2022-07-13 01:04:01 +02:00
|
|
|
d->hdds[HDD_BUS_SCSI].refresh();
|
2024-03-20 18:52:51 +05:00
|
|
|
d->hdds[HDD_BUS_SCSI].label->setToolTip(tr("Hard disk (%1)").arg("SCSI"));
|
2025-04-21 16:13:11 +06:00
|
|
|
auto tooltip = d->hdds[HDD_BUS_SCSI].label->toolTip();
|
|
|
|
|
tooltip.append("\n");
|
|
|
|
|
for (int i = 0; i < HDD_NUM; i++) {
|
|
|
|
|
if (hdd[i].bus_type == HDD_BUS_SCSI && hdd[i].fn[0] != 0) {
|
2025-04-21 17:25:12 +06:00
|
|
|
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 4), QString::asprintf("%02d", hdd[i].channel & 15), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
|
2025-04-21 16:13:11 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->hdds[HDD_BUS_SCSI].label->setToolTip(tooltip);
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->addWidget(d->hdds[HDD_BUS_SCSI].label.get());
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
|
2021-12-14 00:31:55 +06:00
|
|
|
d->sound = std::make_unique<ClickableLabel>();
|
2025-03-29 00:13:10 +01:00
|
|
|
d->sound->setPixmap(sound_muted ? d->pixmaps.sound.disabled : d->pixmaps.sound.normal);
|
2025-03-28 23:13:23 +01:00
|
|
|
|
2025-03-07 00:36:09 +06:00
|
|
|
connect(d->sound.get(), &ClickableLabel::clicked, this, [this](QPoint pos) {
|
|
|
|
|
this->soundMenu->popup(pos - QPoint(0, this->soundMenu->sizeHint().height()));
|
2021-12-14 00:31:55 +06:00
|
|
|
});
|
2025-03-07 00:36:09 +06:00
|
|
|
|
2022-01-07 16:21:40 +06:00
|
|
|
d->sound->setToolTip(tr("Sound"));
|
2021-11-30 22:06:41 +01:00
|
|
|
sbar->addWidget(d->sound.get());
|
2021-12-03 11:38:00 +01:00
|
|
|
d->text = std::make_unique<QLabel>();
|
|
|
|
|
sbar->addWidget(d->text.get());
|
2024-09-18 09:38:47 +02:00
|
|
|
|
|
|
|
|
sbar_initialized = true;
|
|
|
|
|
|
|
|
|
|
refreshEmptyIcons();
|
2021-11-28 20:49:05 +01:00
|
|
|
}
|
|
|
|
|
|
2025-04-11 05:26:01 +05:00
|
|
|
void
|
|
|
|
|
MachineStatus::updateSoundIcon()
|
|
|
|
|
{
|
|
|
|
|
if (d->sound)
|
|
|
|
|
d->sound->setPixmap(sound_muted ? d->pixmaps.sound.disabled : d->pixmaps.sound.normal);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::message(const QString &msg)
|
|
|
|
|
{
|
2021-12-03 11:38:00 +01:00
|
|
|
d->text->setText(msg);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
QString
|
|
|
|
|
MachineStatus::getMessage()
|
|
|
|
|
{
|
2021-12-28 16:47:10 +06:00
|
|
|
return d->text->text();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
MachineStatus::updateTip(int tag)
|
2021-12-14 00:31:55 +06:00
|
|
|
{
|
|
|
|
|
int category = tag & 0xfffffff0;
|
2022-11-19 08:49:04 -05:00
|
|
|
int item = tag & 0xf;
|
|
|
|
|
if (!MediaMenu::ptr)
|
|
|
|
|
return;
|
2021-12-14 00:31:55 +06:00
|
|
|
switch (category) {
|
2022-11-19 08:49:04 -05:00
|
|
|
case SB_CASSETTE:
|
|
|
|
|
if (d->cassette.label && MediaMenu::ptr->cassetteMenu)
|
|
|
|
|
d->cassette.label->setToolTip(MediaMenu::ptr->cassetteMenu->title());
|
|
|
|
|
break;
|
|
|
|
|
case SB_CARTRIDGE:
|
|
|
|
|
if (d->cartridge[item].label && MediaMenu::ptr->cartridgeMenus[item])
|
|
|
|
|
d->cartridge[item].label->setToolTip(MediaMenu::ptr->cartridgeMenus[item]->title());
|
|
|
|
|
break;
|
|
|
|
|
case SB_FLOPPY:
|
|
|
|
|
if (d->fdd[item].label && MediaMenu::ptr->floppyMenus[item])
|
|
|
|
|
d->fdd[item].label->setToolTip(MediaMenu::ptr->floppyMenus[item]->title());
|
|
|
|
|
break;
|
|
|
|
|
case SB_CDROM:
|
|
|
|
|
if (d->cdrom[item].label && MediaMenu::ptr->cdromMenus[item])
|
|
|
|
|
d->cdrom[item].label->setToolTip(MediaMenu::ptr->cdromMenus[item]->title());
|
|
|
|
|
break;
|
|
|
|
|
case SB_ZIP:
|
|
|
|
|
if (d->zip[item].label && MediaMenu::ptr->zipMenus[item])
|
|
|
|
|
d->zip[item].label->setToolTip(MediaMenu::ptr->zipMenus[item]->title());
|
|
|
|
|
break;
|
|
|
|
|
case SB_MO:
|
|
|
|
|
if (d->mo[item].label && MediaMenu::ptr->moMenus[item])
|
|
|
|
|
d->mo[item].label->setToolTip(MediaMenu::ptr->moMenus[item]->title());
|
|
|
|
|
break;
|
|
|
|
|
case SB_HDD:
|
|
|
|
|
break;
|
|
|
|
|
case SB_NETWORK:
|
|
|
|
|
break;
|
|
|
|
|
case SB_SOUND:
|
|
|
|
|
break;
|
|
|
|
|
case SB_TEXT:
|
|
|
|
|
break;
|
2021-12-14 00:31:55 +06:00
|
|
|
}
|
2024-09-18 09:38:47 +02:00
|
|
|
|
|
|
|
|
refreshEmptyIcons();
|
2021-12-14 00:31:55 +06:00
|
|
|
}
|