diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/IconPickerDialog.cpp | 55 | ||||
-rw-r--r-- | gui/IconPickerDialog.h | 5 | ||||
-rw-r--r-- | gui/aboutdialog.cpp | 17 | ||||
-rw-r--r-- | gui/instancesettings.ui | 8 | ||||
-rw-r--r-- | gui/mainwindow.cpp | 1 | ||||
-rw-r--r-- | gui/settingsdialog.cpp | 8 | ||||
-rw-r--r-- | gui/settingsdialog.ui | 16 |
7 files changed, 80 insertions, 30 deletions
diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp index d80673a8..d3a33e57 100644 --- a/gui/IconPickerDialog.cpp +++ b/gui/IconPickerDialog.cpp @@ -2,6 +2,9 @@ #include "instancedelegate.h" #include "ui_IconPickerDialog.h" #include "logic/IconListModel.h" +#include <QKeyEvent> +#include <QPushButton> +#include <QFileDialog> IconPickerDialog::IconPickerDialog(QWidget *parent) : QDialog(parent), @@ -25,9 +28,24 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : contentsWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); contentsWidget->setItemDelegate(new ListViewDelegate()); + //contentsWidget->setAcceptDrops(true); + contentsWidget->setDropIndicatorShown(true); + contentsWidget->viewport()->setAcceptDrops(true); + contentsWidget->setDragDropMode(QAbstractItemView::DropOnly); + contentsWidget->setDefaultDropAction(Qt::CopyAction); + + contentsWidget->installEventFilter(this); + IconList * list = IconList::instance(); contentsWidget->setModel(list); + auto buttonAdd = ui->buttonBox->addButton("Add Icon",QDialogButtonBox::ResetRole); + auto buttonRemove = ui->buttonBox->addButton("Remove Icon",QDialogButtonBox::ResetRole); + + + connect(buttonAdd,SIGNAL(clicked(bool)),SLOT(addNewIcon())); + connect(buttonRemove,SIGNAL(clicked(bool)),SLOT(removeSelectedIcon())); + connect ( contentsWidget, @@ -42,6 +60,43 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : SLOT(selectionChanged(QItemSelection,QItemSelection)) ); } +bool IconPickerDialog::eventFilter ( QObject* obj, QEvent* evt) +{ + if(obj != ui->iconView) + return QDialog::eventFilter(obj ,evt); + if (evt->type() != QEvent::KeyPress) + { + return QDialog::eventFilter(obj ,evt); + } + QKeyEvent *keyEvent = static_cast<QKeyEvent*>(evt); + IconList * list = IconList::instance(); + switch(keyEvent->key()) + { + case Qt::Key_Delete: + removeSelectedIcon(); + return true; + case Qt::Key_Plus: + addNewIcon(); + return true; + default: + break; + } + return QDialog::eventFilter(obj ,evt); +} + +void IconPickerDialog::addNewIcon() +{ + QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Icons", QString(), "Icons (*.png *.jpg *.jpeg)"); + IconList * list = IconList::instance(); + list->installIcons(fileNames); +} + +void IconPickerDialog::removeSelectedIcon() +{ + IconList * list = IconList::instance(); + list->deleteIcon(selectedIconKey); +} + void IconPickerDialog::activated ( QModelIndex index ) { diff --git a/gui/IconPickerDialog.h b/gui/IconPickerDialog.h index c55f6ff2..96fc61ff 100644 --- a/gui/IconPickerDialog.h +++ b/gui/IconPickerDialog.h @@ -15,7 +15,8 @@ public: ~IconPickerDialog(); int exec(QString selection); QString selectedIconKey; - +protected: + virtual bool eventFilter ( QObject* , QEvent* ); private: Ui::IconPickerDialog *ui; @@ -23,4 +24,6 @@ private slots: void selectionChanged ( QItemSelection,QItemSelection ); void activated ( QModelIndex ); void delayed_scroll ( QModelIndex ); + void addNewIcon(); + void removeSelectedIcon(); }; diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp index 876f3044..873cc175 100644 --- a/gui/aboutdialog.cpp +++ b/gui/aboutdialog.cpp @@ -1,23 +1,24 @@ #include "aboutdialog.h" #include "ui_aboutdialog.h" +#include <AppVersion.h> #include <QIcon> #include <QApplication> AboutDialog::AboutDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::AboutDialog) + QDialog(parent), + ui(new Ui::AboutDialog) { - ui->setupUi(this); + ui->setupUi(this); - ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64)); + ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64)); + ui->title->setText("MultiMC " + AppVersion::current.toString()); + connect(ui->closeButton, SIGNAL(clicked()), SLOT(close())); - connect(ui->closeButton, SIGNAL(clicked()), SLOT(close())); - - QApplication::instance()->connect(ui->aboutQt, SIGNAL(clicked()), SLOT(aboutQt())); + QApplication::instance()->connect(ui->aboutQt, SIGNAL(clicked()), SLOT(aboutQt())); } AboutDialog::~AboutDialog() { - delete ui; + delete ui; } diff --git a/gui/instancesettings.ui b/gui/instancesettings.ui index 4a8ae12c..49309f11 100644 --- a/gui/instancesettings.ui +++ b/gui/instancesettings.ui @@ -43,13 +43,6 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> - <widget class="QCheckBox" name="compatModeCheckBox"> - <property name="text"> - <string>Compatibility mode?</string> - </property> - </widget> - </item> - <item> <widget class="QCheckBox" name="maximizedCheckBox"> <property name="text"> <string>Start Minecraft maximized?</string> @@ -403,7 +396,6 @@ <tabstops> <tabstop>settingsTabs</tabstop> <tabstop>windowSizeGroupBox</tabstop> - <tabstop>compatModeCheckBox</tabstop> <tabstop>maximizedCheckBox</tabstop> <tabstop>windowWidthSpinBox</tabstop> <tabstop>windowHeightSpinBox</tabstop> diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index fbda2547..8b06d698 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -87,6 +87,7 @@ MainWindow::MainWindow ( QWidget *parent ) : // the rename label is inside the rename tool button renameButton = new LabeledToolButton(); renameButton->setText("Instance Name"); + renameButton->setToolTip(ui->actionRenameInstance->toolTip()); connect(renameButton, SIGNAL(clicked(bool)), SLOT(on_actionRenameInstance_triggered())); ui->instanceToolBar->insertWidget(ui->actionLaunchInstance, renameButton); ui->instanceToolBar->insertSeparator(ui->actionLaunchInstance); diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index 909706b6..52093039 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -43,12 +43,8 @@ void SettingsDialog::showEvent ( QShowEvent* ev ) void SettingsDialog::updateCheckboxStuff() { - ui->windowWidthSpinBox->setEnabled(!(ui->compatModeCheckBox->isChecked() || - ui->maximizedCheckBox->isChecked())); - ui->windowHeightSpinBox->setEnabled(!(ui->compatModeCheckBox->isChecked() || - ui->maximizedCheckBox->isChecked())); - - ui->maximizedCheckBox->setEnabled(!ui->compatModeCheckBox->isChecked()); + ui->windowWidthSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked()); + ui->windowHeightSpinBox->setEnabled(! ui->maximizedCheckBox->isChecked()); } void SettingsDialog::on_instDirBrowseBtn_clicked() diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui index 8b53b0f1..0d30e301 100644 --- a/gui/settingsdialog.ui +++ b/gui/settingsdialog.ui @@ -54,6 +54,9 @@ <property name="text"> <string>By last launched</string> </property> + <attribute name="buttonGroup"> + <string notr="true">sortingModeGroup</string> + </attribute> </widget> </item> <item> @@ -61,6 +64,9 @@ <property name="text"> <string>By name</string> </property> + <attribute name="buttonGroup"> + <string notr="true">sortingModeGroup</string> + </attribute> </widget> </item> </layout> @@ -176,13 +182,6 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> - <widget class="QCheckBox" name="compatModeCheckBox"> - <property name="text"> - <string>Compatibility mode?</string> - </property> - </widget> - </item> - <item> <widget class="QCheckBox" name="maximizedCheckBox"> <property name="text"> <string>Start Minecraft maximized?</string> @@ -504,4 +503,7 @@ </hints> </connection> </connections> + <buttongroups> + <buttongroup name="sortingModeGroup"/> + </buttongroups> </ui> |