From 7a92f532129d88d09c2c8c8fa90e794dfa8ce197 Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Thu, 26 Jun 2025 11:58:06 +1000 Subject: [PATCH] Revamp config tool, add tooltips and consolidate options. (#427) * Add tooltips, remove obsolete directory stuff In the config tool, the "Media Path" entry was removed, as it doesn't do anything in isle-portable as far as I know. The "Disk Path" and "CD Path" options were merged into one directory editing thing, where CD Path is specified and Disk Path is then derived from that. A checkbox to enable or disable full-screen was added. Tooltips were added to the config app, so now users can more easily tell what a setting in the config tool does. * Make clang-format happy * oops that's an extra semicolon I don't need * Remove obsolete full screen forcing Co-authored-by: Anders Jenbo * Update CONFIG/config.cpp Co-authored-by: Anders Jenbo --------- Co-authored-by: Anders Jenbo --- CONFIG/MainDlg.cpp | 110 ++++++++++---------------- CONFIG/MainDlg.h | 11 +-- CONFIG/config.cpp | 10 --- CONFIG/config.h | 1 - CONFIG/res/maindialog.ui | 165 +++++++++++++-------------------------- 5 files changed, 103 insertions(+), 194 deletions(-) diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 46a2efe8..b90f1f66 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -56,18 +56,15 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->musicCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxMusic); connect(m_ui->sound3DCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DSound); connect(m_ui->joystickCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxJoystick); + connect(m_ui->fullscreenCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxFullscreen); connect(m_ui->okButton, &QPushButton::clicked, this, &CMainDialog::accept); connect(m_ui->cancelButton, &QPushButton::clicked, this, &CMainDialog::reject); - connect(m_ui->diskPathOpen, &QPushButton::clicked, this, &CMainDialog::SelectDiskPathDialog); - connect(m_ui->cdPathOpen, &QPushButton::clicked, this, &CMainDialog::SelectCDPathDialog); - connect(m_ui->mediaPathOpen, &QPushButton::clicked, this, &CMainDialog::SelectMediaPathDialog); + connect(m_ui->dataPathOpen, &QPushButton::clicked, this, &CMainDialog::SelectDataPathDialog); connect(m_ui->savePathOpen, &QPushButton::clicked, this, &CMainDialog::SelectSavePathDialog); - connect(m_ui->diskPath, &QLineEdit::textEdited, this, &CMainDialog::DiskPathEdited); - connect(m_ui->cdPath, &QLineEdit::textEdited, this, &CMainDialog::CDPathEdited); - connect(m_ui->mediaPath, &QLineEdit::textEdited, this, &CMainDialog::MediaPathEdited); - connect(m_ui->savePath, &QLineEdit::textEdited, this, &CMainDialog::SavePathEdited); + connect(m_ui->dataPath, &QLineEdit::editingFinished, this, &CMainDialog::DataPathEdited); + connect(m_ui->savePath, &QLineEdit::editingFinished, this, &CMainDialog::SavePathEdited); connect(m_ui->maxLoDSlider, &QSlider::valueChanged, this, &CMainDialog::MaxLoDChanged); connect(m_ui->maxActorsSlider, &QSlider::valueChanged, this, &CMainDialog::MaxActorsChanged); @@ -187,9 +184,8 @@ void CMainDialog::UpdateInterface() } m_ui->joystickCheckBox->setChecked(currentConfigApp->m_use_joystick); m_ui->musicCheckBox->setChecked(currentConfigApp->m_music); - m_ui->diskPath->setText(QString::fromStdString(currentConfigApp->m_base_path)); - m_ui->cdPath->setText(QString::fromStdString(currentConfigApp->m_cd_path)); - m_ui->mediaPath->setText(QString::fromStdString(currentConfigApp->m_media_path)); + m_ui->fullscreenCheckBox->setChecked(currentConfigApp->m_full_screen); + m_ui->dataPath->setText(QString::fromStdString(currentConfigApp->m_cd_path)); m_ui->savePath->setText(QString::fromStdString(currentConfigApp->m_save_path)); } @@ -266,54 +262,33 @@ void CMainDialog::OnCheckboxMusic(bool checked) UpdateInterface(); } -void CMainDialog::SelectDiskPathDialog() +void CMainDialog::OnCheckboxFullscreen(bool checked) { - QString disk_path = QString::fromStdString(currentConfigApp->m_base_path); - disk_path = QFileDialog::getExistingDirectory( - this, - tr("Open Directory"), - disk_path, - QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks - ); - - if (disk_path.toStdString() != "") { - currentConfigApp->m_base_path = disk_path.toStdString(); - m_modified = true; - UpdateInterface(); - } + currentConfigApp->m_full_screen = checked; + m_modified = true; + UpdateInterface(); } -void CMainDialog::SelectCDPathDialog() +void CMainDialog::SelectDataPathDialog() { - QString cd_path = QString::fromStdString(currentConfigApp->m_cd_path); - cd_path = QFileDialog::getExistingDirectory( + QString data_path = QString::fromStdString(currentConfigApp->m_cd_path); + data_path = QFileDialog::getExistingDirectory( this, tr("Open Directory"), - cd_path, + data_path, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); - if (cd_path.toStdString() != "") { - currentConfigApp->m_cd_path = cd_path.toStdString(); - m_modified = true; - UpdateInterface(); - } -} + QDir data_dir = QDir(data_path); -void CMainDialog::SelectMediaPathDialog() -{ - QString media_path = QString::fromStdString(currentConfigApp->m_media_path); - media_path = QFileDialog::getExistingDirectory( - this, - tr("Open Directory"), - media_path, - QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks - ); - if (media_path.toStdString() != "") { - currentConfigApp->m_media_path = media_path.toStdString(); + if (data_dir.exists()) { + currentConfigApp->m_cd_path = data_dir.absolutePath().toStdString(); + data_dir.cd(QString("DATA")); + data_dir.cd(QString("disk")); + currentConfigApp->m_base_path = data_dir.absolutePath().toStdString(); m_modified = true; - UpdateInterface(); } + UpdateInterface(); } void CMainDialog::SelectSavePathDialog() @@ -326,38 +301,39 @@ void CMainDialog::SelectSavePathDialog() QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); - if (save_path.toStdString() != "") { - currentConfigApp->m_save_path = save_path.toStdString(); + QDir save_dir = QDir(save_path); + + if (save_dir.exists()) { + currentConfigApp->m_save_path = save_dir.absolutePath().toStdString(); m_modified = true; - UpdateInterface(); } -} - -void CMainDialog::DiskPathEdited(const QString& text) -{ - currentConfigApp->m_base_path = text.toStdString(); - m_modified = true; UpdateInterface(); } -void CMainDialog::CDPathEdited(const QString& text) +void CMainDialog::DataPathEdited() { - currentConfigApp->m_cd_path = text.toStdString(); - m_modified = true; + QDir data_dir = QDir(m_ui->dataPath->text()); + + if (data_dir.exists()) { + currentConfigApp->m_cd_path = data_dir.absolutePath().toStdString(); + data_dir.cd(QString("DATA")); + data_dir.cd(QString("disk")); + currentConfigApp->m_base_path = data_dir.absolutePath().toStdString(); + m_modified = true; + } + UpdateInterface(); } -void CMainDialog::MediaPathEdited(const QString& text) +void CMainDialog::SavePathEdited() { - currentConfigApp->m_media_path = text.toStdString(); - m_modified = true; - UpdateInterface(); -} -void CMainDialog::SavePathEdited(const QString& text) -{ - currentConfigApp->m_save_path = text.toStdString(); - m_modified = true; + QDir save_dir = QDir(m_ui->savePath->text()); + + if (save_dir.exists()) { + currentConfigApp->m_save_path = save_dir.absolutePath().toStdString(); + m_modified = true; + } UpdateInterface(); } diff --git a/CONFIG/MainDlg.h b/CONFIG/MainDlg.h index b441248d..65782037 100644 --- a/CONFIG/MainDlg.h +++ b/CONFIG/MainDlg.h @@ -42,16 +42,13 @@ private slots: void OnRadiobuttonTextureHighQuality(bool checked); void OnCheckboxJoystick(bool checked); void OnCheckboxMusic(bool checked); + void OnCheckboxFullscreen(bool checked); void accept() override; void reject() override; - void SelectDiskPathDialog(); - void SelectCDPathDialog(); - void SelectMediaPathDialog(); + void SelectDataPathDialog(); void SelectSavePathDialog(); - void DiskPathEdited(const QString& text); - void CDPathEdited(const QString& text); - void MediaPathEdited(const QString& text); - void SavePathEdited(const QString& text); + void DataPathEdited(); + void SavePathEdited(); void MaxLoDChanged(int value); void MaxActorsChanged(int value); }; diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index 31e7032b..bd38e669 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -141,7 +141,6 @@ bool CConfigApp::ReadRegisterSettings() } m_base_path = iniparser_getstring(dict, "isle:diskpath", m_base_path.c_str()); m_cd_path = iniparser_getstring(dict, "isle:cdpath", m_cd_path.c_str()); - m_media_path = iniparser_getstring(dict, "isle:mediapath", m_media_path.c_str()); m_save_path = iniparser_getstring(dict, "isle:savepath", m_save_path.c_str()); m_display_bit_depth = iniparser_getint(dict, "isle:Display Bit Depth", -1); m_flip_surfaces = iniparser_getboolean(dict, "isle:Flip Surfaces", m_flip_surfaces); @@ -166,10 +165,6 @@ bool CConfigApp::ValidateSettings() { BOOL is_modified = FALSE; - if (!IsPrimaryDriver() && !m_full_screen) { - m_full_screen = TRUE; - is_modified = TRUE; - } if (IsDeviceInBasicRGBMode()) { if (m_3d_video_ram) { m_3d_video_ram = FALSE; @@ -203,10 +198,6 @@ bool CConfigApp::ValidateSettings() m_3d_video_ram = TRUE; is_modified = TRUE; } - if (!m_full_screen) { - m_full_screen = TRUE; - is_modified = TRUE; - } } if ((m_display_bit_depth != 8 && m_display_bit_depth != 16) && (m_display_bit_depth != 0 || m_full_screen)) { m_display_bit_depth = 16; @@ -302,7 +293,6 @@ void CConfigApp::WriteRegisterSettings() const } iniparser_set(dict, "isle:diskpath", m_base_path.c_str()); iniparser_set(dict, "isle:cdpath", m_cd_path.c_str()); - iniparser_set(dict, "isle:mediapath", m_media_path.c_str()); iniparser_set(dict, "isle:savepath", m_save_path.c_str()); SetIniInt(dict, "isle:Display Bit Depth", m_display_bit_depth); diff --git a/CONFIG/config.h b/CONFIG/config.h index 276dc755..a621655a 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -77,7 +77,6 @@ class CConfigApp { std::string m_iniPath; std::string m_base_path; std::string m_cd_path; - std::string m_media_path; std::string m_save_path; float m_max_lod; int m_max_actors; diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index ac69f782..78c5a174 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -7,7 +7,7 @@ 0 0 575 - 650 + 600 @@ -44,6 +44,9 @@ 16777215 + + Jaws. + @@ -76,13 +79,7 @@ 0 - - - - - - - + @@ -101,68 +98,8 @@ - - - - - 0 - 0 - - - - - 55 - 16777215 - - - - Open - - - - - - - - 0 - 0 - - - - - 55 - 16777215 - - - - Open - - - - - - - - 0 - 0 - - - - CD Path: - - - Qt::PlainText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - + 0 @@ -180,26 +117,7 @@ - - - - - 0 - 0 - - - - Disk Path: - - - Qt::PlainText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + @@ -218,8 +136,22 @@ - - + + + + Path to the game data files. Set this to the CD image root. + + + + + + + Folder where save files are kept. + + + + + 0 @@ -227,7 +159,7 @@ - Media Path: + Data Path: Qt::PlainText @@ -237,9 +169,6 @@ - - - @@ -266,6 +195,9 @@ 120 + + Set 3D model detail level. + Island Model Quality @@ -345,6 +277,9 @@ + + Set texture detail level. + Island Texture Quality @@ -422,16 +357,13 @@ - - - - 0 - - - 0 - + + + + Enable 3D positional audio effects. + 3D Sound @@ -439,6 +371,9 @@ + + Enable in-game background music. + Music @@ -446,11 +381,24 @@ + + Enable joystick and gamepad support for LEGO Island. + Use Joystick + + + + Toggle fullscreen display mode. + + + Fullscreen + + + @@ -462,6 +410,9 @@ 225 + + 3D graphics device used to render the game. + @@ -581,12 +532,8 @@ - diskPath - diskPathOpen - cdPath - cdPathOpen - mediaPath - mediaPathOpen + dataPath + dataPathOpen savePath savePathOpen textureQualityFastRadioButton