summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/mainwindow.cpp27
-rw-r--r--gui/mainwindow.h4
-rw-r--r--gui/mainwindow.ui9
-rw-r--r--gui/settingsdialog.cpp2
4 files changed, 31 insertions, 11 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 43c5cd82..e080bbef 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -27,10 +27,11 @@
#include <QDesktopServices>
#include <QUrl>
#include <QDir>
+#include <QFileInfo>
-#include "util/osutils.h"
-#include "util/userutil.h"
-#include "util/pathutils.h"
+#include "osutils.h"
+#include "userutils.h"
+#include "pathutils.h"
#include "gui/settingsdialog.h"
#include "gui/newinstancedialog.h"
@@ -39,14 +40,20 @@
#include "gui/browserdialog.h"
#include "gui/aboutdialog.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);
@@ -55,8 +62,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()
@@ -77,7 +83,7 @@ void MainWindow::on_actionViewInstanceFolder_triggered()
void MainWindow::on_actionRefresh_triggered()
{
- instList.initialLoad("instances");
+ instList.loadList();
}
void MainWindow::on_actionViewCentralModsFolder_triggered()
@@ -188,3 +194,8 @@ void MainWindow::openWebPage(QUrl url)
browser->load(url);
browser->exec();
}
+
+void openInDefaultProgram(QString filename)
+{
+ QDesktopServices::openUrl("file:///" + QFileInfo(filename).absolutePath());
+}
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index f2dfbc70..a57b8db4 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
@@ -75,7 +75,7 @@ private slots:
private:
Ui::MainWindow *ui;
- InstanceModel instList;
+ InstanceList instList;
};
#endif // MAINWINDOW_H
diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui
index bc58f7f8..137f7e97 100644
--- a/gui/mainwindow.ui
+++ b/gui/mainwindow.ui
@@ -35,6 +35,15 @@
</property>
<item>
<widget class="QTreeView" name="instanceView">
+ <property name="animated">
+ <bool>true</bool>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <attribute name="headerVisible">
+ <bool>false</bool>
+ </attribute>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
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>