diff options
| author | Petr Mrázek <peterix@gmail.com> | 2018-07-15 14:51:05 +0200 |
|---|---|---|
| committer | Petr Mrázek <peterix@gmail.com> | 2018-07-15 14:51:05 +0200 |
| commit | bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 (patch) | |
| tree | e6497e304b7b9368367565fbc7c06efab1124b1c /application/widgets | |
| parent | 03280cc62e75f8073f8d3d9e9e3952acf21fa77d (diff) | |
| download | PrismLauncher-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.gz PrismLauncher-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.bz2 PrismLauncher-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.zip | |
NOISSUE tabs -> spaces
Diffstat (limited to 'application/widgets')
31 files changed, 1527 insertions, 1527 deletions
diff --git a/application/widgets/Common.cpp b/application/widgets/Common.cpp index 9b730d6c..f72f3596 100644 --- a/application/widgets/Common.cpp +++ b/application/widgets/Common.cpp @@ -2,26 +2,26 @@ // Origin: Qt QStringList viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height, - qreal &widthUsed) + 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; + 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 index fc46e08f..b3fbe1a0 100644 --- a/application/widgets/Common.h +++ b/application/widgets/Common.h @@ -3,4 +3,4 @@ #include <QTextLayout> QStringList viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height, - qreal &widthUsed);
\ No newline at end of file + qreal &widthUsed);
\ No newline at end of file diff --git a/application/widgets/CustomCommands.cpp b/application/widgets/CustomCommands.cpp index 9f11e344..9e7673fd 100644 --- a/application/widgets/CustomCommands.cpp +++ b/application/widgets/CustomCommands.cpp @@ -6,43 +6,43 @@ CustomCommands::~CustomCommands() } CustomCommands::CustomCommands(QWidget* parent): - QWidget(parent), - ui(new Ui::CustomCommands) + QWidget(parent), + ui(new Ui::CustomCommands) { - ui->setupUi(this); + 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); + 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(); + if(!ui->customCommandsGroupBox->isCheckable()) + return true; + return ui->customCommandsGroupBox->isChecked(); } QString CustomCommands::prelaunchCommand() const { - return ui->preLaunchCmdTextBox->text(); + return ui->preLaunchCmdTextBox->text(); } QString CustomCommands::wrapperCommand() const { - return ui->wrapperCmdTextBox->text(); + return ui->wrapperCmdTextBox->text(); } QString CustomCommands::postexitCommand() const { - return ui->postExitCmdTextBox->text(); + return ui->postExitCmdTextBox->text(); } diff --git a/application/widgets/CustomCommands.h b/application/widgets/CustomCommands.h index 2bc7cb1a..07041479 100644 --- a/application/widgets/CustomCommands.h +++ b/application/widgets/CustomCommands.h @@ -24,20 +24,20 @@ class CustomCommands; class CustomCommands : public QWidget { - Q_OBJECT + Q_OBJECT public: - explicit CustomCommands(QWidget *parent = 0); - ~CustomCommands(); - void initialize(bool checkable, bool checked, const QString & prelaunch, const QString & wrapper, const QString & postexit); + explicit CustomCommands(QWidget *parent = 0); + ~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; + bool checked() const; + QString prelaunchCommand() const; + QString wrapperCommand() const; + QString postexitCommand() const; private: - Ui::CustomCommands *ui; + Ui::CustomCommands *ui; }; diff --git a/application/widgets/FocusLineEdit.cpp b/application/widgets/FocusLineEdit.cpp index 139126c8..b272100c 100644 --- a/application/widgets/FocusLineEdit.cpp +++ b/application/widgets/FocusLineEdit.cpp @@ -3,23 +3,23 @@ FocusLineEdit::FocusLineEdit(QWidget *parent) : QLineEdit(parent) { - _selectOnMousePress = false; + _selectOnMousePress = false; } void FocusLineEdit::focusInEvent(QFocusEvent *e) { - QLineEdit::focusInEvent(e); - selectAll(); - _selectOnMousePress = true; + QLineEdit::focusInEvent(e); + selectAll(); + _selectOnMousePress = true; } void FocusLineEdit::mousePressEvent(QMouseEvent *me) { - QLineEdit::mousePressEvent(me); - if (_selectOnMousePress) - { - selectAll(); - _selectOnMousePress = false; - } - qDebug() << selectedText(); + QLineEdit::mousePressEvent(me); + if (_selectOnMousePress) + { + selectAll(); + _selectOnMousePress = false; + } + qDebug() << selectedText(); } diff --git a/application/widgets/FocusLineEdit.h b/application/widgets/FocusLineEdit.h index 6d1c78a8..71b4f140 100644 --- a/application/widgets/FocusLineEdit.h +++ b/application/widgets/FocusLineEdit.h @@ -2,16 +2,16 @@ class FocusLineEdit : public QLineEdit { - Q_OBJECT + Q_OBJECT public: - FocusLineEdit(QWidget *parent); - virtual ~FocusLineEdit() - { - } + FocusLineEdit(QWidget *parent); + virtual ~FocusLineEdit() + { + } protected: - void focusInEvent(QFocusEvent *e); - void mousePressEvent(QMouseEvent *me); + void focusInEvent(QFocusEvent *e); + void mousePressEvent(QMouseEvent *me); - bool _selectOnMousePress; + bool _selectOnMousePress; }; diff --git a/application/widgets/IconLabel.cpp b/application/widgets/IconLabel.cpp index 86c8a431..bf1c2358 100644 --- a/application/widgets/IconLabel.cpp +++ b/application/widgets/IconLabel.cpp @@ -7,37 +7,37 @@ #include <QRect> IconLabel::IconLabel(QWidget *parent, QIcon icon, QSize size) - : QWidget(parent), m_size(size), m_icon(icon) + : QWidget(parent), m_size(size), m_icon(icon) { - setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); } QSize IconLabel::sizeHint() const { - return m_size; + return m_size; } void IconLabel::setIcon(QIcon icon) { - m_icon = icon; - update(); + 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); + 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 index a2f1eef3..6d212c4c 100644 --- a/application/widgets/IconLabel.h +++ b/application/widgets/IconLabel.h @@ -9,18 +9,18 @@ class QStyleOption; */ class IconLabel : public QWidget { - Q_OBJECT + Q_OBJECT public: - /// Create a line separator. orientation is the orientation of the line. - explicit IconLabel(QWidget *parent, QIcon icon, QSize size); + /// 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 *); + virtual QSize sizeHint() const; + virtual void paintEvent(QPaintEvent *); - void setIcon(QIcon icon); + void setIcon(QIcon icon); private: - QSize m_size; - QIcon m_icon; + QSize m_size; + QIcon m_icon; }; diff --git a/application/widgets/JavaSettingsWidget.cpp b/application/widgets/JavaSettingsWidget.cpp index 1e9d5546..a11dd1aa 100644 --- a/application/widgets/JavaSettingsWidget.cpp +++ b/application/widgets/JavaSettingsWidget.cpp @@ -19,410 +19,410 @@ JavaSettingsWidget::JavaSettingsWidget(QWidget* parent) : QWidget(parent) { - m_availableMemory = Sys::getSystemRam() / Sys::megabyte; - - 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); + m_availableMemory = Sys::getSystemRam() / Sys::megabyte; + + 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(); + 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); + 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(); + 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; - } - } + 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(); + return m_javaPathTextBox->text(); } int JavaSettingsWidget::maxHeapSize() const { - return m_maxMemSpinBox->value(); + return m_maxMemSpinBox->value(); } int JavaSettingsWidget::minHeapSize() const { - return m_minMemSpinBox->value(); + return m_minMemSpinBox->value(); } bool JavaSettingsWidget::permGenEnabled() const { - return m_permGenSpinBox->isVisible(); + return m_permGenSpinBox->isVisible(); } int JavaSettingsWidget::permGenSize() const { - return m_permGenSpinBox->value(); + 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()); - } + 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()); + } } void JavaSettingsWidget::javaVersionSelected(BaseVersionPtr version) { - auto java = std::dynamic_pointer_cast<JavaInstall>(version); - if(!java) - { - return; - } - auto visible = java->id.requiresPermGen(); - m_labelPermGen->setVisible(visible); - m_permGenSpinBox->setVisible(visible); - m_javaPathTextBox->setText(java->path); - checkJavaPath(java->path); + auto java = std::dynamic_pointer_cast<JavaInstall>(version); + if(!java) + { + return; + } + auto visible = java->id.requiresPermGen(); + m_labelPermGen->setVisible(visible); + m_permGenSpinBox->setVisible(visible); + m_javaPathTextBox->setText(java->path); + checkJavaPath(java->path); } void JavaSettingsWidget::on_javaBrowseBtn_clicked() { - QString filter; + QString filter; #if defined Q_OS_WIN32 - filter = "Java (javaw.exe)"; + filter = "Java (javaw.exe)"; #else - filter = "Java (java)"; + filter = "Java (java)"; #endif - QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"), QString(), filter); - if(raw_path.isEmpty()) - { - return; - } - QString cooked_path = FS::NormalizePath(raw_path); - m_javaPathTextBox->setText(cooked_path); - checkJavaPath(cooked_path); + QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"), QString(), filter); + if(raw_path.isEmpty()) + { + return; + } + QString cooked_path = FS::NormalizePath(raw_path); + m_javaPathTextBox->setText(cooked_path); + checkJavaPath(cooked_path); } void JavaSettingsWidget::on_javaStatusBtn_clicked() { - QString text; - bool failed = false; - switch(javaStatus) - { - case JavaStatus::NotSet: - checkJavaPath(m_ja |
