diff options
author | Petr Mrázek <peterix@gmail.com> | 2018-02-05 02:01:12 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2018-02-05 02:01:12 +0100 |
commit | 41aef8414a0c01883a431c0353369ba1651b5cd9 (patch) | |
tree | cbbc45b79dc252cb02a7f8a503c86e94a48f3bde /application/dialogs | |
parent | 83649b5d52c1e9e56cf1fc4e5f5ab42b7508ad77 (diff) | |
download | MultiMC-41aef8414a0c01883a431c0353369ba1651b5cd9.tar MultiMC-41aef8414a0c01883a431c0353369ba1651b5cd9.tar.gz MultiMC-41aef8414a0c01883a431c0353369ba1651b5cd9.tar.lz MultiMC-41aef8414a0c01883a431c0353369ba1651b5cd9.tar.xz MultiMC-41aef8414a0c01883a431c0353369ba1651b5cd9.zip |
NOISSUE add an 'open folder' button to the icon dialog
Diffstat (limited to 'application/dialogs')
-rw-r--r-- | application/dialogs/IconPickerDialog.cpp | 18 | ||||
-rw-r--r-- | application/dialogs/IconPickerDialog.h | 1 |
2 files changed, 14 insertions, 5 deletions
diff --git a/application/dialogs/IconPickerDialog.cpp b/application/dialogs/IconPickerDialog.cpp index 5dabaee4..89f3ca4d 100644 --- a/application/dialogs/IconPickerDialog.cpp +++ b/application/dialogs/IconPickerDialog.cpp @@ -25,6 +25,7 @@ #include "groupview/InstanceDelegate.h" #include "icons/IconList.h" +#include <DesktopServices.h> IconPickerDialog::IconPickerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::IconPickerDialog) @@ -59,19 +60,21 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) contentsWidget->setModel(MMC->icons().get()); + // NOTE: ResetRole forces the button to be on the left, while the OK/Cancel ones are on the right. We win. auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"), QDialogButtonBox::ResetRole); - auto buttonRemove = - ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole); + auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole); connect(buttonAdd, SIGNAL(clicked(bool)), SLOT(addNewIcon())); connect(buttonRemove, SIGNAL(clicked(bool)), SLOT(removeSelectedIcon())); connect(contentsWidget, SIGNAL(doubleClicked(QModelIndex)), SLOT(activated(QModelIndex))); - connect(contentsWidget->selectionModel(), - SIGNAL(selectionChanged(QItemSelection, QItemSelection)), - SLOT(selectionChanged(QItemSelection, QItemSelection))); + connect(contentsWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(selectionChanged(QItemSelection, QItemSelection))); + + auto buttonFolder = ui->buttonBox->addButton(tr("Open Folder"), QDialogButtonBox::ResetRole); + connect(buttonFolder, &QPushButton::clicked, this, &IconPickerDialog::openFolder); } + bool IconPickerDialog::eventFilter(QObject *obj, QEvent *evt) { if (obj != ui->iconView) @@ -152,3 +155,8 @@ IconPickerDialog::~IconPickerDialog() { delete ui; } + +void IconPickerDialog::openFolder() +{ + DesktopServices::openDirectory(MMC->icons()->getDirectory(), true); +} diff --git a/application/dialogs/IconPickerDialog.h b/application/dialogs/IconPickerDialog.h index a2a657ed..e4598324 100644 --- a/application/dialogs/IconPickerDialog.h +++ b/application/dialogs/IconPickerDialog.h @@ -45,4 +45,5 @@ slots: void delayed_scroll(QModelIndex); void addNewIcon(); void removeSelectedIcon(); + void openFolder(); }; |