2022-02-07 15:00:02 +06:00
|
|
|
/*
|
2023-01-06 15:36:05 -05: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-06 15:36:05 -05:00
|
|
|
* This file is part of the 86Box distribution.
|
2022-02-07 15:00:02 +06:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Other removable devices configuration UI module.
|
2022-02-07 15:00:02 +06:00
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Authors: Joakim L. Gilje <jgilje@jgilje.net>
|
2022-02-07 16:11:13 +06:00
|
|
|
* Cacodemon345
|
2022-02-07 15:00:02 +06:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Copyright 2021-2022 Cacodemon345
|
|
|
|
|
* Copyright 2021 Joakim L. Gilje
|
2022-02-07 15:00:02 +06:00
|
|
|
*/
|
2021-11-25 10:20:56 +01:00
|
|
|
#include "qt_settingsotherremovable.hpp"
|
|
|
|
|
#include "ui_qt_settingsotherremovable.h"
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/scsi_device.h>
|
|
|
|
|
#include <86box/mo.h>
|
2025-07-25 16:30:40 +02:00
|
|
|
#include <86box/rdisk.h>
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
|
|
|
|
|
|
#include "qt_models_common.hpp"
|
|
|
|
|
#include "qt_harddrive_common.hpp"
|
2022-01-10 01:12:23 +06:00
|
|
|
#include "qt_settings_bus_tracking.hpp"
|
2021-12-28 16:47:10 +06:00
|
|
|
#include "qt_progsettings.hpp"
|
2021-11-25 10:20:56 +01:00
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
static QString
|
|
|
|
|
moDriveTypeName(int i)
|
|
|
|
|
{
|
2023-08-16 05:23:03 +02:00
|
|
|
return QString("%1 %2 %3").arg(mo_drive_types[i].vendor, mo_drive_types[i].model,
|
|
|
|
|
mo_drive_types[i].revision);
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
static QString
|
|
|
|
|
rdiskDriveTypeName(int i)
|
|
|
|
|
{
|
|
|
|
|
return QString("%1 %2 %3").arg(rdisk_drive_types[i].vendor, rdisk_drive_types[i].model,
|
|
|
|
|
rdisk_drive_types[i].revision);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
static void
|
|
|
|
|
setMOBus(QAbstractItemModel *model, const QModelIndex &idx, uint8_t bus, uint8_t channel)
|
|
|
|
|
{
|
2021-11-25 10:20:56 +01:00
|
|
|
QIcon icon;
|
|
|
|
|
switch (bus) {
|
2022-11-19 08:49:04 -05:00
|
|
|
case MO_BUS_DISABLED:
|
2025-03-28 23:13:23 +01:00
|
|
|
icon = QIcon(":/settings/qt/icons/mo_disabled.ico");
|
2022-11-19 08:49:04 -05:00
|
|
|
break;
|
|
|
|
|
case MO_BUS_ATAPI:
|
|
|
|
|
case MO_BUS_SCSI:
|
2025-03-28 23:13:23 +01:00
|
|
|
icon = QIcon(":/settings/qt/icons/mo.ico");
|
2022-11-19 08:49:04 -05:00
|
|
|
break;
|
2023-08-21 20:23:52 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto i = idx.siblingAtColumn(0);
|
|
|
|
|
model->setData(i, Harddrives::BusChannelName(bus, channel));
|
|
|
|
|
model->setData(i, bus, Qt::UserRole);
|
|
|
|
|
model->setData(i, channel, Qt::UserRole + 1);
|
|
|
|
|
model->setData(i, icon, Qt::DecorationRole);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
static void
|
2025-07-25 16:30:40 +02:00
|
|
|
setRDiskBus(QAbstractItemModel *model, const QModelIndex &idx, uint8_t bus, uint8_t channel)
|
2022-11-19 08:49:04 -05:00
|
|
|
{
|
2021-11-25 10:20:56 +01:00
|
|
|
QIcon icon;
|
|
|
|
|
switch (bus) {
|
2025-07-25 16:30:40 +02:00
|
|
|
case RDISK_BUS_DISABLED:
|
|
|
|
|
icon = QIcon(":/settings/qt/icons/rdisk_disabled.ico");
|
2022-11-19 08:49:04 -05:00
|
|
|
break;
|
2025-07-25 16:30:40 +02:00
|
|
|
case RDISK_BUS_ATAPI:
|
|
|
|
|
case RDISK_BUS_SCSI:
|
|
|
|
|
icon = QIcon(":/settings/qt/icons/rdisk.ico");
|
2022-11-19 08:49:04 -05:00
|
|
|
break;
|
2023-08-21 20:23:52 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto i = idx.siblingAtColumn(0);
|
|
|
|
|
model->setData(i, Harddrives::BusChannelName(bus, channel));
|
|
|
|
|
model->setData(i, bus, Qt::UserRole);
|
|
|
|
|
model->setData(i, channel, Qt::UserRole + 1);
|
|
|
|
|
model->setData(i, icon, Qt::DecorationRole);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
static void
|
2025-07-25 16:30:40 +02:00
|
|
|
setMOType(QAbstractItemModel *model, const QModelIndex &idx, uint32_t type)
|
2022-11-19 08:49:04 -05:00
|
|
|
{
|
2021-11-25 10:20:56 +01:00
|
|
|
auto i = idx.siblingAtColumn(1);
|
2025-07-25 16:30:40 +02:00
|
|
|
if (idx.siblingAtColumn(0).data(Qt::UserRole).toUInt() == MO_BUS_DISABLED)
|
|
|
|
|
model->setData(i, QCoreApplication::translate("", "None"));
|
|
|
|
|
else
|
|
|
|
|
model->setData(i, moDriveTypeName(type));
|
|
|
|
|
model->setData(i, type, Qt::UserRole);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
setRDiskType(QAbstractItemModel *model, const QModelIndex &idx, uint32_t type)
|
|
|
|
|
{
|
|
|
|
|
auto i = idx.siblingAtColumn(1);
|
|
|
|
|
if (idx.siblingAtColumn(0).data(Qt::UserRole).toUInt() == RDISK_BUS_DISABLED)
|
|
|
|
|
model->setData(i, QCoreApplication::translate("", "None"));
|
|
|
|
|
else
|
|
|
|
|
model->setData(i, rdiskDriveTypeName(type));
|
|
|
|
|
model->setData(i, type, Qt::UserRole);
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
SettingsOtherRemovable::SettingsOtherRemovable(QWidget *parent)
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
, ui(new Ui::SettingsOtherRemovable)
|
2021-11-25 10:20:56 +01:00
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
Harddrives::populateRemovableBuses(ui->comboBoxMOBus->model());
|
2025-07-25 16:26:36 +06:00
|
|
|
ui->comboBoxMOBus->model()->removeRows(3, ui->comboBoxMOBus->model()->rowCount() - 3);
|
2022-11-19 08:49:04 -05:00
|
|
|
auto *model = ui->comboBoxMOType->model();
|
2021-11-25 10:20:56 +01:00
|
|
|
for (uint32_t i = 0; i < KNOWN_MO_DRIVE_TYPES; i++) {
|
|
|
|
|
Models::AddEntry(model, moDriveTypeName(i), i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model = new QStandardItemModel(0, 2, this);
|
|
|
|
|
ui->tableViewMO->setModel(model);
|
2022-01-07 01:58:18 +06:00
|
|
|
model->setHeaderData(0, Qt::Horizontal, tr("Bus"));
|
|
|
|
|
model->setHeaderData(1, Qt::Horizontal, tr("Type"));
|
2021-11-25 10:20:56 +01:00
|
|
|
model->insertRows(0, MO_NUM);
|
|
|
|
|
for (int i = 0; i < MO_NUM; i++) {
|
|
|
|
|
auto idx = model->index(i, 0);
|
|
|
|
|
setMOBus(model, idx, mo_drives[i].bus_type, mo_drives[i].res);
|
|
|
|
|
setMOType(model, idx.siblingAtColumn(1), mo_drives[i].type);
|
2022-01-10 01:12:23 +06:00
|
|
|
Harddrives::busTrackClass->device_track(1, DEV_MO, mo_drives[i].bus_type, mo_drives[i].bus_type == MO_BUS_ATAPI ? mo_drives[i].ide_channel : mo_drives[i].scsi_device_id);
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
ui->tableViewMO->resizeColumnsToContents();
|
|
|
|
|
ui->tableViewMO->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
|
|
|
|
|
|
|
|
|
connect(ui->tableViewMO->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &SettingsOtherRemovable::onMORowChanged);
|
|
|
|
|
ui->tableViewMO->setCurrentIndex(model->index(0, 0));
|
|
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
Harddrives::populateRemovableBuses(ui->comboBoxRDiskBus->model());
|
2025-07-26 01:13:59 +06:00
|
|
|
if ((ui->comboBoxRDiskBus->model()->rowCount() - 3) > 0)
|
|
|
|
|
ui->comboBoxRDiskBus->model()->removeRows(3, ui->comboBoxRDiskBus->model()->rowCount() - 3);
|
2025-07-25 16:30:40 +02:00
|
|
|
model = ui->comboBoxRDiskType->model();
|
|
|
|
|
for (uint32_t i = 0; i < KNOWN_RDISK_DRIVE_TYPES; i++) {
|
|
|
|
|
Models::AddEntry(model, rdiskDriveTypeName(i), i);
|
|
|
|
|
}
|
2021-11-25 10:20:56 +01:00
|
|
|
|
|
|
|
|
model = new QStandardItemModel(0, 2, this);
|
2025-07-25 16:30:40 +02:00
|
|
|
ui->tableViewRDisk->setModel(model);
|
2024-03-20 23:35:03 +02:00
|
|
|
model->setHeaderData(0, Qt::Horizontal, tr("Bus"));
|
|
|
|
|
model->setHeaderData(1, Qt::Horizontal, tr("Type"));
|
2025-07-25 16:30:40 +02:00
|
|
|
model->insertRows(0, RDISK_NUM);
|
|
|
|
|
for (int i = 0; i < RDISK_NUM; i++) {
|
2021-11-25 10:20:56 +01:00
|
|
|
auto idx = model->index(i, 0);
|
2025-07-25 16:30:40 +02:00
|
|
|
setRDiskBus(model, idx, rdisk_drives[i].bus_type, rdisk_drives[i].res);
|
|
|
|
|
setRDiskType(model, idx.siblingAtColumn(1), rdisk_drives[i].type);
|
|
|
|
|
Harddrives::busTrackClass->device_track(1, DEV_MO, rdisk_drives[i].bus_type, rdisk_drives[i].bus_type == RDISK_BUS_ATAPI ? rdisk_drives[i].ide_channel : rdisk_drives[i].scsi_device_id);
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
2025-07-25 16:30:40 +02:00
|
|
|
ui->tableViewRDisk->resizeColumnsToContents();
|
|
|
|
|
ui->tableViewRDisk->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
2021-11-25 10:20:56 +01:00
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
connect(ui->tableViewRDisk->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &SettingsOtherRemovable::onRDiskRowChanged);
|
|
|
|
|
ui->tableViewRDisk->setCurrentIndex(model->index(0, 0));
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SettingsOtherRemovable::~SettingsOtherRemovable()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::save()
|
|
|
|
|
{
|
2023-08-21 20:23:52 -04:00
|
|
|
const auto *model = ui->tableViewMO->model();
|
|
|
|
|
for (uint8_t i = 0; i < MO_NUM; i++) {
|
|
|
|
|
mo_drives[i].fp = NULL;
|
2022-11-19 08:49:04 -05:00
|
|
|
mo_drives[i].priv = NULL;
|
2021-11-25 10:20:56 +01:00
|
|
|
mo_drives[i].bus_type = model->index(i, 0).data(Qt::UserRole).toUInt();
|
2022-11-19 08:49:04 -05:00
|
|
|
mo_drives[i].res = model->index(i, 0).data(Qt::UserRole + 1).toUInt();
|
|
|
|
|
mo_drives[i].type = model->index(i, 1).data(Qt::UserRole).toUInt();
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
model = ui->tableViewRDisk->model();
|
|
|
|
|
for (uint8_t i = 0; i < RDISK_NUM; i++) {
|
|
|
|
|
rdisk_drives[i].fp = NULL;
|
|
|
|
|
rdisk_drives[i].priv = NULL;
|
|
|
|
|
rdisk_drives[i].bus_type = model->index(i, 0).data(Qt::UserRole).toUInt();
|
|
|
|
|
rdisk_drives[i].res = model->index(i, 0).data(Qt::UserRole + 1).toUInt();
|
|
|
|
|
rdisk_drives[i].type = model->index(i, 1).data(Qt::UserRole).toUInt();
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::onMORowChanged(const QModelIndex ¤t)
|
|
|
|
|
{
|
|
|
|
|
uint8_t bus = current.siblingAtColumn(0).data(Qt::UserRole).toUInt();
|
2021-11-25 10:20:56 +01:00
|
|
|
uint8_t channel = current.siblingAtColumn(0).data(Qt::UserRole + 1).toUInt();
|
2022-11-19 08:49:04 -05:00
|
|
|
uint8_t type = current.siblingAtColumn(1).data(Qt::UserRole).toUInt();
|
2021-11-25 10:20:56 +01:00
|
|
|
|
|
|
|
|
ui->comboBoxMOBus->setCurrentIndex(-1);
|
2023-08-21 20:23:52 -04:00
|
|
|
const auto *model = ui->comboBoxMOBus->model();
|
|
|
|
|
auto match = model->match(model->index(0, 0), Qt::UserRole, bus);
|
2023-08-16 05:23:03 +02:00
|
|
|
if (!match.isEmpty())
|
2021-11-25 10:20:56 +01:00
|
|
|
ui->comboBoxMOBus->setCurrentIndex(match.first().row());
|
|
|
|
|
|
|
|
|
|
model = ui->comboBoxMOChannel->model();
|
|
|
|
|
match = model->match(model->index(0, 0), Qt::UserRole, channel);
|
2023-08-16 05:23:03 +02:00
|
|
|
if (!match.isEmpty())
|
2021-11-25 10:20:56 +01:00
|
|
|
ui->comboBoxMOChannel->setCurrentIndex(match.first().row());
|
|
|
|
|
ui->comboBoxMOType->setCurrentIndex(type);
|
2024-05-03 17:02:13 +02:00
|
|
|
enableCurrentlySelectedChannel_MO();
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
2025-07-25 16:30:40 +02:00
|
|
|
SettingsOtherRemovable::onRDiskRowChanged(const QModelIndex ¤t)
|
2022-11-19 08:49:04 -05:00
|
|
|
{
|
|
|
|
|
uint8_t bus = current.siblingAtColumn(0).data(Qt::UserRole).toUInt();
|
2021-11-25 10:20:56 +01:00
|
|
|
uint8_t channel = current.siblingAtColumn(0).data(Qt::UserRole + 1).toUInt();
|
2025-07-25 16:30:40 +02:00
|
|
|
uint8_t type = current.siblingAtColumn(1).data(Qt::UserRole).toUInt();
|
2021-11-25 10:20:56 +01:00
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
ui->comboBoxRDiskBus->setCurrentIndex(-1);
|
|
|
|
|
const auto *model = ui->comboBoxRDiskBus->model();
|
2023-08-21 20:23:52 -04:00
|
|
|
auto match = model->match(model->index(0, 0), Qt::UserRole, bus);
|
2023-08-16 05:23:03 +02:00
|
|
|
if (!match.isEmpty())
|
2025-07-25 16:30:40 +02:00
|
|
|
ui->comboBoxRDiskBus->setCurrentIndex(match.first().row());
|
2021-11-25 10:20:56 +01:00
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
model = ui->comboBoxRDiskChannel->model();
|
2021-11-25 10:20:56 +01:00
|
|
|
match = model->match(model->index(0, 0), Qt::UserRole, channel);
|
2023-08-16 05:23:03 +02:00
|
|
|
if (!match.isEmpty())
|
2025-07-25 16:30:40 +02:00
|
|
|
ui->comboBoxRDiskChannel->setCurrentIndex(match.first().row());
|
|
|
|
|
ui->comboBoxRDiskType->setCurrentIndex(type);
|
|
|
|
|
enableCurrentlySelectedChannel_RDisk();
|
2024-05-03 17:02:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::reloadBusChannels_MO() {
|
|
|
|
|
auto selected = ui->comboBoxMOChannel->currentIndex();
|
|
|
|
|
Harddrives::populateBusChannels(ui->comboBoxMOChannel->model(),
|
|
|
|
|
ui->comboBoxMOBus->currentData().toInt(), Harddrives::busTrackClass);
|
|
|
|
|
ui->comboBoxMOChannel->setCurrentIndex(selected);
|
|
|
|
|
enableCurrentlySelectedChannel_MO();
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::reloadBusChannels_RDisk() {
|
|
|
|
|
auto selected = ui->comboBoxRDiskChannel->currentIndex();
|
|
|
|
|
Harddrives::populateBusChannels(ui->comboBoxRDiskChannel->model(),
|
|
|
|
|
ui->comboBoxRDiskBus->currentData().toInt(), Harddrives::busTrackClass);
|
|
|
|
|
ui->comboBoxRDiskChannel->setCurrentIndex(selected);
|
|
|
|
|
enableCurrentlySelectedChannel_RDisk();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::on_comboBoxMOBus_currentIndexChanged(int index)
|
|
|
|
|
{
|
2023-08-16 05:23:03 +02:00
|
|
|
if (index >= 0) {
|
|
|
|
|
int bus = ui->comboBoxMOBus->currentData().toInt();
|
|
|
|
|
bool enabled = (bus != MO_BUS_DISABLED);
|
|
|
|
|
ui->comboBoxMOChannel->setEnabled(enabled);
|
|
|
|
|
ui->comboBoxMOType->setEnabled(enabled);
|
2024-05-03 17:02:13 +02:00
|
|
|
Harddrives::populateBusChannels(ui->comboBoxMOChannel->model(), bus, Harddrives::busTrackClass);
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::on_comboBoxRDiskBus_currentIndexChanged(int index)
|
|
|
|
|
{
|
|
|
|
|
if (index >= 0) {
|
|
|
|
|
int bus = ui->comboBoxRDiskBus->currentData().toInt();
|
|
|
|
|
bool enabled = (bus != RDISK_BUS_DISABLED);
|
|
|
|
|
ui->comboBoxRDiskChannel->setEnabled(enabled);
|
|
|
|
|
ui->comboBoxRDiskType->setEnabled(enabled);
|
|
|
|
|
Harddrives::populateBusChannels(ui->comboBoxRDiskChannel->model(), bus, Harddrives::busTrackClass);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::on_comboBoxMOBus_activated(int)
|
|
|
|
|
{
|
2022-01-10 01:12:23 +06:00
|
|
|
auto i = ui->tableViewMO->selectionModel()->currentIndex().siblingAtColumn(0);
|
2023-08-16 05:23:03 +02:00
|
|
|
Harddrives::busTrackClass->device_track(0, DEV_MO, ui->tableViewMO->model()->data(i,
|
|
|
|
|
Qt::UserRole).toInt(), ui->tableViewMO->model()->data(i,
|
|
|
|
|
Qt::UserRole + 1).toInt());
|
2025-07-25 16:30:40 +02:00
|
|
|
ui->comboBoxMOChannel->setCurrentIndex(ui->comboBoxMOBus->currentData().toUInt() == MO_BUS_ATAPI ?
|
|
|
|
|
Harddrives::busTrackClass->next_free_ide_channel() :
|
|
|
|
|
Harddrives::busTrackClass->next_free_scsi_id());
|
2022-01-10 01:12:23 +06:00
|
|
|
ui->tableViewMO->model()->data(i, Qt::UserRole + 1);
|
2023-08-16 05:23:03 +02:00
|
|
|
setMOBus(ui->tableViewMO->model(),
|
|
|
|
|
ui->tableViewMO->selectionModel()->currentIndex(),
|
|
|
|
|
ui->comboBoxMOBus->currentData().toUInt(),
|
|
|
|
|
ui->comboBoxMOChannel->currentData().toUInt());
|
|
|
|
|
setMOType(ui->tableViewMO->model(),
|
|
|
|
|
ui->tableViewMO->selectionModel()->currentIndex(),
|
|
|
|
|
ui->comboBoxMOType->currentData().toUInt());
|
2021-11-25 10:20:56 +01:00
|
|
|
ui->tableViewMO->resizeColumnsToContents();
|
|
|
|
|
ui->tableViewMO->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
2023-08-16 05:23:03 +02:00
|
|
|
Harddrives::busTrackClass->device_track(1, DEV_MO, ui->tableViewMO->model()->data(i,
|
|
|
|
|
Qt::UserRole).toInt(), ui->tableViewMO->model()->data(i,
|
|
|
|
|
Qt::UserRole + 1).toInt());
|
2024-05-03 17:02:13 +02:00
|
|
|
emit moChannelChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::on_comboBoxRDiskBus_activated(int)
|
|
|
|
|
{
|
|
|
|
|
auto i = ui->tableViewRDisk->selectionModel()->currentIndex().siblingAtColumn(0);
|
|
|
|
|
Harddrives::busTrackClass->device_track(0, DEV_RDISK, ui->tableViewRDisk->model()->data(i,
|
|
|
|
|
Qt::UserRole).toInt(), ui->tableViewRDisk->model()->data(i,
|
|
|
|
|
Qt::UserRole + 1).toInt());
|
|
|
|
|
ui->comboBoxRDiskChannel->setCurrentIndex(ui->comboBoxRDiskBus->currentData().toUInt() == RDISK_BUS_ATAPI ?
|
|
|
|
|
Harddrives::busTrackClass->next_free_ide_channel() :
|
|
|
|
|
Harddrives::busTrackClass->next_free_scsi_id());
|
|
|
|
|
ui->tableViewRDisk->model()->data(i, Qt::UserRole + 1);
|
|
|
|
|
setRDiskBus(ui->tableViewRDisk->model(),
|
|
|
|
|
ui->tableViewRDisk->selectionModel()->currentIndex(),
|
|
|
|
|
ui->comboBoxRDiskBus->currentData().toUInt(),
|
|
|
|
|
ui->comboBoxRDiskChannel->currentData().toUInt());
|
|
|
|
|
setRDiskType(ui->tableViewRDisk->model(),
|
|
|
|
|
ui->tableViewRDisk->selectionModel()->currentIndex(),
|
|
|
|
|
ui->comboBoxRDiskType->currentData().toUInt());
|
|
|
|
|
ui->tableViewRDisk->resizeColumnsToContents();
|
|
|
|
|
ui->tableViewRDisk->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
|
|
|
|
Harddrives::busTrackClass->device_track(1, DEV_RDISK, ui->tableViewRDisk->model()->data(i,
|
|
|
|
|
Qt::UserRole).toInt(), ui->tableViewRDisk->model()->data(i,
|
|
|
|
|
Qt::UserRole + 1).toInt());
|
|
|
|
|
emit rdiskChannelChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-03 17:02:13 +02:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::enableCurrentlySelectedChannel_MO()
|
|
|
|
|
{
|
|
|
|
|
const auto *item_model = qobject_cast<QStandardItemModel*>(ui->comboBoxMOChannel->model());
|
|
|
|
|
const auto index = ui->comboBoxMOChannel->currentIndex();
|
|
|
|
|
auto *item = item_model->item(index);
|
|
|
|
|
if (item)
|
|
|
|
|
item->setEnabled(true);
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::enableCurrentlySelectedChannel_RDisk()
|
|
|
|
|
{
|
|
|
|
|
const auto *item_model = qobject_cast<QStandardItemModel*>(ui->comboBoxRDiskChannel->model());
|
|
|
|
|
const auto index = ui->comboBoxRDiskChannel->currentIndex();
|
|
|
|
|
auto *item = item_model->item(index);
|
|
|
|
|
if (item)
|
|
|
|
|
item->setEnabled(true);
|
|
|
|
|
}
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::on_comboBoxMOChannel_activated(int)
|
|
|
|
|
{
|
2022-01-10 01:12:23 +06:00
|
|
|
auto i = ui->tableViewMO->selectionModel()->currentIndex().siblingAtColumn(0);
|
2023-08-16 05:23:03 +02:00
|
|
|
Harddrives::busTrackClass->device_track(0, DEV_MO, ui->tableViewMO->model()->data(i,
|
|
|
|
|
Qt::UserRole).toInt(), ui->tableViewMO->model()->data(i,
|
|
|
|
|
Qt::UserRole + 1).toInt());
|
|
|
|
|
setMOBus(ui->tableViewMO->model(),
|
|
|
|
|
ui->tableViewMO->selectionModel()->currentIndex(),
|
|
|
|
|
ui->comboBoxMOBus->currentData().toUInt(),
|
|
|
|
|
ui->comboBoxMOChannel->currentData().toUInt());
|
|
|
|
|
Harddrives::busTrackClass->device_track(1, DEV_MO, ui->tableViewMO->model()->data(i,
|
|
|
|
|
Qt::UserRole).toInt(), ui->tableViewMO->model()->data(i,
|
|
|
|
|
Qt::UserRole + 1).toInt());
|
2024-05-03 17:02:13 +02:00
|
|
|
emit moChannelChanged();
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|
|
|
|
|
|
2025-07-25 16:30:40 +02:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::on_comboBoxRDiskChannel_activated(int)
|
|
|
|
|
{
|
|
|
|
|
auto i = ui->tableViewRDisk->selectionModel()->currentIndex().siblingAtColumn(0);
|
|
|
|
|
Harddrives::busTrackClass->device_track(0, DEV_RDISK, ui->tableViewRDisk->model()->data(i,
|
|
|
|
|
Qt::UserRole).toInt(), ui->tableViewRDisk->model()->data(i,
|
|
|
|
|
Qt::UserRole + 1).toInt());
|
|
|
|
|
setRDiskBus(ui->tableViewRDisk->model(),
|
|
|
|
|
ui->tableViewRDisk->selectionModel()->currentIndex(),
|
|
|
|
|
ui->comboBoxRDiskBus->currentData().toUInt(),
|
|
|
|
|
ui->comboBoxRDiskChannel->currentData().toUInt());
|
|
|
|
|
Harddrives::busTrackClass->device_track(1, DEV_RDISK, ui->tableViewRDisk->model()->data(i,
|
|
|
|
|
Qt::UserRole).toInt(),
|
|
|
|
|
ui->tableViewRDisk->model()->data(i, Qt::UserRole + 1).toInt());
|
|
|
|
|
emit rdiskChannelChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void
|
|
|
|
|
SettingsOtherRemovable::on_comboBoxMOType_activated(int)
|
|
|
|
|
{
|
2023-08-16 05:23:03 +02:00
|
|
|
setMOType(ui->tableViewMO->model(),
|
|
|
|
|
ui->tableViewMO->selectionModel()->currentIndex(),
|
|
|
|
|
ui->comboBoxMOType->currentData().toUInt());
|
2021-11-25 10:20:56 +01:00
|
|
|
ui->tableViewMO->resizeColumnsToContents();
|
|
|
|
|
ui->tableViewMO->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-03 17:02:13 +02:00
|
|
|
void
|
2025-07-25 16:30:40 +02:00
|
|
|
SettingsOtherRemovable::on_comboBoxRDiskType_activated(int)
|
2022-11-19 08:49:04 -05:00
|
|
|
{
|
2025-07-25 16:30:40 +02:00
|
|
|
setRDiskType(ui->tableViewRDisk->model(),
|
|
|
|
|
ui->tableViewRDisk->selectionModel()->currentIndex(),
|
|
|
|
|
ui->comboBoxRDiskType->currentData().toUInt());
|
|
|
|
|
ui->tableViewRDisk->resizeColumnsToContents();
|
|
|
|
|
ui->tableViewRDisk->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
2021-11-25 10:20:56 +01:00
|
|
|
}
|