summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
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>