diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2023-09-21 21:04:45 -0500 |
|---|---|---|
| committer | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2023-09-21 21:04:45 -0500 |
| commit | 7c900bb1c86406669119a71bbbe156fedc8341cd (patch) | |
| tree | 14fb3a459081f703e9eed98d4d6206a79249456f /src/categoryimportdialog.cpp | |
| parent | d2e48ed72e3526c08580d5c4b3531778267532c5 (diff) | |
Add new dialog for category import
- Merge or replace strategies
- Nexus mappings are optional
- If mappings are applied, remapping is optional
Diffstat (limited to 'src/categoryimportdialog.cpp')
| -rw-r--r-- | src/categoryimportdialog.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/categoryimportdialog.cpp b/src/categoryimportdialog.cpp new file mode 100644 index 00000000..4b09c391 --- /dev/null +++ b/src/categoryimportdialog.cpp @@ -0,0 +1,75 @@ +#include "categoryimportdialog.h" +#include "ui_categoryimportdialog.h" + +#include "organizercore.h" + +using namespace MOBase; + +CategoryImportDialog::CategoryImportDialog(QWidget* parent) + : QDialog(parent), ui(new Ui::CategoryImportDialog) +{ + ui->setupUi(this); + connect(ui->buttonBox, &QDialogButtonBox::accepted, this, + &CategoryImportDialog::accepted); + connect(ui->buttonBox, &QDialogButtonBox::rejected, this, + &CategoryImportDialog::rejected); + connect(ui->strategyGroup, &QButtonGroup::buttonClicked, this, + &CategoryImportDialog::on_strategyClicked); + connect(ui->assignOption, &QCheckBox::clicked, this, + &CategoryImportDialog::on_assignOptionClicked); +} + +void CategoryImportDialog::accepted() +{ + accept(); +} + +void CategoryImportDialog::rejected() +{ + reject(); +} + +CategoryImportDialog::~CategoryImportDialog() +{ + delete ui; +} + +CategoryImportDialog::ImportStrategy CategoryImportDialog::strategy() +{ + if (ui->mergeOption->isChecked()) { + return ImportStrategy::Merge; + } else if (ui->replaceOption->isChecked()) { + return ImportStrategy::Overwrite; + } + return ImportStrategy::None; +} + +bool CategoryImportDialog::assign() +{ + return ui->assignOption->isChecked(); +} + +bool CategoryImportDialog::remap() +{ + return ui->remapOption->isChecked(); +} + +void CategoryImportDialog::on_strategyClicked(QAbstractButton* button) +{ + if (button == ui->replaceOption) { + ui->remapOption->setChecked(false); + ui->remapOption->setDisabled(true); + } else { + ui->remapOption->setEnabled(true); + } +} + +void CategoryImportDialog::on_assignOptionClicked(bool checked) +{ + if (checked && strategy() == ImportStrategy::Merge) { + ui->remapOption->setEnabled(true); + } else { + ui->remapOption->setChecked(false); + ui->remapOption->setDisabled(true); + } +} |
