From 2cce3f9e4eb30b896bc2d29b10a4ae12b3034032 Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Tue, 12 Aug 2025 09:27:08 +1000 Subject: [PATCH] Finish work on adding `si loader` extension --- CONFIG/MainDlg.cpp | 28 ++++++++++++++++++++++------ CONFIG/config.cpp | 3 ++- CONFIG/res/maindialog.ui | 9 +++------ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 30be8d36..59f321b7 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -102,8 +102,6 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->yResSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::YResChanged); connect(m_ui->framerateSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::FramerateChanged); - layout()->setSizeConstraint(QLayout::SetFixedSize); - if (currentConfigApp->m_ram_quality_limit != 0) { m_modified = true; const QString ramError = QString("Insufficient RAM!"); @@ -624,13 +622,17 @@ void CMainDialog::AddCustomAssetPath() data_path.absolutePath(), "Interleaf files (*.si)" ); + for (QString& item : new_files) { + item = data_path.relativeFilePath(item); + } + assetPaths += new_files; UpdateAssetPaths(); - UpdateInterface(); } void CMainDialog::RemoveCustomAssetPath() { - + assetPaths.removeAt(m_ui->customAssetPaths->currentRow()); + UpdateAssetPaths(); } void CMainDialog::SelectedPathChanged(int currentRow) @@ -640,12 +642,26 @@ void CMainDialog::SelectedPathChanged(int currentRow) void CMainDialog::EditCustomAssetPath() { - + QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path)); + QString prev_asset_path = assetPaths[m_ui->customAssetPaths->currentRow()]; + QString new_file = QFileDialog::getOpenFileName( + this, + "Open File", + data_path.absoluteFilePath(prev_asset_path), + "Interleaf files (*.si)" + ); + if (!new_file.isEmpty()) { + new_file = data_path.relativeFilePath(new_file); + assetPaths[m_ui->customAssetPaths->currentRow()] = new_file; + } + UpdateAssetPaths(); } void CMainDialog::UpdateAssetPaths() { - + assetPaths.removeDuplicates(); + currentConfigApp->m_custom_asset_path = assetPaths.join(u',').toStdString(); + UpdateInterface(); } void CMainDialog::AspectRatioChanged(int index) diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index 920eaca7..e71f75e8 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -368,7 +368,8 @@ void CConfigApp::WriteRegisterSettings() const dictionary* dict = dictionary_new(0); iniparser_set(dict, "isle", NULL); iniparser_set(dict, "extensions", NULL); - iniparser_set(dict, "texture loader", NULL); + iniparser_set(dict, "si loader", NULL); + if (m_device_enumerator->FormatDeviceName(buffer, m_driver, m_device) >= 0) { iniparser_set(dict, "isle:3D Device ID", buffer); } diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index 2cce27d2..407c6971 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -24,6 +24,9 @@ :/lego1.png:/lego1.png + + QLayout::SizeConstraint::SetFixedSize + @@ -1153,12 +1156,6 @@ The game will gradually increase the number of actors until this maximum is reac QAbstractScrollArea::SizeAdjustPolicy::AdjustToContentsOnFirstShow - - true - - - QAbstractItemView::DragDropMode::InternalMove -