diff --git a/data/appsettings.h b/data/appsettings.h index eff22b11..a9068bfd 100644 --- a/data/appsettings.h +++ b/data/appsettings.h @@ -19,6 +19,7 @@ #include #include #include +#include #include "util/apputils.h" #include "util/osutils.h" @@ -60,6 +61,10 @@ public: DEFINE_SETTING(ShowConsole, bool, true) DEFINE_SETTING(AutoCloseConsole, bool, true) + // Toolbar settings + DEFINE_SETTING(InstanceToolbarVisible, bool, true) + DEFINE_SETTING(InstanceToolbarPosition, QPoint, QPoint()) + // Console Colors DEFINE_SETTING(SysMessageColor, QColor, QColor(Qt::blue)) DEFINE_SETTING(StdOutColor, QColor, QColor(Qt::black)) @@ -97,6 +102,8 @@ class AppSettings : public SettingsBase public: explicit AppSettings(QObject *parent = 0); + QSettings& getConfig() { return config; } + protected: virtual QVariant getValue(const QString &name, QVariant defVal = QVariant()) const; virtual void setValue(const QString& name, QVariant val); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index e2a3abfb..e257f5ae 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -32,6 +32,9 @@ MainWindow::MainWindow(QWidget *parent) : setWindowTitle(QString("MultiMC %1").arg(Version::current.toString())); + restoreGeometry(settings->getConfig().value("MainWindowGeometry", saveGeometry()).toByteArray()); + restoreState(settings->getConfig().value("MainWindowState", saveState()).toByteArray()); + instList.initialLoad("instances"); ui->instanceView->setModel(&instList); } @@ -86,3 +89,18 @@ void MainWindow::on_actionAbout_triggered() { } + +void MainWindow::on_mainToolBar_visibilityChanged(bool) +{ + // Don't allow hiding the main toolbar. + // This is the only way I could find to prevent it... :/ + ui->mainToolBar->setVisible(true); +} + +void MainWindow::closeEvent(QCloseEvent *event) +{ + // Save the window state and geometry. + settings->getConfig().setValue("MainWindowGeometry", saveGeometry()); + settings->getConfig().setValue("MainWindowState", saveState()); + QMainWindow::closeEvent(event); +} diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 77245531..91efd497 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -33,6 +33,8 @@ public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); + void closeEvent(QCloseEvent *event); + private slots: void on_actionAbout_triggered(); @@ -52,6 +54,8 @@ private slots: void on_actionNews_triggered(); + void on_mainToolBar_visibilityChanged(bool); + private: Ui::MainWindow *ui; diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 6640657a..3e832276 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 854 - 480 + 600 + 400 @@ -39,6 +39,9 @@ + + Main Toolbar + false @@ -64,6 +67,38 @@ + + + Instance Toolbar + + + false + + + RightToolBarArea + + + false + + + + + + + + + + + + + + + + + + + + @@ -178,6 +213,118 @@ QAction::AboutRole + + + Play + + + Launch the selected instance. + + + + + Rename + + + Rename the selected instance. + + + + + Change Group + + + Change the selected instance's group. + + + + + Change Icon + + + Change the selected instance's icon. + + + + + Edit Notes + + + Edit the notes for the selected instance. + + + + + Settings + + + Change settings for the selected instance. + + + + + Make Shortcut + + + Make a shortcut on the desktop for the selected instance. + + + + + Manage Saves + + + Manage saves for the selected instance. + + + + + Edit Mods + + + Edit the mods for the selected instance. + + + + + Change Version + + + Change the selected instance's Minecraft version. + + + + + Change LWJGL + + + Change the version of LWJGL for the selected instance to use. + + + + + Rebuild Jar + + + Re-installs the mods for the selected instance. + + + + + View Folder + + + Opens the selected instance's root folder in a file browser. + + + + + Delete + + + Deletes the selected instance. + +