summaryrefslogtreecommitdiffstats
path: root/application/pages
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-05-04 01:20:48 +0200
committerPetr Mrázek <peterix@gmail.com>2015-05-04 01:20:48 +0200
commit1b884d0a9dc28d8bca38fe8756482d991d0ea850 (patch)
treefabe4350a3d64123ad0801fe7c285c2150f9562b /application/pages
parent8e9d5f56b592fd0dd0f54e747a835391a775120d (diff)
downloadMultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.tar
MultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.tar.gz
MultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.tar.lz
MultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.tar.xz
MultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.zip
GH-907 improve Java testing and PermGen deprecation handling
Diffstat (limited to 'application/pages')
-rw-r--r--application/pages/InstanceSettingsPage.cpp41
-rw-r--r--application/pages/InstanceSettingsPage.h11
-rw-r--r--application/pages/global/JavaPage.cpp43
-rw-r--r--application/pages/global/JavaPage.h9
-rw-r--r--application/pages/global/JavaPage.ui80
-rw-r--r--application/pages/global/MinecraftPage.cpp12
-rw-r--r--application/pages/global/MultiMCPage.cpp15
7 files changed, 79 insertions, 132 deletions
diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/InstanceSettingsPage.cpp
index 1e571eff..4fc812b2 100644
--- a/application/pages/InstanceSettingsPage.cpp
+++ b/application/pages/InstanceSettingsPage.cpp
@@ -6,10 +6,11 @@
#include <QMessageBox>
#include "dialogs/VersionSelectDialog.h"
-#include "NagUtils.h"
-#include "java/JavaVersionList.h"
+#include "JavaCommon.h"
#include "MultiMC.h"
+#include <java/JavaVersionList.h>
+
InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
: QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst)
{
@@ -100,7 +101,7 @@ void InstanceSettingsPage::applySettings()
if(javaArgs)
{
m_settings->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " "));
- NagUtils::checkJVMArgs(m_settings->get("JvmArgs").toString(), this->parentWidget());
+ JavaCommon::checkJVMArgs(m_settings->get("JvmArgs").toString(), this->parentWidget());
}
else
{
@@ -187,30 +188,18 @@ void InstanceSettingsPage::on_javaBrowseBtn_clicked()
void InstanceSettingsPage::on_javaTestBtn_clicked()
{
- checker.reset(new JavaChecker());
- connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this,
- SLOT(checkFinished(JavaCheckResult)));
- checker->path = ui->javaPathTextBox->text();
- checker->performCheck();
+ if(checker)
+ {
+ return;
+ }
+ checker.reset(new JavaCommon::TestCheck(
+ this, ui->javaPathTextBox->text(), ui->jvmArgsTextBox->toPlainText().replace("\n", " "),
+ ui->minMemSpinBox->value(), ui->maxMemSpinBox->value(), ui->permGenSpinBox->value()));
+ connect(checker.get(), SIGNAL(finished()), SLOT(checkerFinished()));
+ checker->run();
}
-void InstanceSettingsPage::checkFinished(JavaCheckResult result)
+void InstanceSettingsPage::checkerFinished()
{
- if (result.valid)
- {
- QString text;
- text += "Java test succeeded!\n";
- if (result.is_64bit)
- text += "Using 64bit java.\n";
- text += "\n";
- text += "Platform reported: " + result.realPlatform;
- QMessageBox::information(this, tr("Java test success"), text);
- }
- else
- {
- QMessageBox::warning(
- this, tr("Java test failure"),
- tr("The specified java binary didn't work. You should use the auto-detect feature, "
- "or set the path to the java executable."));
- }
+ checker.reset();
}
diff --git a/application/pages/InstanceSettingsPage.h b/application/pages/InstanceSettingsPage.h
index 60cc1898..55ae69db 100644
--- a/application/pages/InstanceSettingsPage.h
+++ b/application/pages/InstanceSettingsPage.h
@@ -19,7 +19,9 @@
#include "java/JavaChecker.h"
#include "BaseInstance.h"
+#include <QObjectPtr.h>
#include "BasePage.h"
+#include "JavaCommon.h"
#include "MultiMC.h"
class JavaChecker;
@@ -53,21 +55,20 @@ public:
return "Instance-settings";
}
virtual bool shouldDisplay() const;
+
private slots:
void on_javaDetectBtn_clicked();
-
void on_javaTestBtn_clicked();
-
void on_javaBrowseBtn_clicked();
- void checkFinished(JavaCheckResult result);
-
void applySettings();
void loadSettings();
+ void checkerFinished();
+
private:
Ui::InstanceSettingsPage *ui;
BaseInstance *m_instance;
SettingsObject *m_settings;
- std::shared_ptr<JavaChecker> checker;
+ QObjectPtr<JavaCommon::TestCheck> checker;
};
diff --git a/application/pages/global/JavaPage.cpp b/application/pages/global/JavaPage.cpp
index 1b480376..3daf35dc 100644
--- a/application/pages/global/JavaPage.cpp
+++ b/application/pages/global/JavaPage.cpp
@@ -14,6 +14,7 @@
*/
#include "JavaPage.h"
+#include "JavaCommon.h"
#include "ui_JavaPage.h"
#include <QFileDialog>
@@ -22,15 +23,11 @@
#include <pathutils.h>
-#include "NagUtils.h"
-
-#include "Platform.h"
#include "dialogs/VersionSelectDialog.h"
#include <ColumnResizer.h>
#include "java/JavaUtils.h"
#include "java/JavaVersionList.h"
-#include "java/JavaChecker.h"
#include "settings/SettingsObject.h"
#include "MultiMC.h"
@@ -69,7 +66,7 @@ void JavaPage::applySettings()
// Java Settings
s->set("JavaPath", ui->javaPathTextBox->text());
s->set("JvmArgs", ui->jvmArgsTextBox->text());
- NagUtils::checkJVMArgs(s->get("JvmArgs").toString(), this->parentWidget());
+ JavaCommon::checkJVMArgs(s->get("JvmArgs").toString(), this->parentWidget());
// Custom Commands
s->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
@@ -113,33 +110,21 @@ void JavaPage::on_javaBrowseBtn_clicked()
ui->javaPathTextBox->setText(dir);
}
}
+
void JavaPage::on_javaTestBtn_clicked()
{
- checker.reset(new JavaChecker());
- connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this,
- SLOT(checkFinished(JavaCheckResult)));
- checker->path = ui->javaPathTextBox->text();
- checker->performCheck();
+ if(checker)
+ {
+ return;
+ }
+ checker.reset(new JavaCommon::TestCheck(
+ this, ui->javaPathTextBox->text(), ui->jvmArgsTextBox->text(),
+ ui->minMemSpinBox->value(), ui->maxMemSpinBox->value(), ui->permGenSpinBox->value()));
+ connect(checker.get(), SIGNAL(finished()), SLOT(checkerFinished()));
+ checker->run();
}
-void JavaPage::checkFinished(JavaCheckResult result)
+void JavaPage::checkerFinished()
{
- if (result.valid)
- {
- QString text;
- text += "Java test succeeded!\n";
- if (result.is_64bit)
- text += "Using 64bit java.\n";
- text += "\n";
- text += "Platform reported: " + result.realPlatform + "\n";
- text += "Java version reported: " + result.javaVersion;
- QMessageBox::information(this, tr("Java test success"), text);
- }
- else
- {
- QMessageBox::warning(
- this, tr("Java test failure"),
- tr("The specified java binary didn't work. You should use the auto-detect feature, "
- "or set the path to the java executable."));
- }
+ checker.reset();
}
diff --git a/application/pages/global/JavaPage.h b/application/pages/global/JavaPage.h
index 2af85280..4dd2b306 100644
--- a/application/pages/global/JavaPage.h
+++ b/application/pages/global/JavaPage.h
@@ -17,10 +17,10 @@
#include <memory>
#include <QDialog>
-
-#include "java/JavaChecker.h"
#include "pages/BasePage.h"
+#include "JavaCommon.h"
#include <MultiMC.h>
+#include <QObjectPtr.h>
class SettingsObject;
@@ -64,10 +64,9 @@ slots:
void on_javaDetectBtn_clicked();
void on_javaTestBtn_clicked();
void on_javaBrowseBtn_clicked();
-
- void checkFinished(JavaCheckResult result);
+ void checkerFinished();
private:
Ui::JavaPage *ui;
- std::shared_ptr<JavaChecker> checker;
+ QObjectPtr<JavaCommon::TestCheck> checker;
};
diff --git a/application/pages/global/JavaPage.ui b/application/pages/global/JavaPage.ui
index 6ae41a49..f9c629c2 100644
--- a/application/pages/global/JavaPage.ui
+++ b/application/pages/global/JavaPage.ui
@@ -161,45 +161,6 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QPushButton" name="javaDetectBtn">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Auto-detect...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="javaTestBtn">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Test</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="labelJVMArgs">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>JVM arguments:</string>
- </property>
- </widget>
- </item>
<item row="0" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@@ -229,6 +190,45 @@
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="jvmArgsTextBox"/>
</item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="labelJVMArgs">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>JVM arguments:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QPushButton" name="javaDetectBtn">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Auto-detect...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QPushButton" name="javaTestBtn">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Test</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -292,8 +292,6 @@
<tabstop>permGenSpinBox</tabstop>
<tabstop>javaPathTextBox</tabstop>
<tabstop>javaBrowseBtn</tabstop>
- <tabstop>javaDetectBtn</tabstop>
- <tabstop>javaTestBtn</tabstop>
<tabstop>jvmArgsTextBox</tabstop>
<tabstop>preLaunchCmdTextBox</tabstop>
<tabstop>postExitCmdTextBox</tabstop>
diff --git a/application/pages/global/MinecraftPage.cpp b/application/pages/global/MinecraftPage.cpp
index f5e7e57f..d1f1fb08 100644
--- a/application/pages/global/MinecraftPage.cpp
+++ b/application/pages/global/MinecraftPage.cpp
@@ -23,18 +23,6 @@
#include <pathutils.h>
#include "Platform.h"
-#include "dialogs/VersionSelectDialog.h"
-#include "dialogs/CustomMessageBox.h"
-
-#include "NagUtils.h"
-
-#include "java/JavaUtils.h"
-#include "java/JavaVersionList.h"
-#include "java/JavaChecker.h"
-
-#include "updater/UpdateChecker.h"
-
-#include "tools/BaseProfiler.h"
#include "settings/SettingsObject.h"
#include "MultiMC.h"
diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp
index 5f56fb89..83c1ccd5 100644
--- a/application/pages/global/MultiMCPage.cpp
+++ b/application/pages/global/MultiMCPage.cpp
@@ -22,22 +22,9 @@
#include <QTextCharFormat>
#include <pathutils.h>
-
-#include "Platform.h"
-#include "dialogs/VersionSelectDialog.h"
-#include "dialogs/CustomMessageBox.h"
#include <ColumnResizer.h>
-
-#include "NagUtils.h"
-
-#include "java/JavaUtils.h"
-#include "java/JavaVersionList.h"
-#include "java/JavaChecker.h"
-
#include "updater/UpdateChecker.h"
-#include "tools/BaseProfiler.h"
-
#include "settings/SettingsObject.h"
#include "MultiMC.h"
@@ -456,4 +443,4 @@ void MultiMCPage::refreshFontPreview()
workCursor.insertText(tr("[Something/WARN] A not so spooky warning."), format);
workCursor.insertBlock();
}
-} \ No newline at end of file
+}