From cd6bb523ae79cb860bfff8f7712ac628cb8df299 Mon Sep 17 00:00:00 2001 From: Warchamp7 Date: Sun, 23 Feb 2025 00:05:16 -0500 Subject: [PATCH] frontend: Adjust scene collection importer --- frontend/data/locale/en-US.ini | 3 ++- frontend/data/themes/Yami.obt | 21 ++++++++++++++------- frontend/data/themes/Yami_Light.ovt | 18 ++++++++++++------ frontend/forms/OBSImporter.ui | 23 +++++++++++++++-------- frontend/importer/OBSImporter.cpp | 18 +++++++++++++++--- 5 files changed, 58 insertions(+), 25 deletions(-) diff --git a/frontend/data/locale/en-US.ini b/frontend/data/locale/en-US.ini index cd9fde94d..f3cb18dc8 100644 --- a/frontend/data/locale/en-US.ini +++ b/frontend/data/locale/en-US.ini @@ -1443,7 +1443,7 @@ ResizeOutputSizeOfSource.Continue="Do you want to continue?" PreviewTransition="Preview Transition" # Import Dialog -Importer="Scene Collection Importer" +Importer="Import Scene Collection" Importer.SelectCollection="Select a Scene Collection" Importer.Collection="Scene Collection" Importer.HelpText="Add files to this window to import collections from OBS or other supported programs." @@ -1451,6 +1451,7 @@ Importer.Path="Collection Path" Importer.Program="Detected Application" Importer.AutomaticCollectionPrompt="Automatically Search for Scene Collections" Importer.AutomaticCollectionText="OBS can automatically find importable scene collections from supported third-party programs. Would you like OBS to automatically find collections for you?\n\nYou can change this later in Settings > General > Importers." +Importer.SelectFile="Browse..." # Importers OBSStudio="OBS Studio" diff --git a/frontend/data/themes/Yami.obt b/frontend/data/themes/Yami.obt index c13e31707..8f9f2ed8f 100644 --- a/frontend/data/themes/Yami.obt +++ b/frontend/data/themes/Yami.obt @@ -1555,7 +1555,8 @@ OBSBasicSettings { /* Checkboxes */ QCheckBox::indicator, -QGroupBox::indicator { +QGroupBox::indicator, +QTableView::indicator { width: var(--icon_base); height: var(--icon_base); } @@ -1565,33 +1566,39 @@ QGroupBox::indicator { } QCheckBox::indicator:unchecked, -QGroupBox::indicator:unchecked { +QGroupBox::indicator:unchecked, +QTableView::indicator:unchecked { image: url(theme:Yami/checkbox_unchecked.svg); } QCheckBox::indicator:unchecked:hover, -QGroupBox::indicator:unchecked:hover { +QGroupBox::indicator:unchecked:hover, +QTableView::indicator:unchecked:hover { border: none; image: url(theme:Yami/checkbox_unchecked_focus.svg); } QCheckBox::indicator:checked, -QGroupBox::indicator:checked { +QGroupBox::indicator:checked, +QTableView::indicator:checked { image: url(theme:Yami/checkbox_checked.svg); } QCheckBox::indicator:checked:hover, -QGroupBox::indicator:checked:hover { +QGroupBox::indicator:checked:hover, +QTableView::indicator:checked:hover { image: url(theme:Yami/checkbox_checked_focus.svg); } QCheckBox::indicator:checked:disabled, -QGroupBox::indicator:checked:disabled { +QGroupBox::indicator:checked:disabled, +QTableView::indicator:checked:disabled { image: url(theme:Yami/checkbox_checked_disabled.svg); } QCheckBox::indicator:unchecked:disabled, -QGroupBox::indicator:unchecked:disabled { +QGroupBox::indicator:unchecked:disabled, +QTableView::indicator:unchecked:disabled { image: url(theme:Yami/checkbox_unchecked_disabled.svg); } diff --git a/frontend/data/themes/Yami_Light.ovt b/frontend/data/themes/Yami_Light.ovt index e9bf87686..4d31b3e31 100644 --- a/frontend/data/themes/Yami_Light.ovt +++ b/frontend/data/themes/Yami_Light.ovt @@ -157,32 +157,38 @@ OBSBasicSettings { } QCheckBox::indicator:unchecked, -QGroupBox::indicator:unchecked { +QGroupBox::indicator:unchecked, +QTableView::indicator:unchecked { image: url(theme:Light/checkbox_unchecked.svg); } QCheckBox::indicator:unchecked:hover, -QGroupBox::indicator:unchecked:hover { +QGroupBox::indicator:unchecked:hover, +QTableView::indicator:unchecked:hover { image: url(theme:Light/checkbox_unchecked_focus.svg); } QCheckBox::indicator:checked, -QGroupBox::indicator:checked { +QGroupBox::indicator:checked, +QTableView::indicator:checked { image: url(theme:Light/checkbox_checked.svg); } QCheckBox::indicator:checked:hover, -QGroupBox::indicator:checked:hover { +QGroupBox::indicator:checked:hover, +QTableView::indicator:checked:hover { image: url(theme:Light/checkbox_checked_focus.svg); } QCheckBox::indicator:checked:disabled, -QGroupBox::indicator:checked:disabled { +QGroupBox::indicator:checked:disabled, +QTableView::indicator:checked:disabled { image: url(theme:Light/checkbox_checked_disabled.svg); } QCheckBox::indicator:unchecked:disabled, -QGroupBox::indicator:unchecked:disabled { +QGroupBox::indicator:unchecked:disabled, +QTableView::indicator:unchecked:disabled { image: url(theme:Light/checkbox_unchecked_disabled.svg); } diff --git a/frontend/forms/OBSImporter.ui b/frontend/forms/OBSImporter.ui index 0528d543d..18cdf2814 100644 --- a/frontend/forms/OBSImporter.ui +++ b/frontend/forms/OBSImporter.ui @@ -17,27 +17,34 @@ true - - - - Importer.HelpText - - - 6 + + + + Importer.SelectFile + + + - QDialogButtonBox::Close|QDialogButtonBox::Ok|QDialogButtonBox::Open + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + Importer.HelpText + + + diff --git a/frontend/importer/OBSImporter.cpp b/frontend/importer/OBSImporter.cpp index 0bb270ab0..9576cc8ec 100644 --- a/frontend/importer/OBSImporter.cpp +++ b/frontend/importer/OBSImporter.cpp @@ -42,6 +42,7 @@ OBSImporter::OBSImporter(QWidget *parent) : QDialog(parent), optionsModel(new Im ui->tableView->setModel(optionsModel); ui->tableView->setItemDelegateForColumn(ImporterColumn::Path, new ImporterEntryPathItemDelegate()); ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeMode::ResizeToContents); + ui->tableView->horizontalHeader()->setSectionResizeMode(ImporterColumn::Name, QHeaderView::ResizeMode::Stretch); ui->tableView->horizontalHeader()->setSectionResizeMode(ImporterColumn::Path, QHeaderView::ResizeMode::Stretch); connect(optionsModel, &ImporterModel::dataChanged, this, &OBSImporter::dataChanged); @@ -49,12 +50,11 @@ OBSImporter::OBSImporter(QWidget *parent) : QDialog(parent), optionsModel(new Im ui->tableView->setEditTriggers(QAbstractItemView::EditTrigger::CurrentChanged); ui->buttonBox->button(QDialogButtonBox::Ok)->setText(QTStr("Import")); - ui->buttonBox->button(QDialogButtonBox::Open)->setText(QTStr("Add")); connect(ui->buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &OBSImporter::importCollections); - connect(ui->buttonBox->button(QDialogButtonBox::Open), &QPushButton::clicked, this, &OBSImporter::browseImport); - connect(ui->buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, this, &OBSImporter::close); + connect(ui->importerSelectFiles, &QPushButton::clicked, this, &OBSImporter::browseImport); + connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &OBSImporter::close); ImportersInit(); @@ -229,4 +229,16 @@ void OBSImporter::importCollections() void OBSImporter::dataChanged() { ui->tableView->resizeColumnToContents(ImporterColumn::Name); + + bool enableImportButton = false; + + for (int i = 0; i < optionsModel->rowCount() - 1; i++) { + int selected = optionsModel->index(i, ImporterColumn::Selected).data(Qt::CheckStateRole).value(); + if (selected == Qt::Checked) { + enableImportButton = true; + break; + } + } + + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enableImportButton); }