diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
| commit | 7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch) | |
| tree | 27fb39be241fdb5ac2734c574de678977d1856d0 /libs/bsapacker/src/PackerDialog.cpp | |
Fluorine Manager: full Linux port of Mod Organizer 2
Complete native Linux port with FUSE-based virtual filesystem,
Proton/umu-run integration, and Flatpak packaging.
Key features:
- FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak)
- Proton/GE-Proton/umu-run launcher with env var forwarding
- Flatpak support (sandbox-aware VFS, NXM handler, umu-run)
- Wine prefix management UI
- Case-insensitive path resolution for Linux filesystems
- QSettings-safe INI handling (avoids Bethesda INI corruption)
- Portable instance support with auto-generated launcher scripts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/bsapacker/src/PackerDialog.cpp')
| -rw-r--r-- | libs/bsapacker/src/PackerDialog.cpp | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/libs/bsapacker/src/PackerDialog.cpp b/libs/bsapacker/src/PackerDialog.cpp new file mode 100644 index 0000000..cb6bd33 --- /dev/null +++ b/libs/bsapacker/src/PackerDialog.cpp @@ -0,0 +1,98 @@ +#include "PackerDialog.h" + +#include <QObject> +#include <QMessageBox> +#include <QPushButton> +#include <QStringList> + +namespace BsaPacker +{ + constexpr uint32_t DIALOG_WIDTH = 240; + constexpr uint32_t DIALOG_HEIGHT = 200; + constexpr uint32_t COMBO_MIN_WIDTH = 100; + constexpr uint32_t LIST_MIN_HEIGHT = 100; + + PackerDialog::PackerDialog(const IModContext* modContext) : + m_ModContext(modContext), + buttonsOkCancelMod(QDialogButtonBox::Ok | QDialogButtonBox::Cancel) + { + QPushButton* ok = this->buttonsOkCancelMod.button(QDialogButtonBox::Ok); + ok->setEnabled(false); + + this->labelChooseMod.setText(QObject::tr("Choose a mod to pack:")); + this->labelChooseName.setText(QObject::tr("Choose a name for the packed archive:")); + + this->resize(DIALOG_WIDTH, DIALOG_HEIGHT); + this->setWindowTitle(QObject::tr("BSA Packer")); + + this->comboModList.setMinimumWidth(COMBO_MIN_WIDTH); + + this->listArchiveNames.setMinimumHeight(LIST_MIN_HEIGHT); + + this->layoutHorizontal.addStretch(1); + this->layoutHorizontal.addWidget(&buttonsOkCancelMod); + + this->layoutVertical.addWidget(&labelChooseMod); + this->layoutVertical.addWidget(&comboModList); + this->layoutVertical.addWidget(&labelChooseName); + this->layoutVertical.addWidget(&listArchiveNames); + this->layoutVertical.addLayout(&layoutHorizontal); + + this->setLayout(&layoutVertical); + + QObject::connect(&listArchiveNames, &QListWidget::itemSelectionChanged, this, &PackerDialog::RefreshOkButton, Qt::QueuedConnection); + QObject::connect(&listArchiveNames, qOverload<QListWidgetItem*>(&QListWidget::itemDoubleClicked), this, &QDialog::accept); + QObject::connect(&buttonsOkCancelMod, &QDialogButtonBox::accepted, this, &QDialog::accept); + QObject::connect(&buttonsOkCancelMod, &QDialogButtonBox::rejected, this, &QDialog::reject); + QObject::connect(&comboModList, qOverload<const QString&>(&QComboBox::currentTextChanged), [this](auto&& text) { this->UpdateNameList(text); }); + } + + bool PackerDialog::IsNewFilename() const + { + const int currentIndex = this->listArchiveNames.currentIndex().row() + 1; + const int count = this->listArchiveNames.count(); + return currentIndex == count; + } + + QString PackerDialog::SelectedMod() const + { + return this->comboModList.currentText(); + } + + QString PackerDialog::SelectedPluginItem() const + { + const QListWidgetItem* const currentItem = this->listArchiveNames.currentItem(); + return currentItem != nullptr ? currentItem->text() : QString(); + } + + void PackerDialog::RefreshModList() + { + const QStringList validMods = this->m_ModContext->GetValidMods(); + this->comboModList.clear(); + this->comboModList.addItems(validMods); + } + + void PackerDialog::UpdateNameList(const QString& modName) + { + this->listArchiveNames.clear(); + const QString& modPath = this->m_ModContext->GetAbsoluteModPath(modName); + const QStringList& filenames = this->m_ModContext->GetPlugins(modPath); + this->listArchiveNames.addItems(filenames); + } + + int PackerDialog::Exec() + { + return QDialog::exec(); + } + + void PackerDialog::RefreshSelectedName() + { + Q_EMIT this->comboModList.currentTextChanged(this->comboModList.currentText()); + } + + void PackerDialog::RefreshOkButton() + { + QPushButton* ok = this->buttonsOkCancelMod.button(QDialogButtonBox::Ok); + ok->setEnabled(this->listArchiveNames.currentItem() != nullptr); + } +} // namespace BsaPacker |
