-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Merge or replace strategies - Nexus mappings are optional - If mappings are applied, remapping is optional
- Loading branch information
Showing
3 changed files
with
161 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef CATEGORYIMPORTDIALOG_H | ||
#define CATEGORYIMPORTDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui | ||
{ | ||
class CategoryImportDialog; | ||
} | ||
|
||
/** | ||
* @brief Dialog that allows users to configure mod categories | ||
**/ | ||
class CategoryImportDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
enum ImportStrategy | ||
{ | ||
None, | ||
Overwrite, | ||
Merge | ||
}; | ||
|
||
public: | ||
explicit CategoryImportDialog(QWidget* parent = 0); | ||
~CategoryImportDialog(); | ||
|
||
ImportStrategy strategy(); | ||
bool assign(); | ||
bool remap(); | ||
|
||
public slots: | ||
void accepted(); | ||
void rejected(); | ||
void on_strategyClicked(QAbstractButton* button); | ||
void on_assignOptionClicked(bool clicked); | ||
|
||
private: | ||
Ui::CategoryImportDialog* ui; | ||
}; | ||
|
||
#endif // CATEGORYIMPORTDIALOG_H |