summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-02-21 18:09:26 +0100
committerPetr Mrázek <peterix@gmail.com>2013-02-21 18:09:26 +0100
commit58379657e99a146123814fd182d6c58424e9713e (patch)
tree98b601a9edf238683857ab9ad78855cbf52a64e9 /gui
parent1beef3f73cd126af9ce3805b6990c64b835a593b (diff)
parent96e4f73a94e0697ce7200e09983d447220ea5a0b (diff)
downloadMultiMC-58379657e99a146123814fd182d6c58424e9713e.tar
MultiMC-58379657e99a146123814fd182d6c58424e9713e.tar.gz
MultiMC-58379657e99a146123814fd182d6c58424e9713e.tar.lz
MultiMC-58379657e99a146123814fd182d6c58424e9713e.tar.xz
MultiMC-58379657e99a146123814fd182d6c58424e9713e.zip
Merge branch 'inst_rewrite' of https://github.com/Forkk/MultiMC5
Conflicts: data/instancemodel.cpp
Diffstat (limited to 'gui')
-rw-r--r--gui/mainwindow.cpp23
-rw-r--r--gui/mainwindow.h4
-rw-r--r--gui/settingsdialog.cpp2
3 files changed, 20 insertions, 9 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index bc0840a0..19ff2108 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -21,22 +21,29 @@
#include <QDesktopServices>
#include <QUrl>
+#include <QFileInfo>
-#include "util/osutils.h"
+#include "osutils.h"
#include "gui/settingsdialog.h"
#include "gui/newinstancedialog.h"
#include "gui/logindialog.h"
#include "gui/taskdialog.h"
-#include "data/appsettings.h"
+#include "instancelist.h"
+#include "appsettings.h"
#include "data/version.h"
#include "tasks/logintask.h"
+// Opens the given file in the default application.
+// TODO: Move this somewhere.
+void openInDefaultProgram(QString filename);
+
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
- ui(new Ui::MainWindow)
+ ui(new Ui::MainWindow),
+ instList(settings->getInstanceDir())
{
ui->setupUi(this);
@@ -45,8 +52,7 @@ MainWindow::MainWindow(QWidget *parent) :
restoreGeometry(settings->getConfig().value("MainWindowGeometry", saveGeometry()).toByteArray());
restoreState(settings->getConfig().value("MainWindowState", saveState()).toByteArray());
- instList.initialLoad("instances");
- ui->instanceView->setModel(&instList);
+ instList.loadList();
}
MainWindow::~MainWindow()
@@ -67,7 +73,7 @@ void MainWindow::on_actionViewInstanceFolder_triggered()
void MainWindow::on_actionRefresh_triggered()
{
- instList.initialLoad("instances");
+ instList.loadList();
}
void MainWindow::on_actionViewCentralModsFolder_triggered()
@@ -155,3 +161,8 @@ void MainWindow::onLoginComplete(LoginResponse response)
QString("Logged in as %1 with session ID %2.").
arg(response.getUsername(), response.getSessionID()));
}
+
+void openInDefaultProgram(QString filename)
+{
+ QDesktopServices::openUrl("file:///" + QFileInfo(filename).absolutePath());
+}
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index 28ca341a..591d0632 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -18,7 +18,7 @@
#include <QMainWindow>
-#include "data/instancemodel.h"
+#include "instancelist.h"
#include "data/loginresponse.h"
namespace Ui
@@ -70,7 +70,7 @@ private slots:
private:
Ui::MainWindow *ui;
- InstanceModel instList;
+ InstanceList instList;
};
#endif // MAINWINDOW_H
diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp
index ab4d18ee..b3c42380 100644
--- a/gui/settingsdialog.cpp
+++ b/gui/settingsdialog.cpp
@@ -16,7 +16,7 @@
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
-#include "data/appsettings.h"
+#include "appsettings.h"
#include <QFileDialog>
#include <QMessageBox>