Merge global settings and accounts into a pagedialog
Also split external tools into it's own page
This commit is contained in:
		
				
					committed by
					
						
						Petr Mrázek
					
				
			
			
				
	
			
			
			
						parent
						
							c91adfb3d1
						
					
				
				
					commit
					e178284172
				
			@@ -312,12 +312,18 @@ SET(MULTIMC_SOURCES
 | 
			
		||||
	gui/pages/ScreenshotsPage.h
 | 
			
		||||
	gui/pages/OtherLogsPage.cpp
 | 
			
		||||
	gui/pages/OtherLogsPage.h
 | 
			
		||||
	gui/pages/global/SettingsPage.cpp
 | 
			
		||||
	gui/pages/global/SettingsPage.h
 | 
			
		||||
	gui/pages/global/ExternalToolsPage.cpp
 | 
			
		||||
	gui/pages/global/ExternalToolsPage.h
 | 
			
		||||
	gui/pages/global/BaseSettingsPage.cpp
 | 
			
		||||
	gui/pages/global/BaseSettingsPage.h
 | 
			
		||||
	gui/pages/global/AccountListPage.cpp
 | 
			
		||||
	gui/pages/global/AccountListPage.h
 | 
			
		||||
 | 
			
		||||
	# GUI - dialogs
 | 
			
		||||
	gui/dialogs/AboutDialog.cpp
 | 
			
		||||
	gui/dialogs/AboutDialog.h
 | 
			
		||||
	gui/dialogs/AccountListDialog.cpp
 | 
			
		||||
	gui/dialogs/AccountListDialog.h
 | 
			
		||||
	gui/dialogs/AccountSelectDialog.cpp
 | 
			
		||||
	gui/dialogs/AccountSelectDialog.h
 | 
			
		||||
	gui/dialogs/CopyInstanceDialog.cpp
 | 
			
		||||
@@ -342,8 +348,6 @@ SET(MULTIMC_SOURCES
 | 
			
		||||
	gui/pagedialog/PageDialog.h
 | 
			
		||||
	gui/dialogs/ProgressDialog.cpp
 | 
			
		||||
	gui/dialogs/ProgressDialog.h
 | 
			
		||||
	gui/dialogs/SettingsDialog.cpp
 | 
			
		||||
	gui/dialogs/SettingsDialog.h
 | 
			
		||||
	gui/dialogs/UpdateDialog.cpp
 | 
			
		||||
	gui/dialogs/UpdateDialog.h
 | 
			
		||||
	gui/dialogs/VersionSelectDialog.cpp
 | 
			
		||||
@@ -644,9 +648,11 @@ SET(MULTIMC_UIS
 | 
			
		||||
	gui/pages/NotesPage.ui
 | 
			
		||||
	gui/pages/ScreenshotsPage.ui
 | 
			
		||||
	gui/pages/OtherLogsPage.ui
 | 
			
		||||
	gui/pages/global/SettingsPage.ui
 | 
			
		||||
	gui/pages/global/ExternalToolsPage.ui
 | 
			
		||||
	gui/pages/global/AccountListPage.ui
 | 
			
		||||
 | 
			
		||||
	# Dialogs
 | 
			
		||||
	gui/dialogs/SettingsDialog.ui
 | 
			
		||||
	gui/dialogs/CopyInstanceDialog.ui
 | 
			
		||||
	gui/dialogs/NewInstanceDialog.ui
 | 
			
		||||
	gui/dialogs/AboutDialog.ui
 | 
			
		||||
@@ -654,7 +660,6 @@ SET(MULTIMC_UIS
 | 
			
		||||
	gui/dialogs/LwjglSelectDialog.ui
 | 
			
		||||
	gui/dialogs/ProgressDialog.ui
 | 
			
		||||
	gui/dialogs/IconPickerDialog.ui
 | 
			
		||||
	gui/dialogs/AccountListDialog.ui
 | 
			
		||||
	gui/dialogs/AccountSelectDialog.ui
 | 
			
		||||
	gui/dialogs/EditAccountDialog.ui
 | 
			
		||||
	gui/dialogs/LoginDialog.ui
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,6 @@
 | 
			
		||||
#include "gui/widgets/LabeledToolButton.h"
 | 
			
		||||
#include "widgets/ServerStatus.h"
 | 
			
		||||
 | 
			
		||||
#include "gui/dialogs/SettingsDialog.h"
 | 
			
		||||
#include "gui/dialogs/NewInstanceDialog.h"
 | 
			
		||||
#include "gui/dialogs/ProgressDialog.h"
 | 
			
		||||
#include "gui/dialogs/AboutDialog.h"
 | 
			
		||||
@@ -58,12 +57,15 @@
 | 
			
		||||
#include "gui/dialogs/LwjglSelectDialog.h"
 | 
			
		||||
#include "gui/dialogs/IconPickerDialog.h"
 | 
			
		||||
#include "gui/dialogs/CopyInstanceDialog.h"
 | 
			
		||||
#include "gui/dialogs/AccountListDialog.h"
 | 
			
		||||
#include "gui/dialogs/AccountSelectDialog.h"
 | 
			
		||||
#include "gui/dialogs/UpdateDialog.h"
 | 
			
		||||
#include "gui/dialogs/EditAccountDialog.h"
 | 
			
		||||
#include "gui/dialogs/NotificationDialog.h"
 | 
			
		||||
 | 
			
		||||
#include "gui/pages/global/SettingsPage.h"
 | 
			
		||||
#include "gui/pages/global/ExternalToolsPage.h"
 | 
			
		||||
#include "gui/pages/global/AccountListPage.h"
 | 
			
		||||
 | 
			
		||||
#include "gui/ConsoleWindow.h"
 | 
			
		||||
#include "pagedialog/PageDialog.h"
 | 
			
		||||
 | 
			
		||||
@@ -245,6 +247,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
 | 
			
		||||
 | 
			
		||||
	ui->mainToolBar->addAction(accountMenuButtonAction);
 | 
			
		||||
 | 
			
		||||
	// set up global pages dialog
 | 
			
		||||
	{
 | 
			
		||||
		m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings"));
 | 
			
		||||
		m_globalSettingsProvider->addPage<AccountListPage>();
 | 
			
		||||
		m_globalSettingsProvider->addPage<SettingsPage>();
 | 
			
		||||
		m_globalSettingsProvider->addPage<ExternalToolsPage>();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Update the menu when the active account changes.
 | 
			
		||||
	// Shouldn't have to use lambdas here like this, but if I don't, the compiler throws a fit.
 | 
			
		||||
	// Template hell sucks...
 | 
			
		||||
@@ -937,16 +947,6 @@ void MainWindow::on_actionCheckUpdate_triggered()
 | 
			
		||||
	updater->checkForUpdate(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionSettings_triggered()
 | 
			
		||||
{
 | 
			
		||||
	SettingsDialog dialog(this);
 | 
			
		||||
	dialog.exec();
 | 
			
		||||
	// FIXME: quick HACK to make this work. improve, optimize.
 | 
			
		||||
	proxymodel->invalidate();
 | 
			
		||||
	proxymodel->sort(0);
 | 
			
		||||
	updateToolsMenu();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
void ShowPageDialog(T raw_provider, QWidget * parent, QString open_page = QString())
 | 
			
		||||
{
 | 
			
		||||
@@ -957,6 +957,15 @@ void ShowPageDialog(T raw_provider, QWidget * parent, QString open_page = QStrin
 | 
			
		||||
	dlg.exec();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionSettings_triggered()
 | 
			
		||||
{
 | 
			
		||||
	ShowPageDialog(m_globalSettingsProvider, this, "global-settings");
 | 
			
		||||
	// FIXME: quick HACK to make this work. improve, optimize.
 | 
			
		||||
	proxymodel->invalidate();
 | 
			
		||||
	proxymodel->sort(0);
 | 
			
		||||
	updateToolsMenu();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionInstanceSettings_triggered()
 | 
			
		||||
{
 | 
			
		||||
	ShowPageDialog(m_selectedInstance, this, "settings");
 | 
			
		||||
@@ -980,8 +989,7 @@ void MainWindow::on_actionScreenshots_triggered()
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionManageAccounts_triggered()
 | 
			
		||||
{
 | 
			
		||||
	AccountListDialog dialog(this);
 | 
			
		||||
	dialog.exec();
 | 
			
		||||
	ShowPageDialog(m_globalSettingsProvider, this, "accounts");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionReportBug_triggered()
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@ class QLabel;
 | 
			
		||||
class MinecraftProcess;
 | 
			
		||||
class ConsoleWindow;
 | 
			
		||||
class BaseProfilerFactory;
 | 
			
		||||
class GenericPageProvider;
 | 
			
		||||
 | 
			
		||||
namespace Ui
 | 
			
		||||
{
 | 
			
		||||
@@ -189,6 +190,8 @@ private:
 | 
			
		||||
	QToolButton *changeIconButton;
 | 
			
		||||
	QToolButton *newsLabel;
 | 
			
		||||
 | 
			
		||||
	std::shared_ptr<GenericPageProvider> m_globalSettingsProvider;
 | 
			
		||||
 | 
			
		||||
	InstancePtr m_selectedInstance;
 | 
			
		||||
	QString m_currentInstIcon;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,7 @@
 | 
			
		||||
 | 
			
		||||
#include "BasePage.h"
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <functional>
 | 
			
		||||
 | 
			
		||||
class BasePageProvider
 | 
			
		||||
{
 | 
			
		||||
@@ -25,4 +26,44 @@ public:
 | 
			
		||||
	virtual QString dialogTitle() = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class GenericPageProvider : public BasePageProvider
 | 
			
		||||
{
 | 
			
		||||
	typedef std::function<BasePage *()> PageCreator;
 | 
			
		||||
public:
 | 
			
		||||
	explicit GenericPageProvider(const QString &dialogTitle)
 | 
			
		||||
		: m_dialogTitle(dialogTitle)
 | 
			
		||||
	{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	QList<BasePage *> getPages() override
 | 
			
		||||
	{
 | 
			
		||||
		QList<BasePage *> pages;
 | 
			
		||||
		for (PageCreator creator : m_creators)
 | 
			
		||||
		{
 | 
			
		||||
			pages.append(creator());
 | 
			
		||||
		}
 | 
			
		||||
		return pages;
 | 
			
		||||
	}
 | 
			
		||||
	QString dialogTitle() override { return m_dialogTitle; }
 | 
			
		||||
 | 
			
		||||
	void setDialogTitle(const QString &title)
 | 
			
		||||
	{
 | 
			
		||||
		m_dialogTitle = title;
 | 
			
		||||
	}
 | 
			
		||||
	void addPageCreator(PageCreator page)
 | 
			
		||||
	{
 | 
			
		||||
		m_creators.append(page);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template<typename PageClass>
 | 
			
		||||
	void addPage()
 | 
			
		||||
	{
 | 
			
		||||
		addPageCreator([](){return new PageClass();});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	QList<PageCreator> m_creators;
 | 
			
		||||
	QString m_dialogTitle;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef std::shared_ptr<BasePageProvider> BasePageProviderPtr;
 | 
			
		||||
 
 | 
			
		||||
@@ -13,28 +13,28 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "AccountListDialog.h"
 | 
			
		||||
#include "ui_AccountListDialog.h"
 | 
			
		||||
#include "AccountListPage.h"
 | 
			
		||||
#include "ui_AccountListPage.h"
 | 
			
		||||
 | 
			
		||||
#include <QItemSelectionModel>
 | 
			
		||||
 | 
			
		||||
#include <logger/QsLog.h>
 | 
			
		||||
 | 
			
		||||
#include <logic/net/NetJob.h>
 | 
			
		||||
#include <logic/net/URLConstants.h>
 | 
			
		||||
#include "logic/net/NetJob.h"
 | 
			
		||||
#include "logic/net/URLConstants.h"
 | 
			
		||||
 | 
			
		||||
#include <gui/dialogs/EditAccountDialog.h>
 | 
			
		||||
#include <gui/dialogs/ProgressDialog.h>
 | 
			
		||||
#include <gui/dialogs/AccountSelectDialog.h>
 | 
			
		||||
#include <gui/dialogs/LoginDialog.h>
 | 
			
		||||
#include "CustomMessageBox.h"
 | 
			
		||||
#include <logic/tasks/Task.h>
 | 
			
		||||
#include <logic/auth/YggdrasilTask.h>
 | 
			
		||||
#include "gui/dialogs/EditAccountDialog.h"
 | 
			
		||||
#include "gui/dialogs/ProgressDialog.h"
 | 
			
		||||
#include "gui/dialogs/AccountSelectDialog.h"
 | 
			
		||||
#include "gui/dialogs/LoginDialog.h"
 | 
			
		||||
#include "gui/dialogs/CustomMessageBox.h"
 | 
			
		||||
#include "logic/tasks/Task.h"
 | 
			
		||||
#include "logic/auth/YggdrasilTask.h"
 | 
			
		||||
 | 
			
		||||
#include <MultiMC.h>
 | 
			
		||||
 | 
			
		||||
AccountListDialog::AccountListDialog(QWidget *parent)
 | 
			
		||||
	: QDialog(parent), ui(new Ui::AccountListDialog)
 | 
			
		||||
AccountListPage::AccountListPage(QWidget *parent)
 | 
			
		||||
	: QDialog(parent), ui(new Ui::AccountListPage)
 | 
			
		||||
{
 | 
			
		||||
	ui->setupUi(this);
 | 
			
		||||
 | 
			
		||||
@@ -58,23 +58,23 @@ AccountListDialog::AccountListDialog(QWidget *parent)
 | 
			
		||||
	updateButtonStates();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AccountListDialog::~AccountListDialog()
 | 
			
		||||
AccountListPage::~AccountListPage()
 | 
			
		||||
{
 | 
			
		||||
	delete ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AccountListDialog::listChanged()
 | 
			
		||||
void AccountListPage::listChanged()
 | 
			
		||||
{
 | 
			
		||||
	updateButtonStates();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AccountListDialog::on_addAccountBtn_clicked()
 | 
			
		||||
void AccountListPage::on_addAccountBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	addAccount(tr("Please enter your Mojang or Minecraft account username and password to add "
 | 
			
		||||
				  "your account."));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AccountListDialog::on_rmAccountBtn_clicked()
 | 
			
		||||
void AccountListPage::on_rmAccountBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
 | 
			
		||||
	if (selection.size() > 0)
 | 
			
		||||
@@ -84,7 +84,7 @@ void AccountListDialog::on_rmAccountBtn_clicked()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AccountListDialog::on_setDefaultBtn_clicked()
 | 
			
		||||
void AccountListPage::on_setDefaultBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
 | 
			
		||||
	if (selection.size() > 0)
 | 
			
		||||
@@ -96,17 +96,12 @@ void AccountListDialog::on_setDefaultBtn_clicked()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AccountListDialog::on_noDefaultBtn_clicked()
 | 
			
		||||
void AccountListPage::on_noDefaultBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	m_accounts->setActiveAccount("");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AccountListDialog::on_closeBtnBox_rejected()
 | 
			
		||||
{
 | 
			
		||||
	close();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AccountListDialog::updateButtonStates()
 | 
			
		||||
void AccountListPage::updateButtonStates()
 | 
			
		||||
{
 | 
			
		||||
	// If there is no selection, disable buttons that require something selected.
 | 
			
		||||
	QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
 | 
			
		||||
@@ -117,7 +112,7 @@ void AccountListDialog::updateButtonStates()
 | 
			
		||||
	ui->noDefaultBtn->setDown(m_accounts->activeAccount().get() == nullptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AccountListDialog::addAccount(const QString &errMsg)
 | 
			
		||||
void AccountListPage::addAccount(const QString &errMsg)
 | 
			
		||||
{
 | 
			
		||||
	// TODO: The login dialog isn't quite done yet
 | 
			
		||||
	MojangAccountPtr account = LoginDialog::newAccount(this, errMsg);
 | 
			
		||||
@@ -16,24 +16,42 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "gui/pages/BasePage.h"
 | 
			
		||||
 | 
			
		||||
#include "logic/auth/MojangAccountList.h"
 | 
			
		||||
 | 
			
		||||
namespace Ui
 | 
			
		||||
{
 | 
			
		||||
class AccountListDialog;
 | 
			
		||||
class AccountListPage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class AuthenticateTask;
 | 
			
		||||
 | 
			
		||||
class AccountListDialog : public QDialog
 | 
			
		||||
class AccountListPage : public QDialog, public BasePage
 | 
			
		||||
{
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
	explicit AccountListDialog(QWidget *parent = 0);
 | 
			
		||||
	~AccountListDialog();
 | 
			
		||||
	explicit AccountListPage(QWidget *parent = 0);
 | 
			
		||||
	~AccountListPage();
 | 
			
		||||
 | 
			
		||||
	QString displayName() const override
 | 
			
		||||
	{
 | 
			
		||||
		return tr("Accounts");
 | 
			
		||||
	}
 | 
			
		||||
	QIcon icon() const override
 | 
			
		||||
	{
 | 
			
		||||
		return QIcon::fromTheme("noaccount");
 | 
			
		||||
	}
 | 
			
		||||
	QString id() const override
 | 
			
		||||
	{
 | 
			
		||||
		return "accounts";
 | 
			
		||||
	}
 | 
			
		||||
	QString helpPage() const override
 | 
			
		||||
	{
 | 
			
		||||
		return "Accounts";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
public
 | 
			
		||||
slots:
 | 
			
		||||
@@ -45,9 +63,6 @@ slots:
 | 
			
		||||
 | 
			
		||||
	void on_noDefaultBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	// This will be sent when the "close" button is clicked.
 | 
			
		||||
	void on_closeBtnBox_rejected();
 | 
			
		||||
 | 
			
		||||
	void listChanged();
 | 
			
		||||
 | 
			
		||||
	//! Updates the states of the dialog's buttons.
 | 
			
		||||
@@ -61,5 +76,5 @@ slots:
 | 
			
		||||
	void addAccount(const QString& errMsg="");
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	Ui::AccountListDialog *ui;
 | 
			
		||||
	Ui::AccountListPage *ui;
 | 
			
		||||
};
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>AccountListDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="AccountListDialog">
 | 
			
		||||
 <class>AccountListPage</class>
 | 
			
		||||
 <widget class="QWidget" name="AccountListPage">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
@@ -82,13 +82,6 @@
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QDialogButtonBox" name="closeBtnBox">
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Close</set>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
							
								
								
									
										28
									
								
								gui/pages/global/BaseSettingsPage.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								gui/pages/global/BaseSettingsPage.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
/* Copyright 2014 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 "BaseSettingsPage.h"
 | 
			
		||||
 | 
			
		||||
#include "MultiMC.h"
 | 
			
		||||
 | 
			
		||||
void BaseSettingsPage::opened()
 | 
			
		||||
{
 | 
			
		||||
	loadSettings(MMC->settings().get());
 | 
			
		||||
}
 | 
			
		||||
bool BaseSettingsPage::apply()
 | 
			
		||||
{
 | 
			
		||||
	applySettings(MMC->settings().get());
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								gui/pages/global/BaseSettingsPage.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								gui/pages/global/BaseSettingsPage.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
/* Copyright 2014 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 "gui/pages/BasePage.h"
 | 
			
		||||
 | 
			
		||||
class SettingsObject;
 | 
			
		||||
 | 
			
		||||
class BaseSettingsPage : public BasePage
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
	virtual ~BaseSettingsPage()
 | 
			
		||||
	{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void opened() override;
 | 
			
		||||
	bool apply() override;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	virtual void loadSettings(SettingsObject *object) = 0;
 | 
			
		||||
	virtual void applySettings(SettingsObject *object) = 0;
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										177
									
								
								gui/pages/global/ExternalToolsPage.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										177
									
								
								gui/pages/global/ExternalToolsPage.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,177 @@
 | 
			
		||||
/* Copyright 2014 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 "ExternalToolsPage.h"
 | 
			
		||||
#include "ui_ExternalToolsPage.h"
 | 
			
		||||
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
 | 
			
		||||
#include <pathutils.h>
 | 
			
		||||
 | 
			
		||||
#include "logic/settings/SettingsObject.h"
 | 
			
		||||
#include "logic/tools/BaseProfiler.h"
 | 
			
		||||
#include "MultiMC.h"
 | 
			
		||||
 | 
			
		||||
ExternalToolsPage::ExternalToolsPage(QWidget *parent) :
 | 
			
		||||
	QWidget(parent),
 | 
			
		||||
	ui(new Ui::ExternalToolsPage)
 | 
			
		||||
{
 | 
			
		||||
	ui->setupUi(this);
 | 
			
		||||
 | 
			
		||||
	ui->mceditLink->setOpenExternalLinks(true);
 | 
			
		||||
	ui->jvisualvmLink->setOpenExternalLinks(true);
 | 
			
		||||
	ui->jprofilerLink->setOpenExternalLinks(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ExternalToolsPage::~ExternalToolsPage()
 | 
			
		||||
{
 | 
			
		||||
	delete ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ExternalToolsPage::loadSettings(SettingsObject *object)
 | 
			
		||||
{
 | 
			
		||||
	ui->jprofilerPathEdit->setText(object->get("JProfilerPath").toString());
 | 
			
		||||
	ui->jvisualvmPathEdit->setText(object->get("JVisualVMPath").toString());
 | 
			
		||||
	ui->mceditPathEdit->setText(object->get("MCEditPath").toString());
 | 
			
		||||
}
 | 
			
		||||
void ExternalToolsPage::applySettings(SettingsObject *object)
 | 
			
		||||
{
 | 
			
		||||
	object->set("JProfilerPath", ui->jprofilerPathEdit->text());
 | 
			
		||||
	object->set("JVisualVMPath", ui->jvisualvmPathEdit->text());
 | 
			
		||||
	object->set("MCEditPath", ui->mceditPathEdit->text());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ExternalToolsPage::on_jprofilerPathBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = ui->jprofilerPathEdit->text();
 | 
			
		||||
	QString error;
 | 
			
		||||
	do
 | 
			
		||||
	{
 | 
			
		||||
		raw_dir = QFileDialog::getExistingDirectory(this, tr("JProfiler Directory"), raw_dir);
 | 
			
		||||
		if (raw_dir.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		QString cooked_dir = NormalizePath(raw_dir);
 | 
			
		||||
		if (!MMC->profilers()["jprofiler"]->check(cooked_dir, &error))
 | 
			
		||||
		{
 | 
			
		||||
			QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
								  tr("Error while checking JProfiler install:\n%1").arg(error));
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			ui->jprofilerPathEdit->setText(cooked_dir);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	} while (1);
 | 
			
		||||
}
 | 
			
		||||
void ExternalToolsPage::on_jprofilerCheckBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString error;
 | 
			
		||||
	if (!MMC->profilers()["jprofiler"]->check(ui->jprofilerPathEdit->text(), &error))
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
							  tr("Error while checking JProfiler install:\n%1").arg(error));
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::information(this, tr("OK"), tr("JProfiler setup seems to be OK"));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ExternalToolsPage::on_jvisualvmPathBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = ui->jvisualvmPathEdit->text();
 | 
			
		||||
	QString error;
 | 
			
		||||
	do
 | 
			
		||||
	{
 | 
			
		||||
		raw_dir = QFileDialog::getOpenFileName(this, tr("JVisualVM Executable"), raw_dir);
 | 
			
		||||
		if (raw_dir.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		QString cooked_dir = NormalizePath(raw_dir);
 | 
			
		||||
		if (!MMC->profilers()["jvisualvm"]->check(cooked_dir, &error))
 | 
			
		||||
		{
 | 
			
		||||
			QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
								  tr("Error while checking JVisualVM install:\n%1").arg(error));
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			ui->jvisualvmPathEdit->setText(cooked_dir);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	} while (1);
 | 
			
		||||
}
 | 
			
		||||
void ExternalToolsPage::on_jvisualvmCheckBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString error;
 | 
			
		||||
	if (!MMC->profilers()["jvisualvm"]->check(ui->jvisualvmPathEdit->text(), &error))
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
							  tr("Error while checking JVisualVM install:\n%1").arg(error));
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::information(this, tr("OK"), tr("JVisualVM setup seems to be OK"));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ExternalToolsPage::on_mceditPathBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = ui->mceditPathEdit->text();
 | 
			
		||||
	QString error;
 | 
			
		||||
	do
 | 
			
		||||
	{
 | 
			
		||||
#ifdef Q_OS_OSX
 | 
			
		||||
#warning stuff
 | 
			
		||||
		raw_dir = QFileDialog::getOpenFileName(this, tr("MCEdit Application"), raw_dir);
 | 
			
		||||
#else
 | 
			
		||||
		raw_dir = QFileDialog::getExistingDirectory(this, tr("MCEdit Directory"), raw_dir);
 | 
			
		||||
#endif
 | 
			
		||||
		if (raw_dir.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		QString cooked_dir = NormalizePath(raw_dir);
 | 
			
		||||
		if (!MMC->tools()["mcedit"]->check(cooked_dir, &error))
 | 
			
		||||
		{
 | 
			
		||||
			QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
								  tr("Error while checking MCEdit install:\n%1").arg(error));
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			ui->mceditPathEdit->setText(cooked_dir);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	} while (1);
 | 
			
		||||
}
 | 
			
		||||
void ExternalToolsPage::on_mceditCheckBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString error;
 | 
			
		||||
	if (!MMC->tools()["mcedit"]->check(ui->mceditPathEdit->text(), &error))
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
							  tr("Error while checking MCEdit install:\n%1").arg(error));
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::information(this, tr("OK"), tr("MCEdit setup seems to be OK"));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										66
									
								
								gui/pages/global/ExternalToolsPage.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								gui/pages/global/ExternalToolsPage.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,66 @@
 | 
			
		||||
/* Copyright 2014 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>
 | 
			
		||||
 | 
			
		||||
#include "BaseSettingsPage.h"
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class ExternalToolsPage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ExternalToolsPage : public QWidget, public BaseSettingsPage
 | 
			
		||||
{
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	explicit ExternalToolsPage(QWidget *parent = 0);
 | 
			
		||||
	~ExternalToolsPage();
 | 
			
		||||
 | 
			
		||||
	QString displayName() const override
 | 
			
		||||
	{
 | 
			
		||||
		return tr("External Tools");
 | 
			
		||||
	}
 | 
			
		||||
	QIcon icon() const override
 | 
			
		||||
	{
 | 
			
		||||
		return QIcon::fromTheme("plugin-blue");
 | 
			
		||||
	}
 | 
			
		||||
	QString id() const override
 | 
			
		||||
	{
 | 
			
		||||
		return "external-tools";
 | 
			
		||||
	}
 | 
			
		||||
	QString helpPage() const override
 | 
			
		||||
	{
 | 
			
		||||
		return "External-tools";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	void loadSettings(SettingsObject *object) override;
 | 
			
		||||
	void applySettings(SettingsObject *object) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	Ui::ExternalToolsPage *ui;
 | 
			
		||||
 | 
			
		||||
private
 | 
			
		||||
slots:
 | 
			
		||||
	void on_jprofilerPathBtn_clicked();
 | 
			
		||||
	void on_jprofilerCheckBtn_clicked();
 | 
			
		||||
	void on_jvisualvmPathBtn_clicked();
 | 
			
		||||
	void on_jvisualvmCheckBtn_clicked();
 | 
			
		||||
	void on_mceditPathBtn_clicked();
 | 
			
		||||
	void on_mceditCheckBtn_clicked();
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										145
									
								
								gui/pages/global/ExternalToolsPage.ui
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								gui/pages/global/ExternalToolsPage.ui
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,145 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>ExternalToolsPage</class>
 | 
			
		||||
 <widget class="QWidget" name="ExternalToolsPage">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>494</width>
 | 
			
		||||
    <height>562</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Form</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QGroupBox" name="groupBox_2">
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>JProfiler</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout_10">
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_4">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLineEdit" name="jprofilerPathEdit"/>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="jprofilerPathBtn">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>...</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QPushButton" name="jprofilerCheckBtn">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Check</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QLabel" name="jprofilerLink">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string><html><head/><body><p><a href="http://www.ej-technologies.com/products/jprofiler/overview.html"><span style=" text-decoration: underline; color:#0000ff;">http://www.ej-technologies.com/products/jprofiler/overview.html</span></a></p></body></html></string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QGroupBox" name="groupBox_3">
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>JVisualVM</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout_11">
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_5">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLineEdit" name="jvisualvmPathEdit"/>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="jvisualvmPathBtn">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>...</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QPushButton" name="jvisualvmCheckBtn">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Check</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QLabel" name="jvisualvmLink">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string><html><head/><body><p><a href="http://visualvm.java.net/"><span style=" text-decoration: underline; color:#0000ff;">http://visualvm.java.net/</span></a></p></body></html></string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QGroupBox" name="groupBox_4">
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>MCEdit</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout_12">
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_6">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLineEdit" name="mceditPathEdit"/>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="mceditPathBtn">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>...</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QPushButton" name="mceditCheckBtn">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Check</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QLabel" name="mceditLink">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string><html><head/><body><p><a href="http://www.mcedit.net/"><span style=" text-decoration: underline; color:#0000ff;">http://www.mcedit.net/</span></a></p></body></html></string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <spacer name="verticalSpacer">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Vertical</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="sizeHint" stdset="0">
 | 
			
		||||
      <size>
 | 
			
		||||
       <width>20</width>
 | 
			
		||||
       <height>160</height>
 | 
			
		||||
      </size>
 | 
			
		||||
     </property>
 | 
			
		||||
    </spacer>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
@@ -13,10 +13,14 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "MultiMC.h"
 | 
			
		||||
#include "SettingsPage.h"
 | 
			
		||||
#include "ui_SettingsPage.h"
 | 
			
		||||
 | 
			
		||||
#include "gui/dialogs/SettingsDialog.h"
 | 
			
		||||
#include "ui_SettingsDialog.h"
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include <QDir>
 | 
			
		||||
 | 
			
		||||
#include <pathutils.h>
 | 
			
		||||
 | 
			
		||||
#include "gui/Platform.h"
 | 
			
		||||
#include "gui/dialogs/VersionSelectDialog.h"
 | 
			
		||||
@@ -33,10 +37,7 @@
 | 
			
		||||
#include "logic/tools/BaseProfiler.h"
 | 
			
		||||
 | 
			
		||||
#include "logic/settings/SettingsObject.h"
 | 
			
		||||
#include <pathutils.h>
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include "MultiMC.h"
 | 
			
		||||
 | 
			
		||||
// FIXME: possibly move elsewhere
 | 
			
		||||
enum InstSortMode
 | 
			
		||||
@@ -47,7 +48,7 @@ enum InstSortMode
 | 
			
		||||
	Sort_LastLaunch
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog)
 | 
			
		||||
SettingsPage::SettingsPage(QWidget *parent) : QWidget(parent), ui(new Ui::SettingsPage)
 | 
			
		||||
{
 | 
			
		||||
	MultiMCPlatform::fixWM_CLASS(this);
 | 
			
		||||
	ui->setupUi(this);
 | 
			
		||||
@@ -61,11 +62,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se
 | 
			
		||||
	restoreGeometry(
 | 
			
		||||
		QByteArray::fromBase64(MMC->settings()->get("SettingsGeometry").toByteArray()));
 | 
			
		||||
 | 
			
		||||
	loadSettings(MMC->settings().get());
 | 
			
		||||
	updateCheckboxStuff();
 | 
			
		||||
 | 
			
		||||
	QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this,
 | 
			
		||||
					 &SettingsDialog::refreshUpdateChannelList);
 | 
			
		||||
					 &SettingsPage::refreshUpdateChannelList);
 | 
			
		||||
 | 
			
		||||
	if (MMC->updateChecker()->hasChannels())
 | 
			
		||||
	{
 | 
			
		||||
@@ -76,28 +74,21 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se
 | 
			
		||||
		MMC->updateChecker()->updateChanList(false);
 | 
			
		||||
	}
 | 
			
		||||
	connect(ui->proxyGroup, SIGNAL(buttonClicked(int)), SLOT(proxyChanged(int)));
 | 
			
		||||
	ui->mceditLink->setOpenExternalLinks(true);
 | 
			
		||||
	ui->jvisualvmLink->setOpenExternalLinks(true);
 | 
			
		||||
	ui->jprofilerLink->setOpenExternalLinks(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SettingsDialog::~SettingsDialog()
 | 
			
		||||
SettingsPage::~SettingsPage()
 | 
			
		||||
{
 | 
			
		||||
	delete ui;
 | 
			
		||||
}
 | 
			
		||||
void SettingsDialog::showEvent(QShowEvent *ev)
 | 
			
		||||
{
 | 
			
		||||
	QDialog::showEvent(ev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::closeEvent(QCloseEvent *ev)
 | 
			
		||||
void SettingsPage::closeEvent(QCloseEvent *ev)
 | 
			
		||||
{
 | 
			
		||||
	MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
 | 
			
		||||
 | 
			
		||||
	QDialog::closeEvent(ev);
 | 
			
		||||
	QWidget::closeEvent(ev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::updateCheckboxStuff()
 | 
			
		||||
void SettingsPage::updateCheckboxStuff()
 | 
			
		||||
{
 | 
			
		||||
	ui->windowWidthSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked());
 | 
			
		||||
	ui->windowHeightSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked());
 | 
			
		||||
@@ -107,7 +98,7 @@ void SettingsDialog::updateCheckboxStuff()
 | 
			
		||||
								 !ui->proxyDefaultBtn->isChecked());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_ftbLauncherBrowseBtn_clicked()
 | 
			
		||||
void SettingsPage::on_ftbLauncherBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = QFileDialog::getExistingDirectory(this, tr("FTB Launcher Directory"),
 | 
			
		||||
														ui->ftbLauncherBox->text());
 | 
			
		||||
@@ -119,8 +110,7 @@ void SettingsDialog::on_ftbLauncherBrowseBtn_clicked()
 | 
			
		||||
		ui->ftbLauncherBox->setText(cooked_dir);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_ftbBrowseBtn_clicked()
 | 
			
		||||
void SettingsPage::on_ftbBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir =
 | 
			
		||||
		QFileDialog::getExistingDirectory(this, tr("FTB Directory"), ui->ftbBox->text());
 | 
			
		||||
@@ -133,7 +123,7 @@ void SettingsDialog::on_ftbBrowseBtn_clicked()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_instDirBrowseBtn_clicked()
 | 
			
		||||
void SettingsPage::on_instDirBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"),
 | 
			
		||||
														ui->instDirTextBox->text());
 | 
			
		||||
@@ -145,7 +135,7 @@ void SettingsDialog::on_instDirBrowseBtn_clicked()
 | 
			
		||||
		ui->instDirTextBox->setText(cooked_dir);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
void SettingsDialog::on_iconsDirBrowseBtn_clicked()
 | 
			
		||||
void SettingsPage::on_iconsDirBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Directory"),
 | 
			
		||||
														ui->iconsDirTextBox->text());
 | 
			
		||||
@@ -157,8 +147,7 @@ void SettingsDialog::on_iconsDirBrowseBtn_clicked()
 | 
			
		||||
		ui->iconsDirTextBox->setText(cooked_dir);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_modsDirBrowseBtn_clicked()
 | 
			
		||||
void SettingsPage::on_modsDirBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Directory"),
 | 
			
		||||
														ui->modsDirTextBox->text());
 | 
			
		||||
@@ -170,8 +159,7 @@ void SettingsDialog::on_modsDirBrowseBtn_clicked()
 | 
			
		||||
		ui->modsDirTextBox->setText(cooked_dir);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_lwjglDirBrowseBtn_clicked()
 | 
			
		||||
void SettingsPage::on_lwjglDirBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Directory"),
 | 
			
		||||
														ui->lwjglDirTextBox->text());
 | 
			
		||||
@@ -184,7 +172,7 @@ void SettingsDialog::on_lwjglDirBrowseBtn_clicked()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_jsonEditorBrowseBtn_clicked()
 | 
			
		||||
void SettingsPage::on_jsonEditorBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_file = QFileDialog::getOpenFileName(
 | 
			
		||||
		this, tr("JSON Editor"),
 | 
			
		||||
@@ -214,33 +202,18 @@ void SettingsDialog::on_jsonEditorBrowseBtn_clicked()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_maximizedCheckBox_clicked(bool checked)
 | 
			
		||||
void SettingsPage::on_maximizedCheckBox_clicked(bool checked)
 | 
			
		||||
{
 | 
			
		||||
	Q_UNUSED(checked);
 | 
			
		||||
	updateCheckboxStuff();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_buttonBox_accepted()
 | 
			
		||||
{
 | 
			
		||||
	applySettings(MMC->settings().get());
 | 
			
		||||
 | 
			
		||||
	// Apply proxy settings
 | 
			
		||||
	MMC->updateProxySettings();
 | 
			
		||||
 | 
			
		||||
	MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_buttonBox_rejected()
 | 
			
		||||
{
 | 
			
		||||
	MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::proxyChanged(int)
 | 
			
		||||
void SettingsPage::proxyChanged(int)
 | 
			
		||||
{
 | 
			
		||||
	updateCheckboxStuff();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::refreshUpdateChannelList()
 | 
			
		||||
void SettingsPage::refreshUpdateChannelList()
 | 
			
		||||
{
 | 
			
		||||
	// Stop listening for selection changes. It's going to change a lot while we update it and
 | 
			
		||||
	// we don't need to update the
 | 
			
		||||
@@ -285,12 +258,12 @@ void SettingsDialog::refreshUpdateChannelList()
 | 
			
		||||
	ui->updateChannelComboBox->setEnabled(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::updateChannelSelectionChanged(int index)
 | 
			
		||||
void SettingsPage::updateChannelSelectionChanged(int index)
 | 
			
		||||
{
 | 
			
		||||
	refreshUpdateChannelDesc();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::refreshUpdateChannelDesc()
 | 
			
		||||
void SettingsPage::refreshUpdateChannelDesc()
 | 
			
		||||
{
 | 
			
		||||
	// Get the channel list.
 | 
			
		||||
	QList<UpdateChecker::ChannelListEntry> channelList = MMC->updateChecker()->getChannelList();
 | 
			
		||||
@@ -312,7 +285,7 @@ void SettingsDialog::refreshUpdateChannelDesc()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::applySettings(SettingsObject *s)
 | 
			
		||||
void SettingsPage::applySettings(SettingsObject *s)
 | 
			
		||||
{
 | 
			
		||||
	// Language
 | 
			
		||||
	s->set("Language",
 | 
			
		||||
@@ -421,14 +394,8 @@ void SettingsDialog::applySettings(SettingsObject *s)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	s->set("PostExitCommand", ui->postExitCmdTextBox->text());
 | 
			
		||||
 | 
			
		||||
	// Profilers
 | 
			
		||||
	s->set("JProfilerPath", ui->jprofilerPathEdit->text());
 | 
			
		||||
	s->set("JVisualVMPath", ui->jvisualvmPathEdit->text());
 | 
			
		||||
	s->set("MCEditPath", ui->mceditPathEdit->text());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::loadSettings(SettingsObject *s)
 | 
			
		||||
void SettingsPage::loadSettings(SettingsObject *s)
 | 
			
		||||
{
 | 
			
		||||
	// Language
 | 
			
		||||
	ui->languageBox->clear();
 | 
			
		||||
@@ -524,14 +491,9 @@ void SettingsDialog::loadSettings(SettingsObject *s)
 | 
			
		||||
	// Custom Commands
 | 
			
		||||
	ui->preLaunchCmdTextBox->setText(s->get("PreLaunchCommand").toString());
 | 
			
		||||
	ui->postExitCmdTextBox->setText(s->get("PostExitCommand").toString());
 | 
			
		||||
 | 
			
		||||
	// Profilers
 | 
			
		||||
	ui->jprofilerPathEdit->setText(s->get("JProfilerPath").toString());
 | 
			
		||||
	ui->jvisualvmPathEdit->setText(s->get("JVisualVMPath").toString());
 | 
			
		||||
	ui->mceditPathEdit->setText(s->get("MCEditPath").toString());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_javaDetectBtn_clicked()
 | 
			
		||||
void SettingsPage::on_javaDetectBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	JavaVersionPtr java;
 | 
			
		||||
 | 
			
		||||
@@ -545,8 +507,7 @@ void SettingsDialog::on_javaDetectBtn_clicked()
 | 
			
		||||
		ui->javaPathTextBox->setText(java->path);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_javaBrowseBtn_clicked()
 | 
			
		||||
void SettingsPage::on_javaBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString dir = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
 | 
			
		||||
	if (!dir.isNull())
 | 
			
		||||
@@ -554,8 +515,7 @@ void SettingsDialog::on_javaBrowseBtn_clicked()
 | 
			
		||||
		ui->javaPathTextBox->setText(dir);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_javaTestBtn_clicked()
 | 
			
		||||
void SettingsPage::on_javaTestBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	checker.reset(new JavaChecker());
 | 
			
		||||
	connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this,
 | 
			
		||||
@@ -564,7 +524,7 @@ void SettingsDialog::on_javaTestBtn_clicked()
 | 
			
		||||
	checker->performCheck();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::checkFinished(JavaCheckResult result)
 | 
			
		||||
void SettingsPage::checkFinished(JavaCheckResult result)
 | 
			
		||||
{
 | 
			
		||||
	if (result.valid)
 | 
			
		||||
	{
 | 
			
		||||
@@ -585,126 +545,3 @@ void SettingsDialog::checkFinished(JavaCheckResult result)
 | 
			
		||||
			   "or set the path to the java executable."));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_jprofilerPathBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = ui->jprofilerPathEdit->text();
 | 
			
		||||
	QString error;
 | 
			
		||||
	do
 | 
			
		||||
	{
 | 
			
		||||
		raw_dir = QFileDialog::getExistingDirectory(this, tr("JProfiler Directory"), raw_dir);
 | 
			
		||||
		if (raw_dir.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		QString cooked_dir = NormalizePath(raw_dir);
 | 
			
		||||
		if (!MMC->profilers()["jprofiler"]->check(cooked_dir, &error))
 | 
			
		||||
		{
 | 
			
		||||
			QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
								  tr("Error while checking JProfiler install:\n%1").arg(error));
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			ui->jprofilerPathEdit->setText(cooked_dir);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	} while (1);
 | 
			
		||||
}
 | 
			
		||||
void SettingsDialog::on_jprofilerCheckBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString error;
 | 
			
		||||
	if (!MMC->profilers()["jprofiler"]->check(ui->jprofilerPathEdit->text(), &error))
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
							  tr("Error while checking JProfiler install:\n%1").arg(error));
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::information(this, tr("OK"), tr("JProfiler setup seems to be OK"));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_jvisualvmPathBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = ui->jvisualvmPathEdit->text();
 | 
			
		||||
	QString error;
 | 
			
		||||
	do
 | 
			
		||||
	{
 | 
			
		||||
		raw_dir = QFileDialog::getOpenFileName(this, tr("JVisualVM Executable"), raw_dir);
 | 
			
		||||
		if (raw_dir.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		QString cooked_dir = NormalizePath(raw_dir);
 | 
			
		||||
		if (!MMC->profilers()["jvisualvm"]->check(cooked_dir, &error))
 | 
			
		||||
		{
 | 
			
		||||
			QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
								  tr("Error while checking JVisualVM install:\n%1").arg(error));
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			ui->jvisualvmPathEdit->setText(cooked_dir);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	} while (1);
 | 
			
		||||
}
 | 
			
		||||
void SettingsDialog::on_jvisualvmCheckBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString error;
 | 
			
		||||
	if (!MMC->profilers()["jvisualvm"]->check(ui->jvisualvmPathEdit->text(), &error))
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
							  tr("Error while checking JVisualVM install:\n%1").arg(error));
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::information(this, tr("OK"), tr("JVisualVM setup seems to be OK"));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_mceditPathBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString raw_dir = ui->mceditPathEdit->text();
 | 
			
		||||
	QString error;
 | 
			
		||||
	do
 | 
			
		||||
	{
 | 
			
		||||
#ifdef Q_OS_OSX
 | 
			
		||||
#warning stuff
 | 
			
		||||
		raw_dir = QFileDialog::getOpenFileName(this, tr("MCEdit Application"), raw_dir);
 | 
			
		||||
#else
 | 
			
		||||
		raw_dir = QFileDialog::getExistingDirectory(this, tr("MCEdit Directory"), raw_dir);
 | 
			
		||||
#endif
 | 
			
		||||
		if (raw_dir.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		QString cooked_dir = NormalizePath(raw_dir);
 | 
			
		||||
		if (!MMC->tools()["mcedit"]->check(cooked_dir, &error))
 | 
			
		||||
		{
 | 
			
		||||
			QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
								  tr("Error while checking MCEdit install:\n%1").arg(error));
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			ui->mceditPathEdit->setText(cooked_dir);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	} while (1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsDialog::on_mceditCheckBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString error;
 | 
			
		||||
	if (!MMC->tools()["mcedit"]->check(ui->mceditPathEdit->text(), &error))
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::critical(this, tr("Error"),
 | 
			
		||||
							  tr("Error while checking MCEdit install:\n%1").arg(error));
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::information(this, tr("OK"), tr("MCEdit setup seems to be OK"));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -19,69 +19,68 @@
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
 | 
			
		||||
#include "logic/java/JavaChecker.h"
 | 
			
		||||
#include "BaseSettingsPage.h"
 | 
			
		||||
 | 
			
		||||
class SettingsObject;
 | 
			
		||||
 | 
			
		||||
namespace Ui
 | 
			
		||||
{
 | 
			
		||||
class SettingsDialog;
 | 
			
		||||
class SettingsPage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class SettingsDialog : public QDialog
 | 
			
		||||
class SettingsPage : public QWidget, public BaseSettingsPage
 | 
			
		||||
{
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	explicit SettingsDialog(QWidget *parent = 0);
 | 
			
		||||
	~SettingsDialog();
 | 
			
		||||
	explicit SettingsPage(QWidget *parent = 0);
 | 
			
		||||
	~SettingsPage();
 | 
			
		||||
 | 
			
		||||
	QString displayName() const override
 | 
			
		||||
	{
 | 
			
		||||
		return tr("Settings");
 | 
			
		||||
	}
 | 
			
		||||
	QIcon icon() const override
 | 
			
		||||
	{
 | 
			
		||||
		return QIcon::fromTheme("settings");
 | 
			
		||||
	}
 | 
			
		||||
	QString id() const override
 | 
			
		||||
	{
 | 
			
		||||
		return "global-settings";
 | 
			
		||||
	}
 | 
			
		||||
	QString helpPage() const override
 | 
			
		||||
	{
 | 
			
		||||
		return "Global-settings";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void updateCheckboxStuff();
 | 
			
		||||
 | 
			
		||||
	void applySettings(SettingsObject *s);
 | 
			
		||||
	void loadSettings(SettingsObject *s);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	virtual void showEvent(QShowEvent *ev);
 | 
			
		||||
	void applySettings(SettingsObject *s) override;
 | 
			
		||||
	void loadSettings(SettingsObject *s) override;
 | 
			
		||||
	virtual void closeEvent(QCloseEvent *ev);
 | 
			
		||||
 | 
			
		||||
private
 | 
			
		||||
slots:
 | 
			
		||||
	void on_ftbLauncherBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_ftbBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_instDirBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_modsDirBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_lwjglDirBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_iconsDirBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_jsonEditorBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_iconsDirBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_maximizedCheckBox_clicked(bool checked);
 | 
			
		||||
 | 
			
		||||
	void on_buttonBox_accepted();
 | 
			
		||||
 | 
			
		||||
	void on_buttonBox_rejected();
 | 
			
		||||
 | 
			
		||||
	void on_javaDetectBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_javaTestBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_javaBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void checkFinished(JavaCheckResult result);
 | 
			
		||||
 | 
			
		||||
	void on_jprofilerPathBtn_clicked();
 | 
			
		||||
	void on_jprofilerCheckBtn_clicked();
 | 
			
		||||
	void on_jvisualvmPathBtn_clicked();
 | 
			
		||||
	void on_jvisualvmCheckBtn_clicked();
 | 
			
		||||
	void on_mceditPathBtn_clicked();
 | 
			
		||||
	void on_mceditCheckBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	/*!
 | 
			
		||||
	 * Updates the list of update channels in the combo box.
 | 
			
		||||
	 */
 | 
			
		||||
@@ -96,7 +95,7 @@ slots:
 | 
			
		||||
	void proxyChanged(int);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	Ui::SettingsDialog *ui;
 | 
			
		||||
	Ui::SettingsPage *ui;
 | 
			
		||||
	std::shared_ptr<JavaChecker> checker;
 | 
			
		||||
 | 
			
		||||
	/*!
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>SettingsDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="SettingsDialog">
 | 
			
		||||
 <class>SettingsPage</class>
 | 
			
		||||
 <widget class="QWidget" name="SettingsPage">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
@@ -23,9 +23,6 @@
 | 
			
		||||
   <iconset>
 | 
			
		||||
    <normaloff>:/icons/toolbar/settings</normaloff>:/icons/toolbar/settings</iconset>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="modal">
 | 
			
		||||
   <bool>true</bool>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="mainLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QTabWidget" name="settingsTabs">
 | 
			
		||||
@@ -926,147 +923,6 @@
 | 
			
		||||
       </item>
 | 
			
		||||
      </layout>
 | 
			
		||||
     </widget>
 | 
			
		||||
     <widget class="QWidget" name="externalToolsTab">
 | 
			
		||||
      <attribute name="title">
 | 
			
		||||
       <string>External Tools</string>
 | 
			
		||||
      </attribute>
 | 
			
		||||
      <layout class="QVBoxLayout" name="verticalLayout_13">
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QGroupBox" name="groupBox_2">
 | 
			
		||||
         <property name="title">
 | 
			
		||||
          <string>JProfiler</string>
 | 
			
		||||
         </property>
 | 
			
		||||
         <layout class="QVBoxLayout" name="verticalLayout_10">
 | 
			
		||||
          <item>
 | 
			
		||||
           <layout class="QHBoxLayout" name="horizontalLayout_4">
 | 
			
		||||
            <item>
 | 
			
		||||
             <widget class="QLineEdit" name="jprofilerPathEdit"/>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item>
 | 
			
		||||
             <widget class="QPushButton" name="jprofilerPathBtn">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>...</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
           </layout>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QPushButton" name="jprofilerCheckBtn">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Check</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QLabel" name="jprofilerLink">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string><html><head/><body><p><a href="http://www.ej-technologies.com/products/jprofiler/overview.html"><span style=" text-decoration: underline; color:#0000ff;">http://www.ej-technologies.com/products/jprofiler/overview.html</span></a></p></body></html></string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QGroupBox" name="groupBox_3">
 | 
			
		||||
         <property name="title">
 | 
			
		||||
          <string>JVisualVM</string>
 | 
			
		||||
         </property>
 | 
			
		||||
         <layout class="QVBoxLayout" name="verticalLayout_11">
 | 
			
		||||
          <item>
 | 
			
		||||
           <layout class="QHBoxLayout" name="horizontalLayout_5">
 | 
			
		||||
            <item>
 | 
			
		||||
             <widget class="QLineEdit" name="jvisualvmPathEdit"/>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item>
 | 
			
		||||
             <widget class="QPushButton" name="jvisualvmPathBtn">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>...</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
           </layout>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QPushButton" name="jvisualvmCheckBtn">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Check</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QLabel" name="jvisualvmLink">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string><html><head/><body><p><a href="http://visualvm.java.net/"><span style=" text-decoration: underline; color:#0000ff;">http://visualvm.java.net/</span></a></p></body></html></string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QGroupBox" name="groupBox_4">
 | 
			
		||||
         <property name="title">
 | 
			
		||||
          <string>MCEdit</string>
 | 
			
		||||
         </property>
 | 
			
		||||
         <layout class="QVBoxLayout" name="verticalLayout_12">
 | 
			
		||||
          <item>
 | 
			
		||||
           <layout class="QHBoxLayout" name="horizontalLayout_6">
 | 
			
		||||
            <item>
 | 
			
		||||
             <widget class="QLineEdit" name="mceditPathEdit"/>
 | 
			
		||||
            </item>
 | 
			
		||||
            <item>
 | 
			
		||||
             <widget class="QPushButton" name="mceditPathBtn">
 | 
			
		||||
              <property name="text">
 | 
			
		||||
               <string>...</string>
 | 
			
		||||
              </property>
 | 
			
		||||
             </widget>
 | 
			
		||||
            </item>
 | 
			
		||||
           </layout>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QPushButton" name="mceditCheckBtn">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Check</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QLabel" name="mceditLink">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string><html><head/><body><p><a href="http://www.mcedit.net/"><span style=" text-decoration: underline; color:#0000ff;">http://www.mcedit.net/</span></a></p></body></html></string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <spacer name="verticalSpacer_3">
 | 
			
		||||
         <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>
 | 
			
		||||
    </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>
 | 
			
		||||
@@ -1119,53 +975,9 @@
 | 
			
		||||
  <tabstop>proxyPortEdit</tabstop>
 | 
			
		||||
  <tabstop>proxyUserEdit</tabstop>
 | 
			
		||||
  <tabstop>proxyPassEdit</tabstop>
 | 
			
		||||
  <tabstop>jprofilerPathEdit</tabstop>
 | 
			
		||||
  <tabstop>jprofilerPathBtn</tabstop>
 | 
			
		||||
  <tabstop>jprofilerCheckBtn</tabstop>
 | 
			
		||||
  <tabstop>jvisualvmPathEdit</tabstop>
 | 
			
		||||
  <tabstop>jvisualvmPathBtn</tabstop>
 | 
			
		||||
  <tabstop>jvisualvmCheckBtn</tabstop>
 | 
			
		||||
  <tabstop>mceditPathEdit</tabstop>
 | 
			
		||||
  <tabstop>mceditPathBtn</tabstop>
 | 
			
		||||
  <tabstop>mceditCheckBtn</tabstop>
 | 
			
		||||
 </tabstops>
 | 
			
		||||
 <resources>
 | 
			
		||||
  <include location="../../graphics.qrc"/>
 | 
			
		||||
 </resources>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>accepted()</signal>
 | 
			
		||||
   <receiver>SettingsDialog</receiver>
 | 
			
		||||
   <slot>accept()</slot>
 | 
			
		||||
   <hints>
 | 
			
		||||
    <hint type="sourcelabel">
 | 
			
		||||
     <x>257</x>
 | 
			
		||||
     <y>410</y>
 | 
			
		||||
    </hint>
 | 
			
		||||
    <hint type="destinationlabel">
 | 
			
		||||
     <x>157</x>
 | 
			
		||||
     <y>274</y>
 | 
			
		||||
    </hint>
 | 
			
		||||
   </hints>
 | 
			
		||||
  </connection>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>rejected()</signal>
 | 
			
		||||
   <receiver>SettingsDialog</receiver>
 | 
			
		||||
   <slot>reject()</slot>
 | 
			
		||||
   <hints>
 | 
			
		||||
    <hint type="sourcelabel">
 | 
			
		||||
     <x>325</x>
 | 
			
		||||
     <y>410</y>
 | 
			
		||||
    </hint>
 | 
			
		||||
    <hint type="destinationlabel">
 | 
			
		||||
     <x>286</x>
 | 
			
		||||
     <y>274</y>
 | 
			
		||||
    </hint>
 | 
			
		||||
   </hints>
 | 
			
		||||
  </connection>
 | 
			
		||||
 </connections>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
 <buttongroups>
 | 
			
		||||
  <buttongroup name="sortingModeGroup"/>
 | 
			
		||||
  <buttongroup name="proxyGroup"/>
 | 
			
		||||
		Reference in New Issue
	
	Block a user