summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-02-01 13:07:36 -0600
committerAndrew <forkk@forkk.net>2013-02-01 13:07:36 -0600
commit3c8a12aded03e6e3f4a0c50cbb7a7ef4e57fab07 (patch)
tree347c31b8d86b923bdf535ec95ec19c93478af2c6
parenta96e1853de4c2769a6c3092212bec4276630b719 (diff)
downloadMultiMC-3c8a12aded03e6e3f4a0c50cbb7a7ef4e57fab07.tar
MultiMC-3c8a12aded03e6e3f4a0c50cbb7a7ef4e57fab07.tar.gz
MultiMC-3c8a12aded03e6e3f4a0c50cbb7a7ef4e57fab07.tar.lz
MultiMC-3c8a12aded03e6e3f4a0c50cbb7a7ef4e57fab07.tar.xz
MultiMC-3c8a12aded03e6e3f4a0c50cbb7a7ef4e57fab07.zip
Added new instance dialog.
-rw-r--r--CMakeLists.txt3
-rw-r--r--gui/mainwindow.cpp7
-rw-r--r--gui/newinstancedialog.cpp33
-rw-r--r--gui/newinstancedialog.h37
-rw-r--r--gui/newinstancedialog.ui166
-rw-r--r--multimc.qrc61
6 files changed, 276 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20675e0d..0f5bd8ed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,6 +100,7 @@ data/version.cpp
gui/mainwindow.cpp
gui/modeditwindow.cpp
gui/settingsdialog.cpp
+gui/newinstancedialog.cpp
util/pathutils.cpp
util/osutils.cpp
@@ -112,6 +113,7 @@ SET(MULTIMC_HEADERS
gui/mainwindow.h
gui/modeditwindow.h
gui/settingsdialog.h
+gui/newinstancedialog.h
data/appsettings.h
data/inifile.h
@@ -139,6 +141,7 @@ SET(MULTIMC5_UIS
gui/mainwindow.ui
gui/modeditwindow.ui
gui/settingsdialog.ui
+gui/newinstancedialog.ui
)
SET_SOURCE_FILES_PROPERTIES(resources/MultiMCLauncher.jar GENERATED)
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 3a5e3d86..1ff633b2 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -17,12 +17,16 @@
#include "ui_mainwindow.h"
#include <QMenu>
+#include <QMessageBox>
#include <QDesktopServices>
#include <QUrl>
#include "util/osutils.h"
+
#include "gui/settingsdialog.h"
+#include "gui/newinstancedialog.h"
+
#include "data/appsettings.h"
#include "data/version.h"
@@ -48,7 +52,8 @@ MainWindow::~MainWindow()
void MainWindow::on_actionAddInstance_triggered()
{
-
+ NewInstanceDialog *newInstDlg = new NewInstanceDialog(this);
+ newInstDlg->exec();
}
void MainWindow::on_actionViewInstanceFolder_triggered()
diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp
new file mode 100644
index 00000000..400b42d8
--- /dev/null
+++ b/gui/newinstancedialog.cpp
@@ -0,0 +1,33 @@
+/* Copyright 2013 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "newinstancedialog.h"
+#include "ui_newinstancedialog.h"
+
+#include <QLayout>
+
+NewInstanceDialog::NewInstanceDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::NewInstanceDialog)
+{
+ ui->setupUi(this);
+ resize(minimumSizeHint());
+ layout()->setSizeConstraint(QLayout::SetFixedSize);
+}
+
+NewInstanceDialog::~NewInstanceDialog()
+{
+ delete ui;
+}
diff --git a/gui/newinstancedialog.h b/gui/newinstancedialog.h
new file mode 100644
index 00000000..263136f1
--- /dev/null
+++ b/gui/newinstancedialog.h
@@ -0,0 +1,37 @@
+/* Copyright 2013 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEWINSTANCEDIALOG_H
+#define NEWINSTANCEDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+class NewInstanceDialog;
+}
+
+class NewInstanceDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit NewInstanceDialog(QWidget *parent = 0);
+ ~NewInstanceDialog();
+
+private:
+ Ui::NewInstanceDialog *ui;
+};
+
+#endif // NEWINSTANCEDIALOG_H
diff --git a/gui/newinstancedialog.ui b/gui/newinstancedialog.ui
new file mode 100644
index 00000000..865f6301
--- /dev/null
+++ b/gui/newinstancedialog.ui
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NewInstanceDialog</class>
+ <widget class="QDialog" name="NewInstanceDialog">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>220</width>
+ <height>230</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>New Instance</string>
+ </property>
+ <property name="windowIcon">
+ <iconset resource="../multimc.qrc">
+ <normaloff>:/icons/toolbar/new</normaloff>:/icons/toolbar/new</iconset>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="iconBtnLayout">
+ <item>
+ <spacer name="iconBtnLeftSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QToolButton" name="iconButton">
+ <property name="icon">
+ <iconset resource="../multimc.qrc">
+ <normaloff>:/icons/instances/infinity</normaloff>:/icons/instances/infinity</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>80</width>
+ <height>80</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="iconBtnRightSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="instNameTextBox">
+ <property name="placeholderText">
+ <string>Name</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="labelVersion">
+ <property name="text">
+ <string>Version:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="versionTextBox">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="btnChangeVersion">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources>
+ <include location="../multimc.qrc"/>
+ </resources>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>NewInstanceDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>NewInstanceDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/multimc.qrc b/multimc.qrc
index a3c46548..d0171fa3 100644
--- a/multimc.qrc
+++ b/multimc.qrc
@@ -1,32 +1,33 @@
<RCC>
- <qresource prefix="/icons/toolbar">
- <file alias="about">resources/icons/toolbar/about.png</file>
- <file alias="bug">resources/icons/toolbar/bug.svg</file>
- <file alias="centralmods">resources/icons/toolbar/centralmods.png</file>
- <file alias="checkupdate">resources/icons/toolbar/checkupdate.png</file>
- <file alias="help">resources/icons/toolbar/help.png</file>
- <file alias="new">resources/icons/toolbar/new.png</file>
- <file alias="news">resources/icons/toolbar/news.svg</file>
- <file alias="refresh">resources/icons/toolbar/refresh.png</file>
- <file alias="settings">resources/icons/toolbar/settings.png</file>
- <file alias="viewfolder">resources/icons/toolbar/viewfolder.png</file>
- </qresource>
- <qresource prefix="/icons/instances">
- <file alias="chicken">resources/icons/instances/clucker.svg</file>
- <file alias="creeper">resources/icons/instances/creeper.svg</file>
- <file alias="enderpearl">resources/icons/instances/enderpearl.svg</file>
- <file alias="ftb-glow">resources/icons/instances/ftb-glow.svg</file>
- <file alias="ftb-logo">resources/icons/instances/ftb-logo.svg</file>
- <file alias="gear">resources/icons/instances/gear.svg</file>
- <file alias="herobrine">resources/icons/instances/herobrine.svg</file>
- <file alias="magitech">resources/icons/instances/magitech.svg</file>
- <file alias="meat">resources/icons/instances/meat.svg</file>
- <file alias="netherstar">resources/icons/instances/netherstar.svg</file>
- <file alias="skeleton">resources/icons/instances/skeleton.svg</file>
- <file alias="squarecreeper">resources/icons/instances/squarecreeper.svg</file>
- <file alias="steve">resources/icons/instances/steve.svg</file>
- </qresource>
- <qresource prefix="launcher">
- <file alias="launcherjar">resources/MultiMCLauncher.jar</file>
- </qresource>
+ <qresource prefix="/icons/toolbar">
+ <file alias="about">resources/icons/toolbar/about.png</file>
+ <file alias="bug">resources/icons/toolbar/bug.svg</file>
+ <file alias="centralmods">resources/icons/toolbar/centralmods.png</file>
+ <file alias="checkupdate">resources/icons/toolbar/checkupdate.png</file>
+ <file alias="help">resources/icons/toolbar/help.png</file>
+ <file alias="new">resources/icons/toolbar/new.png</file>
+ <file alias="news">resources/icons/toolbar/news.svg</file>
+ <file alias="refresh">resources/icons/toolbar/refresh.png</file>
+ <file alias="settings">resources/icons/toolbar/settings.png</file>
+ <file alias="viewfolder">resources/icons/toolbar/viewfolder.png</file>
+ </qresource>
+ <qresource prefix="/icons/instances">
+ <file alias="chicken">resources/icons/instances/clucker.svg</file>
+ <file alias="creeper">resources/icons/instances/creeper.svg</file>
+ <file alias="enderpearl">resources/icons/instances/enderpearl.svg</file>
+ <file alias="ftb-glow">resources/icons/instances/ftb-glow.svg</file>
+ <file alias="ftb-logo">resources/icons/instances/ftb-logo.svg</file>
+ <file alias="gear">resources/icons/instances/gear.svg</file>
+ <file alias="herobrine">resources/icons/instances/herobrine.svg</file>
+ <file alias="magitech">resources/icons/instances/magitech.svg</file>
+ <file alias="meat">resources/icons/instances/meat.svg</file>
+ <file alias="netherstar">resources/icons/instances/netherstar.svg</file>
+ <file alias="skeleton">resources/icons/instances/skeleton.svg</file>
+ <file alias="squarecreeper">resources/icons/instances/squarecreeper.svg</file>
+ <file alias="steve">resources/icons/instances/steve.svg</file>
+ <file alias="infinity">resources/icons/multimc.svg</file>
+ </qresource>
+ <qresource prefix="/launcher">
+ <file alias="launcherjar">resources/MultiMCLauncher.jar</file>
+ </qresource>
</RCC>