Fix NagUtils and hack GroupView to work

This commit is contained in:
Petr Mrázek
2015-02-01 18:54:58 +01:00
parent aa70ed2244
commit 382ae78a0b
10 changed files with 14 additions and 15 deletions

View File

@ -382,7 +382,7 @@ namespace Ui {
#include "logic/BaseProcess.h"
#include "logic/OneSixUpdate.h"
#include "logic/java/JavaUtils.h"
#include "logic/NagUtils.h"
#include "gui/NagUtils.h"
#include "logic/SkinUtils.h"
#include "logic/LegacyInstance.h"

38
gui/NagUtils.cpp Normal file
View File

@ -0,0 +1,38 @@
/* Copyright 2013-2015 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 "gui/NagUtils.h"
#include "gui/dialogs/CustomMessageBox.h"
namespace NagUtils
{
void checkJVMArgs(QString jvmargs, QWidget *parent)
{
if (jvmargs.contains("-XX:PermSize=") || jvmargs.contains(QRegExp("-Xm[sx]")))
{
CustomMessageBox::selectable(
parent, QObject::tr("JVM arguments warning"),
QObject::tr("You tried to manually set a JVM memory option (using "
" \"-XX:PermSize\", \"-Xmx\" or \"-Xms\") - there"
" are dedicated boxes for these in the settings (Java"
" tab, in the Memory group at the top).\n"
"Your manual settings will be overridden by the"
" dedicated options.\n"
"This message will be displayed until you remove them"
" from the JVM arguments."),
QMessageBox::Warning)->exec();
}
}
}

23
gui/NagUtils.h Normal file
View File

@ -0,0 +1,23 @@
/* Copyright 2013-2015 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 NagUtils
{
void checkJVMArgs(QString args, QWidget *parent);
}

View File

@ -6,7 +6,7 @@
#include <QMessageBox>
#include "gui/dialogs/VersionSelectDialog.h"
#include "logic/NagUtils.h"
#include "gui/NagUtils.h"
#include "logic/java/JavaVersionList.h"
#include "MultiMC.h"
@ -148,7 +148,7 @@ void InstanceSettingsPage::loadSettings()
bool overrideJava = m_settings->get("OverrideJava").toBool();
bool overrideLocation = m_settings->get("OverrideJavaLocation").toBool() || overrideJava;
bool overrideArgs = m_settings->get("OverrideJavaArgs").toBool() || overrideJava;
ui->javaSettingsGroupBox->setChecked(overrideLocation);
ui->javaPathTextBox->setText(m_settings->get("JavaPath").toString());

View File

@ -22,7 +22,7 @@
#include <pathutils.h>
#include "logic/NagUtils.h"
#include "gui/NagUtils.h"
#include "gui/Platform.h"
#include "gui/dialogs/VersionSelectDialog.h"
@ -39,11 +39,11 @@ JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage)
{
ui->setupUi(this);
ui->tabWidget->tabBar()->hide();
auto resizer = new ColumnResizer(this);
resizer->addWidgetsFromLayout(ui->javaSettingsGroupBox->layout(), 0);
resizer->addWidgetsFromLayout(ui->customCommandsGroupBox->layout(), 0);
loadSettings();
}

View File

@ -26,7 +26,7 @@
#include "gui/dialogs/VersionSelectDialog.h"
#include "gui/dialogs/CustomMessageBox.h"
#include "logic/NagUtils.h"
#include "gui/NagUtils.h"
#include "logic/java/JavaUtils.h"
#include "logic/java/JavaVersionList.h"

View File

@ -28,7 +28,7 @@
#include "gui/dialogs/CustomMessageBox.h"
#include <gui/ColumnResizer.h>
#include "logic/NagUtils.h"
#include "gui/NagUtils.h"
#include "logic/java/JavaUtils.h"
#include "logic/java/JavaVersionList.h"