diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-08-12 00:39:19 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-08-12 00:39:19 +0200 |
commit | ff33d4a1a48abf1442cde77c2253f071d0870d50 (patch) | |
tree | 7846f144b2ee2e24574745847c0f921677021d73 /gui | |
parent | 7e78a422e8bb22572706b7fadb58fc45e7b8a7db (diff) | |
download | MultiMC-ff33d4a1a48abf1442cde77c2253f071d0870d50.tar MultiMC-ff33d4a1a48abf1442cde77c2253f071d0870d50.tar.gz MultiMC-ff33d4a1a48abf1442cde77c2253f071d0870d50.tar.lz MultiMC-ff33d4a1a48abf1442cde77c2253f071d0870d50.tar.xz MultiMC-ff33d4a1a48abf1442cde77c2253f071d0870d50.zip |
OneSix instances now have a minecraft folder inside.
Also, the main instance view was expanded with helpful key events:
F2 for rename, F5 for refresh, Enter for start instance, Delete for...
Diffstat (limited to 'gui')
-rw-r--r-- | gui/instancemodel.cpp | 2 | ||||
-rw-r--r-- | gui/mainwindow.cpp | 36 | ||||
-rw-r--r-- | gui/mainwindow.h | 3 |
3 files changed, 38 insertions, 3 deletions
diff --git a/gui/instancemodel.cpp b/gui/instancemodel.cpp index dbeba0da..3cbb0fb9 100644 --- a/gui/instancemodel.cpp +++ b/gui/instancemodel.cpp @@ -68,7 +68,7 @@ QVariant InstanceModel::data ( const QModelIndex& index, int role ) const } case Qt::ToolTipRole: { - return pdata->rootDir(); + return pdata->instanceRoot(); } case Qt::DecorationRole: { diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 6187de93..6176c079 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -109,6 +109,7 @@ MainWindow::MainWindow ( QWidget *parent ) : view->setItemDelegate(delegate); view->setSpacing(10); view->setUniformItemWidths(true); + view->installEventFilter(this); model = new InstanceModel ( instList,this ); proxymodel = new InstanceProxyModel ( this ); @@ -160,6 +161,37 @@ MainWindow::~MainWindow() delete assets_downloader; } +bool MainWindow::eventFilter ( QObject* obj, QEvent* ev ) +{ + if(obj == view) + { + if (ev->type() == QEvent::KeyPress) + { + QKeyEvent *keyEvent = static_cast<QKeyEvent*>(ev); + switch(keyEvent->key()) + { + case Qt::Key_Enter: + case Qt::Key_Return: + on_actionLaunchInstance_triggered(); + return true; + case Qt::Key_Delete: + on_actionDeleteInstance_triggered(); + return true; + case Qt::Key_F5: + on_actionRefresh_triggered(); + return true; + case Qt::Key_F2: + on_actionRenameInstance_triggered(); + return true; + default: + break; + } + } + } + return QMainWindow::eventFilter ( obj, ev ); +} + + void MainWindow::instanceActivated ( QModelIndex index ) { if(!index.isValid()) @@ -306,7 +338,7 @@ void MainWindow::on_actionDeleteInstance_triggered() QString("This is permanent! Are you sure?\nAbout to delete: ") + inst->name()); if (response == QMessageBox::Yes) { - QDir(inst->rootDir()).removeRecursively(); + QDir(inst->instanceRoot()).removeRecursively(); instList.loadList(); } } @@ -335,7 +367,7 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered() BaseInstance* inst = selectedInstance(); if(inst) { - QString str = inst->rootDir(); + QString str = inst->instanceRoot(); openDirInDefaultProgram ( QDir(str).absolutePath() ); } } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index efcbc80c..62115e1d 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -122,6 +122,9 @@ public slots: void launchInstance(BaseInstance *inst, LoginResponse response); +protected: + bool eventFilter(QObject *obj, QEvent *ev); + private: Ui::MainWindow *ui; KCategoryDrawer * drawer; |