diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-09-07 04:00:58 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-09-07 04:00:58 +0200 |
commit | 6892c11e9f287dcfb1e698f8f46233a01fb7abb6 (patch) | |
tree | ee94607e92bcf39faef7f35842499fafbb2e270f /gui/IconPickerDialog.cpp | |
parent | 3f30055afe757637ae865b2adc7cf021edd9b8b5 (diff) | |
download | MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar.gz MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar.lz MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar.xz MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.zip |
Move a good chunk of the singleton objects into a new QApplication subclass.
Diffstat (limited to 'gui/IconPickerDialog.cpp')
-rw-r--r-- | gui/IconPickerDialog.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp index b75eb30c..2dd80292 100644 --- a/gui/IconPickerDialog.cpp +++ b/gui/IconPickerDialog.cpp @@ -1,7 +1,8 @@ +#include <MultiMC.h> #include "IconPickerDialog.h" #include "instancedelegate.h" #include "ui_IconPickerDialog.h" -#include "logic/IconListModel.h" +#include "logic/lists/IconList.h" #include <QKeyEvent> #include <QPushButton> #include <QFileDialog> @@ -38,8 +39,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : contentsWidget->installEventFilter(this); - IconList * list = IconList::instance(); - contentsWidget->setModel(list); + contentsWidget->setModel(MMC->icons()); auto buttonAdd = ui->buttonBox->addButton("Add Icon",QDialogButtonBox::ResetRole); auto buttonRemove = ui->buttonBox->addButton("Remove Icon",QDialogButtonBox::ResetRole); @@ -71,7 +71,6 @@ bool IconPickerDialog::eventFilter ( QObject* obj, QEvent* evt) return QDialog::eventFilter(obj ,evt); } QKeyEvent *keyEvent = static_cast<QKeyEvent*>(evt); - IconList * list = IconList::instance(); switch(keyEvent->key()) { case Qt::Key_Delete: @@ -89,14 +88,12 @@ bool IconPickerDialog::eventFilter ( QObject* obj, QEvent* evt) void IconPickerDialog::addNewIcon() { QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Icons", QString(), "Icons (*.png *.jpg *.jpeg)"); - IconList * list = IconList::instance(); - list->installIcons(fileNames); + MMC->icons()->installIcons(fileNames); } void IconPickerDialog::removeSelectedIcon() { - IconList * list = IconList::instance(); - list->deleteIcon(selectedIconKey); + MMC->icons()->deleteIcon(selectedIconKey); } @@ -119,7 +116,7 @@ void IconPickerDialog::selectionChanged ( QItemSelection selected, QItemSelectio int IconPickerDialog::exec ( QString selection ) { - IconList * list = IconList::instance(); + IconList * list = MMC->icons(); auto contentsWidget = ui->iconView; selectedIconKey = selection; |