aboutsummaryrefslogtreecommitdiff
path: root/application/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'application/widgets')
-rw-r--r--application/widgets/Common.cpp27
-rw-r--r--application/widgets/Common.h6
-rw-r--r--application/widgets/CustomCommands.cpp49
-rw-r--r--application/widgets/CustomCommands.h43
-rw-r--r--application/widgets/CustomCommands.ui107
-rw-r--r--application/widgets/DropLabel.cpp41
-rw-r--r--application/widgets/DropLabel.h20
-rw-r--r--application/widgets/FocusLineEdit.cpp25
-rw-r--r--application/widgets/FocusLineEdit.h17
-rw-r--r--application/widgets/IconLabel.cpp43
-rw-r--r--application/widgets/IconLabel.h26
-rw-r--r--application/widgets/InstanceCardWidget.ui58
-rw-r--r--application/widgets/JavaSettingsWidget.cpp428
-rw-r--r--application/widgets/JavaSettingsWidget.h102
-rw-r--r--application/widgets/LabeledToolButton.cpp115
-rw-r--r--application/widgets/LabeledToolButton.h40
-rw-r--r--application/widgets/LanguageSelectionWidget.cpp66
-rw-r--r--application/widgets/LanguageSelectionWidget.h41
-rw-r--r--application/widgets/LineSeparator.cpp37
-rw-r--r--application/widgets/LineSeparator.h18
-rw-r--r--application/widgets/LogView.cpp144
-rw-r--r--application/widgets/LogView.h36
-rw-r--r--application/widgets/MCModInfoFrame.cpp167
-rw-r--r--application/widgets/MCModInfoFrame.h52
-rw-r--r--application/widgets/MCModInfoFrame.ui92
-rw-r--r--application/widgets/ModListView.cpp66
-rw-r--r--application/widgets/ModListView.h25
-rw-r--r--application/widgets/PageContainer.cpp239
-rw-r--r--application/widgets/PageContainer.h89
-rw-r--r--application/widgets/PageContainer_p.h123
-rw-r--r--application/widgets/ProgressWidget.cpp73
-rw-r--r--application/widgets/ProgressWidget.h32
-rw-r--r--application/widgets/ServerStatus.cpp179
-rw-r--r--application/widgets/ServerStatus.h40
-rw-r--r--application/widgets/VersionListView.cpp163
-rw-r--r--application/widgets/VersionListView.h56
-rw-r--r--application/widgets/VersionSelectWidget.cpp202
-rw-r--r--application/widgets/VersionSelectWidget.h81
-rw-r--r--application/widgets/WideBar.cpp116
-rw-r--r--application/widgets/WideBar.h26
40 files changed, 0 insertions, 3310 deletions
diff --git a/application/widgets/Common.cpp b/application/widgets/Common.cpp
deleted file mode 100644
index f72f3596..00000000
--- a/application/widgets/Common.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "Common.h"
-
-// Origin: Qt
-QStringList viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height,
- qreal &widthUsed)
-{
- QStringList lines;
- height = 0;
- widthUsed = 0;
- textLayout.beginLayout();
- QString str = textLayout.text();
- while (true)
- {
- QTextLine line = textLayout.createLine();
- if (!line.isValid())
- break;
- if (line.textLength() == 0)
- break;
- line.setLineWidth(lineWidth);
- line.setPosition(QPointF(0, height));
- height += line.height();
- lines.append(str.mid(line.textStart(), line.textLength()));
- widthUsed = qMax(widthUsed, line.naturalTextWidth());
- }
- textLayout.endLayout();
- return lines;
-}
diff --git a/application/widgets/Common.h b/application/widgets/Common.h
deleted file mode 100644
index b3fbe1a0..00000000
--- a/application/widgets/Common.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-#include <QStringList>
-#include <QTextLayout>
-
-QStringList viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height,
- qreal &widthUsed); \ No newline at end of file
diff --git a/application/widgets/CustomCommands.cpp b/application/widgets/CustomCommands.cpp
deleted file mode 100644
index 24bdc07d..00000000
--- a/application/widgets/CustomCommands.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "CustomCommands.h"
-#include "ui_CustomCommands.h"
-
-CustomCommands::~CustomCommands()
-{
- delete ui;
-}
-
-CustomCommands::CustomCommands(QWidget* parent):
- QWidget(parent),
- ui(new Ui::CustomCommands)
-{
- ui->setupUi(this);
-}
-
-void CustomCommands::initialize(bool checkable, bool checked, const QString& prelaunch, const QString& wrapper, const QString& postexit)
-{
- ui->customCommandsGroupBox->setCheckable(checkable);
- if(checkable)
- {
- ui->customCommandsGroupBox->setChecked(checked);
- }
- ui->preLaunchCmdTextBox->setText(prelaunch);
- ui->wrapperCmdTextBox->setText(wrapper);
- ui->postExitCmdTextBox->setText(postexit);
-}
-
-
-bool CustomCommands::checked() const
-{
- if(!ui->customCommandsGroupBox->isCheckable())
- return true;
- return ui->customCommandsGroupBox->isChecked();
-}
-
-QString CustomCommands::prelaunchCommand() const
-{
- return ui->preLaunchCmdTextBox->text();
-}
-
-QString CustomCommands::wrapperCommand() const
-{
- return ui->wrapperCmdTextBox->text();
-}
-
-QString CustomCommands::postexitCommand() const
-{
- return ui->postExitCmdTextBox->text();
-}
diff --git a/application/widgets/CustomCommands.h b/application/widgets/CustomCommands.h
deleted file mode 100644
index 8db991fa..00000000
--- a/application/widgets/CustomCommands.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright 2018-2021 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.
- */
-
-#pragma once
-
-#include <QWidget>
-
-namespace Ui
-{
-class CustomCommands;
-}
-
-class CustomCommands : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit CustomCommands(QWidget *parent = 0);
- virtual ~CustomCommands();
- void initialize(bool checkable, bool checked, const QString & prelaunch, const QString & wrapper, const QString & postexit);
-
- bool checked() const;
- QString prelaunchCommand() const;
- QString wrapperCommand() const;
- QString postexitCommand() const;
-
-private:
- Ui::CustomCommands *ui;
-};
-
-
diff --git a/application/widgets/CustomCommands.ui b/application/widgets/CustomCommands.ui
deleted file mode 100644
index 25b2681b..00000000
--- a/application/widgets/CustomCommands.ui
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>CustomCommands</class>
- <widget class="QWidget" name="CustomCommands">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>518</width>
- <height>646</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QGroupBox" name="customCommandsGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Cus&amp;tom Commands</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="2" column="0">
- <widget class="QLabel" name="labelPostExitCmd">
- <property name="text">
- <string>Post-exit command:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="preLaunchCmdTextBox"/>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelPreLaunchCmd">
- <property name="text">
- <string>Pre-launch command:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="postExitCmdTextBox"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="labelWrapperCmd">
- <property name="text">
- <string>Wrapper command:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="wrapperCmdTextBox"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelCustomCmdsDescription">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Pre-launch command runs before the instance launches and post-exit command runs after it exits.&lt;/p&gt;&lt;p&gt;Both will be run in MultiMC's working folder with extra environment variables:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;$INST_NAME - Name of the instance&lt;/li&gt;&lt;li&gt;$INST_ID - ID of the instance (its folder name)&lt;/li&gt;&lt;li&gt;$INST_DIR - absolute path of the instance&lt;/li&gt;&lt;li&gt;$INST_MC_DIR - absolute path of minecraft&lt;/li&gt;&lt;li&gt;$INST_JAVA - java binary used for launch&lt;/li&gt;&lt;li&gt;$INST_JAVA_ARGS - command-line parameters used for launch&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Wrapper command allows launching using an extra wrapper program (like 'optirun' on Linux)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/application/widgets/DropLabel.cpp b/application/widgets/DropLabel.cpp
deleted file mode 100644
index a900e57c..00000000
--- a/application/widgets/DropLabel.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "DropLabel.h"
-
-#include <QMimeData>
-#include <QDropEvent>
-
-DropLabel::DropLabel(QWidget *parent) : QLabel(parent)
-{
- setAcceptDrops(true);
-}
-
-void DropLabel::dragEnterEvent(QDragEnterEvent *event)
-{
- event->acceptProposedAction();
-}
-
-void DropLabel::dragMoveEvent(QDragMoveEvent *event)
-{
- event->acceptProposedAction();
-}
-
-void DropLabel::dragLeaveEvent(QDragLeaveEvent *event)
-{
- event->accept();
-}
-
-void DropLabel::dropEvent(QDropEvent *event)
-{
- const QMimeData *mimeData = event->mimeData();
-
- if (!mimeData)
- {
- return;
- }
-
- if (mimeData->hasUrls()) {
- auto urls = mimeData->urls();
- emit droppedURLs(urls);
- }
-
- event->acceptProposedAction();
-}
diff --git a/application/widgets/DropLabel.h b/application/widgets/DropLabel.h
deleted file mode 100644
index c5ca0bcc..00000000
--- a/application/widgets/DropLabel.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#pragma once
-
-#include <QLabel>
-
-class DropLabel : public QLabel
-{
- Q_OBJECT
-
-public:
- explicit DropLabel(QWidget *parent = nullptr);
-
-signals:
- void droppedURLs(QList<QUrl> urls);
-
-protected:
- void dropEvent(QDropEvent *event) override;
- void dragEnterEvent(QDragEnterEvent *event) override;
- void dragMoveEvent(QDragMoveEvent *event) override;
- void dragLeaveEvent(QDragLeaveEvent *event) override;
-};
diff --git a/application/widgets/FocusLineEdit.cpp b/application/widgets/FocusLineEdit.cpp
deleted file mode 100644
index b272100c..00000000
--- a/application/widgets/FocusLineEdit.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "FocusLineEdit.h"
-#include <QDebug>
-
-FocusLineEdit::FocusLineEdit(QWidget *parent) : QLineEdit(parent)
-{
- _selectOnMousePress = false;
-}
-
-void FocusLineEdit::focusInEvent(QFocusEvent *e)
-{
- QLineEdit::focusInEvent(e);
- selectAll();
- _selectOnMousePress = true;
-}
-
-void FocusLineEdit::mousePressEvent(QMouseEvent *me)
-{
- QLineEdit::mousePressEvent(me);
- if (_selectOnMousePress)
- {
- selectAll();
- _selectOnMousePress = false;
- }
- qDebug() << selectedText();
-}
diff --git a/application/widgets/FocusLineEdit.h b/application/widgets/FocusLineEdit.h
deleted file mode 100644
index 71b4f140..00000000
--- a/application/widgets/FocusLineEdit.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <QLineEdit>
-
-class FocusLineEdit : public QLineEdit
-{
- Q_OBJECT
-public:
- FocusLineEdit(QWidget *parent);
- virtual ~FocusLineEdit()
- {
- }
-
-protected:
- void focusInEvent(QFocusEvent *e);
- void mousePressEvent(QMouseEvent *me);
-
- bool _selectOnMousePress;
-};
diff --git a/application/widgets/IconLabel.cpp b/application/widgets/IconLabel.cpp
deleted file mode 100644
index bf1c2358..00000000
--- a/application/widgets/IconLabel.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "IconLabel.h"
-
-#include <QStyle>
-#include <QStyleOption>
-#include <QLayout>
-#include <QPainter>
-#include <QRect>
-
-IconLabel::IconLabel(QWidget *parent, QIcon icon, QSize size)
- : QWidget(parent), m_size(size), m_icon(icon)
-{
- setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-}
-
-QSize IconLabel::sizeHint() const
-{
- return m_size;
-}
-
-void IconLabel::setIcon(QIcon icon)
-{
- m_icon = icon;
- update();
-}
-
-void IconLabel::paintEvent(QPaintEvent *)
-{
- QPainter p(this);
- QRect rect = contentsRect();
- int width = rect.width();
- int height = rect.height();
- if(width < height)
- {
- rect.setHeight(width);
- rect.translate(0, (height - width) / 2);
- }
- else if (width > height)
- {
- rect.setWidth(height);
- rect.translate((width - height) / 2, 0);
- }
- m_icon.paint(&p, rect);
-}
diff --git a/application/widgets/IconLabel.h b/application/widgets/IconLabel.h
deleted file mode 100644
index 6d212c4c..00000000
--- a/application/widgets/IconLabel.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-#include <QWidget>
-#include <QIcon>
-
-class QStyleOption;
-
-/**
- * This is a trivial widget that paints a QIcon of the specified size.
- */
-class IconLabel : public QWidget
-{
- Q_OBJECT
-
-public:
- /// Create a line separator. orientation is the orientation of the line.
- explicit IconLabel(QWidget *parent, QIcon icon, QSize size);
-
- virtual QSize sizeHint() const;
- virtual void paintEvent(QPaintEvent *);
-
- void setIcon(QIcon icon);
-
-private:
- QSize m_size;
- QIcon m_icon;
-};
diff --git a/application/widgets/InstanceCardWidget.ui b/application/widgets/InstanceCardWidget.ui
deleted file mode 100644
index 6eeeb076..00000000
--- a/application/widgets/InstanceCardWidget.ui
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>InstanceCardWidget</class>
- <widget class="QWidget" name="InstanceCardWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>473</width>
- <height>118</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" rowspan="2">
- <widget class="QToolButton" name="iconButton">
- <property name="iconSize">
- <size>
- <width>80</width>
- <height>80</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="nameLabel">
- <property name="text">
- <string>&amp;Name:</string>
- </property>
- <property name="buddy">
- <cstring>instNameTextBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLineEdit" name="instNameTextBox"/>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="groupLabel">
- <property name="text">
- <string>&amp;Group:</string>
- </property>
- <property name="buddy">
- <cstring>groupBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QComboBox" name="groupBox">
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/application/widgets/JavaSettingsWidget.cpp b/application/widgets/JavaSettingsWidget.cpp
deleted file mode 100644
index 7f53dc23..00000000
--- a/application/widgets/JavaSettingsWidget.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-#include "JavaSettingsWidget.h"
-#include <MultiMC.h>
-
-#include <java/JavaInstall.h>
-#include <dialogs/CustomMessageBox.h>
-#include <java/JavaUtils.h>
-#include <sys.h>
-
-#include <QVBoxLayout>
-#include <QGroupBox>
-#include <QSpinBox>
-#include <QLabel>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QToolButton>
-#include <widgets/VersionSelectWidget.h>
-#include <FileSystem.h>
-#include <QFileDialog>
-
-JavaSettingsWidget::JavaSettingsWidget(QWidget* parent) : QWidget(parent)
-{
- m_availableMemory = Sys::getSystemRam() / Sys::mebibyte;
-
- goodIcon = MMC->getThemedIcon("status-good");
- yellowIcon = MMC->getThemedIcon("status-yellow");
- badIcon = MMC->getThemedIcon("status-bad");
- setupUi();
-
- connect(m_minMemSpinBox, SIGNAL(valueChanged(int)), this, SLOT(memoryValueChanged(int)));
- connect(m_maxMemSpinBox, SIGNAL(valueChanged(int)), this, SLOT(memoryValueChanged(int)));
- connect(m_permGenSpinBox, SIGNAL(valueChanged(int)), this, SLOT(memoryValueChanged(int)));
- connect(m_versionWidget, &VersionSelectWidget::selectedVersionChanged, this, &JavaSettingsWidget::javaVersionSelected);
- connect(m_javaBrowseBtn, &QPushButton::clicked, this, &JavaSettingsWidget::on_javaBrowseBtn_clicked);
- connect(m_javaPathTextBox, &QLineEdit::textEdited, this, &JavaSettingsWidget::javaPathEdited);
- connect(m_javaStatusBtn, &QToolButton::clicked, this, &JavaSettingsWidget::on_javaStatusBtn_clicked);
-}
-
-void JavaSettingsWidget::setupUi()
-{
- setObjectName(QStringLiteral("javaSettingsWidget"));
- m_verticalLayout = new QVBoxLayout(this);
- m_verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
-
- m_versionWidget = new VersionSelectWidget(this);
- m_verticalLayout->addWidget(m_versionWidget);
-
- m_horizontalLayout = new QHBoxLayout();
- m_horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
- m_javaPathTextBox = new QLineEdit(this);
- m_javaPathTextBox->setObjectName(QStringLiteral("javaPathTextBox"));
-
- m_horizontalLayout->addWidget(m_javaPathTextBox);
-
- m_javaBrowseBtn = new QPushButton(this);
- m_javaBrowseBtn->setObjectName(QStringLiteral("javaBrowseBtn"));
-
- m_horizontalLayout->addWidget(m_javaBrowseBtn);
-
- m_javaStatusBtn = new QToolButton(this);
- m_javaStatusBtn->setIcon(yellowIcon);
- m_horizontalLayout->addWidget(m_javaStatusBtn);
-
- m_verticalLayout->addLayout(m_horizontalLayout);
-
- m_memoryGroupBox = new QGroupBox(this);
- m_memoryGroupBox->setObjectName(QStringLiteral("memoryGroupBox"));
- m_gridLayout_2 = new QGridLayout(m_memoryGroupBox);
- m_gridLayout_2->setObjectName(QStringLiteral("gridLayout_2"));
-
- m_labelMinMem = new QLabel(m_memoryGroupBox);
- m_labelMinMem->setObjectName(QStringLiteral("labelMinMem"));
- m_gridLayout_2->addWidget(m_labelMinMem, 0, 0, 1, 1);
-
- m_minMemSpinBox = new QSpinBox(m_memoryGroupBox);
- m_minMemSpinBox->setObjectName(QStringLiteral("minMemSpinBox"));
- m_minMemSpinBox->setSuffix(QStringLiteral(" MB"));
- m_minMemSpinBox->setMinimum(128);
- m_minMemSpinBox->setMaximum(m_availableMemory);
- m_minMemSpinBox->setSingleStep(128);
- m_labelMinMem->setBuddy(m_minMemSpinBox);
- m_gridLayout_2->addWidget(m_minMemSpinBox, 0, 1, 1, 1);
-
- m_labelMaxMem = new QLabel(m_memoryGroupBox);
- m_labelMaxMem->setObjectName(QStringLiteral("labelMaxMem"));
- m_gridLayout_2->addWidget(m_labelMaxMem, 1, 0, 1, 1);
-
- m_maxMemSpinBox = new QSpinBox(m_memoryGroupBox);
- m_maxMemSpinBox->setObjectName(QStringLiteral("maxMemSpinBox"));
- m_maxMemSpinBox->setSuffix(QStringLiteral(" MB"));
- m_maxMemSpinBox->setMinimum(128);
- m_maxMemSpinBox->setMaximum(m_availableMemory);
- m_maxMemSpinBox->setSingleStep(128);
- m_labelMaxMem->setBuddy(m_maxMemSpinBox);
- m_gridLayout_2->addWidget(m_maxMemSpinBox, 1, 1, 1, 1);
-
- m_labelPermGen = new QLabel(m_memoryGroupBox);
- m_labelPermGen->setObjectName(QStringLiteral("labelPermGen"));
- m_labelPermGen->setText(QStringLiteral("PermGen:"));
- m_gridLayout_2->addWidget(m_labelPermGen, 2, 0, 1, 1);
- m_labelPermGen->setVisible(false);
-
- m_permGenSpinBox = new QSpinBox(m_memoryGroupBox);
- m_permGenSpinBox->setObjectName(QStringLiteral("permGenSpinBox"));
- m_permGenSpinBox->setSuffix(QStringLiteral(" MB"));
- m_permGenSpinBox->setMinimum(64);
- m_permGenSpinBox->setMaximum(m_availableMemory);
- m_permGenSpinBox->setSingleStep(8);
- m_gridLayout_2->addWidget(m_permGenSpinBox, 2, 1, 1, 1);
- m_permGenSpinBox->setVisible(false);
-
- m_verticalLayout->addWidget(m_memoryGroupBox);
-
- retranslate();
-}
-
-void JavaSettingsWidget::initialize()
-{
- m_versionWidget->initialize(MMC->javalist().get());
- m_versionWidget->setResizeOn(2);
- auto s = MMC->settings();
- // Memory
- observedMinMemory = s->get("MinMemAlloc").toInt();
- observedMaxMemory = s->get("MaxMemAlloc").toInt();
- observedPermGenMemory = s->get("PermGen").toInt();
- m_minMemSpinBox->setValue(observedMinMemory);
- m_maxMemSpinBox->setValue(observedMaxMemory);
- m_permGenSpinBox->setValue(observedPermGenMemory);
-}
-
-void JavaSettingsWidget::refresh()
-{
- m_versionWidget->loadList();
-}
-
-JavaSettingsWidget::ValidationStatus JavaSettingsWidget::validate()
-{
- switch(javaStatus)
- {
- default:
- case JavaStatus::NotSet:
- case JavaStatus::DoesNotExist:
- case JavaStatus::DoesNotStart:
- case JavaStatus::ReturnedInvalidData:
- {
- int button = CustomMessageBox::selectable(
- this,
- tr("No Java version selected"),
- tr("You didn't select a Java version or selected something that doesn't work.\n"
- "MultiMC will not be able to start Minecraft.\n"
- "Do you wish to proceed without any Java?"
- "\n\n"
- "You can change the Java version in the settings later.\n"
- ),
- QMessageBox::Warning,
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::NoButton
- )->exec();
- if(button == QMessageBox::No)
- {
- return ValidationStatus::Bad;
- }
- return ValidationStatus::JavaBad;
- }
- break;
- case JavaStatus::Pending:
- {
- return ValidationStatus::Bad;
- }
- case JavaStatus::Good:
- {
- return ValidationStatus::AllOK;
- }
- }
-}
-
-QString JavaSettingsWidget::javaPath() const
-{
- return m_javaPathTextBox->text();
-}
-
-int JavaSettingsWidget::maxHeapSize() const
-{
- return m_maxMemSpinBox->value();
-}
-
-int JavaSettingsWidget::minHeapSize() const
-{
- return m_minMemSpinBox->value();
-}
-
-bool JavaSettingsWidget::permGenEnabled() const
-{
- return m_permGenSpinBox->isVisible();
-}
-
-int JavaSettingsWidget::permGenSize() const
-{
- return m_permGenSpinBox->value();
-}
-
-void JavaSettingsWidget::memoryValueChanged(int)
-{
- bool actuallyChanged = false;
- int min = m_minMemSpinBox->value();
- int max = m_maxMemSpinBox->value();
- int permgen = m_permGenSpinBox->value();
- QObject *obj = sender();
- if (obj == m_minMemSpinBox && min != observedMinMemory)
- {
- observedMinMemory = min;
- actuallyChanged = true;
- if (min > max)
- {
- observedMaxMemory = min;
- m_maxMemSpinBox->setValue(min);
- }
- }
- else if (obj == m_maxMemSpinBox && max != observedMaxMemory)
- {
- observedMaxMemory = max;
- actuallyChanged = true;
- if (min > max)
- {
- observedMinMemory = max;
- m_minMemSpinBox->setValue(max);
- }
- }
- else if (obj == m_permGenSpinBox && permgen != observedPermGenMemory)
- {
- observedPermGenMemory = permgen;
- actuallyChanged = true;
- }
- if(actuallyChanged)
- {
- checkJavaPathOnEdit(m_javaPathTextBox->text());
- }
<