diff options
Diffstat (limited to 'application/dialogs/IconPickerDialog.cpp')
-rw-r--r-- | application/dialogs/IconPickerDialog.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/application/dialogs/IconPickerDialog.cpp b/application/dialogs/IconPickerDialog.cpp index 70649b72..4ffd12bc 100644 --- a/application/dialogs/IconPickerDialog.cpp +++ b/application/dialogs/IconPickerDialog.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2017 MultiMC Contributors +/* Copyright 2013-2018 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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) @@ -101,7 +104,7 @@ void IconPickerDialog::addNewIcon() QString selectIcons = tr("Select Icons"); //: The type of icon files QStringList fileNames = QFileDialog::getOpenFileNames(this, selectIcons, QString(), - tr("Icons") + "(*.png *.jpg *.jpeg *.ico)"); + tr("Icons") + "(*.png *.jpg *.jpeg *.ico *.svg)"); MMC->icons()->installIcons(fileNames); } @@ -152,3 +155,8 @@ IconPickerDialog::~IconPickerDialog() { delete ui; } + +void IconPickerDialog::openFolder() +{ + DesktopServices::openDirectory(MMC->icons()->getDirectory(), true); +} |