This commit is contained in:
starfrost013
2025-06-22 14:10:19 +01:00
107 changed files with 4493 additions and 2472 deletions

View File

@@ -1834,7 +1834,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -1834,7 +1834,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -1834,7 +1834,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -1833,7 +1833,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -1834,7 +1834,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -2194,4 +2194,13 @@ msgid "Toggle pause"
msgstr "Переключить паузу"
msgid "Toggle mute"
msgstr "Переключить беззвучный режим"
msgstr "Переключить беззвучный режим"
msgid "Text files"
msgstr "Текстовые файлы"
msgid "ROM files"
msgstr "Файлы ПЗУ"
msgid "SoundFont files"
msgstr "Файлы SoundFont"

View File

@@ -31,6 +31,7 @@
#include <QLabel>
#include <QDir>
#include <QSettings>
#include <QStringBuilder>
extern "C" {
#include <86box/86box.h>
@@ -45,6 +46,7 @@ extern "C" {
#include "qt_filefield.hpp"
#include "qt_models_common.hpp"
#include "qt_util.hpp"
#ifdef Q_OS_LINUX
# include <sys/stat.h>
# include <sys/sysmacros.h>
@@ -276,11 +278,25 @@ DeviceConfig::ProcessConfig(void *dc, const void *c, const bool is_dep)
}
case CONFIG_FNAME:
{
auto *fileField = new FileField();
auto *fileField = new FileField(this);
fileField->setObjectName(config->name);
fileField->setFileName(selected);
fileField->setFilter(QString(config->file_filter).left(static_cast<int>(strcspn(config->file_filter,
"|"))));
/* Get the actually used part of the filter */
QString filter = QString(config->file_filter).left(static_cast<int>(strcspn(config->file_filter, "|")));
/* Extract the description and the extension list */
QRegularExpressionMatch match = QRegularExpression("(.+) \\((.+)\\)$").match(filter);
QString description = match.captured(1);
QString extensions = match.captured(2);
QStringList extensionList;
/* Split the extension list up and strip the filename globs */
QRegularExpression re("\\*\\.(.*)");
int i = 0;
while (extensions.section(' ', i, i) != "") {
QString extension = re.match(extensions.section(' ', i, i)).captured(1);
extensionList.append(extension);
i++;
}
fileField->setFilter(tr(description.toUtf8().constData()) % util::DlgFilter(extensionList) % tr("All files") % util::DlgFilter({ "*" }, true));
this->ui->formLayout->addRow(tr(config->description), fileField);
break;
}
@@ -388,6 +404,7 @@ DeviceConfig::ConfigureDevice(const _device_ *device, int instance, Settings *se
}
case CONFIG_MIDI_OUT:
case CONFIG_MIDI_IN:
case CONFIG_INT:
case CONFIG_SELECTION:
{
auto *cbox = dc.findChild<QComboBox *>(config->name);

View File

@@ -104,22 +104,22 @@ glsl_detect_bom(const char *fn)
static char *load_file(const char *fn) {
int bom = glsl_detect_bom(fn);
FILE *f = plat_fopen(fn, "rb");
if (!f)
FILE *fp = plat_fopen(fn, "rb");
if (!fp)
return 0;
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
fseek(fp, 0, SEEK_END);
long fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
if (bom) {
fsize -= 3;
fseek(f, 3, SEEK_SET);
fseek(fp, 3, SEEK_SET);
}
char *data = (char*)malloc(fsize + 1);
fread(data, fsize, 1, f);
fclose(f);
(void) fread(data, fsize, 1, fp);
fclose(fp);
data[fsize] = 0;

View File

@@ -214,7 +214,7 @@ emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
(GetForegroundWindow() == ((HWND) secondaryRenderer->winId())));
}
bool skip = ((nCode < 0) || (nCode != HC_ACTION) || !is_over_window);
bool skip = ((nCode < 0) || (nCode != HC_ACTION) || !is_over_window || (kbd_req_capture && !mouse_capture));
if (skip)
return CallNextHookEx(NULL, nCode, wParam, lParam);

View File

@@ -51,22 +51,29 @@ SettingsDisplay::~SettingsDisplay()
void
SettingsDisplay::save()
{
gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
// TODO
#if 0
for (uint8_t i = 0; i < GFXCARD_MAX; ++i) {
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxVideo%1").arg(i + 1));
gfxcard[i] = cbox->currentData().toInt();
}
#else
gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
for (uint8_t i = 1; i < GFXCARD_MAX; i ++)
gfxcard[i] = ui->comboBoxVideoSecondary->currentData().toInt();
gfxcard[i] = ui->comboBoxVideoSecondary->currentData().toInt();
#endif
voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0;
ibm8514_standalone_enabled = ui->checkBox8514->isChecked() ? 1 : 0;
xga_standalone_enabled = ui->checkBoxXga->isChecked() ? 1 : 0;
da2_standalone_enabled = ui->checkBoxDa2->isChecked() ? 1 : 0;
da2_standalone_enabled = ui->checkBoxDa2->isChecked() ? 1 : 0;
}
void
SettingsDisplay::onCurrentMachineChanged(int machineId)
{
// win_settings_video_proc, WM_INITDIALOG
this->machineId = machineId;
this->machineId = machineId;
auto curVideoCard = videoCard[0];
auto *model = ui->comboBoxVideo->model();
@@ -98,25 +105,26 @@ SettingsDisplay::onCurrentMachineChanged(int machineId)
}
model->removeRows(0, removeRows);
// TODO
if (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0) {
ui->comboBoxVideo->setEnabled(false);
ui->comboBoxVideoSecondary->setEnabled(false);
ui->pushButtonConfigureSecondary->setEnabled(false);
ui->pushButtonConfigureVideoSecondary->setEnabled(false);
selectedRow = 1;
} else {
ui->comboBoxVideo->setEnabled(true);
ui->comboBoxVideoSecondary->setEnabled(true);
ui->pushButtonConfigureSecondary->setEnabled(true);
ui->pushButtonConfigureVideoSecondary->setEnabled(true);
}
ui->comboBoxVideo->setCurrentIndex(selectedRow);
// TODO
for (uint8_t i = 1; i < GFXCARD_MAX; i ++)
if (gfxcard[i] == 0)
ui->pushButtonConfigureSecondary->setEnabled(false);
ui->pushButtonConfigureVideoSecondary->setEnabled(false);
}
void
SettingsDisplay::on_pushButtonConfigure_clicked()
SettingsDisplay::on_pushButtonConfigureVideo_clicked()
{
int videoCard = ui->comboBoxVideo->currentData().toInt();
auto *device = video_card_getdevice(videoCard);
@@ -160,17 +168,17 @@ SettingsDisplay::on_pushButtonConfigureDa2_clicked()
void
SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
static QRegularExpression voodooRegex("3dfx|voodoo|banshee", QRegularExpression::CaseInsensitiveOption);
static QRegularExpression voodooRegex("3dfx|voodoo|banshee|raven", QRegularExpression::CaseInsensitiveOption);
auto curVideoCard_2 = videoCard[1];
videoCard[0] = ui->comboBoxVideo->currentData().toInt();
if (videoCard[0] == VID_INTERNAL)
ui->pushButtonConfigure->setEnabled(machine_has_flags(machineId, MACHINE_VIDEO) &&
device_has_config(machine_get_vid_device(machineId)));
ui->pushButtonConfigureVideo->setEnabled(machine_has_flags(machineId, MACHINE_VIDEO) &&
device_has_config(machine_get_vid_device(machineId)));
else
ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0);
ui->pushButtonConfigureVideo->setEnabled(video_card_has_config(videoCard[0]) > 0);
bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0;
ui->pushButtonConfigureVoodoo->setEnabled(machineHasPci && ui->checkBoxVoodoo->isChecked());
@@ -233,7 +241,7 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
if ((videoCard[1] == 0) || (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0)) {
ui->comboBoxVideoSecondary->setCurrentIndex(0);
ui->pushButtonConfigureSecondary->setEnabled(false);
ui->pushButtonConfigureVideoSecondary->setEnabled(false);
}
// Is the currently selected video card a voodoo?
@@ -287,15 +295,15 @@ void
SettingsDisplay::on_comboBoxVideoSecondary_currentIndexChanged(int index)
{
if (index < 0) {
ui->pushButtonConfigureSecondary->setEnabled(false);
ui->pushButtonConfigureVideoSecondary->setEnabled(false);
return;
}
videoCard[1] = ui->comboBoxVideoSecondary->currentData().toInt();
ui->pushButtonConfigureSecondary->setEnabled(index != 0 && video_card_has_config(videoCard[1]) > 0);
ui->pushButtonConfigureVideoSecondary->setEnabled(index != 0 && video_card_has_config(videoCard[1]) > 0);
}
void
SettingsDisplay::on_pushButtonConfigureSecondary_clicked()
SettingsDisplay::on_pushButtonConfigureVideoSecondary_clicked()
{
auto *device = video_card_getdevice(ui->comboBoxVideoSecondary->currentData().toInt());
DeviceConfig::ConfigureDevice(device);

View File

@@ -22,22 +22,23 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigureSecondary_clicked();
private slots:
void on_comboBoxVideoSecondary_currentIndexChanged(int index);
private slots:
void on_checkBoxVoodoo_stateChanged(int state);
void on_checkBox8514_stateChanged(int state);
void on_checkBoxXga_stateChanged(int state);
void on_checkBoxDa2_stateChanged(int state);
void on_comboBoxVideo_currentIndexChanged(int index);
void on_pushButtonConfigureVideo_clicked();
void on_comboBoxVideoSecondary_currentIndexChanged(int index);
void on_pushButtonConfigureVideoSecondary_clicked();
void on_checkBoxVoodoo_stateChanged(int state);
void on_pushButtonConfigureVoodoo_clicked();
void on_checkBox8514_stateChanged(int state);
void on_pushButtonConfigure8514_clicked();
void on_checkBoxXga_stateChanged(int state);
void on_pushButtonConfigureXga_clicked();
void on_checkBoxDa2_stateChanged(int state);
void on_pushButtonConfigureDa2_clicked();
void on_pushButtonConfigure_clicked();
private:
Ui::SettingsDisplay *ui;

View File

@@ -26,28 +26,8 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigure">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxXga">
<property name="text">
<string>XGA Graphics</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelVideo">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -72,15 +52,21 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonConfigureVoodoo">
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureVideo">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelVideoSecondary">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -92,10 +78,23 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox8514">
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideoSecondary">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureVideoSecondary">
<property name="text">
<string>IBM 8514/A Graphics</string>
<string>Configure</string>
</property>
</widget>
</item>
@@ -106,6 +105,20 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonConfigureVoodoo">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox8514">
<property name="text">
<string>IBM 8514/A Graphics</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonConfigure8514">
<property name="text">
@@ -113,6 +126,13 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxXga">
<property name="text">
<string>XGA Graphics</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pushButtonConfigureXga">
<property name="text">
@@ -134,26 +154,6 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureSecondary">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideoSecondary">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">

View File

@@ -359,9 +359,9 @@ SettingsFloppyCDROM::on_comboBoxSpeed_activated(int index)
void
SettingsFloppyCDROM::on_comboBoxBus_activated(int)
{
auto i = ui->tableViewCDROM->selectionModel()->currentIndex().siblingAtColumn(0);
auto i = ui->tableViewCDROM->selectionModel()->currentIndex().siblingAtColumn(0);
uint8_t bus_type = ui->comboBoxBus->currentData().toUInt();
int cdromIdx = ui->tableViewCDROM->selectionModel()->currentIndex().data().toInt();
int cdromIdx = ui->tableViewCDROM->selectionModel()->currentIndex().data().toInt();
Harddrives::busTrackClass->device_track(0, DEV_CDROM, ui->tableViewCDROM->model()->data(i,
Qt::UserRole).toInt(), ui->tableViewCDROM->model()->data(i,
@@ -384,9 +384,9 @@ SettingsFloppyCDROM::on_comboBoxBus_activated(int)
auto *modelType = ui->comboBoxCDROMType->model();
int removeRows = modelType->rowCount();
uint32_t j = 0;
int selectedTypeRow = 0;
int eligibleRows = 0;
uint32_t j = 0;
int selectedTypeRow = 0;
int eligibleRows = 0;
while (cdrom_drive_types[j].bus_type != BUS_TYPE_NONE) {
if (((bus_type == CDROM_BUS_ATAPI) || (bus_type == CDROM_BUS_SCSI)) &&
((cdrom_drive_types[j].bus_type == bus_type) ||
@@ -414,11 +414,10 @@ void
SettingsFloppyCDROM::enableCurrentlySelectedChannel()
{
const auto *item_model = qobject_cast<QStandardItemModel*>(ui->comboBoxChannel->model());
const auto index = ui->comboBoxChannel->currentIndex();
auto *item = item_model->item(index);
if(item) {
const auto index = ui->comboBoxChannel->currentIndex();
auto *item = item_model->item(index);
if(item)
item->setEnabled(true);
}
}
void
@@ -449,9 +448,9 @@ SettingsFloppyCDROM::on_comboBoxCDROMType_activated(int)
ui->tableViewCDROM->resizeColumnsToContents();
ui->tableViewCDROM->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
int speed = cdrom_get_speed(type);
int speed = cdrom_get_speed(type);
if (speed == -1) {
speed = ui->comboBoxSpeed->currentData().toUInt();
speed = ui->comboBoxSpeed->currentData().toUInt();
ui->comboBoxSpeed->setEnabled(true);
} else
ui->comboBoxSpeed->setEnabled(false);

View File

@@ -19,17 +19,20 @@ public:
signals:
void cdromChannelChanged();
private slots:
void on_comboBoxCDROMType_activated(int index);
void on_comboBoxChannel_activated(int index);
void on_comboBoxBus_activated(int index);
void on_comboBoxSpeed_activated(int index);
void on_comboBoxBus_currentIndexChanged(int index);
void on_comboBoxFloppyType_activated(int index);
void on_checkBoxCheckBPB_stateChanged(int arg1);
void on_checkBoxTurboTimings_stateChanged(int arg1);
void onFloppyRowChanged(const QModelIndex &current);
void on_comboBoxFloppyType_activated(int index);
void on_checkBoxTurboTimings_stateChanged(int arg1);
void on_checkBoxCheckBPB_stateChanged(int arg1);
void onCDROMRowChanged(const QModelIndex &current);
void on_comboBoxBus_activated(int index);
void on_comboBoxBus_currentIndexChanged(int index);
void on_comboBoxChannel_activated(int index);
void on_comboBoxSpeed_activated(int index);
void on_comboBoxCDROMType_activated(int index);
private:
Ui::SettingsFloppyCDROM *ui;

View File

@@ -27,7 +27,7 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelFloppy">
<property name="text">
<string>Floppy drives:</string>
</property>
@@ -68,7 +68,7 @@
<widget class="QWidget" name="floppyControls" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelFloppyType">
<property name="text">
<string>Type:</string>
</property>
@@ -99,7 +99,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelCDROM">
<property name="text">
<string>CD-ROM drives:</string>
</property>
@@ -140,33 +140,12 @@
<widget class="QWidget" name="cdControls" native="true">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelBus">
<property name="text">
<string>Bus:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxBus">
<property name="maxVisibleItems">
@@ -174,6 +153,13 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="labelChannel">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="comboBoxChannel">
<property name="maxVisibleItems">
@@ -181,6 +167,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSpeed">
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxSpeed">
<property name="maxVisibleItems">
@@ -188,6 +181,13 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelCDROMType">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxCDROMType">
<property name="maxVisibleItems">

View File

@@ -49,9 +49,8 @@ static void
normalize_hd_list()
{
hard_disk_t ihdd[HDD_NUM];
int j;
int j = 0;
j = 0;
memset(ihdd, 0x00, HDD_NUM * sizeof(hard_disk_t));
for (uint8_t i = 0; i < HDD_NUM; i++) {
@@ -75,8 +74,8 @@ static void
addRow(QAbstractItemModel *model, hard_disk_t *hd)
{
const QString userPath = usr_path;
int row = model->rowCount();
model->insertRow(row);
QString busName = Harddrives::BusChannelName(hd->bus_type, hd->channel);
@@ -88,11 +87,11 @@ addRow(QAbstractItemModel *model, hard_disk_t *hd)
model->setData(model->index(row, ColumnBus), hd->channel, DataBusChannelPrevious);
Harddrives::busTrackClass->device_track(1, DEV_HDD, hd->bus_type, hd->channel);
QString fileName = hd->fn;
if (fileName.startsWith(userPath, Qt::CaseInsensitive)) {
if (fileName.startsWith(userPath, Qt::CaseInsensitive))
model->setData(model->index(row, ColumnFilename), fileName.mid(userPath.size()));
} else {
else
model->setData(model->index(row, ColumnFilename), fileName);
}
model->setData(model->index(row, ColumnFilename), fileName, Qt::UserRole);
model->setData(model->index(row, ColumnCylinders), hd->tracks);
@@ -120,9 +119,8 @@ SettingsHarddisks::SettingsHarddisks(QWidget *parent)
ui->tableView->setModel(model);
for (int i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus_type > 0) {
if (hdd[i].bus_type > 0)
addRow(model, &hdd[i]);
}
}
if (model->rowCount() == HDD_NUM) {
ui->pushButtonNew->setEnabled(false);
@@ -176,9 +174,8 @@ void SettingsHarddisks::reloadBusChannels() {
void
SettingsHarddisks::on_comboBoxBus_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
buschangeinprogress = true;
auto idx = ui->tableView->selectionModel()->currentIndex();
@@ -226,9 +223,8 @@ SettingsHarddisks::on_comboBoxBus_currentIndexChanged(int index)
void
SettingsHarddisks::on_comboBoxChannel_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
auto idx = ui->tableView->selectionModel()->currentIndex();
if (idx.isValid()) {
@@ -250,17 +246,15 @@ SettingsHarddisks::enableCurrentlySelectedChannel()
const auto *item_model = qobject_cast<QStandardItemModel*>(ui->comboBoxChannel->model());
const auto index = ui->comboBoxChannel->currentIndex();
auto *item = item_model->item(index);
if(item) {
if(item)
item->setEnabled(true);
}
}
void
SettingsHarddisks::on_comboBoxSpeed_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
auto idx = ui->tableView->selectionModel()->currentIndex();
if (idx.isValid()) {
@@ -288,20 +282,19 @@ SettingsHarddisks::onTableRowChanged(const QModelIndex &current)
auto *model = ui->comboBoxBus->model();
auto match = model->match(model->index(0, 0), Qt::UserRole, bus);
if (!match.isEmpty()) {
if (!match.isEmpty())
ui->comboBoxBus->setCurrentIndex(match.first().row());
}
model = ui->comboBoxChannel->model();
match = model->match(model->index(0, 0), Qt::UserRole, busChannel);
if (!match.isEmpty()) {
if (!match.isEmpty())
ui->comboBoxChannel->setCurrentIndex(match.first().row());
}
model = ui->comboBoxSpeed->model();
match = model->match(model->index(0, 0), Qt::UserRole, speed);
if (!match.isEmpty()) {
if (!match.isEmpty())
ui->comboBoxSpeed->setCurrentIndex(match.first().row());
}
reloadBusChannels();
}
@@ -358,11 +351,10 @@ void
SettingsHarddisks::on_pushButtonRemove_clicked()
{
auto idx = ui->tableView->selectionModel()->currentIndex();
if (!idx.isValid()) {
if (!idx.isValid())
return;
}
auto *model = ui->tableView->model();
auto *model = ui->tableView->model();
const auto col = idx.siblingAtColumn(ColumnBus);
Harddrives::busTrackClass->device_track(0, DEV_HDD, model->data(col, DataBus).toInt(), model->data(col, DataBusChannel).toInt());
model->removeRow(idx.row());

View File

@@ -21,14 +21,13 @@ signals:
void driveChannelChanged();
private slots:
void on_comboBoxBus_currentIndexChanged(int index);
void on_comboBoxChannel_currentIndexChanged(int index);
void on_comboBoxSpeed_currentIndexChanged(int index);
private slots:
void on_pushButtonRemove_clicked();
void on_pushButtonExisting_clicked();
void on_pushButtonNew_clicked();
void on_comboBoxBus_currentIndexChanged(int index);
void on_pushButtonExisting_clicked();
void on_pushButtonRemove_clicked();
void onTableRowChanged(const QModelIndex &current);

View File

@@ -46,7 +46,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayoutHardDisks">
<item>
<widget class="QLabel" name="labelBus">
<property name="text">

View File

@@ -38,7 +38,7 @@ extern "C" {
#include "qt_keybind.hpp"
extern MainWindow *main_window;
// Temporary working copy of key list
accelKey acc_keys_t[NUM_ACCELS];
@@ -48,41 +48,40 @@ SettingsInput::SettingsInput(QWidget *parent)
{
ui->setupUi(this);
QStringList horizontalHeader;
QStringList verticalHeader;
horizontalHeader.append(tr("Action"));
QStringList horizontalHeader;
QStringList verticalHeader;
horizontalHeader.append(tr("Action"));
horizontalHeader.append(tr("Keybind"));
QTableWidget *keyTable = ui->tableKeys;
keyTable->setRowCount(10);
keyTable->setColumnCount(3);
keyTable->setColumnHidden(2, true);
keyTable->setColumnWidth(0, 200);
keyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
QStringList headers;
//headers << "Action" << "Bound key";
keyTable->setHorizontalHeaderLabels(horizontalHeader);
keyTable->verticalHeader()->setVisible(false);
keyTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
keyTable->setSelectionBehavior(QAbstractItemView::SelectRows);
keyTable->setSelectionMode(QAbstractItemView::SingleSelection);
keyTable->setShowGrid(true);
// Make a working copy of acc_keys so we can check for dupes later without getting
// confused
for(int x=0;x<NUM_ACCELS;x++) {
strcpy(acc_keys_t[x].name, acc_keys[x].name);
strcpy(acc_keys_t[x].desc, acc_keys[x].desc);
strcpy(acc_keys_t[x].seq, acc_keys[x].seq);
}
QTableWidget *keyTable = ui->tableKeys;
keyTable->setRowCount(10);
keyTable->setColumnCount(3);
keyTable->setColumnHidden(2, true);
keyTable->setColumnWidth(0, 200);
keyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
QStringList headers;
//headers << "Action" << "Bound key";
keyTable->setHorizontalHeaderLabels(horizontalHeader);
keyTable->verticalHeader()->setVisible(false);
keyTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
keyTable->setSelectionBehavior(QAbstractItemView::SelectRows);
keyTable->setSelectionMode(QAbstractItemView::SingleSelection);
keyTable->setShowGrid(true);
refreshInputList();
// Make a working copy of acc_keys so we can check for dupes later without getting
// confused
for(int x = 0; x < NUM_ACCELS; x++) {
strcpy(acc_keys_t[x].name, acc_keys[x].name);
strcpy(acc_keys_t[x].desc, acc_keys[x].desc);
strcpy(acc_keys_t[x].seq, acc_keys[x].seq);
}
refreshInputList();
onCurrentMachineChanged(machine);
}
SettingsInput::~SettingsInput()
{
delete ui;
@@ -93,16 +92,16 @@ SettingsInput::save()
{
mouse_type = ui->comboBoxMouse->currentData().toInt();
joystick_type = ui->comboBoxJoystick->currentData().toInt();
// Copy accelerators from working set to global set
for(int x=0;x<NUM_ACCELS;x++) {
strcpy(acc_keys[x].name, acc_keys_t[x].name);
strcpy(acc_keys[x].desc, acc_keys_t[x].desc);
strcpy(acc_keys[x].seq, acc_keys_t[x].seq);
}
ProgSettings::reloadStrings();
// Copy accelerators from working set to global set
for(int x = 0; x < NUM_ACCELS; x++) {
strcpy(acc_keys[x].name, acc_keys_t[x].name);
strcpy(acc_keys[x].desc, acc_keys_t[x].desc);
strcpy(acc_keys[x].seq, acc_keys_t[x].seq);
}
ProgSettings::reloadStrings();
}
void
SettingsInput::onCurrentMachineChanged(int machineId)
{
@@ -115,13 +114,11 @@ SettingsInput::onCurrentMachineChanged(int machineId)
int selectedRow = 0;
for (int i = 0; i < mouse_get_ndev(); ++i) {
const auto *dev = mouse_get_device(i);
if ((i == MOUSE_TYPE_INTERNAL) && (machine_has_flags(machineId, MACHINE_MOUSE) == 0)) {
if ((i == MOUSE_TYPE_INTERNAL) && (machine_has_flags(machineId, MACHINE_MOUSE) == 0))
continue;
}
if (device_is_valid(dev, machineId) == 0) {
if (device_is_valid(dev, machineId) == 0)
continue;
}
QString name = DeviceConfig::DeviceName(dev, mouse_get_internal_name(i), 0);
int row = mouseModel->rowCount();
@@ -131,9 +128,8 @@ SettingsInput::onCurrentMachineChanged(int machineId)
mouseModel->setData(idx, name, Qt::DisplayRole);
mouseModel->setData(idx, i, Qt::UserRole);
if (i == mouse_type) {
if (i == mouse_type)
selectedRow = row - removeRows;
}
}
mouseModel->removeRows(0, removeRows);
ui->comboBoxMouse->setCurrentIndex(selectedRow);
@@ -141,13 +137,12 @@ SettingsInput::onCurrentMachineChanged(int machineId)
int i = 0;
const char *joyName = joystick_get_name(i);
auto *joystickModel = ui->comboBoxJoystick->model();
removeRows = joystickModel->rowCount();
selectedRow = 0;
removeRows = joystickModel->rowCount();
selectedRow = 0;
while (joyName) {
int row = Models::AddEntry(joystickModel, tr(joyName).toUtf8().data(), i);
if (i == joystick_type) {
if (i == joystick_type)
selectedRow = row - removeRows;
}
++i;
joyName = joystick_get_name(i);
@@ -159,95 +154,95 @@ SettingsInput::onCurrentMachineChanged(int machineId)
void
SettingsInput::refreshInputList()
{
for (int x=0;x<NUM_ACCELS;x++) {
ui->tableKeys->setItem(x, 0, new QTableWidgetItem(tr(acc_keys_t[x].desc)));
ui->tableKeys->setItem(x, 1, new QTableWidgetItem(QKeySequence(acc_keys_t[x].seq, QKeySequence::PortableText).toString(QKeySequence::NativeText)));
ui->tableKeys->setItem(x, 2, new QTableWidgetItem(acc_keys_t[x].name));
}
for (int x = 0; x < NUM_ACCELS; x++) {
ui->tableKeys->setItem(x, 0, new QTableWidgetItem(tr(acc_keys_t[x].desc)));
ui->tableKeys->setItem(x, 1, new QTableWidgetItem(QKeySequence(acc_keys_t[x].seq, QKeySequence::PortableText).toString(QKeySequence::NativeText)));
ui->tableKeys->setItem(x, 2, new QTableWidgetItem(acc_keys_t[x].name));
}
}
void
SettingsInput::on_tableKeys_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn)
{
// Enable/disable bind/clear buttons if user clicked valid row
QTableWidgetItem *cell = ui->tableKeys->item(currentRow,1);
if (!cell)
{
ui->pushButtonBind->setEnabled(false);
ui->pushButtonClearBind->setEnabled(false);
}
else
{
ui->pushButtonBind->setEnabled(true);
ui->pushButtonClearBind->setEnabled(true);
}
// Enable/disable bind/clear buttons if user clicked valid row
QTableWidgetItem *cell = ui->tableKeys->item(currentRow,1);
if (!cell) {
ui->pushButtonBind->setEnabled(false);
ui->pushButtonClearBind->setEnabled(false);
} else {
ui->pushButtonBind->setEnabled(true);
ui->pushButtonClearBind->setEnabled(true);
}
}
void
SettingsInput::on_tableKeys_cellDoubleClicked(int row, int col)
{
// Edit bind
QTableWidgetItem *cell = ui->tableKeys->item(row,1);
if (!cell) return;
QKeySequence keyseq = KeyBinder::BindKey(this, cell->text());
if (keyseq != false) {
// If no change was made, don't change anything.
if (keyseq.toString(QKeySequence::NativeText) == cell->text()) return;
// Otherwise, check for conflicts.
// Check against the *working* copy - NOT the one in use by the app,
// so we don't test against shortcuts the user already changed.
for(int x=0;x<NUM_ACCELS;x++)
{
if(QString::fromStdString(acc_keys_t[x].seq) == keyseq.toString(QKeySequence::PortableText))
{
// That key is already in use
main_window->showMessage(MBX_ANSI & MBX_INFO, "Bind conflict", "This key combo is already in use", false);
return;
}
}
// If we made it here, there were no conflicts.
// Go ahead and apply the bind.
// Find the correct accelerator key entry
int accKeyID = FindAccelerator(ui->tableKeys->item(row,2)->text().toUtf8().constData());
if (accKeyID < 0) return; // this should never happen
// Make the change
cell->setText(keyseq.toString(QKeySequence::NativeText));
strcpy(acc_keys_t[accKeyID].seq, keyseq.toString(QKeySequence::PortableText).toUtf8().constData());
refreshInputList();
}
// Edit bind
QTableWidgetItem *cell = ui->tableKeys->item(row,1);
if (!cell)
return;
QKeySequence keyseq = KeyBinder::BindKey(this, cell->text());
if (keyseq != false) {
// If no change was made, don't change anything.
if (keyseq.toString(QKeySequence::NativeText) == cell->text())
return;
// Otherwise, check for conflicts.
// Check against the *working* copy - NOT the one in use by the app,
// so we don't test against shortcuts the user already changed.
for(int x = 0; x < NUM_ACCELS; x++) {
if(QString::fromStdString(acc_keys_t[x].seq) == keyseq.toString(QKeySequence::PortableText)) {
// That key is already in use
main_window->showMessage(MBX_ANSI & MBX_INFO, "Bind conflict", "This key combo is already in use", false);
return;
}
}
// If we made it here, there were no conflicts.
// Go ahead and apply the bind.
// Find the correct accelerator key entry
int accKeyID = FindAccelerator(ui->tableKeys->item(row,2)->text().toUtf8().constData());
if (accKeyID < 0)
return; // this should never happen
// Make the change
cell->setText(keyseq.toString(QKeySequence::NativeText));
strcpy(acc_keys_t[accKeyID].seq, keyseq.toString(QKeySequence::PortableText).toUtf8().constData());
refreshInputList();
}
}
void
SettingsInput::on_pushButtonBind_clicked()
{
// Edit bind
QTableWidgetItem *cell = ui->tableKeys->currentItem();
if (!cell) return;
on_tableKeys_cellDoubleClicked(cell->row(), cell->column());
// Edit bind
QTableWidgetItem *cell = ui->tableKeys->currentItem();
if (!cell)
return;
on_tableKeys_cellDoubleClicked(cell->row(), cell->column());
}
void
SettingsInput::on_pushButtonClearBind_clicked()
{
// Wipe bind
QTableWidgetItem *cell = ui->tableKeys->item(ui->tableKeys->currentRow(), 1);
if (!cell) return;
cell->setText("");
// Find the correct accelerator key entry
int accKeyID = FindAccelerator(ui->tableKeys->item(cell->row(),2)->text().toUtf8().constData());
if (accKeyID < 0) return; // this should never happen
// Make the change
cell->setText("");
strcpy(acc_keys_t[accKeyID].seq, "");
// Wipe bind
QTableWidgetItem *cell = ui->tableKeys->item(ui->tableKeys->currentRow(), 1);
if (!cell)
return;
cell->setText("");
// Find the correct accelerator key entry
int accKeyID = FindAccelerator(ui->tableKeys->item(cell->row(),2)->text().toUtf8().constData());
if (accKeyID < 0)
return; // this should never happen
// Make the change
cell->setText("");
strcpy(acc_keys_t[accKeyID].seq, "");
}
void
@@ -263,9 +258,9 @@ SettingsInput::on_comboBoxJoystick_currentIndexChanged(int index)
int joystickId = ui->comboBoxJoystick->currentData().toInt();
for (int i = 0; i < MAX_JOYSTICKS; ++i) {
auto *btn = findChild<QPushButton *>(QString("pushButtonJoystick%1").arg(i + 1));
if (btn == nullptr) {
if (btn == nullptr)
continue;
}
btn->setEnabled(joystick_get_max_joysticks(joystickId) > i);
}
}
@@ -283,9 +278,8 @@ get_axis(JoystickConfiguration &jc, int axis, int joystick_nr)
int axis_sel = jc.selectedAxis(axis);
int nr_axes = plat_joystick_state[joystick_state[0][joystick_nr].plat_joystick_nr - 1].nr_axes;
if (axis_sel < nr_axes) {
if (axis_sel < nr_axes)
return axis_sel;
}
axis_sel -= nr_axes;
if (axis_sel & 1)

View File

@@ -26,17 +26,20 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigureMouse_clicked();
void on_comboBoxJoystick_currentIndexChanged(int index);
void on_comboBoxMouse_currentIndexChanged(int index);
void on_pushButtonConfigureMouse_clicked();
void on_comboBoxJoystick_currentIndexChanged(int index);
void on_pushButtonJoystick1_clicked();
void on_pushButtonJoystick2_clicked();
void on_pushButtonJoystick3_clicked();
void on_pushButtonJoystick4_clicked();
void on_tableKeys_cellDoubleClicked(int row, int col);
void on_tableKeys_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
void on_pushButtonBind_clicked();
void on_pushButtonClearBind_clicked();
void on_pushButtonBind_clicked();
private:
Ui::SettingsInput *ui;

View File

@@ -23,6 +23,13 @@
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelMouse">
<property name="text">
<string>Mouse:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxMouse">
<property name="sizePolicy">
@@ -36,75 +43,6 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonJoystick4">
<property name="text">
<string>Joystick 4...</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonJoystick3">
<property name="text">
<string>Joystick 3...</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButtonBind">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pushButtonJoystick1">
<property name="text">
<string>Joystick 1...</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxJoystick">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Mouse:</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonClearBind">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Clear binding</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Joystick:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonJoystick2">
<property name="text">
<string>Joystick 2...</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButtonConfigureMouse">
<property name="sizePolicy">
@@ -118,8 +56,50 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelJoystick">
<property name="text">
<string>Joystick:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxJoystick">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pushButtonJoystick1">
<property name="text">
<string>Joystick 1...</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonJoystick2">
<property name="text">
<string>Joystick 2...</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonJoystick3">
<property name="text">
<string>Joystick 3...</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonJoystick4">
<property name="text">
<string>Joystick 4...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelKeys">
<property name="text">
<string>Key Bindings:</string>
</property>
@@ -144,6 +124,26 @@
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonClearBind">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Clear binding</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButtonBind">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@@ -358,4 +358,4 @@ void SettingsMachine::on_checkBoxFPUSoftfloat_stateChanged(int state) {
ui->softFloatWarningIcon->setVisible(false);
ui->softFloatWarningText->setVisible(false);
}
}
}

View File

@@ -18,22 +18,13 @@ public:
signals:
void currentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigure_clicked();
private slots:
void on_comboBoxFPU_currentIndexChanged(int index);
private slots:
void on_comboBoxSpeed_currentIndexChanged(int index);
private slots:
void on_comboBoxCPU_currentIndexChanged(int index);
private slots:
void on_comboBoxMachine_currentIndexChanged(int index);
private slots:
void on_comboBoxMachineType_currentIndexChanged(int index);
void on_checkBoxFPUSoftfloat_stateChanged(int state);

View File

@@ -41,6 +41,7 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxMachineType">
<property name="maxVisibleItems">
@@ -48,6 +49,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
@@ -55,6 +57,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
@@ -62,6 +65,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxFPU">
<property name="maxVisibleItems">
@@ -69,6 +73,7 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="spinBoxRAM">
<property name="sizePolicy">
@@ -79,6 +84,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@@ -86,6 +92,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
@@ -93,6 +100,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
@@ -121,6 +129,7 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
@@ -131,6 +140,7 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxSpeed">
<property name="sizePolicy">
@@ -147,6 +157,7 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
@@ -154,6 +165,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@@ -161,6 +173,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
@@ -183,6 +196,7 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonConfigure">
<property name="sizePolicy">
@@ -199,6 +213,7 @@
</layout>
</widget>
</item>
<item row="4" column="1">
<widget class="QWidget" name="widget_4" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
@@ -253,6 +268,7 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="dynamicRecompilerLayout">
<item>
@@ -270,6 +286,7 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="softFloatLayout">
<item>
@@ -285,6 +302,7 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="softFloatWarningIcon">
<property name="text">
@@ -292,6 +310,7 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="softFloatWarningText">
<property name="text">
@@ -314,6 +333,7 @@
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">

View File

@@ -36,17 +36,17 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
auto *nic_cbox = findChild<QComboBox *>(QString("comboBoxNIC%1").arg(i + 1));
auto *net_type_cbox = findChild<QComboBox *>(QString("comboBoxNet%1").arg(i + 1));
auto *intf_label = findChild<QLabel *>(QString("interfaceLabel%1").arg(i + 1));
auto *intf_label = findChild<QLabel *>(QString("labelIntf%1").arg(i + 1));
auto *intf_cbox = findChild<QComboBox *>(QString("comboBoxIntf%1").arg(i + 1));
auto *conf_btn = findChild<QPushButton *>(QString("pushButtonConf%1").arg(i + 1));
// auto *net_type_conf_btn = findChild<QPushButton *>(QString("pushButtonNetTypeConf%1").arg(i + 1));
auto *vde_socket_label = findChild<QLabel *>(QString("socketVDELabel%1").arg(i + 1));
auto *vde_socket_label = findChild<QLabel *>(QString("labelSocketVDENIC%1").arg(i + 1));
auto *socket_line = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i + 1));
auto *option_list_label = findChild<QLabel *>(QString("optionListLabel%1").arg(i + 1));
auto *option_list_line = findChild<QWidget *>(QString("optionListLine%1").arg(i + 1));
auto *option_list_label = findChild<QLabel *>(QString("labelOptionList%1").arg(i + 1));
auto *option_list_line = findChild<QWidget *>(QString("lineOptionList%1").arg(i + 1));
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
conf_btn->setEnabled(network_card_has_config(nic_cbox->currentData().toInt()));
@@ -56,7 +56,6 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
option_list_label->setVisible(false);
option_list_line->setVisible(false);
// VDE
vde_socket_label->setVisible(false);
socket_line->setVisible(false);
@@ -70,21 +69,26 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
// Then only enable as needed based on network type
switch (net_type_cbox->currentData().toInt()) {
case NET_TYPE_VDE:
// option_list_label->setText("VDE Options");
// option_list_label->setText("VDE Options");
option_list_label->setVisible(true);
option_list_line->setVisible(true);
vde_socket_label->setVisible(true);
socket_line->setVisible(true);
break;
case NET_TYPE_PCAP:
// option_list_label->setText("PCAP Options");
// option_list_label->setText("PCAP Options");
option_list_label->setVisible(true);
option_list_line->setVisible(true);
intf_cbox->setVisible(true);
intf_label->setVisible(true);
break;
case NET_TYPE_SLIRP:
default:
break;
}
}
}
@@ -124,11 +128,10 @@ SettingsNetwork::save()
net_cards_conf[i].net_type = cbox->currentData().toInt();
cbox = findChild<QComboBox *>(QString("comboBoxIntf%1").arg(i + 1));
memset(net_cards_conf[i].host_dev_name, '\0', sizeof(net_cards_conf[i].host_dev_name));
if (net_cards_conf[i].net_type == NET_TYPE_PCAP) {
if (net_cards_conf[i].net_type == NET_TYPE_PCAP)
strncpy(net_cards_conf[i].host_dev_name, network_devs[cbox->currentData().toInt()].device, sizeof(net_cards_conf[i].host_dev_name) - 1);
} else if (net_cards_conf[i].net_type == NET_TYPE_VDE) {
else if (net_cards_conf[i].net_type == NET_TYPE_VDE)
strncpy(net_cards_conf[i].host_dev_name, socket_line->text().toUtf8().constData(), sizeof(net_cards_conf[i].host_dev_name));
}
}
}
@@ -141,7 +144,7 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
int selectedRow = 0;
// Network Card
QComboBox * cbox_[NET_CARD_MAX] = { 0 };
QComboBox *cbox_[NET_CARD_MAX] = { 0 };
QAbstractItemModel *models[NET_CARD_MAX] = { 0 };
int removeRows_[NET_CARD_MAX] = { 0 };
int selectedRows[NET_CARD_MAX] = { 0 };
@@ -226,9 +229,8 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
void
SettingsNetwork::on_comboIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
enableElements(ui);
}
@@ -236,8 +238,8 @@ SettingsNetwork::on_comboIndexChanged(int index)
void
SettingsNetwork::on_pushButtonConf1_clicked()
{
int netCard = ui->comboBoxNIC1->currentData().toInt();
auto *device = network_card_getdevice(netCard);
int netCard = ui->comboBoxNIC1->currentData().toInt();
auto *device = network_card_getdevice(netCard);
if (netCard == NET_INTERNAL)
device = machine_get_net_device(machineId);
DeviceConfig::ConfigureDevice(device, 1);
@@ -246,23 +248,23 @@ SettingsNetwork::on_pushButtonConf1_clicked()
void
SettingsNetwork::on_pushButtonConf2_clicked()
{
int netCard = ui->comboBoxNIC2->currentData().toInt();
auto *device = network_card_getdevice(netCard);
int netCard = ui->comboBoxNIC2->currentData().toInt();
auto *device = network_card_getdevice(netCard);
DeviceConfig::ConfigureDevice(device, 2);
}
void
SettingsNetwork::on_pushButtonConf3_clicked()
{
int netCard = ui->comboBoxNIC3->currentData().toInt();
auto *device = network_card_getdevice(netCard);
int netCard = ui->comboBoxNIC3->currentData().toInt();
auto *device = network_card_getdevice(netCard);
DeviceConfig::ConfigureDevice(device, 3);
}
void
SettingsNetwork::on_pushButtonConf4_clicked()
{
int netCard = ui->comboBoxNIC4->currentData().toInt();
auto *device = network_card_getdevice(netCard);
int netCard = ui->comboBoxNIC4->currentData().toInt();
auto *device = network_card_getdevice(netCard);
DeviceConfig::ConfigureDevice(device, 4);
}

View File

@@ -27,15 +27,29 @@
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
<widget class="QTabWidget" name="tabWidgetNet">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_1">
<widget class="QWidget" name="tabNet1">
<attribute name="title">
<string>Network Card #1</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayoutNet1">
<item row="0" column="0">
<widget class="QLabel" name="labelMode1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNet1">
<property name="maxVisibleItems">
@@ -50,7 +64,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="labelAdapter1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -62,79 +76,6 @@
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="optionListLine1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="optionListLabel1">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interfaceLabel1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="socketVDELabel1">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxNIC1">
<property name="sizePolicy">
@@ -151,10 +92,43 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC1">
<property name="maxLength">
<number>127</number>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelOptionList1">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="lineOptionList1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIntf1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
@@ -168,15 +142,22 @@
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Network Card #2</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="0">
<widget class="QLabel" name="labelSocketVDENIC1">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC1">
<property name="maxLength">
<number>127</number>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer">
<spacer name="verticalSpacerNIC1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -188,28 +169,16 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interfaceLabel2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="optionListLabel2">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabNet2">
<attribute name="title">
<string>Network Card #2</string>
</attribute>
<layout class="QGridLayout" name="gridLayoutNet2">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="labelMode2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -234,22 +203,8 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="socketVDELabel2">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="optionListLine2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<widget class="QLabel" name="labelAdapter2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -261,6 +216,22 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxNIC2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf2">
<property name="sizePolicy">
@@ -274,25 +245,33 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxNIC2">
<property name="maxVisibleItems">
<number>30</number>
<item row="2" column="0">
<widget class="QLabel" name="labelOptionList2">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="lineOptionList2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIntf2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC2"/>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxIntf2">
<property name="sizePolicy">
@@ -303,13 +282,54 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelSocketVDENIC2">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC2">
<property name="maxLength">
<number>127</number>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacerNIC2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="tabNet3">
<attribute name="title">
<string>Network Card #3</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayoutNet3">
<item row="0" column="0">
<widget class="QLabel" name="labelMode3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNet3">
<property name="maxVisibleItems">
@@ -323,17 +343,16 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="socketVDELabel3">
<property name="text">
<string>VDE Socket:</string>
<item row="1" column="0">
<widget class="QLabel" name="labelAdapter3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="optionListLabel3">
<property name="text">
<string>Options</string>
<string>Adapter:</string>
</property>
</widget>
</item>
@@ -353,39 +372,6 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interfaceLabel3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="optionListLine3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf3">
<property name="sizePolicy">
@@ -399,8 +385,22 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<item row="2" column="0">
<widget class="QLabel" name="labelOptionList3">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="lineOptionList3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIntf3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -408,13 +408,10 @@
</sizepolicy>
</property>
<property name="text">
<string>Adapter:</string>
<string>Interface:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC3"/>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxIntf3">
<property name="sizePolicy">
@@ -425,8 +422,22 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelSocketVDENIC3">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC3">
<property name="maxLength">
<number>127</number>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_3">
<spacer name="verticalSpacerNIC3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -440,20 +451,14 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<widget class="QWidget" name="tabNet4">
<attribute name="title">
<string>Network Card #4</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="0">
<widget class="QLabel" name="optionListLabel4">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<layout class="QGridLayout" name="gridLayoutNet4">
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<widget class="QLabel" name="labelMode4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -465,28 +470,21 @@
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNet4">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="socketVDELabel4">
<property name="text">
<string>VDE Socket:</string>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_16">
<widget class="QLabel" name="labelAdapter4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -498,26 +496,6 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="optionListLine4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interfaceLabel4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxNIC4">
<property name="sizePolicy">
@@ -534,19 +512,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNet4">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf4">
<property name="sizePolicy">
@@ -560,8 +525,32 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC4"/>
<item row="2" column="0">
<widget class="QLabel" name="labelOptionList4">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="lineOptionList4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIntf4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxIntf4">
@@ -573,8 +562,36 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelSocketVDENIC4">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC4">
<property name="maxLength">
<number>127</number>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacerNIC4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@@ -11,8 +11,10 @@
*
*
* Authors: Joakim L. Gilje <jgilje@jgilje.net>
* Jasmine Iwanek <jriwanek@gmail.com>
*
* Copyright 2021 Joakim L. Gilje
* Copyright 2025 Jasmine Iwanek
*/
#include "qt_settingsotherperipherals.hpp"
#include "ui_qt_settingsotherperipherals.h"
@@ -22,6 +24,7 @@ extern "C" {
#include <86box/device.h>
#include <86box/machine.h>
#include <86box/isamem.h>
#include <86box/isarom.h>
#include <86box/isartc.h>
#include <86box/unittester.h>
#include <86box/novell_cardkey.h>
@@ -44,84 +47,131 @@ SettingsOtherPeripherals::onCurrentMachineChanged(int machineId)
this->machineId = machineId;
bool machineHasIsa = (machine_has_bus(machineId, MACHINE_BUS_ISA) > 0);
ui->pushButtonConfigureRTC->setEnabled(machineHasIsa);
ui->comboBoxRTC->setEnabled(machineHasIsa);
ui->checkBoxISABugger->setEnabled(machineHasIsa);
ui->pushButtonConfigureUT->setEnabled(unittester_enabled > 0);
ui->checkBoxKeyCard->setEnabled(machineHasIsa);
ui->pushButtonConfigureKeyCard->setEnabled(novell_keycard_enabled > 0);
ui->checkBoxISABugger->setChecked((machineHasIsa && (bugger_enabled > 0)) ? true : false);
ui->checkBoxPOSTCard->setChecked(postcard_enabled > 0 ? true : false);
ui->checkBoxUnitTester->setChecked(unittester_enabled > 0 ? true : false);
ui->checkBoxKeyCard->setChecked((machineHasIsa && (novell_keycard_enabled > 0)) ? true : false);
ui->checkBoxISABugger->setEnabled(machineHasIsa);
ui->checkBoxKeyCard->setEnabled(machineHasIsa);
ui->pushButtonConfigureKeyCard->setEnabled(novell_keycard_enabled > 0);
ui->pushButtonConfigureUT->setEnabled(unittester_enabled > 0);
ui->comboBoxRTC->setEnabled(machineHasIsa);
ui->pushButtonConfigureRTC->setEnabled(machineHasIsa);
ui->comboBoxCard1->clear();
ui->comboBoxCard2->clear();
ui->comboBoxCard3->clear();
ui->comboBoxCard4->clear();
ui->comboBoxRTC->clear();
auto *model = ui->comboBoxRTC->model();
int d = 0;
for (uint8_t i = 0; i < ISAMEM_MAX; ++i)
if (auto *cb = findChild<QComboBox *>(QString("comboBoxIsaMemCard%1").arg(i + 1)))
cb->clear();
for (uint8_t i = 0; i < ISAROM_MAX; ++i)
if (auto *cb = findChild<QComboBox *>(QString("comboBoxIsaRomCard%1").arg(i + 1)))
cb->clear();
int c = 0;
int selectedRow = 0;
// ISA RTC Cards
auto *model = ui->comboBoxRTC->model();
while (true) {
QString name = DeviceConfig::DeviceName(isartc_get_device(d), isartc_get_internal_name(d), 0);
if (name.isEmpty()) {
const QString name = DeviceConfig::DeviceName(isartc_get_device(c), isartc_get_internal_name(c), 0);
if (name.isEmpty())
break;
}
if (!device_is_valid(isartc_get_device(d), machineId)) {
if (!device_is_valid(isartc_get_device(c), machineId))
break;
}
int row = Models::AddEntry(model, name, d);
if (d == isartc_type) {
int row = Models::AddEntry(model, name, c);
if (c == isartc_type)
selectedRow = row;
}
++d;
++c;
}
ui->comboBoxRTC->setCurrentIndex(selectedRow);
ui->pushButtonConfigureRTC->setEnabled((isartc_type != 0) && isartc_has_config(isartc_type) && machineHasIsa);
// ISA Memory Expansion Card
QComboBox * cbox[ISAMEM_MAX] = { 0 };
QAbstractItemModel *models[ISAMEM_MAX] = { 0 };
int removeRows_[ISAMEM_MAX] = { 0 };
int selectedRows[ISAMEM_MAX] = { 0 };
// ISA Memory Expansion Cards
QComboBox *isamem_cbox[ISAMEM_MAX] = { 0 };
QAbstractItemModel *isamem_models[ISAMEM_MAX] = { 0 };
int isamem_removeRows_[ISAMEM_MAX] = { 0 };
int isamem_selectedRows[ISAMEM_MAX] = { 0 };
for (uint8_t c = 0; c < ISAMEM_MAX; ++c) {
cbox[c] = findChild<QComboBox *>(QString("comboBoxCard%1").arg(c + 1));
models[c] = cbox[c]->model();
removeRows_[c] = models[c]->rowCount();
for (uint8_t i = 0; i < ISAMEM_MAX; ++i) {
isamem_cbox[i] = findChild<QComboBox *>(QString("comboBoxIsaMemCard%1").arg(i + 1));
isamem_models[i] = isamem_cbox[i]->model();
isamem_removeRows_[i] = isamem_models[i]->rowCount();
}
d = 0;
c = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(isamem_get_device(d),
isamem_get_internal_name(d), 0);
const QString name = DeviceConfig::DeviceName(isamem_get_device(c),
isamem_get_internal_name(c), 0);
if (name.isEmpty())
break;
if (device_is_valid(isamem_get_device(d), machineId)) {
for (uint8_t c = 0; c < ISAMEM_MAX; ++c) {
int row = Models::AddEntry(models[c], name, d);
if (device_is_valid(isamem_get_device(c), machineId)) {
for (uint8_t i = 0; i < ISAMEM_MAX; ++i) {
int row = Models::AddEntry(isamem_models[i], name, c);
if (d == isamem_type[c])
selectedRows[c] = row - removeRows_[c];
if (c == isamem_type[i])
isamem_selectedRows[i] = row - isamem_removeRows_[i];
}
}
d++;
c++;
}
for (uint8_t c = 0; c < ISAMEM_MAX; ++c) {
models[c]->removeRows(0, removeRows_[c]);
cbox[c]->setEnabled(models[c]->rowCount() > 1);
cbox[c]->setCurrentIndex(-1);
cbox[c]->setCurrentIndex(selectedRows[c]);
findChild<QPushButton *>(QString("pushButtonConfigureCard%1").arg(c + 1))->setEnabled((isamem_type[c] != 0) &&
isamem_has_config(isamem_type[c]) && machineHasIsa);
for (uint8_t i = 0; i < ISAMEM_MAX; ++i) {
isamem_models[i]->removeRows(0, isamem_removeRows_[i]);
isamem_cbox[i]->setEnabled(isamem_models[i]->rowCount() > 1);
isamem_cbox[i]->setCurrentIndex(-1);
isamem_cbox[i]->setCurrentIndex(isamem_selectedRows[i]);
findChild<QPushButton *>(QString("pushButtonConfigureIsaMemCard%1").arg(i + 1))->setEnabled((isamem_type[i] != 0) &&
isamem_has_config(isamem_type[i]) && machineHasIsa);
}
// ISA ROM Expansion Cards
QComboBox *isarom_cbox[ISAROM_MAX] = { 0 };
QAbstractItemModel *isarom_models[ISAROM_MAX] = { 0 };
int isarom_removeRows_[ISAROM_MAX] = { 0 };
int isarom_selectedRows[ISAROM_MAX] = { 0 };
for (uint8_t i = 0; i < ISAROM_MAX; ++i) {
isarom_cbox[i] = findChild<QComboBox *>(QString("comboBoxIsaRomCard%1").arg(i + 1));
isarom_models[i] = isarom_cbox[i]->model();
isarom_removeRows_[i] = isarom_models[i]->rowCount();
}
c = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(isarom_get_device(c),
isarom_get_internal_name(c), 0);
if (name.isEmpty())
break;
if (device_is_valid(isarom_get_device(c), machineId)) {
for (uint8_t i = 0; i < ISAROM_MAX; ++i) {
int row = Models::AddEntry(isarom_models[i], name, c);
if (c == isarom_type[i])
isarom_selectedRows[i] = row - isarom_removeRows_[i];
}
}
c++;
}
for (uint8_t i = 0; i < ISAROM_MAX; ++i) {
isarom_models[i]->removeRows(0, isarom_removeRows_[i]);
isarom_cbox[i]->setEnabled(isarom_models[i]->rowCount() > 1);
isarom_cbox[i]->setCurrentIndex(-1);
isarom_cbox[i]->setCurrentIndex(isarom_selectedRows[i]);
findChild<QPushButton *>(QString("pushButtonConfigureIsaRomCard%1").arg(i + 1))->setEnabled((isarom_type[i] != 0) &&
isarom_has_config(isarom_type[i]) && machineHasIsa);
}
}
@@ -134,25 +184,31 @@ void
SettingsOtherPeripherals::save()
{
/* Other peripherals category */
isartc_type = ui->comboBoxRTC->currentData().toInt();
bugger_enabled = ui->checkBoxISABugger->isChecked() ? 1 : 0;
postcard_enabled = ui->checkBoxPOSTCard->isChecked() ? 1 : 0;
unittester_enabled = ui->checkBoxUnitTester->isChecked() ? 1 : 0;
novell_keycard_enabled = ui->checkBoxKeyCard->isChecked() ? 1 : 0;
isartc_type = ui->comboBoxRTC->currentData().toInt();
/* ISA memory boards. */
for (int i = 0; i < ISAMEM_MAX; i++) {
auto *cbox = findChild<QComboBox *>(QString("comboBoxCard%1").arg(i + 1));
auto *cbox = findChild<QComboBox *>(QString("comboBoxIsaMemCard%1").arg(i + 1));
isamem_type[i] = cbox->currentData().toInt();
}
/* ISA ROM boards. */
for (int i = 0; i < ISAROM_MAX; i++) {
auto *cbox = findChild<QComboBox *>(QString("comboBoxIsaRomCard%1").arg(i + 1));
isarom_type[i] = cbox->currentData().toInt();
}
}
void
SettingsOtherPeripherals::on_comboBoxRTC_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureRTC->setEnabled((index != 0) && isartc_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
@@ -163,63 +219,123 @@ SettingsOtherPeripherals::on_pushButtonConfigureRTC_clicked()
}
void
SettingsOtherPeripherals::on_comboBoxCard1_currentIndexChanged(int index)
SettingsOtherPeripherals::on_comboBoxIsaMemCard1_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureCard1->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureIsaMemCard1->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureCard1_clicked()
SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard1_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard1->currentData().toInt()), 1);
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard1->currentData().toInt()), 1);
}
void
SettingsOtherPeripherals::on_comboBoxCard2_currentIndexChanged(int index)
SettingsOtherPeripherals::on_comboBoxIsaMemCard2_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureCard2->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureIsaMemCard2->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureCard2_clicked()
SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard2_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard2->currentData().toInt()), 2);
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard2->currentData().toInt()), 2);
}
void
SettingsOtherPeripherals::on_comboBoxCard3_currentIndexChanged(int index)
SettingsOtherPeripherals::on_comboBoxIsaMemCard3_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureCard3->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureIsaMemCard3->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureCard3_clicked()
SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard3_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard3->currentData().toInt()), 3);
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard3->currentData().toInt()), 3);
}
void
SettingsOtherPeripherals::on_comboBoxCard4_currentIndexChanged(int index)
SettingsOtherPeripherals::on_comboBoxIsaMemCard4_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureCard4->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureIsaMemCard4->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureCard4_clicked()
SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard4_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard4->currentData().toInt()), 4);
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard4->currentData().toInt()), 4);
}
void
SettingsOtherPeripherals::on_comboBoxIsaRomCard1_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonConfigureIsaRomCard1->setEnabled((index != 0) && isarom_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureIsaRomCard1_clicked()
{
DeviceConfig::ConfigureDevice(isarom_get_device(ui->comboBoxIsaRomCard1->currentData().toInt()), 1);
}
void
SettingsOtherPeripherals::on_comboBoxIsaRomCard2_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonConfigureIsaRomCard2->setEnabled((index != 0) && isarom_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureIsaRomCard2_clicked()
{
DeviceConfig::ConfigureDevice(isarom_get_device(ui->comboBoxIsaRomCard2->currentData().toInt()), 2);
}
void
SettingsOtherPeripherals::on_comboBoxIsaRomCard3_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonConfigureIsaRomCard3->setEnabled((index != 0) && isarom_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureIsaRomCard3_clicked()
{
DeviceConfig::ConfigureDevice(isarom_get_device(ui->comboBoxIsaRomCard3->currentData().toInt()), 3);
}
void
SettingsOtherPeripherals::on_comboBoxIsaRomCard4_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonConfigureIsaRomCard4->setEnabled((index != 0) && isarom_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureIsaRomCard4_clicked()
{
DeviceConfig::ConfigureDevice(isarom_get_device(ui->comboBoxIsaRomCard4->currentData().toInt()), 4);
}
void
@@ -234,13 +350,12 @@ SettingsOtherPeripherals::on_pushButtonConfigureUT_clicked()
DeviceConfig::ConfigureDevice(&unittester_device);
}
void SettingsOtherPeripherals::on_pushButtonConfigureKeyCard_clicked()
{
DeviceConfig::ConfigureDevice(&novell_keycard_device);
}
void SettingsOtherPeripherals::on_checkBoxKeyCard_stateChanged(int arg1)
{
ui->pushButtonConfigureKeyCard->setEnabled(arg1 != 0);
}
void SettingsOtherPeripherals::on_pushButtonConfigureKeyCard_clicked()
{
DeviceConfig::ConfigureDevice(&novell_keycard_device);
}

View File

@@ -20,22 +20,32 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigureCard4_clicked();
void on_comboBoxCard4_currentIndexChanged(int index);
void on_pushButtonConfigureCard3_clicked();
void on_comboBoxCard3_currentIndexChanged(int index);
void on_pushButtonConfigureCard2_clicked();
void on_comboBoxCard2_currentIndexChanged(int index);
void on_pushButtonConfigureCard1_clicked();
void on_comboBoxCard1_currentIndexChanged(int index);
void on_pushButtonConfigureRTC_clicked();
void on_comboBoxRTC_currentIndexChanged(int index);
void on_pushButtonConfigureRTC_clicked();
void on_comboBoxIsaMemCard1_currentIndexChanged(int index);
void on_pushButtonConfigureIsaMemCard1_clicked();
void on_comboBoxIsaMemCard2_currentIndexChanged(int index);
void on_pushButtonConfigureIsaMemCard2_clicked();
void on_comboBoxIsaMemCard3_currentIndexChanged(int index);
void on_pushButtonConfigureIsaMemCard3_clicked();
void on_comboBoxIsaMemCard4_currentIndexChanged(int index);
void on_pushButtonConfigureIsaMemCard4_clicked();
void on_comboBoxIsaRomCard1_currentIndexChanged(int index);
void on_pushButtonConfigureIsaRomCard1_clicked();
void on_comboBoxIsaRomCard2_currentIndexChanged(int index);
void on_pushButtonConfigureIsaRomCard2_clicked();
void on_comboBoxIsaRomCard3_currentIndexChanged(int index);
void on_pushButtonConfigureIsaRomCard3_clicked();
void on_comboBoxIsaRomCard4_currentIndexChanged(int index);
void on_pushButtonConfigureIsaRomCard4_clicked();
void on_checkBoxUnitTester_stateChanged(int arg1);
void on_pushButtonConfigureUT_clicked();
void on_pushButtonConfigureKeyCard_clicked();
void on_checkBoxKeyCard_stateChanged(int arg1);
void on_pushButtonConfigureKeyCard_clicked();
private:
Ui::SettingsOtherPeripherals *ui;

View File

@@ -27,9 +27,9 @@
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayoutRtc">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelRtc">
<property name="text">
<string>ISA RTC:</string>
</property>
@@ -58,20 +58,74 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBoxMem">
<property name="title">
<string>ISA Memory Expansion</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureCard2">
<layout class="QGridLayout" name="gridLayoutMem">
<item row="0" column="0">
<widget class="QLabel" name="labelIsaMemCard1">
<property name="text">
<string>Card 1:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxIsaMemCard1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaMemCard1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelIsaMemCard2">
<property name="text">
<string>Card 2:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxCard2">
<widget class="QComboBox" name="comboBoxIsaMemCard2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaMemCard2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelIsaMemCard3">
<property name="text">
<string>Card 3:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxIsaMemCard3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -84,68 +138,21 @@
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonConfigureCard3">
<widget class="QPushButton" name="pushButtonConfigureIsaMemCard3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<item row="3" column="0">
<widget class="QLabel" name="labelIsaMemCard4">
<property name="text">
<string>Card 2:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Card 3:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonConfigureCard1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxCard1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Card 1:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxCard3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
<string>Card 4:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxCard4">
<widget class="QComboBox" name="comboBoxIsaMemCard4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -158,24 +165,134 @@
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureCard4">
<widget class="QPushButton" name="pushButtonConfigureIsaMemCard4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Card 4:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<widget class="QGroupBox" name="groupBoxRom">
<property name="title">
<string>ISA ROM Cards</string>
</property>
<layout class="QGridLayout" name="gridLayoutRom">
<item row="0" column="0">
<widget class="QLabel" name="labelIsaRomCard1">
<property name="text">
<string>Card 1:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxIsaRomCard1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaRomCard1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelIsaRomCard2">
<property name="text">
<string>Card 2:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxIsaRomCard2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaRomCard2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelIsaRomCard3">
<property name="text">
<string>Card 3:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxIsaRomCard3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaRomCard3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIsaRomCard4">
<property name="text">
<string>Card 4:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxIsaRomCard4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaRomCard4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutIBPC">
<item>
<widget class="QCheckBox" name="checkBoxISABugger">
<property name="text">
@@ -193,7 +310,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayoutUT">
<item>
<widget class="QCheckBox" name="checkBoxUnitTester">
<property name="sizePolicy">
@@ -217,7 +334,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<layout class="QHBoxLayout" name="horizontalLayoutKeyCard">
<property name="topMargin">
<number>0</number>
</property>

View File

@@ -21,33 +21,19 @@ public:
signals:
void moChannelChanged();
void zipChannelChanged();
private slots:
void on_checkBoxZIP250_stateChanged(int arg1);
private slots:
void on_comboBoxZIPChannel_activated(int index);
private slots:
void on_comboBoxZIPBus_activated(int index);
private slots:
void on_comboBoxZIPBus_currentIndexChanged(int index);
private slots:
void on_comboBoxMOType_activated(int index);
private slots:
void on_comboBoxMOChannel_activated(int index);
private slots:
void on_comboBoxMOBus_activated(int index);
private slots:
void on_comboBoxMOBus_currentIndexChanged(int index);
private slots:
void onMORowChanged(const QModelIndex &current);
void on_comboBoxMOBus_currentIndexChanged(int index);
void on_comboBoxMOBus_activated(int index);
void on_comboBoxMOChannel_activated(int index);
void on_comboBoxMOType_activated(int index);
void onZIPRowChanged(const QModelIndex &current);
void on_comboBoxZIPBus_currentIndexChanged(int index);
void on_comboBoxZIPBus_activated(int index);
void on_comboBoxZIPChannel_activated(int index);
void on_checkBoxZIP250_stateChanged(int arg1);
private:
Ui::SettingsOtherRemovable *ui;

View File

@@ -27,7 +27,7 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelMO">
<property name="text">
<string>MO drives:</string>
</property>
@@ -68,19 +68,12 @@
<widget class="QWidget" name="moControls" native="true">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelMOBus">
<property name="text">
<string>Bus:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxMOBus">
<property name="maxVisibleItems">
@@ -88,6 +81,13 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="labelMOChannel">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="comboBoxMOChannel">
<property name="maxVisibleItems">
@@ -96,7 +96,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelMOType">
<property name="text">
<string>Type:</string>
</property>
@@ -113,7 +113,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelZIP">
<property name="text">
<string>ZIP drives:</string>
</property>
@@ -154,7 +154,7 @@
<widget class="QWidget" name="zipControls" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelZIPBus">
<property name="text">
<string>Bus:</string>
</property>
@@ -168,7 +168,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="labelZIPChannel">
<property name="text">
<string>Channel:</string>
</property>

View File

@@ -51,7 +51,7 @@ SettingsPorts::save()
{
for (int i = 0; i < PARALLEL_MAX; i++) {
auto *cbox = findChild<QComboBox *>(QString("comboBoxLpt%1").arg(i + 1));
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxParallel%1").arg(i + 1));
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxParallel%1").arg(i + 1));
if (cbox != NULL)
lpt_ports[i].device = cbox->currentData().toInt();
if (checkBox != NULL)
@@ -73,7 +73,7 @@ SettingsPorts::onCurrentMachineChanged(int machineId)
{
this->machineId = machineId;
int c = 0;
int c = 0;
// LPT Device
QComboBox * cbox[PARALLEL_MAX] = { 0 };
@@ -93,7 +93,7 @@ SettingsPorts::onCurrentMachineChanged(int machineId)
if (lptName == nullptr)
break;
const QString name = tr(lptName);
const QString name = tr(lptName);
for (uint8_t i = 0; i < PARALLEL_MAX; ++i) {
int row = Models::AddEntry(models[i], name, c);

View File

@@ -35,22 +35,25 @@ private slots:
void on_checkBoxSerial7_stateChanged(int state);
#endif
void on_checkBoxSerialPassThru1_stateChanged(int state);
void on_pushButtonSerialPassThru1_clicked();
void on_checkBoxSerialPassThru2_stateChanged(int state);
void on_pushButtonSerialPassThru2_clicked();
void on_checkBoxSerialPassThru3_stateChanged(int state);
void on_pushButtonSerialPassThru3_clicked();
void on_checkBoxSerialPassThru4_stateChanged(int state);
void on_pushButtonSerialPassThru4_clicked();
#if 0
void on_checkBoxSerialPassThru5_stateChanged(int state);
void on_checkBoxSerialPassThru6_stateChanged(int state);
void on_checkBoxSerialPassThru7_stateChanged(int state);
#endif
void on_pushButtonSerialPassThru1_clicked();
void on_pushButtonSerialPassThru2_clicked();
void on_pushButtonSerialPassThru3_clicked();
void on_pushButtonSerialPassThru4_clicked();
#if 0
void on_pushButtonSerialPassThru5_clicked();
void on_checkBoxSerialPassThru6_stateChanged(int state);
void on_pushButtonSerialPassThru6_clicked();
void on_checkBoxSerialPassThru7_stateChanged(int state);
void on_pushButtonSerialPassThru7_clicked();
#endif

View File

@@ -29,7 +29,7 @@
<item row="0" column="0">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelLpt1">
<property name="text">
<string>LPT1 Device:</string>
</property>
@@ -43,7 +43,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelLpt2">
<property name="text">
<string>LPT2 Device:</string>
</property>
@@ -57,7 +57,7 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelLpt3">
<property name="text">
<string>LPT3 Device:</string>
</property>
@@ -71,7 +71,7 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelLpt4">
<property name="text">
<string>LPT4 Device:</string>
</property>
@@ -88,27 +88,6 @@
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxParallel2">
<property name="text">
<string>Parallel port 2</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxParallel3">
<property name="text">
<string>Parallel port 3</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxSerial3">
<property name="text">
<string>Serial port 3</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxSerial1">
<property name="text">
@@ -116,20 +95,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxParallel4">
<property name="text">
<string>Parallel port 4</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSerial2">
<property name="text">
<string>Serial port 2</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBoxParallel1">
<property name="text">
@@ -137,6 +102,34 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSerial2">
<property name="text">
<string>Serial port 2</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxParallel2">
<property name="text">
<string>Parallel port 2</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxSerial3">
<property name="text">
<string>Serial port 3</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxParallel3">
<property name="text">
<string>Parallel port 3</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxSerial4">
<property name="text">
@@ -144,13 +137,76 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxParallel4">
<property name="text">
<string>Parallel port 4</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<layout class="QGridLayout" name="gridLayoutPassThru">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru1">
<property name="text">
<string>Serial port passthrough 1</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru2">
<property name="text">
<string>Serial port passthrough 2</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru3">
<property name="text">
<string>Serial port passthrough 3</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru4">
<property name="text">
<string>Serial port passthrough 4</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
@@ -164,13 +220,6 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru3">
<property name="text">
<string>Serial port passthrough 3</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
@@ -184,55 +233,6 @@
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru1">
<property name="text">
<string>Serial port passthrough 1</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru2">
<property name="text">
<string>Serial port passthrough 2</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru4">
<property name="text">
<string>Serial port passthrough 4</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -14,7 +14,7 @@
* Jasmine Iwanek <jriwanek@gmail.com>
*
* Copyright 2021 Joakim L. Gilje
* Copyright 2022-2023 Jasmine Iwanek
* Copyright 2022-2025 Jasmine Iwanek
*/
#include "qt_settingssound.hpp"
#include "ui_qt_settingssound.h"
@@ -76,8 +76,8 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
int c;
int selectedRow;
// Sound Card
QComboBox * cbox[SOUND_CARD_MAX] = { 0 };
// Sound Cards
QComboBox *cbox[SOUND_CARD_MAX] = { 0 };
QAbstractItemModel *models[SOUND_CARD_MAX] = { 0 };
int removeRows_[SOUND_CARD_MAX] = { 0 };
int selectedRows[SOUND_CARD_MAX] = { 0 };
@@ -89,7 +89,7 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
removeRows_[i] = models[i]->rowCount();
}
c = 0;
c = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(sound_card_getdevice(c),
sound_card_get_internal_name(c), 1);
@@ -110,7 +110,7 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
}
}
c++;
c++;
}
for (uint8_t i = 0; i < SOUND_CARD_MAX; ++i) {
@@ -122,21 +122,19 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
// Midi Out
c = 0;
auto model = ui->comboBoxMidiOut->model();
auto *model = ui->comboBoxMidiOut->model();
auto removeRows = model->rowCount();
selectedRow = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0);
if (name.isEmpty()) {
if (name.isEmpty())
break;
}
if (midi_out_device_available(c)) {
int row = Models::AddEntry(model, name, c);
if (c == midi_output_device_current) {
if (c == midi_output_device_current)
selectedRow = row - removeRows;
}
}
c++;
@@ -155,15 +153,13 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
while (true) {
const QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0);
if (name.isEmpty()) {
if (name.isEmpty())
break;
}
if (midi_in_device_available(c)) {
int row = Models::AddEntry(model, name, c);
if (c == midi_input_device_current) {
if (c == midi_input_device_current)
selectedRow = row - removeRows;
}
}
c++;
@@ -198,13 +194,11 @@ allowMpu401(Ui::SettingsSound *ui)
QString midiOut = midi_out_device_get_internal_name(ui->comboBoxMidiOut->currentData().toInt());
QString midiIn = midi_in_device_get_internal_name(ui->comboBoxMidiIn->currentData().toInt());
if (midiOut.isEmpty()) {
if (midiOut.isEmpty())
return false;
}
if (midiOut == QStringLiteral("none") && midiIn == QStringLiteral("none")) {
if (midiOut == QStringLiteral("none") && midiIn == QStringLiteral("none"))
return false;
}
return true;
}
@@ -212,9 +206,9 @@ allowMpu401(Ui::SettingsSound *ui)
void
SettingsSound::on_comboBoxSoundCard1_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
int sndCard = ui->comboBoxSoundCard1->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
@@ -238,9 +232,8 @@ SettingsSound::on_pushButtonConfigureSoundCard1_clicked()
void
SettingsSound::on_comboBoxSoundCard2_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
@@ -258,9 +251,8 @@ SettingsSound::on_pushButtonConfigureSoundCard2_clicked()
void
SettingsSound::on_comboBoxSoundCard3_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
@@ -279,9 +271,8 @@ SettingsSound::on_pushButtonConfigureSoundCard3_clicked()
void
SettingsSound::on_comboBoxSoundCard4_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
@@ -300,9 +291,8 @@ SettingsSound::on_pushButtonConfigureSoundCard4_clicked()
void
SettingsSound::on_comboBoxMidiOut_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureMidiOut->setEnabled(midi_out_device_has_config(ui->comboBoxMidiOut->currentData().toInt()));
ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA)));
@@ -318,9 +308,8 @@ SettingsSound::on_pushButtonConfigureMidiOut_clicked()
void
SettingsSound::on_comboBoxMidiIn_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureMidiIn->setEnabled(midi_in_device_has_config(ui->comboBoxMidiIn->currentData().toInt()));
ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA)));

View File

@@ -20,20 +20,26 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigureMPU401_clicked();
void on_checkBoxMPU401_stateChanged(int arg1);
void on_pushButtonConfigureMidiIn_clicked();
void on_pushButtonConfigureMidiOut_clicked();
void on_comboBoxMidiIn_currentIndexChanged(int index);
void on_comboBoxMidiOut_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard1_clicked();
void on_comboBoxSoundCard1_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard2_clicked();
void on_pushButtonConfigureSoundCard1_clicked();
void on_comboBoxSoundCard2_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard3_clicked();
void on_pushButtonConfigureSoundCard2_clicked();
void on_comboBoxSoundCard3_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard4_clicked();
void on_pushButtonConfigureSoundCard3_clicked();
void on_comboBoxSoundCard4_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard4_clicked();
void on_comboBoxMidiOut_currentIndexChanged(int index);
void on_pushButtonConfigureMidiOut_clicked();
void on_comboBoxMidiIn_currentIndexChanged(int index);
void on_pushButtonConfigureMidiIn_clicked();
void on_checkBoxMPU401_stateChanged(int arg1);
void on_pushButtonConfigureMPU401_clicked();
private:
Ui::SettingsSound *ui;

View File

@@ -26,17 +26,23 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<item row="0" column="0">
<widget class="QLabel" name="labelSoundCard1">
<property name="text">
<string>MIDI In Device:</string>
<string>Sound card #1:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Sound card #1:</string>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxSoundCard1">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
@@ -48,12 +54,25 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelSoundCard2">
<property name="text">
<string>Sound card #2:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxSoundCard2">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonConfigureSoundCard2">
<property name="text">
@@ -62,12 +81,25 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="labelSoundCard3">
<property name="text">
<string>Sound card #3:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxSoundCard3">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonConfigureSoundCard3">
<property name="text">
@@ -75,14 +107,26 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelSoundCard4">
<property name="text">
<string>Sound card #4:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxSoundCard4">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonConfigureSoundCard4">
<property name="text">
@@ -90,49 +134,13 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBoxMidiIn">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelMidiOut">
<property name="text">
<string>MIDI Out Device:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkBoxMPU401">
<property name="text">
<string>Standalone MPU-401</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="pushButtonConfigureMPU401">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButtonConfigureMidiIn">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBoxMidiOut">
<property name="maxVisibleItems">
@@ -153,6 +161,47 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelMidiIn">
<property name="text">
<string>MIDI In Device:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBoxMidiIn">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButtonConfigureMidiIn">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkBoxMPU401">
<property name="text">
<string>Standalone MPU-401</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="pushButtonConfigureMPU401">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="checkBoxFloat32">
<property name="text">
@@ -171,7 +220,7 @@
<property name="title">
<string>FM synth driver</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_1">
<layout class="QVBoxLayout" name="verticalLayoutFM">
<item>
<widget class="QRadioButton" name="radioButtonNuked">
<property name="text">
@@ -202,58 +251,6 @@
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxSoundCard1">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxSoundCard2">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxSoundCard3">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxSoundCard4">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@@ -56,8 +56,8 @@ SettingsStorageControllers::save()
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
scsi_card_current[i] = cbox->currentData().toInt();
}
hdc_current[0] = ui->comboBoxHD->currentData().toInt();
fdc_current[0] = ui->comboBoxFD->currentData().toInt();
hdc_current[0] = ui->comboBoxHD->currentData().toInt();
cdrom_interface_current = ui->comboBoxCDInterface->currentData().toInt();
ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0;
ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0;
@@ -84,18 +84,16 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
}
QString name = DeviceConfig::DeviceName(hdc_get_device(c), hdc_get_internal_name(c), 1);
if (name.isEmpty()) {
if (name.isEmpty())
break;
}
if (hdc_available(c)) {
const device_t *hdc_dev = hdc_get_device(c);
if (device_is_valid(hdc_dev, machineId)) {
int row = Models::AddEntry(model, name, c);
if (c == hdc_current[0]) {
if (c == hdc_current[0])
selectedRow = row - removeRows;
}
}
}
c++;
@@ -105,7 +103,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
ui->comboBoxHD->setCurrentIndex(-1);
ui->comboBoxHD->setCurrentIndex(selectedRow);
/*FD controller config*/
/* FD controller config */
model = ui->comboBoxFD->model();
removeRows = model->rowCount();
c = 0;
@@ -143,11 +141,11 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
/*CD interface controller config*/
#ifdef USE_CDROM_MITSUMI
ui->label_7->setVisible(true);
ui->labelCDInterface->setVisible(true);
ui->comboBoxCDInterface->setVisible(true);
ui->pushButtonCDInterface->setVisible(true);
#else
ui->label_7->setVisible(false);
ui->labelCDInterface->setVisible(false);
ui->comboBoxCDInterface->setVisible(false);
ui->pushButtonCDInterface->setVisible(false);
#endif
@@ -240,29 +238,29 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
}
void
SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index)
SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0);
ui->pushButtonFD->setEnabled(hdc_has_config(ui->comboBoxFD->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index)
SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonFD->setEnabled(hdc_has_config(ui->comboBoxFD->currentData().toInt()) > 0);
ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxCDInterface_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonCDInterface->setEnabled(cdrom_interface_has_config(ui->comboBoxCDInterface->currentData().toInt()) > 0);
}
@@ -278,18 +276,18 @@ SettingsStorageControllers::on_checkBoxQuaternaryIDE_stateChanged(int arg1)
ui->pushButtonQuaternaryIDE->setEnabled(arg1 == Qt::Checked);
}
void
SettingsStorageControllers::on_pushButtonHD_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonFD_clicked()
{
DeviceConfig::ConfigureDevice(fdc_card_getdevice(ui->comboBoxFD->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonHD_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonCDInterface_clicked()
{
@@ -311,36 +309,36 @@ SettingsStorageControllers::on_pushButtonQuaternaryIDE_clicked()
void
SettingsStorageControllers::on_comboBoxSCSI1_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonSCSI1->setEnabled(scsi_card_has_config(ui->comboBoxSCSI1->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxSCSI2_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonSCSI2->setEnabled(scsi_card_has_config(ui->comboBoxSCSI2->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxSCSI3_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonSCSI3->setEnabled(scsi_card_has_config(ui->comboBoxSCSI3->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxSCSI4_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonSCSI4->setEnabled(scsi_card_has_config(ui->comboBoxSCSI4->currentData().toInt()) > 0);
}

View File

@@ -20,27 +20,31 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonSCSI4_clicked();
void on_pushButtonSCSI3_clicked();
void on_pushButtonSCSI2_clicked();
void on_pushButtonSCSI1_clicked();
void on_comboBoxSCSI4_currentIndexChanged(int index);
void on_comboBoxSCSI3_currentIndexChanged(int index);
void on_comboBoxSCSI2_currentIndexChanged(int index);
void on_comboBoxSCSI1_currentIndexChanged(int index);
void on_pushButtonQuaternaryIDE_clicked();
void on_pushButtonTertiaryIDE_clicked();
void on_pushButtonFD_clicked();
void on_pushButtonHD_clicked();
void on_pushButtonCDInterface_clicked();
void on_checkBoxQuaternaryIDE_stateChanged(int arg1);
void on_checkBoxTertiaryIDE_stateChanged(int arg1);
void on_comboBoxFD_currentIndexChanged(int index);
void on_pushButtonFD_clicked();
void on_comboBoxHD_currentIndexChanged(int index);
void on_pushButtonHD_clicked();
void on_comboBoxCDInterface_currentIndexChanged(int index);
void on_pushButtonCDInterface_clicked();
void on_checkBoxTertiaryIDE_stateChanged(int arg1);
void on_pushButtonTertiaryIDE_clicked();
void on_checkBoxQuaternaryIDE_stateChanged(int arg1);
void on_pushButtonQuaternaryIDE_clicked();
void on_comboBoxSCSI1_currentIndexChanged(int index);
void on_pushButtonSCSI1_clicked();
void on_comboBoxSCSI2_currentIndexChanged(int index);
void on_pushButtonSCSI2_clicked();
void on_comboBoxSCSI3_currentIndexChanged(int index);
void on_pushButtonSCSI3_clicked();
void on_comboBoxSCSI4_currentIndexChanged(int index);
void on_pushButtonSCSI4_clicked();
void on_checkBoxLbaEnhancer_stateChanged(int arg1);
void on_pushButtonConfigureLbaEnhancer_clicked();
private:

View File

@@ -29,13 +29,20 @@
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelFD">
<property name="text">
<string>HD Controller:</string>
<string>FD Controller:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxFD">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonFD">
<property name="text">
<string>Configure</string>
@@ -43,14 +50,34 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelHD">
<property name="text">
<string>FD Controller:</string>
<string>HD Controller:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxHD">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonHD">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="labelCDInterface">
<property name="text">
<string>CD-ROM Controller:</string>
</property>
@@ -70,33 +97,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxHD">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonHD">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxFD">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxTertiaryIDE">
<property name="text">
@@ -104,13 +104,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxQuaternaryIDE">
<property name="text">
<string>Quaternary IDE Controller</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonTertiaryIDE">
<property name="enabled">
@@ -121,6 +114,13 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxQuaternaryIDE">
<property name="text">
<string>Quaternary IDE Controller</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonQuaternaryIDE">
<property name="enabled">
@@ -134,29 +134,15 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBoxSCSI">
<property name="title">
<string>SCSI</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonSCSI2">
<layout class="QGridLayout" name="gridLayoutSCSI">
<item row="0" column="0">
<widget class="QLabel" name="labelSCSI1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonSCSI4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Controller 3:</string>
<string>Controller 1:</string>
</property>
</widget>
</item>
@@ -180,6 +166,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSCSI2">
<property name="text">
<string>Controller 2:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxSCSI2">
<property name="sizePolicy">
@@ -193,6 +186,20 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonSCSI2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelSCSI3">
<property name="text">
<string>Controller 3:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="comboBoxSCSI3">
<property name="sizePolicy">
@@ -206,6 +213,20 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonSCSI3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelSCSI4">
<property name="text">
<string>Controller 4:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="comboBoxSCSI4">
<property name="sizePolicy">
@@ -219,29 +240,8 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Controller 1:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Controller 2:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Controller 4:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonSCSI3">
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonSCSI4">
<property name="text">
<string>Configure</string>
</property>

View File

@@ -92,6 +92,29 @@ DlgFilter(std::initializer_list<QString> extensions, bool last)
return " (" % temp.join(' ') % ")" % (!last ? ";;" : "");
}
QString
DlgFilter(QStringList extensions, bool last)
{
QStringList temp;
for (auto ext : extensions) {
#ifdef Q_OS_UNIX
if (ext == "*") {
temp.append("*");
continue;
}
temp.append("*." % ext.toUpper());
#endif
temp.append("*." % ext);
}
#ifdef Q_OS_UNIX
temp.removeDuplicates();
#endif
return " (" % temp.join(' ') % ")" % (!last ? ";;" : "");
}
QString currentUuid()
{
auto configPath = QFileInfo(cfg_path).dir().canonicalPath();

View File

@@ -11,6 +11,7 @@ namespace util {
static constexpr auto UUID_MIN_LENGTH = 36;
/* Creates extension list for qt filedialog */
QString DlgFilter(std::initializer_list<QString> extensions, bool last = false);
QString DlgFilter(QStringList extensions, bool last = false);
/* Returns screen the widget is on */
QScreen *screenOfWidget(QWidget *widget);
#ifdef Q_OS_WINDOWS