Add instance toolbar.
This commit is contained in:
		@@ -19,6 +19,7 @@
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QColor>
 | 
			
		||||
#include <QPoint>
 | 
			
		||||
 | 
			
		||||
#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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,8 @@
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>854</width>
 | 
			
		||||
    <height>480</height>
 | 
			
		||||
    <width>600</width>
 | 
			
		||||
    <height>400</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
@@ -39,6 +39,9 @@
 | 
			
		||||
   </layout>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QToolBar" name="mainToolBar">
 | 
			
		||||
   <property name="windowTitle">
 | 
			
		||||
    <string>Main Toolbar</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="movable">
 | 
			
		||||
    <bool>false</bool>
 | 
			
		||||
   </property>
 | 
			
		||||
@@ -64,6 +67,38 @@
 | 
			
		||||
   <addaction name="actionAbout"/>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QStatusBar" name="statusBar"/>
 | 
			
		||||
  <widget class="QToolBar" name="instanceToolBar">
 | 
			
		||||
   <property name="windowTitle">
 | 
			
		||||
    <string>Instance Toolbar</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="floatable">
 | 
			
		||||
    <bool>false</bool>
 | 
			
		||||
   </property>
 | 
			
		||||
   <attribute name="toolBarArea">
 | 
			
		||||
    <enum>RightToolBarArea</enum>
 | 
			
		||||
   </attribute>
 | 
			
		||||
   <attribute name="toolBarBreak">
 | 
			
		||||
    <bool>false</bool>
 | 
			
		||||
   </attribute>
 | 
			
		||||
   <addaction name="actionLaunchInstance"/>
 | 
			
		||||
   <addaction name="separator"/>
 | 
			
		||||
   <addaction name="actionRenameInstance"/>
 | 
			
		||||
   <addaction name="actionChangeInstGroup"/>
 | 
			
		||||
   <addaction name="actionChangeInstIcon"/>
 | 
			
		||||
   <addaction name="actionChangeInstMCVersion"/>
 | 
			
		||||
   <addaction name="actionChangeInstLWJGLVersion"/>
 | 
			
		||||
   <addaction name="actionEditInstNotes"/>
 | 
			
		||||
   <addaction name="separator"/>
 | 
			
		||||
   <addaction name="actionEditInstMods"/>
 | 
			
		||||
   <addaction name="actionManageInstSaves"/>
 | 
			
		||||
   <addaction name="actionRebuildInstJar"/>
 | 
			
		||||
   <addaction name="separator"/>
 | 
			
		||||
   <addaction name="actionInstanceSettings"/>
 | 
			
		||||
   <addaction name="actionMakeDesktopShortcut"/>
 | 
			
		||||
   <addaction name="actionViewSelectedInstFolder"/>
 | 
			
		||||
   <addaction name="separator"/>
 | 
			
		||||
   <addaction name="actionDeleteInstance"/>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <action name="actionAddInstance">
 | 
			
		||||
   <property name="icon">
 | 
			
		||||
    <iconset resource="../multimc.qrc">
 | 
			
		||||
@@ -178,6 +213,118 @@
 | 
			
		||||
    <enum>QAction::AboutRole</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionLaunchInstance">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Play</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Launch the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionRenameInstance">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Rename</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Rename the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionChangeInstGroup">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Change Group</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Change the selected instance's group.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionChangeInstIcon">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Change Icon</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Change the selected instance's icon.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionEditInstNotes">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Edit Notes</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Edit the notes for the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionInstanceSettings">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Settings</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Change settings for the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionMakeDesktopShortcut">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Make Shortcut</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Make a shortcut on the desktop for the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionManageInstSaves">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Manage Saves</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Manage saves for the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionEditInstMods">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Edit Mods</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Edit the mods for the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionChangeInstMCVersion">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Change Version</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Change the selected instance's Minecraft version.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionChangeInstLWJGLVersion">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Change LWJGL</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Change the version of LWJGL for the selected instance to use.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionRebuildInstJar">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Rebuild Jar</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Re-installs the mods for the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionViewSelectedInstFolder">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>View Folder</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Opens the selected instance's root folder in a file browser.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="actionDeleteInstance">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Delete</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Deletes the selected instance.</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <layoutdefault spacing="6" margin="11"/>
 | 
			
		||||
 <resources>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user