summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-02-09 01:51:14 +0100
committerPetr Mrázek <peterix@gmail.com>2015-04-12 20:57:18 +0200
commitdb877ba121ff87a4e029daf8555d85dfef45993a (patch)
tree7673f83c404b3883f0a4fcf6b492f0c4125c293c /gui
parent4730f54df7edf4775dfddf45f77c60edd86c32d9 (diff)
downloadMultiMC-db877ba121ff87a4e029daf8555d85dfef45993a.tar
MultiMC-db877ba121ff87a4e029daf8555d85dfef45993a.tar.gz
MultiMC-db877ba121ff87a4e029daf8555d85dfef45993a.tar.lz
MultiMC-db877ba121ff87a4e029daf8555d85dfef45993a.tar.xz
MultiMC-db877ba121ff87a4e029daf8555d85dfef45993a.zip
NOISSUE move everything.
Diffstat (limited to 'gui')
-rw-r--r--gui/ColumnResizer.cpp202
-rw-r--r--gui/ColumnResizer.h38
-rw-r--r--gui/ConsoleWindow.cpp260
-rw-r--r--gui/ConsoleWindow.h65
-rw-r--r--gui/GuiUtil.cpp48
-rw-r--r--gui/GuiUtil.h9
-rw-r--r--gui/InstancePageProvider.cpp0
-rw-r--r--gui/InstancePageProvider.h52
-rw-r--r--gui/InstanceProxyModel.cpp23
-rw-r--r--gui/InstanceProxyModel.h13
-rw-r--r--gui/MainWindow.cpp2069
-rw-r--r--gui/MainWindow.h218
-rw-r--r--gui/NagUtils.cpp38
-rw-r--r--gui/NagUtils.h23
-rw-r--r--gui/Platform.h32
-rw-r--r--gui/Platform_Other.cpp27
-rw-r--r--gui/Platform_X11.cpp62
-rw-r--r--gui/dialogs/AboutDialog.cpp127
-rw-r--r--gui/dialogs/AboutDialog.h47
-rw-r--r--gui/dialogs/AboutDialog.ui544
-rw-r--r--gui/dialogs/AccountSelectDialog.cpp85
-rw-r--r--gui/dialogs/AccountSelectDialog.h90
-rw-r--r--gui/dialogs/AccountSelectDialog.ui56
-rw-r--r--gui/dialogs/CopyInstanceDialog.cpp101
-rw-r--r--gui/dialogs/CopyInstanceDialog.h52
-rw-r--r--gui/dialogs/CopyInstanceDialog.ui161
-rw-r--r--gui/dialogs/CustomMessageBox.cpp35
-rw-r--r--gui/dialogs/CustomMessageBox.h26
-rw-r--r--gui/dialogs/EditAccountDialog.cpp51
-rw-r--r--gui/dialogs/EditAccountDialog.h60
-rw-r--r--gui/dialogs/EditAccountDialog.ui94
-rw-r--r--gui/dialogs/IconPickerDialog.cpp156
-rw-r--r--gui/dialogs/IconPickerDialog.h48
-rw-r--r--gui/dialogs/IconPickerDialog.ui67
-rw-r--r--gui/dialogs/LoginDialog.cpp110
-rw-r--r--gui/dialogs/LoginDialog.h58
-rw-r--r--gui/dialogs/LoginDialog.ui77
-rw-r--r--gui/dialogs/ModEditDialogCommon.cpp40
-rw-r--r--gui/dialogs/ModEditDialogCommon.h9
-rw-r--r--gui/dialogs/NewInstanceDialog.cpp207
-rw-r--r--gui/dialogs/NewInstanceDialog.h59
-rw-r--r--gui/dialogs/NewInstanceDialog.ui309
-rw-r--r--gui/dialogs/NotificationDialog.cpp84
-rw-r--r--gui/dialogs/NotificationDialog.h44
-rw-r--r--gui/dialogs/NotificationDialog.ui85
-rw-r--r--gui/dialogs/ProgressDialog.cpp125
-rw-r--r--gui/dialogs/ProgressDialog.h65
-rw-r--r--gui/dialogs/ProgressDialog.ui66
-rw-r--r--gui/dialogs/UpdateDialog.cpp186
-rw-r--r--gui/dialogs/UpdateDialog.h61
-rw-r--r--gui/dialogs/UpdateDialog.ui106
-rw-r--r--gui/dialogs/VersionSelectDialog.cpp177
-rw-r--r--gui/dialogs/VersionSelectDialog.h66
-rw-r--r--gui/dialogs/VersionSelectDialog.ui110
-rw-r--r--gui/groupview/GroupView.cpp1003
-rw-r--r--gui/groupview/GroupView.h125
-rw-r--r--gui/groupview/GroupedProxyModel.cpp42
-rw-r--r--gui/groupview/GroupedProxyModel.h15
-rw-r--r--gui/groupview/InstanceDelegate.cpp362
-rw-r--r--gui/groupview/InstanceDelegate.h35
-rw-r--r--gui/groupview/VisualGroup.cpp301
-rw-r--r--gui/groupview/VisualGroup.h91
-rw-r--r--gui/pagedialog/PageDialog.cpp62
-rw-r--r--gui/pagedialog/PageDialog.h36
-rw-r--r--gui/pages/BasePage.h38
-rw-r--r--gui/pages/BasePageProvider.h69
-rw-r--r--gui/pages/InstanceSettingsPage.cpp216
-rw-r--r--gui/pages/InstanceSettingsPage.h74
-rw-r--r--gui/pages/InstanceSettingsPage.ui453
-rw-r--r--gui/pages/LogPage.cpp222
-rw-r--r--gui/pages/LogPage.h86
-rw-r--r--gui/pages/LogPage.ui140
-rw-r--r--gui/pages/ModFolderPage.cpp160
-rw-r--r--gui/pages/ModFolderPage.h94
-rw-r--r--gui/pages/ModFolderPage.ui124
-rw-r--r--gui/pages/NotesPage.cpp21
-rw-r--r--gui/pages/NotesPage.h61
-rw-r--r--gui/pages/NotesPage.ui60
-rw-r--r--gui/pages/OtherLogsPage.cpp150
-rw-r--r--gui/pages/OtherLogsPage.h72
-rw-r--r--gui/pages/OtherLogsPage.ui117
-rw-r--r--gui/pages/ResourcePackPage.h19
-rw-r--r--gui/pages/ScreenshotsPage.cpp362
-rw-r--r--gui/pages/ScreenshotsPage.h79
-rw-r--r--gui/pages/ScreenshotsPage.ui109
-rw-r--r--gui/pages/TexturePackPage.h17
-rw-r--r--gui/pages/VersionPage.cpp321
-rw-r--r--gui/pages/VersionPage.h80
-rw-r--r--gui/pages/VersionPage.ui204
-rw-r--r--gui/pages/global/AccountListPage.cpp142
-rw-r--r--gui/pages/global/AccountListPage.h86
-rw-r--r--gui/pages/global/AccountListPage.ui115
-rw-r--r--gui/pages/global/ExternalToolsPage.cpp238
-rw-r--r--gui/pages/global/ExternalToolsPage.h74
-rw-r--r--gui/pages/global/ExternalToolsPage.ui197
-rw-r--r--gui/pages/global/JavaPage.cpp146
-rw-r--r--gui/pages/global/JavaPage.h73
-rw-r--r--gui/pages/global/JavaPage.ui303
-rw-r--r--gui/pages/global/MinecraftPage.cpp92
-rw-r--r--gui/pages/global/MinecraftPage.h70
-rw-r--r--gui/pages/global/MinecraftPage.ui148
-rw-r--r--gui/pages/global/MultiMCPage.cpp459
-rw-r--r--gui/pages/global/MultiMCPage.h100
-rw-r--r--gui/pages/global/MultiMCPage.ui532
-rw-r--r--gui/pages/global/ProxyPage.cpp95
-rw-r--r--gui/pages/global/ProxyPage.h67
-rw-r--r--gui/pages/global/ProxyPage.ui197
-rw-r--r--gui/widgets/Common.cpp27
-rw-r--r--gui/widgets/Common.h6
-rw-r--r--gui/widgets/IconLabel.cpp43
-rw-r--r--gui/widgets/IconLabel.h26
-rw-r--r--gui/widgets/LabeledToolButton.cpp86
-rw-r--r--gui/widgets/LabeledToolButton.h37
-rw-r--r--gui/widgets/LineSeparator.cpp37
-rw-r--r--gui/widgets/LineSeparator.h18
-rw-r--r--gui/widgets/MCModInfoFrame.cpp111
-rw-r--r--gui/widgets/MCModInfoFrame.h46
-rw-r--r--gui/widgets/MCModInfoFrame.ui68
-rw-r--r--gui/widgets/ModListView.cpp62
-rw-r--r--gui/widgets/ModListView.h27
-rw-r--r--gui/widgets/PageContainer.cpp210
-rw-r--r--gui/widgets/PageContainer.h63
-rw-r--r--gui/widgets/PageContainer_p.h123
-rw-r--r--gui/widgets/ServerStatus.cpp129
-rw-r--r--gui/widgets/ServerStatus.h37
-rw-r--r--gui/widgets/VersionListView.cpp147
-rw-r--r--gui/widgets/VersionListView.h43
127 files changed, 0 insertions, 16923 deletions
diff --git a/gui/ColumnResizer.cpp b/gui/ColumnResizer.cpp
deleted file mode 100644
index 1c5597aa..00000000
--- a/gui/ColumnResizer.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright 2011 Aurélien Gâteau <agateau@kde.org>
- * License: LGPL v2.1 or later (see COPYING)
- */
-#include "ColumnResizer.h"
-
-#include <QDebug>
-#include <QEvent>
-#include <QFormLayout>
-#include <QGridLayout>
-#include <QTimer>
-#include <QWidget>
-
-class FormLayoutWidgetItem : public QWidgetItem
-{
-public:
- FormLayoutWidgetItem(QWidget* widget, QFormLayout* formLayout, QFormLayout::ItemRole itemRole)
- : QWidgetItem(widget)
- , m_width(-1)
- , m_formLayout(formLayout)
- , m_itemRole(itemRole)
- {}
-
- QSize sizeHint() const
- {
- QSize size = QWidgetItem::sizeHint();
- if (m_width != -1) {
- size.setWidth(m_width);
- }
- return size;
- }
-
- QSize minimumSize() const
- {
- QSize size = QWidgetItem::minimumSize();
- if (m_width != -1) {
- size.setWidth(m_width);
- }
- return size;
- }
-
- QSize maximumSize() const
- {
- QSize size = QWidgetItem::maximumSize();
- if (m_width != -1) {
- size.setWidth(m_width);
- }
- return size;
- }
-
- void setWidth(int width)
- {
- if (width != m_width) {
- m_width = width;
- invalidate();
- }
- }
-
- void setGeometry(const QRect& _rect)
- {
- QRect rect = _rect;
- int width = widget()->sizeHint().width();
- if (m_itemRole == QFormLayout::LabelRole && m_formLayout->labelAlignment() & Qt::AlignRight) {
- rect.setLeft(rect.right() - width);
- }
- QWidgetItem::setGeometry(rect);
- }
-
- QFormLayout* formLayout() const
- {
- return m_formLayout;
- }
-
-private:
- int m_width;
- QFormLayout* m_formLayout;
- QFormLayout::ItemRole m_itemRole;
-};
-
-typedef QPair<QGridLayout*, int> GridColumnInfo;
-
-class ColumnResizerPrivate
-{
-public:
- ColumnResizerPrivate(ColumnResizer* q_ptr)
- : q(q_ptr)
- , m_updateTimer(new QTimer(q))
- {
- m_updateTimer->setSingleShot(true);
- m_updateTimer->setInterval(0);
- QObject::connect(m_updateTimer, SIGNAL(timeout()), q, SLOT(updateWidth()));
- }
-
- void scheduleWidthUpdate()
- {
- m_updateTimer->start();
- }
-
- ColumnResizer* q;
- QTimer* m_updateTimer;
- QList<QWidget*> m_widgets;
- QList<FormLayoutWidgetItem*> m_wrWidgetItemList;
- QList<GridColumnInfo> m_gridColumnInfoList;
-};
-
-ColumnResizer::ColumnResizer(QObject* parent)
-: QObject(parent)
-, d(new ColumnResizerPrivate(this))
-{}
-
-ColumnResizer::~ColumnResizer()
-{
- delete d;
-}
-
-void ColumnResizer::addWidget(QWidget* widget)
-{
- d->m_widgets.append(widget);
- widget->installEventFilter(this);
- d->scheduleWidthUpdate();
-}
-
-void ColumnResizer::updateWidth()
-{
- int width = 0;
- Q_FOREACH(QWidget* widget, d->m_widgets) {
- width = qMax(widget->sizeHint().width(), width);
- }
- Q_FOREACH(FormLayoutWidgetItem* item, d->m_wrWidgetItemList) {
- item->setWidth(width);
- item->formLayout()->update();
- }
- Q_FOREACH(GridColumnInfo info, d->m_gridColumnInfoList) {
- info.first->setColumnMinimumWidth(info.second, width);
- }
-}
-
-bool ColumnResizer::eventFilter(QObject*, QEvent* event)
-{
- if (event->type() == QEvent::Resize) {
- d->scheduleWidthUpdate();
- }
- return false;
-}
-
-void ColumnResizer::addWidgetsFromLayout(QLayout* layout, int column)
-{
- Q_ASSERT(column >= 0);
- QGridLayout* gridLayout = qobject_cast<QGridLayout*>(layout);
- QFormLayout* formLayout = qobject_cast<QFormLayout*>(layout);
- if (gridLayout) {
- addWidgetsFromGridLayout(gridLayout, column);
- } else if (formLayout) {
- if (column > QFormLayout::SpanningRole) {
- qCritical() << "column should not be more than" << QFormLayout::SpanningRole << "for QFormLayout";
- return;
- }
- QFormLayout::ItemRole role = static_cast<QFormLayout::ItemRole>(column);
- addWidgetsFromFormLayout(formLayout, role);
- } else {
- qCritical() << "Don't know how to handle layout" << layout;
- }
-}
-
-void ColumnResizer::addWidgetsFromGridLayout(QGridLayout* layout, int column)
-{
- for (int row = 0; row < layout->rowCount(); ++row) {
- QLayoutItem* item = layout->itemAtPosition(row, column);
- if (!item) {
- continue;
- }
- QWidget* widget = item->widget();
- if (!widget) {
- continue;
- }
- addWidget(widget);
- }
- d->m_gridColumnInfoList << GridColumnInfo(layout, column);
-}
-
-void ColumnResizer::addWidgetsFromFormLayout(QFormLayout* layout, QFormLayout::ItemRole role)
-{
- for (int row = 0; row < layout->rowCount(); ++row) {
- QLayoutItem* item = layout->itemAt(row, role);
- if (!item) {
- continue;
- }
- QWidget* widget = item->widget();
- if (!widget) {
- continue;
- }
- layout->removeItem(item);
- delete item;
- FormLayoutWidgetItem* newItem = new FormLayoutWidgetItem(widget, layout, role);
- layout->setItem(row, role, newItem);
- addWidget(widget);
- d->m_wrWidgetItemList << newItem;
- }
-}
-
-#include <ColumnResizer.moc>
-// vi: ts=4 sw=4 et
diff --git a/gui/ColumnResizer.h b/gui/ColumnResizer.h
deleted file mode 100644
index 4bbac383..00000000
--- a/gui/ColumnResizer.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2011 Aurélien Gâteau <agateau@kde.org>
- * License: LGPL v2.1 or later (see COPYING)
- */
-#pragma once
-
-#include <QFormLayout>
-
-#include <QtCore/QObject>
-#include <QtCore/QList>
-
-class QEvent;
-class QGridLayout;
-class QLayout;
-class QWidget;
-
-class ColumnResizerPrivate;
-class ColumnResizer : public QObject
-{
- Q_OBJECT
-public:
- ColumnResizer(QObject* parent = 0);
- ~ColumnResizer();
-
- void addWidget(QWidget* widget);
- void addWidgetsFromLayout(QLayout*, int column);
- void addWidgetsFromGridLayout(QGridLayout*, int column);
- void addWidgetsFromFormLayout(QFormLayout*, QFormLayout::ItemRole role);
-
-private Q_SLOTS:
- void updateWidth();
-
-protected:
- bool eventFilter(QObject*, QEvent* event);
-
-private:
- ColumnResizerPrivate* const d;
-};
diff --git a/gui/ConsoleWindow.cpp b/gui/ConsoleWindow.cpp
deleted file mode 100644
index a9c1f455..00000000
--- a/gui/ConsoleWindow.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/* 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 "ConsoleWindow.h"
-#include "MultiMC.h"
-
-#include <QScrollBar>
-#include <QMessageBox>
-#include <QSystemTrayIcon>
-#include <QHBoxLayout>
-#include <QPushButton>
-#include <qlayoutitem.h>
-#include <QCloseEvent>
-
-#include <gui/Platform.h>
-#include <gui/dialogs/CustomMessageBox.h>
-#include <gui/dialogs/ProgressDialog.h>
-#include "widgets/PageContainer.h"
-#include "pages/LogPage.h"
-#include "InstancePageProvider.h"
-
-#include "logic/icons/IconList.h"
-
-class LogPageProvider : public BasePageProvider
-{
-public:
- LogPageProvider(BasePageProviderPtr parent, BasePage * log_page)
- {
- m_parent = parent;
- m_log_page = log_page;
- }
- virtual QString dialogTitle() {return "Fake";};
- virtual QList<BasePage *> getPages()
- {
- auto pages = m_parent->getPages();
- pages.prepend(m_log_page);
- return pages;
- }
-private:
- BasePageProviderPtr m_parent;
- BasePage * m_log_page;
-};
-
-ConsoleWindow::ConsoleWindow(BaseProcess *process, QWidget *parent)
- : QMainWindow(parent), m_proc(process)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- setAttribute(Qt::WA_DeleteOnClose);
-
- auto instance = m_proc->instance();
- auto icon = ENV.icons()->getIcon(instance->iconKey());
- QString windowTitle = tr("Console window for ") + instance->name();
-
- // Set window properties
- {
- setWindowIcon(icon);
- setWindowTitle(windowTitle);
- }
-
- // Add page container
- {
- auto mainLayout = new QVBoxLayout;
- auto provider = std::make_shared<InstancePageProvider>(m_proc->instance());
- auto baseprovider = std::dynamic_pointer_cast<BasePageProvider>(provider);
- auto proxy_provider = std::make_shared<LogPageProvider>(baseprovider, new LogPage(m_proc));
- m_container = new PageContainer(proxy_provider, "console", this);
- mainLayout->addWidget(m_container);
- mainLayout->setSpacing(0);
- mainLayout->setContentsMargins(0,0,0,0);
- setLayout(mainLayout);
- setCentralWidget(m_container);
- }
-
- // Add custom buttons to the page container layout.
- {
- auto horizontalLayout = new QHBoxLayout();
- horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
- horizontalLayout->setContentsMargins(6, -1, 6, -1);
-
- auto btnHelp = new QPushButton();
- btnHelp->setText(tr("Help"));
- horizontalLayout->addWidget(btnHelp);
- connect(btnHelp, SIGNAL(clicked(bool)), m_container, SLOT(help()));
-
- auto spacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
- horizontalLayout->addSpacerItem(spacer);
-
- m_killButton = new QPushButton();
- m_killButton->setText(tr("Kill Minecraft"));
- horizontalLayout->addWidget(m_killButton);
- connect(m_killButton, SIGNAL(clicked(bool)), SLOT(on_btnKillMinecraft_clicked()));
-
- m_closeButton = new QPushButton();
- m_closeButton->setText(tr("Close"));
- horizontalLayout->addWidget(m_closeButton);
- connect(m_closeButton, SIGNAL(clicked(bool)), SLOT(on_closeButton_clicked()));
-
- m_container->addButtons(horizontalLayout);
- }
-
- // restore window state
- {
- auto base64State = MMC->settings()->get("ConsoleWindowState").toByteArray();
- restoreState(QByteArray::fromBase64(base64State));
- auto base64Geometry = MMC->settings()->get("ConsoleWindowGeometry").toByteArray();
- restoreGeometry(QByteArray::fromBase64(base64Geometry));
- }
-
- // Set up tray icon
- {
- m_trayIcon = new QSystemTrayIcon(icon, this);
- m_trayIcon->setToolTip(windowTitle);
-
- connect(m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
- SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
- m_trayIcon->show();
- }
-
- // Set up signal connections
- connect(m_proc, SIGNAL(ended(InstancePtr, int, QProcess::ExitStatus)), this,
- SLOT(onEnded(InstancePtr, int, QProcess::ExitStatus)));
- connect(m_proc, SIGNAL(prelaunch_failed(InstancePtr, int, QProcess::ExitStatus)), this,
- SLOT(onEnded(InstancePtr, int, QProcess::ExitStatus)));
- connect(m_proc, SIGNAL(launch_failed(InstancePtr)), this,
- SLOT(onLaunchFailed(InstancePtr)));
-
- setMayClose(false);
-
- if (m_proc->instance()->settings().get("ShowConsole").toBool())
- {
- show();
- }
-}
-
-void ConsoleWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
-{
- switch (reason)
- {
- case QSystemTrayIcon::Trigger:
- {
- toggleConsole();
- }
- default:
- return;
- }
-}
-
-void ConsoleWindow::on_closeButton_clicked()
-{
- close();
-}
-
-void ConsoleWindow::setMayClose(bool mayclose)
-{
- if(mayclose)
- m_closeButton->setText(tr("Close"));
- else
- m_closeButton->setText(tr("Hide"));
- m_mayclose = mayclose;
-}
-
-void ConsoleWindow::toggleConsole()
-{
- if (isVisible())
- {
- if(!isActiveWindow())
- {
- activateWindow();
- return;
- }
- hide();
- }
- else
- {
- show();
- }
-}
-
-void ConsoleWindow::closeEvent(QCloseEvent *event)
-{
- if (!m_mayclose)
- {
- toggleConsole();
- event->ignore();
- }
- else if(m_container->requestClose(event))
- {
- MMC->settings()->set("ConsoleWindowState", saveState().toBase64());
- MMC->settings()->set("ConsoleWindowGeometry", saveGeometry().toBase64());
-
- emit isClosing();
- m_trayIcon->hide();
- event->accept();
- }
-}
-
-void ConsoleWindow::on_btnKillMinecraft_clicked()
-{
- m_killButton->setEnabled(false);
- auto response = CustomMessageBox::selectable(
- this, tr("Kill Minecraft?"),
- tr("This can cause the instance to get corrupted and should only be used if Minecraft "
- "is frozen for some reason"),
- QMessageBox::Question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)->exec();
- if (response == QMessageBox::Yes)
- m_proc->killProcess();
- else
- m_killButton->setEnabled(true);
-}
-
-void ConsoleWindow::onEnded(InstancePtr instance, int code, QProcess::ExitStatus status)
-{
- bool peacefulExit = code == 0 && status != QProcess::CrashExit;
- m_killButton->setEnabled(false);
- setMayClose(true);
- if (instance->settings().get("AutoCloseConsole").toBool())
- {
- if (peacefulExit)
- {
- this->close();
- return;
- }
- }
- if (!isVisible())
- {
- show();
- }
- // Raise Window
- if (MMC->settings()->get("RaiseConsole").toBool())
- {
- raise();
- activateWindow();
- }
-}
-
-void ConsoleWindow::onLaunchFailed(InstancePtr instance)
-{
- m_killButton->setEnabled(false);
-
- setMayClose(true);
-
- if (!isVisible())
- show();
-}
-ConsoleWindow::~ConsoleWindow()
-{
-
-}
diff --git a/gui/ConsoleWindow.h b/gui/ConsoleWindow.h
deleted file mode 100644
index a14cd2fc..00000000
--- a/gui/ConsoleWindow.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 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 <QMainWindow>
-#include <QSystemTrayIcon>
-#include "logic/BaseProcess.h"
-
-class QPushButton;
-class PageContainer;
-class ConsoleWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- explicit ConsoleWindow(BaseProcess *proc, QWidget *parent = 0);
- virtual ~ConsoleWindow();
-
- /**
- * @brief specify if the window is allowed to close
- * @param mayclose
- * used to keep it alive while MC runs
- */
- void setMayClose(bool mayclose);
-
-signals:
- void isClosing();
-
-private
-slots:
- void on_closeButton_clicked();
- void on_btnKillMinecraft_clicked();
-
- void onEnded(InstancePtr instance, int code, QProcess::ExitStatus status);
- void onLaunchFailed(InstancePtr instance);
-
- // FIXME: add handlers for the other MinecraftProcess signals (pre/post launch command
- // failures)
-
- void iconActivated(QSystemTrayIcon::ActivationReason);
- void toggleConsole();
-protected:
- void closeEvent(QCloseEvent *);
-
-private:
- BaseProcess *m_proc = nullptr;
- bool m_mayclose = true;
- QSystemTrayIcon *m_trayIcon = nullptr;
- PageContainer *m_container = nullptr;
- QPushButton *m_closeButton = nullptr;
- QPushButton *m_killButton = nullptr;
-};
diff --git a/gui/GuiUtil.cpp b/gui/GuiUtil.cpp
deleted file mode 100644
index fcbc8acd..00000000
--- a/gui/GuiUtil.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "GuiUtil.h"
-
-#include <QClipboard>
-#include <QDesktopServices>
-#include <QApplication>
-
-#include "dialogs/ProgressDialog.h"
-#include "logic/net/PasteUpload.h"
-#include "dialogs/CustomMessageBox.h"
-
-void GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
-{
- ProgressDialog dialog(parentWidget);
- std::unique_ptr<PasteUpload> paste(new PasteUpload(parentWidget, text));
-
- if (!paste->validateText())
- {
- CustomMessageBox::selectable(
- parentWidget, QObject::tr("Upload failed"),
- QObject::tr("The log file is too big. You'll have to upload it manually."),
- QMessageBox::Warning)->exec();
- return;
- }
-
- dialog.exec(paste.get());
- if (!paste->successful())
- {
- CustomMessageBox::selectable(parentWidget, QObject::tr("Upload failed"),
- paste->failReason(), QMessageBox::Critical)->exec();
- }
- else
- {
- const QString link = paste->pasteLink();
- setClipboardText(link);
- QDesktopServices::openUrl(link);
- CustomMessageBox::selectable(
- parentWidget, QObject::tr("Upload finished"),
- QObject::tr("The <a href=\"%1\">link to the uploaded log</a> has been opened in "
- "the default "
- "browser and placed in your clipboard.").arg(link),
- QMessageBox::Information)->exec();
- }
-}
-
-void GuiUtil::setClipboardText(const QString &text)
-{
- QApplication::clipboard()->setText(text);
-}
diff --git a/gui/GuiUtil.h b/gui/GuiUtil.h
deleted file mode 100644
index 9f872f75..00000000
--- a/gui/GuiUtil.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-#include <QWidget>
-
-namespace GuiUtil
-{
-void uploadPaste(const QString &text, QWidget *parentWidget);
-void setClipboardText(const QString &text);
-}
diff --git a/gui/InstancePageProvider.cpp b/gui/InstancePageProvider.cpp
deleted file mode 100644
index e69de29b..00000000
--- a/gui/InstancePageProvider.cpp
+++ /dev/null
diff --git a/gui/InstancePageProvider.h b/gui/InstancePageProvider.h
deleted file mode 100644
index d4f7cb91..00000000
--- a/gui/InstancePageProvider.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#pragma once
-#include "logic/minecraft/OneSixInstance.h"
-#include "pages/BasePage.h"
-#include "pages/VersionPage.h"
-#include "pages/ModFolderPage.h"
-#include "pages/ResourcePackPage.h"
-#include "pages/TexturePackPage.h"
-#include "pages/NotesPage.h"
-#include "pages/ScreenshotsPage.h"
-#include "pages/InstanceSettingsPage.h"
-#include "pages/OtherLogsPage.h"
-#include "pages/BasePageProvider.h"
-#include <pathutils.h>
-
-class InstancePageProvider : public QObject, public BasePageProvider
-{
- Q_OBJECT
-public:
- explicit InstancePageProvider(InstancePtr parent)
- {
- inst = parent;
- }
-
- virtual ~InstancePageProvider() {};
- virtual QList<BasePage *> getPages() override
- {
- QList<BasePage *> values;
- std::shared_ptr<OneSixInstance> onesix = std::dynamic_pointer_cast<OneSixInstance>(inst);
- if(onesix)
- {
- values.append(new VersionPage(onesix.get()));
- values.append(new ModFolderPage(onesix.get(), onesix->loaderModList(), "mods", "loadermods",
- tr("Loader mods"), "Loader-mods"));
- values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList(), "coremods", "coremods",
- tr("Core mods"), "Core-mods"));
- values.append(new ResourcePackPage(onesix.get()));
- values.append(new TexturePackPage(onesix.get()));
- values.append(new NotesPage(onesix.get()));
- values.append(new ScreenshotsPage(PathCombine(onesix->minecraftRoot(), "screenshots")));
- values.append(new InstanceSettingsPage(onesix.get()));
- values.append(new OtherLogsPage(onesix->minecraftRoot()));
- }
- return values;
- }
-
- virtual QString dialogTitle() override
- {
- return tr("Edit Instance (%1)").arg(inst->name());
- }
-protected:
- InstancePtr inst;
-};
diff --git a/gui/InstanceProxyModel.cpp b/gui/InstanceProxyModel.cpp
deleted file mode 100644
index 09d6fd85..00000000
--- a/gui/InstanceProxyModel.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "InstanceProxyModel.h"
-#include "MultiMC.h"
-#include <logic/BaseInstance.h>
-
-InstanceProxyModel::InstanceProxyModel(QObject *parent) : GroupedProxyModel(parent)
-{
-}
-
-bool InstanceProxyModel::subSortLessThan(const QModelIndex &left,
- const QModelIndex &right) const
-{
- BaseInstance *pdataLeft = static_cast<BaseInstance *>(left.internalPointer());
- BaseInstance *pdataRight = static_cast<BaseInstance *>(right.internalPointer());
- QString sortMode = MMC->settings()->get("InstSortMode").toString();
- if (sortMode == "LastLaunch")
- {
- return pdataLeft->lastLaunch() > pdataRight->lastLaunch();
- }
- else
- {
- return QString::localeAwareCompare(pdataLeft->name(), pdataRight->name()) < 0;
- }
-}
diff --git a/gui/InstanceProxyModel.h b/gui/InstanceProxyModel.h
deleted file mode 100644
index e558efc4..00000000
--- a/gui/InstanceProxyModel.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "groupview/GroupedProxyModel.h"
-
-/**
- * A proxy model that is responsible for sorting instances into groups
- */
-class InstanceProxyModel : public GroupedProxyModel
-{
-public:
- explicit InstanceProxyModel(QObject *parent = 0);
-
-protected:
- virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const;
-};
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
deleted file mode 100644
index 0b0af7f4..00000000
--- a/gui/MainWindow.cpp
+++ /dev/null
@@ -1,2069 +0,0 @@
-/* Copyright 2013-2015 MultiMC Contributors
- *
- * Authors: Andrew Okin
- * Peterix
- * Orochimarufan <orochimarufan.x3@gmail.com>
- *
- * 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 "MultiMC.h"
-#include "BuildConfig.h"
-
-#include "MainWindow.h"
-
-
-#include <QtCore/QVariant>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QButtonGroup>
-#include <QtWidgets/QHBoxLayout>
-#include <QtWidgets/QHeaderView>
-#include <QtWidgets/QMainWindow>
-#include <QtWidgets/QStatusBar>
-#include <QtWidgets/QToolBar>
-#include <QtWidgets/QWidget>
-
-class Ui_MainWindow
-{
-public:
- QAction *actionAddInstance;
- QAction *actionViewInstanceFolder;
- QAction *actionRefresh;
- QAction *actionViewCentralModsFolder;
- QAction *actionCheckUpdate;
- QAction *actionSettings;
- QAction *actionReportBug;
- QAction *actionPatreon;
- QAction *actionMoreNews;
- QAction *actionAbout;
- QAction *actionLaunchInstance;
- QAction *actionRenameInstance;
- QAction *actionChangeInstGroup;
- QAction *actionChangeInstIcon;
- QAction *actionEditInstNotes;
- QAction *actionEditInstance;
- QAction *actionViewSelectedInstFolder;
- QAction *actionDeleteInstance;
- QAction *actionConfig_Folder;
- QAction *actionCAT;
- QAction *actionCopyInstance;
- QAction *actionManageAccounts;
- QAction *actionLaunchInstanceOffline;
- QAction *actionScreenshots;
- QAction *actionInstanceSettings;
- QAction *actionExportInstance;
- QWidget *centralWidget;
- QHBoxLayout *horizontalLayout;
- QToolBar *mainToolBar;
- QStatusBar *statusBar;
- QToolBar *instanceToolBar;
- QToolBar *newsToolBar;
-
- void setupUi(QMainWindow *MainWindow)
- {
- if (MainWindow->objectName().isEmpty())
- {
- MainWindow->setObjectName(QStringLiteral("MainWindow"));
- }
- MainWindow->resize(694, 563);
- MainWindow->setWindowIcon(MMC->getThemedIcon("multimc"));
- actionAddInstance = new QAction(MainWindow);
- actionAddInstance->setObjectName(QStringLiteral("actionAddInstance"));
- actionAddInstance->setIcon(MMC->getThemedIcon("new"));
- actionViewInstanceFolder = new QAction(MainWindow);
- actionViewInstanceFolder->setObjectName(QStringLiteral("actionViewInstanceFolder"));
- actionViewInstanceFolder->setIcon(MMC->getThemedIcon("viewfolder"));
- actionRefresh = new QAction(MainWindow);
- actionRefresh->setObjectName(QStringLiteral("actionRefresh"));
- actionRefresh->setIcon(MMC->getThemedIcon("refresh"));
- actionViewCentralModsFolder = new QAction(MainWindow);
- actionViewCentralModsFolder->setObjectName(QStringLiteral("actionViewCentralModsFolder"));
- actionViewCentralModsFolder->setIcon(MMC->getThemedIcon("centralmods"));
- actionCheckUpdate = new QAction(MainWindow);
- actionCheckUpdate->setObjectName(QStringLiteral("actionCheckUpdate"));
- actionCheckUpdate->setIcon(MMC->getThemedIcon("checkupdate"));
- actionSettings = new QAction(MainWindow);
- actionSettings->setObjectName(QStringLiteral("actionSettings"));
- actionSettings->setIcon(MMC->getThemedIcon("settings"));
- actionSettings->setMenuRole(QAction::PreferencesRole);
- actionReportBug = new QAction(MainWindow);
- actionReportBug->setObjectName(QStringLiteral("actionReportBug"));
- actionReportBug->setIcon(MMC->getThemedIcon("bug"));
- actionPatreon = new QAction(MainWindow);
- actionPatreon->setObjectName(QStringLiteral("actionPatreon"));
- actionPatreon->setIcon(MMC->getThemedIcon("patreon"));
- actionMoreNews = new QAction(MainWindow);
- actionMoreNews->setObjectName(QStringLiteral("actionMoreNews"));
- actionMoreNews->setIcon(MMC->getThemedIcon("news"));
- actionAbout = new QAction(MainWindow);
- actionAbout->setObjectName(QStringLiteral("actionAbout"));
- actionAbout->setIcon(MMC->getThemedIcon("about"));
- actionAbout->setMenuRole(QAction::AboutRole);
- actionLaunchInstance = new QAction(MainWindow);
- actionLaunchInstance->setObjectName(QStringLiteral("actionLaunchInstance"));
- actionRenameInstance = new QAction(MainWindow);
- actionRenameInstance->setObjectName(QStringLiteral("actionRenameInstance"));
- actionChangeInstGroup = new QAction(MainWindow);
- actionChangeInstGroup->setObjectName(QStringLiteral("actionChangeInstGroup"));
- actionChangeInstIcon = new QAction(MainWindow);
- actionChangeInstIcon->setObjectName(QStringLiteral("actionChangeInstIcon"));
- actionChangeInstIcon->setEnabled(true);
- actionChangeInstIcon->setIcon(QIcon(":/icons/instances/infinity"));
- actionChangeInstIcon->setIconVisibleInMenu(true);
- actionEditInstNotes = new QAction(MainWindow);
- actionEditInstNotes->setObjectName(QStringLiteral("actionEditInstNotes"));
- actionEditInstance = new QAction(MainWindow);
- actionEditInstance->setObjectName(QStringLiteral("actionEditInstance"));
- actionViewSelectedInstFolder = new QAction(MainWindow);
- actionViewSelectedInstFolder->setObjectName(QStringLiteral("actionViewSelectedInstFolder"));
- actionDeleteInstance = new QAction(MainWindow);
- actionDeleteInstance->setObjectName(QStringLiteral("actionDeleteInstance"));
- actionConfig_Folder = new QAction(MainWindow);
- actionConfig_Folder->setObjectName(QStringLiteral("actionConfig_Folder"));
- actionCAT = new QAction(MainWindow);
- actionCAT->setObjectName(QStringLiteral("actionCAT"));
- actionCAT->setCheckable(true);
- actionCAT->setIcon(MMC->getThemedIcon("cat"));
- actionCopyInstance = new QAction(MainWindow);
- actionCopyInstance->setObjectName(QStringLiteral("actionCopyInstance"));
- actionCopyInstance->setIcon(MMC->getThemedIcon("copy"));
- actionManageAccounts = new QAction(MainWindow);
- actionManageAccounts->setObjectName(QStringLiteral("actionManageAccounts"));
- actionLaunchInstanceOffline = new QAction(MainWindow);
- actionLaunchInstanceOffline->setObjectName(QStringLiteral("actionLaunchInstanceOffline"));
- actionScreenshots = new QAction(MainWindow);
- actionScreenshots->setObjectName(QStringLiteral("actionScreenshots"));
- actionInstanceSettings = new QAction(MainWindow);
- actionInstanceSettings->setObjectName(QStringLiteral("actionInstanceSettings"));
- actionExportInstance = new QAction(MainWindow);
- actionExportInstance->setObjectName(QStringLiteral("actionExportInstance"));
- centralWidget = new QWidget(MainWindow);
- centralWidget->setObjectName(QStringLiteral("centralWidget"));
- horizontalLayout = new QHBoxLayout(centralWidget);
- horizontalLayout->setSpacing(0);
- horizontalLayout->setContentsMargins(11, 11, 11, 11);
- horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
- horizontalLayout->setSizeConstraint(QLayout::SetDefaultConstraint);
- horizontalLayout->setContentsMargins(0, 0, 0, 0);
- MainWindow->setCentralWidget(centralWidget);
- mainToolBar = new QToolBar(MainWindow);
- mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
- mainToolBar->setMovable(false);
- mainToolBar->setAllowedAreas(Qt::TopToolBarArea);
- mainToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
- mainToolBar->setFloatable(false);
- MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
- statusBar = new QStatusBar(MainWindow);
- statusBar->setObjectName(QStringLiteral("statusBar"));
- MainWindow->setStatusBar(statusBar);
- instanceToolBar = new QToolBar(MainWindow);
- instanceToolBar->setObjectName(QStringLiteral("instanceToolBar"));
- instanceToolBar->setEnabled(true);
- instanceToolBar->setAllowedAreas(Qt::LeftToolBarArea|Qt::RightToolBarArea);
- instanceToolBar->setIconSize(QSize(80, 80));
- instanceToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
- instanceToolBar->setFloatable(false);
- MainWindow->addToolBar(Qt::RightToolBarArea, instanceToolBar);
- newsToolBar = new QToolBar(MainWindow);
- newsToolBar->setObjectName(QStringLiteral("newsToolBar"));
- newsToolBar->setMovable(false);
- newsToolBar->setAllowedAreas(Qt::BottomToolBarArea);
- newsToolBar->setIconSize(QSize(16, 16));
- newsToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- newsToolBar->setFloatable(false);
- MainWindow->addToolBar(Qt::BottomToolBarArea, newsToolBar);
-
- mainToolBar->addAction(actionAddInstance);
- mainToolBar->addAction(actionCopyInstance);
- mainToolBar->addSeparator();
- mainToolBar->addAction(actionViewInstanceFolder);
- mainToolBar->addAction(actionViewCentralModsFolder);
- mainToolBar->addAction(actionRefresh);
- mainToolBar->addSeparator();
- mainToolBar->addAction(actionCheckUpdate);
- mainToolBar->addAction(actionSettings);
- mainToolBar->addSeparator();
- mainToolBar->addAction(actionReportBug);
- mainToolBar->addAction(actionAbout);
- mainToolBar->addSeparator();
- mainToolBar->addAction(actionPatreon);
- mainToolBar->addAction(actionCAT);
- instanceToolBar->addAction(actionChangeInstIcon);
- instanceToolBar->addAction(actionLaunchInstance);
- instanceToolBar->addAction(actionLaunchInstanceOffline);
- instanceToolBar->addAction(actionChangeInstGroup);
- instanceToolBar->addSeparator();
- instanceToolBar->addAction(actionEditInstance);
- instanceToolBar->addAction(actionInstanceSettings);
- instanceToolBar->addAction(actionEditInstNotes);
- instanceToolBar->addAction(actionScreenshots);
- instanceToolBar->addSeparator();
- instanceToolBar->addAction(actionViewSelectedInstFolder);
- instanceToolBar->addAction(actionConfig_Folder);
- instanceToolBar->addSeparator();
- instanceToolBar->addAction(actionExportInstance);
- instanceToolBar->addAction(actionDeleteInstance);
- newsToolBar->addAction(actionMoreNews);
-
- retranslateUi(MainWindow);
-
- QMetaObject::connectSlotsByName(MainWindow);
- } // setupUi
-
- void retranslateUi(QMainWindow *MainWindow)
- {
- MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MultiMC 5", 0));
- actionAddInstance->setText(QApplication::translate("MainWindow", "Add Instance", 0));
- actionAddInstance->setToolTip(QApplication::translate("MainWindow", "Add a new instance.", 0));
- actionAddInstance->setStatusTip(QApplication::translate("MainWindow", "Add a new instance.", 0));
- actionViewInstanceFolder->setText(QApplication::translate("MainWindow", "View Instance Folder", 0));
- actionViewInstanceFolder->setToolTip(QApplication::translate("MainWindow", "Open the instance folder in a file browser.", 0));
- actionViewInstanceFolder->setStatusTip(QApplication::translate("MainWindow", "Open the instance folder in a file browser.", 0));
- actionRefresh->setText(QApplication::translate("MainWindow", "Refresh", 0));
- actionRefresh->setToolTip(QApplication::translate("MainWindow", "Reload the instance list.", 0));
- actionRefresh->setStatusTip(QApplication::translate("MainWindow", "Reload the instance list.", 0));
- actionViewCentralModsFolder->setText(QApplication::translate("MainWindow", "View Central Mods Folder", 0));
- actionViewCentralModsFolder->setToolTip(QApplication::translate("MainWindow", "Open the central mods folder in a file browser.", 0));
- actionViewCentralModsFolder->setStatusTip(QApplication::translate("MainWindow", "Open the central mods folder in a file browser.", 0));
- actionCheckUpdate->setText(QApplication::translate("MainWindow", "Check for Updates", 0));
- actionCheckUpdate->setToolTip(QApplication::translate("MainWindow", "Check for new updates for MultiMC", 0));
- actionCheckUpdate->setStatusTip(QApplication::translate("MainWindow", "Check for new updates for MultiMC", 0));
- actionSettings->setText(QApplication::translate("MainWindow", "Settings", 0));
- actionSettings->setToolTip(QApplication::translate("MainWindow", "Change settings.", 0));
- actionSettings->setStatusTip(QApplication::translate("MainWindow", "Change settings.", 0));
- actionReportBug->setText(QApplication::translate("MainWindow", "Report a Bug", 0));
- actionReportBug->setToolTip(QApplication::translate("MainWindow", "Open the bug tracker to report a bug with MultiMC.", 0));
- actionReportBug->setStatusTip(QApplication::translate("MainWindow", "Open the bug tracker to report a bug with MultiMC.", 0));
- actionPatreon->setText(QApplication::translate("MainWindow", "Support us on Patreon!", 0));
- actionPatreon->setToolTip(QApplication::translate("MainWindow", "Open the MultiMC Patreon page.", 0));
- actionPatreon->setStatusTip(QApplication::translate("MainWindow", "Open the MultiMC Patreon page.", 0));
- actionMoreNews->setText(QApplication::translate("MainWindow", "More News", 0));
- actionMoreNews->setIconText(QApplication::translate("MainWindow", "More news...", 0));
- actionMoreNews->setToolTip(QApplication::translate("MainWindow", "Open the MultiMC development blog to read more news about MultiMC.", 0));
- actionMoreNews->setStatusTip(QApplication::translate("MainWindow", "Open the MultiMC development blog to read more news about MultiMC.", 0));
- actionAbout->setText(QApplication::translate("MainWindow", "About MultiMC", 0));
- actionAbout->setToolTip(QApplication::translate("MainWindow", "View information about MultiMC.", 0));
- actionAbout->setStatusTip(QApplication::translate("MainWindow", "About MultiMC", 0));
- actionLaunchInstance->setText(QApplication::translate("MainWindow", "Play", 0));
- actionLaunchInstance->setToolTip(QApplication::translate("MainWindow", "Launch the selected instance.", 0));
- actionLaunchInstance->setStatusTip(QApplication::translate("MainWindow", "Launch the selected instance.", 0));
- actionRenameInstance->setText(QApplication::translate("MainWindow", "Instance Name", 0));
- actionRenameInstance->setToolTip(QApplication::translate("MainWindow", "Rename the selected instance.", 0));
- actionRenameInstance->setStatusTip(QApplication::translate("MainWindow", "Rename the selected instance.", 0));
- actionChangeInstGroup->setText(QApplication::translate("MainWindow", "Change Group", 0));
- actionChangeInstGroup->setToolTip(QApplication::translate("MainWindow", "Change the selected instance's group.", 0));
- actionChangeInstGroup->setStatusTip(QApplication::translate("MainWindow", "Change the selected instance's group.", 0));
- actionChangeInstIcon->setText(QApplication::translate("MainWindow", "Change Icon", 0));
- actionChangeInstIcon->setToolTip(QApplication::translate("MainWindow", "Change the selected instance's icon.", 0));
- actionChangeInstIcon->setStatusTip(QApplication::translate("MainWindow", "Change the selected instance's icon.", 0));
- actionEditInstNotes->setText(QApplication::translate("MainWindow", "Edit Notes", 0));
- actionEditInstNotes->setToolTip(QApplication::translate("MainWindow", "Edit the notes for the selected instance.", 0));
- actionEditInstNotes->setStatusTip(QApplication::translate("MainWindow", "Edit the notes for the selected instance.", 0));
- actionEditInstance->setText(QApplication::translate("MainWindow", "Edit Instance", 0));
- actionEditInstance->setIconText(QApplication::translate("MainWindow", "Edit Instance", 0));
- actionEditInstance->setToolTip(QApplication::translate("MainWindow", "Change the instance settings, mods and versions.", 0));
- actionEditInstance->setStatusTip(QApplication::translate("MainWindow", "Change the instance settings, mods and versions.", 0));
- actionViewSelectedInstFolder->setText(QApplication::translate("MainWindow", "Instance Folder", 0));
- actionViewSelectedInstFolder->setToolTip(QApplication::translate("MainWindow", "Open the selected instance's root folder in a file browser.", 0));
- actionViewSelectedInstFolder->setStatusTip(QApplication::translate("MainWindow", "Open the selected instance's root folder in a file browser.", 0));
- actionDeleteInstance->setText(QApplication::translate("MainWindow", "Delete", 0));
- actionDeleteInstance->setToolTip(QApplication::translate("MainWindow", "Delete the selected instance.", 0));
- actionDeleteInstance->setStatusTip(QApplication::translate("MainWindow", "Delete the selected instance.", 0));
- actionConfig_Folder->setText(QApplication::translate("MainWindow", "Config Folder", 0));
- actionConfig_Folder->setToolTip(QApplication::translate("MainWindow", "Open the instance's config folder", 0));
- actionCAT->setText(QApplication::translate("MainWindow", "Meow", 0));
- actionCAT->setToolTip(QApplication::translate("MainWindow", "<html><head/><body><p align=\"center\">It's a fluffy kitty :3</p></body></html>", 0));
- actionCopyInstance->setText(QApplication::translate("MainWindow", "Copy Instance", 0));
- actionCopyInstance->setToolTip(QApplication::translate("MainWindow", "Copy the selected instance.", 0));
- actionCopyInstance->setStatusTip(QApplication::translate("MainWindow", "Add a new instance.", 0));
- actionManageAccounts->setText(QApplication::translate("MainWindow", "Manage Accounts", 0));
- actionManageAccounts->setToolTip(QApplication::translate("MainWindow", "Manage your Mojang or Minecraft accounts.", 0));
- actionLaunchInstanceOffline->setText(QApplication::translate("MainWindow", "Play Offline", 0));
- actionLaunchInstanceOffline->setToolTip(QApplication::translate("MainWindow", "Launch the selected instance in offline mode.", 0));
- actionLaunchInstanceOffline->setStatusTip(QApplication::translate("MainWindow", "Launch the selected instance.", 0));
- actionScreenshots->setText(QApplication::translate("MainWindow", "Manage Screenshots", 0));
- actionScreenshots->setToolTip(QApplication::translate("MainWindow", "<html><head/><body><p>View and upload screenshots for this instance</p></body></html>", 0));
- actionInstanceSettings->setText(QApplication::translate("MainWindow", "Instance Settings", 0));
- actionInstanceSettings->setToolTip(QApplication::translate("MainWindow", "Change the settings specific to the instance", 0));
- actionExportInstance->setText(QApplication::translate("MainWindow", "Export Instance", 0));
- mainToolBar->setWindowTitle(QApplication::translate("MainWindow", "Main Toolbar", 0));
- instanceToolBar->setWindowTitle(QApplication::translate("MainWindow", "Instance Toolbar", 0));
- newsToolBar->setWindowTitle(QApplication::translate("MainWindow", "News Toolbar", 0));
- } // retranslateUi
-
-};
-
-namespace Ui {
- class MainWindow: public Ui_MainWindow {};
-} // namespace Ui
-
-#include <QMenu>
-#include <QMessageBox>
-#include <QInputDialog>
-
-#include <QDesktopServices>
-#include <QKeyEvent>
-#include <QUrl>
-#include <QDir>
-#include <QFileInfo>
-#include <QLabel>
-#include <QToolButton>
-#include <QWidgetAction>
-#include <QProgressDialog>
-#include <QShortcut>
-#include <QFileDialog>
-
-#include <JlCompress.h>
-
-#include "osutils.h"
-#include "userutils.h"
-#include "pathutils.h"
-
-#include "gui/groupview/GroupView.h"
-#include "gui/groupview/InstanceDelegate.h"
-#include "gui/InstanceProxyModel.h"
-
-#include "gui/Platform.h"
-
-#include "gui/widgets/LabeledToolButton.h"
-#include "widgets/ServerStatus.h"
-
-#include "gui/dialogs/NewInstanceDialog.h"
-#include "gui/dialogs/ProgressDialog.h"
-#include "gui/dialogs/AboutDialog.h"
-#include "gui/dialogs/VersionSelectDialog.h"
-#include "gui/dialogs/CustomMessageBox.h"
-#include "gui/dialogs/IconPickerDialog.h"
-#include "gui/dialogs/CopyInstanceDialog.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/MultiMCPage.h"
-#include "gui/pages/global/ExternalToolsPage.h"
-#include "gui/pages/global/AccountListPage.h"
-#include "gui/pages/global/ProxyPage.h"
-#include "gui/pages/global/JavaPage.h"
-#include "gui/pages/global/MinecraftPage.h"
-
-#include "gui/ConsoleWindow.h"
-#include "pagedialog/PageDialog.h"
-
-#include "logic/InstanceList.h"
-#include "logic/minecraft/MinecraftVersionList.h"
-#include "logic/minecraft/LwjglVersionList.h"
-#include "logic/icons/IconList.h"
-#include "logic/java/JavaVersionList.h"
-
-#include "logic/auth/flows/AuthenticateTask.h"
-#include "logic/auth/flows/RefreshTask.h"
-
-#include "logic/updater/DownloadTask.h"
-
-#include "logic/news/NewsChecker.h"
-
-#include "logic/net/URLConstants.h"
-#include "logic/net/NetJob.h"
-#include "logic/Env.h"
-
-#include "logic/BaseInstance.h"
-#include "logic/BaseProcess.h"
-#include "logic/java/JavaUtils.h"
-#include "gui/NagUtils.h"
-#include "InstancePageProvider.h"
-#include "logic/minecraft/SkinUtils.h"
-
-//#include "logic/minecraft/LegacyInstance.h"
-
-#include <logic/updater/UpdateChecker.h>
-#include <logic/notifications/NotificationChecker.h>
-#include <logic/tasks/ThreadTask.h>
-#include "logic/net/CacheDownload.h"
-
-#include "logic/tools/BaseProfiler.h"
-
-MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- ui->setupUi(this);
-
- // initialize the news checker
- m_newsChecker.reset(new NewsChecker(BuildConfig.NEWS_RSS_URL));
-
- QString winTitle =
- QString("MultiMC 5 - Version %1").arg(BuildConfig.printableVersionString());
- if (!BuildConfig.BUILD_PLATFORM.isEmpty())
- winTitle += " on " + BuildConfig.BUILD_PLATFORM;
- setWindowTitle(winTitle);
-
- // OSX magic.
- setUnifiedTitleAndToolBarOnMac(true);
-
- // Global shortcuts
- {
- // FIXME: This is kinda weird. and bad. We need some kind of managed shutdown.
- auto q = new QShortcut(QKeySequence::Quit, this);
- connect(q, SIGNAL(activated()), qApp, SLOT(quit()));
- }
-
- // The instance action toolbar customizations
- {
- // disabled until we have an instance selected
- ui->instanceToolBar->setEnabled(false);
-
- // the rename label is inside the rename tool button
- renameButton = new LabeledToolButton();
- renameButton->setText("Instance Name");
- renameButton->setToolTip(ui->actionRenameInstance->toolTip());
- connect(renameButton, SIGNAL(clicked(bool)), SLOT(on_actionRenameInstance_triggered()));
- ui->instanceToolBar->insertWidget(ui->actionLaunchInstance, renameButton);
- ui->instanceToolBar->insertSeparator(ui->actionLaunchInstance);
- renameButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- }
-
- // Add the news label to the news toolbar.
- {
- newsLabel = new QToolButton();
- newsLabel->setIcon(MMC->getThemedIcon("news"));
- newsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- newsLabel->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- ui->newsToolBar->insertWidget(ui->actionMoreNews, newsLabel);
- QObject::connect(newsLabel, &QAbstractButton::clicked, this,
- &MainWindow::newsButtonClicked);
- QObject::connect(m_newsChecker.get(), &NewsChecker::newsLoaded, this,
- &MainWindow::updateNewsLabel);
- updateNewsLabel();
- }
-
- // Create the instance list widget
- {
- view = new GroupView(ui->centralWidget);
-
- view->setSelectionMode(QAbstractItemView::SingleSelection);
- // view->setCategoryDrawer(drawer);
- // view->setCollapsibleBlocks(true);
- // view->setViewMode(QListView::IconMode);
- // view->setFlow(QListView::LeftToRight);
- // view->setWordWrap(true);
- // view->setMouseTracking(true);
- // view->viewport()->setAttribute(Qt::WA_Hover);
- auto delegate = new ListViewDelegate();
- view->setItemDelegate(delegate);
- // view->setSpacing(10);
- // view->setUniformItemWidths(true);
-
- // do not show ugly blue border on the mac
- view->setAttribute(Qt::WA_MacShowFocusRect, false);
-
- view->installEventFilter(this);
-
- proxymodel = new InstanceProxyModel(this);
- // proxymodel->setSortRole(KCategorizedSortFilterProxyModel::CategorySortRole);
- // proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole);
- // proxymodel->setDynamicSortFilter ( true );
-
- // FIXME: instList should be global-ish, or at least not tied to the main window...
- // maybe the application itself?
- proxymodel->setSourceModel(MMC->instances().get());
- proxymodel->sort(0);
- view->setFrameShape(QFrame::NoFrame);
- view->setModel(proxymodel);
-
- view->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(view, SIGNAL(customContextMenuRequested(const QPoint &)), this,
- SLOT(showInstanceContextMenu(const QPoint &)));
-
- ui->horizontalLayout->addWidget(view);
- }
- // The cat background
- {
- bool cat_enable = MMC->settings()->get("TheCat").toBool();
- ui->actionCAT->setChecked(cat_enable);
- connect(ui->actionCAT, SIGNAL(toggled(bool)), SLOT(onCatToggled(bool)));
- setCatBackground(cat_enable);
- }
- // start instance when double-clicked
- connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this,
- SLOT(instanceActivated(const QModelIndex &)));
- // track the selection -- update the instance toolbar
- connect(view->selectionModel(),
- SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this,
- SLOT(instanceChanged(const QModelIndex &, const QModelIndex &)));
-
- // track icon changes and update the toolbar!
- connect(ENV.icons().get(), SIGNAL(iconUpdated(QString)), SLOT(iconUpdated(QString)));
-
- // model reset -> selection is invalid. All the instance pointers are wrong.
- // FIXME: stop using POINTERS everywhere
- connect(MMC->instances().get(), SIGNAL(dataIsInvalid()), SLOT(selectionBad()));
-
- m_statusLeft = new QLabel(tr("No instance selected"), this);
- m_statusRight = new ServerStatus(this);
- statusBar()->addPermanentWidget(m_statusLeft, 1);
- statusBar()->addPermanentWidget(m_statusRight, 0);
-
- // Add "manage accounts" button, right align
- QWidget *spacer = new QWidget();
- spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- ui->mainToolBar->addWidget(spacer);
-
- accountMenu = new QMenu(this);
- manageAccountsAction = new QAction(tr("Manage Accounts"), this);
- manageAccountsAction->setCheckable(false);
- connect(manageAccountsAction, SIGNAL(triggered(bool)), this,
- SLOT(on_actionManageAccounts_triggered()));
-
- repopulateAccountsMenu();
-
- accountMenuButton = new QToolButton(this);
- accountMenuButton->setText(tr("Accounts"));
- accountMenuButton->setMenu(accountMenu);
- accountMenuButton->setPopupMode(QToolButton::InstantPopup);
- accountMenuButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- accountMenuButton->setIcon(MMC->getThemedIcon("noaccount"));
-
- QWidgetAction *accountMenuButtonAction = new QWidgetAction(this);
- accountMenuButtonAction->setDefaultWidget(accountMenuButton);
-
- ui->mainToolBar->addAction(accountMenuButtonAction);
-
- // set up global pages dialog
- {
- m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings"));
- m_globalSettingsProvider->addPage<MultiMCPage>();
- m_globalSettingsProvider->addPage<MinecraftPage>();
- m_globalSettingsProvider->addPage<JavaPage>();
- m_globalSettingsProvider->addPage<ProxyPage>();
- m_globalSettingsProvider->addPage<ExternalToolsPage>();
- m_globalSettingsProvider->addPage<AccountListPage>();
- }
-
- // 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...
- connect(MMC->accounts().get(), &MojangAccountList::activeAccountChanged, [this]
- { activeAccountChanged(); });
- connect(MMC->accounts().get(), &MojangAccountList::listChanged, [this]
- { repopulateAccountsMenu(); });
-
- // Show initial account
- activeAccountChanged();
-
- auto accounts = MMC->accounts();
-
- QList<CacheDownloadPtr> skin_dls;
- for (int i = 0; i < accounts->count(); i++)
- {
- auto account = accounts->at(i);
- if (account != nullptr)
- {
- for (auto profile : account->profiles())
- {
- auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.name + ".png");
- auto action = CacheDownload::make(
- QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta);
- skin_dls.append(action);
- meta->stale = true;
- }
- }
- }
- if (!skin_dls.isEmpty())
- {
- auto job = new NetJob("Startup player skins download");
- connect(job, SIGNAL(succeeded()), SLOT(skinJobFinished()));
- connect(job, SIGNAL(failed()), SLOT(skinJobFinished()));
- for (auto action : skin_dls)
- {
- job->addNetAction(action);
- }
- skin_download_job.reset(job);
- job->start();
- }
-
- // run the things that load and download other things... FIXME: this is NOT the place
- // FIXME: invisible actions in the background = NOPE.
- {
- if (!MMC->minecraftlist()->isLoaded())
- {
- m_versionLoadTask = MMC->minecraftlist()->getLoadTask();
- startTask(m_versionLoadTask);
- }
- if (!MMC->lwjgllist()->isLoaded())
- {
- MMC->lwjgllist()->loadList();
- }
-
- m_newsChecker->reloadNews();
- updateNewsLabel();
-
- // set up the updater object.
- auto updater = MMC->updateChecker();
- connect(updater.get(), &UpdateChecker::updateAvailable, this,
- &MainWindow::updateAvailable);
- connect(updater.get(), &UpdateChecker::noUpdateFound, this,
- &MainWindow::updateNotAvailable);
- // if automatic update checks are allowed, start one.
- if (MMC->settings()->get("AutoUpdate").toBool())
- {
- auto updater = MMC->updateChecker();
- updater->checkForUpdate(MMC->settings()->get("UpdateChannel").toString(), false);
- }
- auto checker = new NotificationChecker();
- checker->setNotificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL));
- checker->setApplicationChannel(BuildConfig.VERSION_CHANNEL);
- checker->setApplicationPlatform(BuildConfig.BUILD_PLATFORM);
- checker->setApplicationFullVersion(BuildConfig.FULL_VERSION_STR);
- m_notificationChecker.reset(checker);
- connect(m_notificationChecker.get(),
- &NotificationChecker::notificationCheckFinished, this,
- &MainWindow::notificationsChanged);
- checker->checkForNotifications();
- }
-
- setSelectedInstanceById(MMC->settings()->get("SelectedInstance").toString());
-
- // removing this looks stupid
- view->setFocus();
-}
-
-MainWindow::~MainWindow()
-{
- delete ui;
- delete proxymodel;
-}
-
-void MainWindow::skinJobFinished()
-{
- activeAccountChanged();
- skin_download_job.reset();
-}
-
-void MainWindow::showInstanceContextMenu(const QPoint &pos)
-{
- QList<QAction *> actions;
-
- QAction *actionSep = new QAction("", this);
- actionSep->setSeparator(true);
-
- bool onInstance = view->indexAt(pos).isValid();
- if (onInstance)
- {
- actions = ui->instanceToolBar->actions();
-
- QAction *actionVoid = new QAction(m_selectedInstance->name(), this);
- actionVoid->setEnabled(false);
-
- QAction *actionRename = new QAction(tr("Rename"), this);
- actionRename->setToolTip(ui->actionRenameInstance->toolTip());
-
- QAction *actionCopyInstance = new QAction(tr("Copy instance"), this);
- actionCopyInstance->setToolTip(ui->actionCopyInstance->toolTip());
-
- connect(actionRename, SIGNAL(triggered(bool)),
- SLOT(on_actionRenameInstance_triggered()));
- connect(actionCopyInstance, SIGNAL(triggered(bool)),
- SLOT(on_actionCopyInstance_triggered()));
-
- actions.replace(1, actionRename);
- actions.prepend(actionSep);
- actions.prepend(actionVoid);
- actions.append(actionCopyInstance);
- }
- else
- {
- QAction *actionVoid = new QAction(tr("MultiMC"), this);
- actionVoid->setEnabled(false);
-
- QAction *actionCreateInstance = new QAction(tr("Create instance"), this);
- actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip());
-
- connect(actionCreateInstance, SIGNAL(triggered(bool)),
- SLOT(on_actionAddInstance_triggered()));
-
- actions.prepend(actionSep);
- actions.prepend(actionVoid);
- actions.append(actionCreateInstance);
- }
- QMenu myMenu;
- myMenu.addActions(actions);
- if (onInstance)
- myMenu.setEnabled(m_selectedInstance->canLaunch());
- myMenu.exec(view->mapToGlobal(pos));
-}
-
-void MainWindow::updateToolsMenu()
-{
- if (ui->actionLaunchInstance->menu())
- {
- ui->actionLaunchInstance->menu()->deleteLater();
- }
- QMenu *launchMenu = new QMenu(this);
- QAction *normalLaunch = launchMenu->addAction(tr("Launch"));
- connect(normalLaunch, &QAction::triggered, [this]()
- { doLaunch(); });
- launchMenu->addSeparator()->setText(tr("Profilers"));
- for (auto profiler : MMC->profilers().values())
- {
- QAction *profilerAction = launchMenu->addAction(profiler->name());
- QString error;
- if (!profiler->check(&error))
- {
- profilerAction->setDisabled(true);
- profilerAction->setToolTip(
- tr("Profiler not setup correctly. Go into settings, \"External Tools\"."));
- }
- else
- {
- connect(profilerAction, &QAction::triggered, [this, profiler]()
- { doLaunch(true, profiler.get()); });
- }
- }
- launchMenu->addSeparator()->setText(tr("Tools"));
- for (auto tool : MMC->tools().values())
- {
- QAction *toolAction = launchMenu->addAction(tool->name());
- QString error;
- if (!tool->check(&error))
- {
- toolAction->setDisabled(true);
- toolAction->setToolTip(
- tr("Tool not setup correctly. Go into settings, \"External Tools\"."));
- }
- else
- {
- connect(toolAction, &QAction::triggered, [this, tool]()
- { tool->createDetachedTool(m_selectedInstance, this)->run(); });
- }
- }
- ui->actionLaunchInstance->setMenu(launchMenu);
-}
-
-void MainWindow::repopulateAccountsMenu()
-{
- accountMenu->clear();
-
- std::shared_ptr<MojangAccountList> accounts = MMC->accounts();
- MojangAccountPtr active_account = accounts->activeAccount();
-
- QString active_username = "";
- if (active_account != nullptr)
- {
- active_username = accounts->activeAccount()->username();
- }
-
- if (accounts->count() <= 0)
- {
- QAction *action = new QAction(tr("No accounts added!"), this);
- action->setEnabled(false);
- accountMenu->addAction(action);
-
- accountMenu->addSeparator();
- }
- else
- {
- // TODO: Nicer way to iterate?
- for (int i = 0; i < accounts->count(); i++)
- {
- MojangAccountPtr account = accounts->at(i);
-
- // Styling hack
- QAction *section = new QAction(account->username(), this);
- section->setEnabled(false);
- accountMenu->addAction(section);
-
- for (auto profile : account->profiles())
- {
- QAction *action = new QAction(profile.name, this);
- action->setData(account->username());
- action->setCheckable(true);
- if (active_username == account->username())
- {
- action->setChecked(true);
- }
-
- action->setIcon(SkinUtils::getFaceFromCache(profile.name));
- accountMenu->addAction(action);
- connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount()));
- }
-
- accountMenu->addSeparator();
- }
- }
-
- QAction *action = new QAction(tr("No Default Account"), this);
- action->setCheckable(true);
- action->setIcon(MMC->getThemedIcon("noaccount"));
- action->setData("");
- if (active_username.isEmpty())
- {
- action->setChecked(true);
- }
-
- accountMenu->addAction(action);
- connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount()));
-
- accountMenu->addSeparator();
- accountMenu->addAction(manageAccountsAction);
-}
-
-/*
- * Assumes the sender is a QAction
- */
-void MainWindow::changeActiveAccount()
-{
- QAction *sAction = (QAction *)sender();
- // Profile's associated Mojang username
- // Will need to change when profiles are properly implemented
- if (sAction->data().type() != QVariant::Type::String)
- return;
-
- QVariant data = sAction->data();
- QString id = "";
- if (!data.isNull())
- {
- id = data.toString();
- }
-
- MMC->accounts()->setActiveAccount(id);
-
- activeAccountChanged();
-}
-
-void MainWindow::activeAccountChanged()
-{
- repopulateAccountsMenu();
-
- MojangAccountPtr account = MMC->accounts()->activeAccount();
-
- if (account != nullptr && account->username() != "")
- {
- const AccountProfile *profile = account->currentProfile();
- if (profile != nullptr)
- {
- accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->name));
- return;
- }
- }
-
- // Set the icon to the "no account" icon.
- accountMenuButton->setIcon(MMC->getThemedIcon("noaccount"));
-}
-
-bool MainWindow::eventFilter(QObject *obj, QEvent *ev)
-{
- if (obj == view)
- {
- if (ev->type() == QEvent::KeyPress)
- {
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
- switch (keyEvent->key())
- {
- case Qt::Key_Enter:
- case Qt::Key_Return:
- on_actionLaunchInstance_triggered();
- return true;
- case Qt::Key_Delete:
- on_actionDeleteInstance_triggered();
- return true;
- case Qt::Key_F5:
- on_actionRefresh_triggered();
- return true;
- case Qt::Key_F2:
- on_actionRenameInstance_triggered();
- return true;
- default:
- break;
- }
- }
- }
- return QMainWindow::eventFilter(obj, ev);
-}
-
-void MainWindow::updateNewsLabel()
-{
- if (m_newsChecker->isLoadingNews())
- {
- newsLabel->setText(tr("Loading news..."));
- newsLabel->setEnabled(false);
- }
- else
- {
- QList<NewsEntryPtr> entries = m_newsChecker->getNewsEntries();
- if (entries.length() > 0)
- {
- newsLabel->setText(entries[0]->title);
- newsLabel->setEnabled(true);
- }
- else
- {
- newsLabel->setText(tr("No news available."));
- newsLabel->setEnabled(false);
- }
- }
-}
-
-void MainWindow::updateAvailable(GoUpdate::Status status)
-{
- UpdateDialog dlg;
- UpdateAction action = (UpdateAction)dlg.exec();
- switch (action)
- {
- case UPDATE_LATER:
- qDebug() << "Update will be installed later.";
- break;
- case UPDATE_NOW:
- downloadUpdates(status);
- break;
- case UPDATE_ONEXIT:
- downloadUpdates(status, true);
- break;
- }
-}
-
-void MainWindow::updateNotAvailable()
-{
- UpdateDialog dlg(false);
- dlg.exec();
-}
-
-QList<int> stringToIntList(const QString &string)
-{
- QStringList split = string.split(',', QString::SkipEmptyParts);
- QList<int> out;
- for (int i = 0; i < split.size(); ++i)
- {
- out.append(split.at(i).toInt());
- }
- return out;
-}
-QString intListToString(const QList<int> &list)
-{
- QStringList slist;
- for (int i = 0; i < list.size(); ++i)
- {
- slist.append(QString::number(list.at(i)));
- }
- return slist.join(',');
-}
-void MainWindow::notificationsChanged()
-{
- QList<NotificationChecker::NotificationEntry> entries =
- m_notificationChecker->notificationEntries();
- QList<int> shownNotifications =
- stringToIntList(MMC->settings()->get("ShownNotifications").toString());
- for (auto it = entries.begin(); it != entries.end(); ++it)
- {
- NotificationChecker::NotificationEntry entry = *it;
- if (!shownNotifications.contains(entry.id))
- {
- NotificationDialog dialog(entry, this);
- if (dialog.exec() == NotificationDialog::DontShowAgain)
- {
- shownNotifications.append(entry.id);
- }
- }
- }
- MMC->settings()->set("ShownNotifications", intListToString(shownNotifications));
-}
-
-void MainWindow::downloadUpdates(GoUpdate::Status status, bool installOnExit)
-{
- qDebug() << "Downloading updates.";
- // TODO: If the user chooses to update on exit, we should download updates in the
- // background.
- // Doing so is a bit complicated, because we'd have to make sure it finished downloading
- // before actually exiting MultiMC.
- ProgressDialog updateDlg(this);
- status.rootPath = MMC->rootPath;
-
- GoUpdate::DownloadTask updateTask(status, &updateDlg);
- // If the task succeeds, install the updates.
- if (updateDlg.exec(&updateTask))
- {
- UpdateFlags baseFlags = None;
- if (BuildConfig.UPDATER_DRY_RUN)
- baseFlags |= DryRun;
- if (installOnExit)
- MMC->installUpdates(updateTask.updateFilesDir(), baseFlags | OnExit);
- else
- MMC->installUpdates(updateTask.updateFilesDir(), baseFlags | RestartOnFinish);
- }
-}
-
-void MainWindow::onCatToggled(bool state)
-{
- setCatBackground(state);
- MMC->settings()->set("TheCat", state);
-}
-
-void MainWindow::setCatBackground(bool enabled)
-{
- if (enabled)
- {
- view->setStyleSheet("GroupView"
- "{"
- "background-image: url(:/backgrounds/kitteh);"
- "background-attachment: fixed;"
- "background-clip: padding;"
- "background-position: top right;"
- "background-repeat: none;"
- "background-color:palette(base);"
- "}");
- }
- else
- {
- view->setStyleSheet(QString());
- }
-}
-
-static QFileInfo findRecursive(const QString &dir, const QString &name)
-{
- for (const auto info : QDir(dir).entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files, QDir::DirsLast))
- {
- if (info.isFile() && info.fileName() == name)
- {
- return info;
- }
- else if (info.isDir())
- {
- const QFileInfo res = findRecursive(info.absoluteFilePath(), name);
- if (res.isFile() && res.exists())
- {
- return res;
- }
- }
- }
- return QFileInfo();
-}
-
-// FIXME: eliminate, should not be needed
-void MainWindow::waitForMinecraftVersions()
-{
- if (!MMC->minecraftlist()->isLoaded() && m_versionLoadTask &&
- m_versionLoadTask->isRunning())
- {
- QEventLoop waitLoop;
- waitLoop.connect(m_versionLoadTask, SIGNAL(failed(QString)), SLOT(quit()));
- waitLoop.connect(m_versionLoadTask, SIGNAL(succeeded()), SLOT(quit()));
- waitLoop.exec();
- }
-}
-
-void MainWindow::instanceFromZipPack(QString instName, QString instGroup, QString instIcon, QUrl url)
-{
- InstancePtr newInstance;
-
- QString instancesDir = MMC->settings()->get("InstanceDir").toString();
- QString instDirName = DirNameFromString(instName, instancesDir);
- QString instDir = PathCombine(instancesDir, instDirName);
-
- QString archivePath;
- if (url.isLocalFile())
- {
- archivePath = url.toLocalFile();
- }
- else
- {
- const QString path = url.host() + '/' + url.path();
- auto entry = ENV.metacache()->resolveEntry("general", path);
- CacheDownloadPtr dl = CacheDownload::make(url, entry);
- NetJob job(tr("Modpack download"));
- job.addNetAction(dl);
-
- // FIXME: possibly causes endless loop problems
- ProgressDialog dlDialog(this);
- if (dlDialog.exec(&job) != QDialog::Accepted)
- {
- return;
- }
- archivePath = entry->getFullPath();
- }
-
- QTemporaryDir extractTmpDir;
- QDir extractDir(extractTmpDir.path());
- qDebug() << "Attempting to create instance from" << archivePath;
- if (JlCompress::extractDir(archivePath, extractDir.absolutePath()).isEmpty())
- {
- CustomMessageBox::selectable(this, tr("Error"),
- tr("Failed to extract modpack"), QMessageBox::Warning)->show();
- return;
- }
- const QFileInfo instanceCfgFile = findRecursive(extractDir.absolutePath(), "instance.cfg");
- if (!instanceCfgFile.isFile() || !instanceCfgFile.exists())
- {
- CustomMessageBox::selectable(this, tr("Error"), tr("Archive does not contain instance.cfg"))->show();
- return;
- }
- if (!copyPath(instanceCfgFile.absoluteDir().absolutePath(), instDir))
- {
- CustomMessageBox::selectable(this, tr("Error"), tr("Unable to copy instance"))->show();
- return;
- }
-
- auto error = MMC->instances()->loadInstance(newInstance, instDir);
- QString errorMsg = tr("Failed to load instance %1: ").arg(instDirName);
- switch (error)
- {
- case InstanceList::UnknownLoadError:
- errorMsg += tr("Unkown error");
- CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
- return;
- case InstanceList::NotAnInstance:
- errorMsg += tr("Not an instance");
- CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
- return;
- }
-
- newInstance->setName(instName);
- newInstance->setIconKey(instIcon);
- newInstance->setGroupInitial(instGroup);
- MMC->instances()->add(InstancePtr(newInstance));
- MMC->instances()->saveGroupList();
-
- finalizeInstance(newInstance);
-}
-
-void MainWindow::instanceFromVersion(QString instName, QString instGroup, QString instIcon, BaseVersionPtr version)
-{
- InstancePtr newInstance;
-
- QString instancesDir = MMC->settings()->get("InstanceDir").toString();
- QString instDirName = DirNameFromString(instName, instancesDir);
- QString instDir = PathCombine(instancesDir, instDirName);
- auto error = MMC->instances()->createInstance(newInstance, version, instDir);
- QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName);
- switch (error)
- {
- case InstanceList::NoCreateError:
- break;
-
- case InstanceList::InstExists:
- {
- errorMsg += tr("An instance with the given directory name already exists.");
- CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
- return;
- }
-
- case InstanceList::CantCreateDir:
- {
- errorMsg += tr("Failed to create the instance directory.");
- CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
- return;
- }
-
- default:
- {
- errorMsg += tr("Unknown instance loader error %1").arg(error);
- CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
- return;
- }
- }
- newInstance->setName(instName);
- newInstance->setIconKey(instIcon);
- newInstance->setGroupInitial(instGroup);
- MMC->instances()->add(InstancePtr(newInstance));
- MMC->instances()->saveGroupList();
- finalizeInstance(newInstance);
-}
-
-void MainWindow::finalizeInstance(InstancePtr inst)
-{
- if (MMC->accounts()->anyAccountIsValid())
- {
- ProgressDialog loadDialog(this);
- auto update = inst->doUpdate();
- connect(update.get(), &Task::failed, [this](QString reason)
- {
- QString error = QString("Instance load failed: %1").arg(reason);
- CustomMessageBox::selectable(this, tr("Error"), error, QMessageBox::Warning)
- ->show();
- });
- loadDialog.exec(update.get());
- }
- else
- {
- CustomMessageBox::selectable(
- this, tr("Error"),
- tr("MultiMC cannot download Minecraft or update instances unless you have at least "
- "one account added.\nPlease add your Mojang or Minecraft account."),
- QMessageBox::Warning)->show();
- }
-}
-
-
-void MainWindow::on_actionAddInstance_triggered()
-{
- waitForMinecraftVersions();
-
- NewInstanceDialog newInstDlg(this);
- if (!newInstDlg.exec())
- return;
-
- MMC->settings()->set("LastUsedGroupForNewInstance", newInstDlg.instGroup());
-
- const QUrl modpackUrl = newInstDlg.modpackUrl();
-
-
- if (modpackUrl.isValid())
- {
- instanceFromZipPack(newInstDlg.instName(), newInstDlg.instGroup(), newInstDlg.iconKey(), modpackUrl);
- }
- else
- {
- instanceFromVersion(newInstDlg.instName(), newInstDlg.instGroup(), newInstDlg.iconKey(), newInstDlg.selectedVersion());
- }
-}
-
-void MainWindow::on_actionCopyInstance_triggered()
-{
- if (!m_selectedInstance)
- return;
-
- CopyInstanceDialog copyInstDlg(m_selectedInstance, this);
- if (!copyInstDlg.exec())
- return;
-
- QString instancesDir = MMC->settings()->get("InstanceDir").toString();
- QString instDirName = DirNameFromString(copyInstDlg.instName(), instancesDir);
- QString instDir = PathCombine(instancesDir, instDirName);
-
- InstancePtr newInstance;
- auto error = MMC->instances()->copyInstance(newInstance, m_selectedInstance, instDir);
-
- QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName);
- switch (error)
- {
- case InstanceList::NoCreateError:
- newInstance->setName(copyInstDlg.instName());
- newInstance->setGroupInitial(copyInstDlg.instGroup());
- newInstance->setIconKey(copyInstDlg.iconKey());
- MMC->instances()->add(newInstance);
- return;
-
- case InstanceList::InstExists:
- {
- errorMsg += tr("An instance with the given directory name already exists.");
- CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
- break;
- }
-
- case InstanceList::CantCreateDir:
- {
- errorMsg += tr("Failed to create the instance directory.");
- CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
- break;
- }
-
- default:
- {
- errorMsg += tr("Unknown instance loader error %1").arg(error);
- CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
- break;
- }
- }
-}
-
-void MainWindow::on_actionChangeInstIcon_triggered()
-{
- if (!m_selectedInstance)
- return;
-
- IconPickerDialog dlg(this);
- dlg.exec(m_selectedInstance->iconKey());
- if (dlg.result() == QDialog::Accepted)
- {
- m_selectedInstance->setIconKey(dlg.selectedIconKey);
- auto ico = ENV.icons()->getBigIcon(dlg.selectedIconKey);
- ui->actionChangeInstIcon->setIcon(ico);
- }
-}
-
-void MainWindow::iconUpdated(QString icon)
-{
- if (icon == m_currentInstIcon)
- {
- ui->actionChangeInstIcon->setIcon(ENV.icons()->getBigIcon(m_currentInstIcon));
- }
-}
-
-void MainWindow::updateInstanceToolIcon(QString new_icon)
-{
- m_currentInstIcon = new_icon;
- ui->actionChangeInstIcon->setIcon(ENV.icons()->getBigIcon(m_currentInstIcon));
-}
-
-void MainWindow::setSelectedInstanceById(const QString &id)
-{
- if (id.isNull())
- return;
- const QModelIndex index = MMC->instances()->getInstanceIndexById(id);
- if (index.isValid())
- {
- QModelIndex selectionIndex = proxymodel->mapFromSource(index);
- view->selectionModel()->setCurrentIndex(selectionIndex, QItemSelectionModel::ClearAndSelect);
- }
-}
-
-void MainWindow::on_actionChangeInstGroup_triggered()
-{
- if (!m_selectedInstance)
- return;
-
- bool ok = false;
- QString name(m_selectedInstance->group());
- auto groups = MMC->instances()->getGroups();
- groups.insert(0, "");
- groups.sort(Qt::CaseInsensitive);
- int foo = groups.indexOf(name);
-
- name = QInputDialog::getItem(this, tr("Group name"), tr("Enter a new group name."), groups,
- foo, true, &ok);
- name = name.simplified();
- if (ok)
- m_selectedInstance->setGroupPost(name);
-}
-
-void MainWindow::on_actionViewInstanceFolder_triggered()
-{
- QString str = MMC->settings()->get("InstanceDir").toString();
- openDirInDefaultProgram(str);
-}
-
-void MainWindow::on_actionRefresh_triggered()
-{
- MMC->instances()->loadList();
-}
-
-void MainWindow::on_actionViewCentralModsFolder_triggered()
-{
- openDirInDefaultProgram(MMC->settings()->get("CentralModsDir").toString(), true);
-}
-
-void MainWindow::on_actionConfig_Folder_triggered()
-{
- if (m_selectedInstance)
- {
- QString str = m_selectedInstance->instanceConfigFolder();
- openDirInDefaultProgram(QDir(str).absolutePath());
- }
-}
-
-void MainWindow::on_actionCheckUpdate_triggered()
-{
- auto updater = MMC->updateChecker();
- updater->checkForUpdate(MMC->settings()->get("UpdateChannel").toString(), true);
-}
-
-template <typename T>
-void ShowPageDialog(T raw_provider, QWidget * parent, QString open_page = QString())
-{
- auto provider = std::dynamic_pointer_cast<BasePageProvider>(raw_provider);
- if(!provider)
- return;
- PageDialog dlg(provider, open_page, parent);
- dlg.exec();
-}
-
-void ShowInstancePageDialog(InstancePtr instance, QWidget * parent, QString open_page = QString())
-{
- auto provider = std::make_shared<InstancePageProvider>(instance);
- ShowPageDialog(provider, parent, open_page);
-}
-
-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();
- update();
-}
-
-void MainWindow::on_actionInstanceSettings_triggered()
-{
- ShowInstancePageDialog(m_selectedInstance, this, "settings");
-}
-
-void MainWindow::on_actionEditInstNotes_triggered()
-{
- ShowInstancePageDialog(m_selectedInstance, this, "notes");
-}
-
-void MainWindow::on_actionEditInstance_triggered()
-{
- ShowInstancePageDialog(m_selectedInstance, this);
-}
-
-void MainWindow::on_actionScreenshots_triggered()
-{
- ShowInstancePageDialog(m_selectedInstance, this, "screenshots");
-}
-
-
-void MainWindow::on_actionManageAccounts_triggered()
-{
- ShowPageDialog(m_globalSettingsProvider, this, "accounts");
-}
-
-void MainWindow::on_actionReportBug_triggered()
-{
- openWebPage(QUrl("https://github.com/MultiMC/MultiMC5/issues"));
-}
-
-void MainWindow::on_actionPatreon_triggered()
-{
- openWebPage(QUrl("http://www.patreon.com/multimc"));
-}
-
-void MainWindow::on_actionMoreNews_triggered()
-{
- openWebPage(QUrl("http://multimc.org/posts.html"));
-}
-
-void MainWindow::newsButtonClicked()
-{
- QList<NewsEntryPtr> entries = m_newsChecker->getNewsEntries();
- if (entries.count() > 0)
- openWebPage(QUrl(entries[0]->link));
- else
- openWebPage(QUrl("http://multimc.org/posts.html"));
-}
-
-void MainWindow::on_actionAbout_triggered()
-{
- AboutDialog dialog(this);
- dialog.exec();
-}
-
-void MainWindow::on_mainToolBar_visibilityChanged(bool)
-{
- // Don't allow hiding the main toolbar.
- // This is the only way I could find to prevent it... :/
- ui->mainToolBar->setVisible(true);
-}
-
-void MainWindow::on_actionDeleteInstance_triggered()
-{
- if (m_selectedInstance)
- {
- auto response = CustomMessageBox::selectable(
- this, tr("CAREFUL"), tr("This is permanent! Are you sure?\nAbout to delete: ") +
- m_selectedInstance->name(),
- QMessageBox::Question, QMessageBox::Yes | QMessageBox::No)->exec();
- if (response == QMessageBox::Yes)
- {
- m_selectedInstance->nuke();
- }
- }
-}
-
-#include <pathutils.h>
-
-bool compressSubDir(QuaZip* zip, QString dir, QString origDir, QString prefix)
-{
- if (!zip) return false;
- if (zip->getMode()!=QuaZip::mdCreate && zip->getMode()!=QuaZip::mdAppend && zip->getMode()!=QuaZip::mdAdd)
- {
- return false;
- }
-
- QDir directory(dir);
- if (!directory.exists()) return false;
-
- QDir origDirectory(origDir);
- if (dir != origDir)
- {
- QuaZipFile dirZipFile(zip);
- auto dirPrefix = PathCombine(prefix, origDirectory.relativeFilePath(dir)) + "/";
- if (!dirZipFile.open(QIODevice::WriteOnly, QuaZipNewInfo(dirPrefix, dir), 0, 0, 0))
- {
- return false;
- }
- dirZipFile.close();
- }
-
- QFileInfoList files = directory.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Hidden);
- for (auto file: files)
- {
- if(!compressSubDir(zip,file.absoluteFilePath(),origDir, prefix))
- {
- return false;
- }
- }
-
- files = directory.entryInfoList(QDir::Files);
- for (auto file: files)
- {
- if(!file.isFile())
- {
- continue;
- }
-
- if(file.absoluteFilePath()==zip->getZipName())
- {
- continue;
- }
-
- QString filename = origDirectory.relativeFilePath(file.absoluteFilePath());
- if(prefix.size())
- {
- filename = PathCombine(prefix, filename);
- }
- if (!JlCompress::compressFile(zip,file.absoluteFilePath(),filename))
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool compressDir(QString zipFile, QString dir, QString prefix = QString())
-{
- QuaZip zip(zipFile);
- QDir().mkpath(QFileInfo(zipFile).absolutePath());
- if(!zip.open(QuaZip::mdCreate))
- {
- QFile::remove(zipFile);
- return false;
- }
-
- QSet<QString> added;
- if (!compressSubDir(&zip,dir,dir,prefix))
- {
- QFile::remove(zipFile);
- return false;
- }
- zip.close();
- if(zip.getZipError()!=0)
- {
- QFile::remove(zipFile);
- return false;
- }
- return true;
-}
-
-void MainWindow::on_actionExportInstance_triggered()
-{
- if (m_selectedInstance)
- {
- auto name = RemoveInvalidFilenameChars(m_selectedInstance->name());
-
- const QString output = QFileDialog::getSaveFileName(this, tr("Export %1")
- .arg(m_selectedInstance->name()),
- PathCombine(QDir::homePath(), name + ".zip") , "Zip (*.zip)");
- if (output.isNull())
- {
- return;
- }
- if (QFile::exists(output))
- {
- int ret = QMessageBox::question(this, tr("Overwrite?"), tr("This file already exists. Do you want to overwrite it?"),
- QMessageBox::No, QMessageBox::Yes);
- if (ret == QMessageBox::No)
- {
- return;
- }
- }
-
- if (!compressDir(output, m_selectedInstance->instanceRoot(), name))
- {
- QMessageBox::warning(this, tr("Error"), tr("Unable to export instance"));
- }
- }
-}
-
-void MainWindow::on_actionRenameInstance_triggered()
-{
- if (m_selectedInstance)
- {
- bool ok = false;
- QString name(m_selectedInstance->name());
- name =
- QInputDialog::getText(this, tr("Instance name"), tr("Enter a new instance name."),
- QLineEdit::Normal, name, &ok);
-
- if (name.length() > 0)
- {
- if (ok && name.length())
- {
- m_selectedInstance->setName(name);
- renameButton->setText(name);
- }
- }
- }
-}
-
-void MainWindow::on_actionViewSelectedInstFolder_triggered()
-{
- if (m_selectedInstance)
- {
- QString str = m_selectedInstance->instanceRoot();
- openDirInDefaultProgram(QDir(str).absolutePath());
- }
-}
-
-void MainWindow::closeEvent(QCloseEvent *event)
-{
- // Save the window state and geometry.
-
- MMC->settings()->set("MainWindowState", saveState().toBase64());
- MMC->settings()->set("MainWindowGeometry", saveGeometry().toBase64());
-
- QMainWindow::closeEvent(event);
- QApplication::exit();
-}
-/*
-void MainWindow::on_instanceView_customContextMenuRequested(const QPoint &pos)
-{
- QMenu *instContextMenu = new QMenu("Instance", this);
-
- // Add the actions from the toolbar to the context menu.
- instContextMenu->addActions(ui->instanceToolBar->actions());
-
- instContextMenu->exec(view->mapToGlobal(pos));
-}
-*/
-void MainWindow::instanceActivated(QModelIndex index)
-{
- if (!index.isValid())
- return;
- QString id = index.data(InstanceList::InstanceIDRole).toString();
- InstancePtr inst = MMC->instances()->getInstanceById(id);
- if (!inst)
- return;
-
- NagUtils::checkJVMArgs(inst->settings().get("JvmArgs").toString(), this);
-
- doLaunch();
-}
-
-void MainWindow::on_actionLaunchInstance_triggered()
-{
- if (m_selectedInstance)
- {
- NagUtils::checkJVMArgs(m_selectedInstance->settings().get("JvmArgs").toString(), this);
- doLaunch();
- }
-}
-
-void MainWindow::on_actionLaunchInstanceOffline_triggered()
-{
- if (m_selectedInstance)
- {
- NagUtils::checkJVMArgs(m_selectedInstance->settings().get("JvmArgs").toString(), this);
- doLaunch(false);
- }
-}
-
-void MainWindow::doLaunch(bool online, BaseProfilerFactory *profiler)
-{
- if (!m_selectedInstance)
- return;
-
- // Find an account to use.
- std::shared_ptr<MojangAccountList> accounts = MMC->accounts();
- MojangAccountPtr account = accounts->activeAccount();
- if (accounts->count() <= 0)
- {
- // Tell the user they need to log in at least one account in order to play.
- auto reply = CustomMessageBox::selectable(
- this, tr("No Accounts"),
- tr("In order to play Minecraft, you must have at least one Mojang or Minecraft "
- "account logged in to MultiMC."
- "Would you like to open the account manager to add an account now?"),
- QMessageBox::Information, QMessageBox::Yes | QMessageBox::No)->exec();
-
- if (reply == QMessageBox::Yes)
- {
- // Open the account manager.
- on_actionManageAccounts_triggered();
- }
- }
- else if (account.get() == nullptr)
- {
- // If no default account is set, ask the user which one to use.
- AccountSelectDialog selectDialog(tr("Which account would you like to use?"),
- AccountSelectDialog::GlobalDefaultCheckbox, this);
-
- selectDialog.exec();
-
- // Launch the instance with the selected account.
- account = selectDialog.selectedAccount();
-
- // If the user said to use the account as default, do that.
- if (selectDialog.useAsGlobalDefault() && account.get() != nullptr)
- accounts->setActiveAccount(account->username());
- }
-
- // if no account is selected, we bail
- if (!account.get())
- return;
-
- // we try empty password first :)
- QString password;
- // we loop until the user succeeds in logging in or gives up
- bool tryagain = true;
- // the failure. the default failure.
- QString failReason = tr("Your account is currently not logged in. Please enter "
- "your password to log in again.");
-
- while (tryagain)
- {
- AuthSessionPtr session(new AuthSession());
- session->wants_online = online;
- auto task = account->login(session, password);
- if (task)
- {
- // We'll need to validate the access token to make sure the account
- // is still logged in.
- ProgressDialog progDialog(this);
- if (online)
- progDialog.setSkipButton(true, tr("Play Offline"));
- progDialog.exec(task.get());
- if (!task->successful())
- {
- failReason = task->failReason();
- }
- }
- switch (session->status)
- {
- case AuthSession::Undetermined:
- {
- qCritical() << "Received undetermined session status during login. Bye.";
- tryagain = false;
- break;
- }
- case AuthSession::RequiresPassword:
- {
- EditAccountDialog passDialog(failReason, this, EditAccountDialog::PasswordField);
- if (passDialog.exec() == QDialog::Accepted)
- {
- password = passDialog.password();
- }
- else
- {
- tryagain = false;
- }
- break;
- }
- case AuthSession::PlayableOffline:
- {
- // we ask the user for a player name
- bool ok = false;
- QString usedname = session->player_name;
- QString name = QInputDialog::getText(this, tr("Player name"),
- tr("Choose your offline mode player name."),
- QLineEdit::Normal, session->player_name, &ok);
- if (!ok)
- {
- tryagain = false;
- break;
- }
- if (name.length())
- {
- usedname = name;
- }
- session->MakeOffline(usedname);
- // offline flavored game from here :3
- }
- case AuthSession::PlayableOnline:
- {
- // update first if the server actually responded
- if (session->auth_server_online)
- {
- updateInstance(m_selectedInstance, session, profiler);
- }
- else
- {
- launchInstance(m_selectedInstance, session, profiler);
- }
- tryagain = false;
- }
- }
- }
-}
-
-void MainWindow::updateInstance(InstancePtr instance, AuthSessionPtr session,
- BaseProfilerFactory *profiler)
-{
- auto updateTask = instance->doUpdate();
- if (!updateTask)
- {
- launchInstance(instance, session, profiler);
- return;
- }
- ProgressDialog tDialog(this);
- connect(updateTask.get(), &Task::succeeded, [this, instance, session, profiler]
- { launchInstance(instance, session, profiler); });
- connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
- tDialog.exec(updateTask.get());
-}
-
-void MainWindow::launchInstance(InstancePtr instance, AuthSessionPtr session,
- BaseProfilerFactory *profiler)
-{
- Q_ASSERT_X(instance != NULL, "launchInstance", "instance is NULL");
- Q_ASSERT_X(session.get() != nullptr, "launchInstance", "session is NULL");
-
- QString launchScript;
-
- BaseProcess *proc = instance->prepareForLaunch(session);
- if (!proc)
- return;
-
- this->hide();
-
- console = new ConsoleWindow(proc);
- connect(console, SIGNAL(isClosing()), this, SLOT(instanceEnded()));
-
- proc->setHeader("MultiMC version: " + BuildConfig.printableVersionString() + "\n\n");
- proc->arm();
-
- if (profiler)
- {
- QString error;
- if (!profiler->check(&error))
- {
- QMessageBox::critical(this, tr("Error"),
- tr("Couldn't start profiler: %1").arg(error));
- proc->abort();
- return;
- }
- BaseProfiler *profilerInstance = profiler->createProfiler(instance, this);
- QProgressDialog dialog;
- dialog.setMinimum(0);
- dialog.setMaximum(0);
- dialog.setValue(0);
- dialog.setLabelText(tr("Waiting for profiler..."));
- connect(&dialog, &QProgressDialog::canceled, profilerInstance,
- &BaseProfiler::abortProfiling);
- dialog.show();
- connect(profilerInstance, &BaseProfiler::readyToLaunch,
- [&dialog, this, proc](const QString & message)
- {
- dialog.accept();
- QMessageBox msg;
- msg.setText(tr("The game launch is delayed until you press the "
- "button. This is the right time to setup the profiler, as the "
- "profiler server is running now.\n\n%1").arg(message));
- msg.setWindowTitle(tr("Waiting"));
- msg.setIcon(QMessageBox::Information);
- msg.addButton(tr("Launch"), QMessageBox::AcceptRole);
- msg.exec();
- proc->launch();
- });
- connect(profilerInstance, &BaseProfiler::abortLaunch,
- [&dialog, this, proc](const QString & message)
- {
- dialog.accept();
- QMessageBox msg;
- msg.setText(tr("Couldn't start the profiler: %1").arg(message));
- msg.setWindowTitle(tr("Error"));
- msg.setIcon(QMessageBox::Critical);
- msg.addButton(QMessageBox::Ok);
- msg.exec();
- proc->abort();
- });
- profilerInstance->beginProfiling(proc);
- dialog.exec();
- }
- else
- {
- proc->launch();
- }
-}
-
-void MainWindow::onGameUpdateError(QString error)
-{
- CustomMessageBox::selectable(this, tr("Error updating instance"), error,
- QMessageBox::Warning)->show();
-}
-
-void MainWindow::taskStart()
-{
- // Nothing to do here yet.
-}
-
-void MainWindow::taskEnd()
-{
- QObject *sender = QObject::sender();
- if (sender == m_versionLoadTask)
- m_versionLoadTask = NULL;
-
- sender->deleteLater();
-}
-
-void MainWindow::startTask(Task *task)
-{
- connect(task, SIGNAL(started()), SLOT(taskStart()));
- connect(task, SIGNAL(succeeded()), SLOT(taskEnd()));
- connect(task, SIGNAL(failed(QString)), SLOT(taskEnd()));
- task->start();
-}
-
-// BrowserDialog
-void MainWindow::openWebPage(QUrl url)
-{
- QDesktopServices::openUrl(url);
-}
-
-void MainWindow::instanceChanged(const QModelIndex &current, const QModelIndex &previous)
-{
- if(!current.isValid())
- {
- MMC->settings()->set("SelectedInstance", QString());
- selectionBad();
- return;
- }
- QString id = current.data(InstanceList::InstanceIDRole).toString();
- m_selectedInstance = MMC->instances()->getInstanceById(id);
- if ( m_selectedInstance )
- {
- ui->instanceToolBar->setEnabled(m_selectedInstance->canLaunch());
- renameButton->setText(m_selectedInstance->name());
- m_statusLeft->setText(m_selectedInstance->getStatusbarDescription());
- updateInstanceToolIcon(m_selectedInstance->iconKey());
-
- updateToolsMenu();
-
- MMC->settings()->set("SelectedInstance", m_selectedInstance->id());
- }
- else
- {
- MMC->settings()->set("SelectedInstance", QString());
- selectionBad();
- return;
- }
-}
-
-void MainWindow::selectionBad()
-{
- // start by reseting everything...
- m_selectedInstance = nullptr;
-
- statusBar()->clearMessage();
- ui->instanceToolBar->setEnabled(false);
- renameButton->setText(tr("Rename Instance"));
- updateInstanceToolIcon("infinity");
-
- // ...and then see if we can enable the previously selected instance
- setSelectedInstanceById(MMC->settings()->get("SelectedInstance").toString());
-}
-
-void MainWindow::instanceEnded()
-{
- this->show();
-}
-
-void MainWindow::checkSetDefaultJava()
-{
- const QString javaHack = "IntelHack";
- bool askForJava = false;
- do
- {
- QString currentHostName = QHostInfo::localHostName();
- QString oldHostName = MMC->settings()->get("LastHostname").toString();
- if (currentHostName != oldHostName)
- {
- MMC->settings()->set("LastHostname", currentHostName);
- askForJava = true;
- break;
- }
- QString currentJavaPath = MMC->settings()->get("JavaPath").toString();
- if (currentJavaPath.isEmpty())
- {
- askForJava = true;
- break;
- }
- if(!currentJavaPath.contains('/'))
- {
- currentJavaPath = QStandardPaths::findExecutable(currentJavaPath);
- }
- QFile currentJavaBin(currentJavaPath);
- if(!currentJavaBin.exists())
- {
- askForJava = true;
- break;
- }
- #if defined Q_OS_WIN32
- QString currentHack = MMC->settings()->get("JavaDetectionHack").toString();
- if (currentHack != javaHack)
- {
- CustomMessageBox::selectable(
- this, tr("Java detection forced"),
- tr("Because of graphics performance issues caused by Intel drivers on Windows, "
- "MultiMC java detection was forced. Please select a Java "
- "version.<br/><br/>If you have custom java versions set for your instances, "
- "make sure you use the 'javaw.exe' executable."),
- QMessageBox::Warning)->exec();
- askForJava = true;
- break;
- }
- #endif
- } while (0);
-
- if (askForJava)
- {
- qDebug() << "Java path needs resetting, showing Java selection dialog...";
-
- JavaVersionPtr java;
-
- VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this,
- false);
- vselect.setResizeOn(2);
- vselect.exec();
-
- if (vselect.selectedVersion())
- java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
- else
- {
- CustomMessageBox::selectable(
- this, tr("Invalid version selected"),
- tr("You didn't select a valid Java version, so MultiMC will "
- "select the default. "
- "You can change this in the settings dialog."),
- QMessageBox::Warning)->show();
-
- JavaUtils ju;
- java = ju.GetDefaultJava();
- }
- if (java)
- {
- MMC->settings()->set("JavaPath", java->path);
- MMC->settings()->set("JavaDetectionHack", javaHack);
- }
- else
- MMC->settings()->set("JavaPath", QString("java"));
- }
-}
-
-void MainWindow::checkInstancePathForProblems()
-{
- QString instanceFolder = MMC->settings()->get("InstanceDir").toString();
- if (checkProblemticPathJava(QDir(instanceFolder)))
- {
- QMessageBox warning;
- warning.setText(tr(
- "Your instance folder contains \'!\' and this is known to cause Java problems!"));
- warning.setInformativeText(
- tr("You have now three options: <br/>"
- " - ignore this warning <br/>"
- " - change the instance dir in the settings <br/>"
- " - move this installation of MultiMC5 to a different folder"));
- warning.setDefaultButton(QMessageBox::Ok);
- warning.exec();
- }
-}
diff --git a/gui/MainWindow.h b/gui/MainWindow.h
deleted file mode 100644
index 13edce81..00000000
--- a/gui/MainWindow.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* 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 <QMainWindow>
-#include <QProcess>
-#include <QTimer>
-
-#include "logic/BaseInstance.h"
-#include "logic/auth/MojangAccount.h"
-#include "logic/net/NetJob.h"
-#include "logic/updater/GoUpdate.h"
-
-class NewsChecker;
-class NotificationChecker;
-class QToolButton;
-class InstanceProxyModel;
-class LabeledToolButton;
-class QLabel;
-class MinecraftProcess;
-class ConsoleWindow;
-class BaseProfilerFactory;
-class GenericPageProvider;
-
-namespace Ui
-{
-class MainWindow;
-}
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- explicit MainWindow(QWidget *parent = 0);
- ~MainWindow();
-
- void closeEvent(QCloseEvent *event);
-
- // Browser Dialog
- void openWebPage(QUrl url);
-
- void checkSetDefaultJava();
- void checkInstancePathForProblems();
-
-private
-slots:
- void onCatToggled(bool);
-
- void on_actionAbout_triggered();
-
- void on_actionAddInstance_triggered();
-
- void on_actionCopyInstance_triggered();
-
- void on_actionChangeInstGroup_triggered();
-
- void on_actionChangeInstIcon_triggered();
-
- void on_actionViewInstanceFolder_triggered();
-
- void on_actionConfig_Folder_triggered();
-
- void on_actionViewSelectedInstFolder_triggered();
-
- void on_actionRefresh_triggered();
-
- void on_actionViewCentralModsFolder_triggered();
-
- void on_actionCheckUpdate_triggered();
-
- void on_actionSettings_triggered();
-
- void on_actionInstanceSettings_triggered();
-
- void on_actionManageAccounts_triggered();
-
- void on_actionReportBug_triggered();
-
- void on_actionPatreon_triggered();
-
- void on_actionMoreNews_triggered();
-
- void newsButtonClicked();
-
- void on_mainToolBar_visibilityChanged(bool);
-
- // void on_instanceView_customContextMenuRequested(const QPoint &pos);
-
- void on_actionLaunchInstance_triggered();
-
- void on_actionLaunchInstanceOffline_triggered();
-
- void on_actionDeleteInstance_triggered();
-
- void on_actionExportInstance_triggered();
-
- void on_actionRenameInstance_triggered();
-
- void on_actionEditInstance_triggered();
-
- void on_actionEditInstNotes_triggered();
-
- void on_actionScreenshots_triggered();
-
- /*!
- * Launches the currently selected instance with the default account.
- * If no default account is selected, prompts the user to pick an account.
- */
- void doLaunch(bool online = true, BaseProfilerFactory *profiler = 0);
-
- /*!
- * Launches the given instance with the given account.
- * This function assumes that the given account has a valid, usable access token.
- */
- void launchInstance(InstancePtr instance, AuthSessionPtr session, BaseProfilerFactory *profiler = 0);
-
- /*!
- * Prepares the given instance for launch with the given account.
- */
- void updateInstance(InstancePtr instance, AuthSessionPtr account, BaseProfilerFactory *profiler = 0);
-
- void onGameUpdateError(QString error);
-
- void taskStart();
- void taskEnd();
-
- void instanceEnded();
-
- // called when an icon is changed in the icon model.
- void iconUpdated(QString);
-
- void showInstanceContextMenu(const QPoint &);
-
- void updateToolsMenu();
-
- void skinJobFinished();
-public
-slots:
- void instanceActivated(QModelIndex);
-
- void instanceChanged(const QModelIndex &current, const QModelIndex &previous);
-
- void selectionBad();
-
- void startTask(Task *task);
-
- void updateAvailable(GoUpdate::Status status);
-
- void updateNotAvailable();
-
- void notificationsChanged();
-
- void activeAccountChanged();
-
- void changeActiveAccount();
-
- void repopulateAccountsMenu();
-
- void updateNewsLabel();
-
- /*!
- * Runs the DownloadTask and installs updates.
- */
- void downloadUpdates(GoUpdate::Status status, bool installOnExit = false);
-
-protected:
- bool eventFilter(QObject *obj, QEvent *ev);
- void setCatBackground(bool enabled);
- void updateInstanceToolIcon(QString new_icon);
-
- void setSelectedInstanceById(const QString &id);
-
- void waitForMinecraftVersions();
- void instanceFromVersion(QString instName, QString instGroup, QString instIcon, BaseVersionPtr version);
- void instanceFromZipPack(QString instName, QString instGroup, QString instIcon, QUrl url);
- void finalizeInstance(InstancePtr inst);
-
-private:
- Ui::MainWindow *ui;
- class GroupView *view;
- InstanceProxyModel *proxymodel;
- NetJobPtr skin_download_job;
- MinecraftProcess *proc;
- ConsoleWindow *console;
- LabeledToolButton *renameButton;
- QToolButton *changeIconButton;
- QToolButton *newsLabel;
-
- std::shared_ptr<GenericPageProvider> m_globalSettingsProvider;
- std::shared_ptr<NewsChecker> m_newsChecker;
- std::shared_ptr<NotificationChecker> m_notificationChecker;
-
- InstancePtr m_selectedInstance;
- QString m_currentInstIcon;
-
- Task *m_versionLoadTask;
-
- QLabel *m_statusLeft;
- class ServerStatus *m_statusRight;
-
- QMenu *accountMenu;
- QToolButton *accountMenuButton;
- QAction *manageAccountsAction;
-};
diff --git a/gui/NagUtils.cpp b/gui/NagUtils.cpp
deleted file mode 100644
index 429bdfcf..00000000
--- a/gui/NagUtils.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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();
- }
-}
-}
diff --git a/gui/NagUtils.h b/gui/NagUtils.h
deleted file mode 100644
index d757703a..00000000
--- a/gui/NagUtils.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* 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);
-}
diff --git a/gui/Platform.h b/gui/Platform.h
deleted file mode 100644
index 349e5ecc..00000000
--- a/gui/Platform.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright 2013-2015 MultiMC Contributors
- *
- * Authors: Orochimarufan <orochimarufan.x3@gmail.com>
- *
- * 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
-
-/**
- * @file Platform.h
- * This file contains platform-specific functions, tweaks and fixes.
- */
-
-#include <QWidget>
-
-class MultiMCPlatform
-{
-public:
- // X11 WM_CLASS
- static void fixWM_CLASS(QWidget *widget);
-};
diff --git a/gui/Platform_Other.cpp b/gui/Platform_Other.cpp
deleted file mode 100644
index 197af55e..00000000
--- a/gui/Platform_Other.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright 2013-2015 MultiMC Contributors
- *
- * Authors: Orochimarufan <orochimarufan.x3@gmail.com>
- *
- * 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/Platform.h>
-/**
- * Stub for non-X11 platforms
- * @brief MultiMCPlatform::fixWM_CLASS
- * @param widget
- */
-void MultiMCPlatform::fixWM_CLASS(QWidget *widget)
-{
- Q_UNUSED(widget);
-}
diff --git a/gui/Platform_X11.cpp b/gui/Platform_X11.cpp
deleted file mode 100644
index b6a6cbce..00000000
--- a/gui/Platform_X11.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright 2013-2015 MultiMC Contributors
- *
- * Authors: Orochimarufan <orochimarufan.x3@gmail.com>
- *
- * 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/Platform.h>
-#include <QtX11Extras/QX11Info>
-#include <xcb/xcb.h>
-
-static QByteArray WM_CLASS = "MultiMC5\0MultiMC5";
-
-template <typename... ArgTypes, typename... ArgTypes2>
-static inline unsigned int XcbCallVoid(xcb_void_cookie_t (*func)(xcb_connection_t *, ArgTypes...), ArgTypes2... args...)
-{
- return func(QX11Info::connection(), args...).sequence;
-}
-
-static void getAtoms(size_t n, xcb_atom_t *atoms, const char *const names[], bool create)
-{
- xcb_connection_t *conn = QX11Info::connection();
- xcb_intern_atom_cookie_t *cookies = (xcb_intern_atom_cookie_t *)malloc(sizeof(xcb_intern_atom_cookie_t) * 2);
- for (size_t i = 0; i < n; ++i)
- cookies[i] = xcb_intern_atom(conn, create, strlen(names[i]), names[i]);
- memset(atoms, 0, sizeof(xcb_atom_t) * n);
- for (size_t i = 0; i < n; ++i)
- {
- xcb_intern_atom_reply_t *r = xcb_intern_atom_reply(conn, cookies[i], 0);
- if (r)
- {
- atoms[i] = r->atom;
- free(r);
- }
- }
- free(cookies);
-}
-
-static inline xcb_atom_t getAtom(const char *name, bool create=false)
-{
- xcb_atom_t atom;
- getAtoms(1, &atom, &name, create);
- return atom;
-}
-
-void MultiMCPlatform::fixWM_CLASS(QWidget *widget)
-{
- static const xcb_atom_t atom = getAtom("WM_CLASS");
- XcbCallVoid(xcb_change_property, XCB_PROP_MODE_REPLACE,
- widget->winId(), atom, XCB_ATOM_STRING, 8, WM_CLASS.count(),
- WM_CLASS.constData());
-}
diff --git a/gui/dialogs/AboutDialog.cpp b/gui/dialogs/AboutDialog.cpp
deleted file mode 100644
index ee08beea..00000000
--- a/gui/dialogs/AboutDialog.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* 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 "AboutDialog.h"
-#include "ui_AboutDialog.h"
-#include <QIcon>
-#include "MultiMC.h"
-#include "gui/Platform.h"
-#include "BuildConfig.h"
-
-#include <logic/net/NetJob.h>
-
-// Credits
-// This is a hack, but I can't think of a better way to do this easily without screwing with QTextDocument...
-QString getCreditsHtml(QStringList patrons)
-{
- QString creditsHtml = QObject::tr(
- "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN' 'http://www.w3.org/TR/REC-html40/strict.dtd'>"
- "<html>"
- ""
- "<head>"
- "<meta name='qrichtext' content='1' />"
- "<style type='text/css'>"
- "p { white-space: pre-wrap; margin-top:2px; margin-bottom:2px; }"
- "</style>"
- "</head>"
- ""
- "<body style=' font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;'>"
- ""
- "<h3>MultiMC Developers</h3>"
- "<p>Andrew Okin &lt;<a href='mailto:forkk@forkk.net'>forkk@forkk.net</a>&gt;</p>"
- "<p>Petr Mrázek &lt;<a href='mailto:peterix@gmail.com'>peterix@gmail.com</a>&gt;</p>"
- "<p>Sky Welch &lt;<a href='mailto:multimc@bunnies.io'>multimc@bunnies.io</a>&gt;</p>"
- "<p>Jan (02JanDal) &lt;<a href='mailto:02jandal@gmail.com'>02jandal@gmail.com</a>&gt;</p>"
- ""
- "<h3>With thanks to</h3>"
- "<p>Orochimarufan &lt;<a href='mailto:orochimarufan.x3@gmail.com'>orochimarufan.x3@gmail.com</a>&gt;</p>"
- "<p>TakSuyu &lt;<a href='mailto:taksuyu@gmail.com'>taksuyu@gmail.com</a>&gt;</p>"
- "<p>Kilobyte &lt;<a href='mailto:stiepen22@gmx.de'>stiepen22@gmx.de</a>&gt;</p>"
- "<p>Robotbrain &lt;<a href='https://twitter.com/skylordelros'>@skylordelros</a>&gt;</p>"
- "<p>Rootbear75 &lt;<a href='https://twitter.com/rootbear75'>@rootbear75</a>&gt; (build server)</p>"
- ""
- "<h3>Patreon Patrons</h3>"
- "%1"
- ""
- "</body>"
- "</html>");
- if (patrons.isEmpty())
- return creditsHtml.arg(QObject::tr("<p>Loading...</p>"));
- else
- {
- QString patronsStr;
- for (QString patron : patrons)
- {
- patronsStr.append(QString("<p>%1</p>").arg(patron));
- }
-
- return creditsHtml.arg(patronsStr);
- }
-}
-
-AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- ui->setupUi(this);
-
- QString chtml = getCreditsHtml(QStringList());
- ui->creditsText->setHtml(chtml);
-
- ui->urlLabel->setOpenExternalLinks(true);
-
- ui->icon->setPixmap(MMC->getThemedIcon("multimc").pixmap(64));
- ui->title->setText("MultiMC 5");
-
- ui->versionLabel->setText(tr("Version") +": " + BuildConfig.printableVersionString());
- ui->platformLabel->setText(tr("Platform") +": " + BuildConfig.BUILD_PLATFORM);
-
- if (BuildConfig.VERSION_BUILD >= 0)
- ui->buildNumLabel->setText(tr("Build Number") +": " + QString::number(BuildConfig.VERSION_BUILD));
- else
- ui->buildNumLabel->setVisible(false);
-
- if (!BuildConfig.VERSION_CHANNEL.isEmpty())
- ui->channelLabel->setText(tr("Channel") +": " + BuildConfig.VERSION_CHANNEL);
- else
- ui->channelLabel->setVisible(false);
-
- connect(ui->closeButton, SIGNAL(clicked()), SLOT(close()));
-
- connect(ui->aboutQt, &QPushButton::clicked, &QApplication::aboutQt);
-
- loadPatronList();
-}
-
-AboutDialog::~AboutDialog()
-{
- delete ui;
-}
-
-void AboutDialog::loadPatronList()
-{
- NetJob* job = new NetJob("Patreon Patron List");
- patronListDownload = ByteArrayDownload::make(QUrl("http://files.multimc.org/patrons.txt"));
- job->addNetAction(patronListDownload);
- connect(job, &NetJob::succeeded, this, &AboutDialog::patronListLoaded);
- job->start();
-}
-
-void AboutDialog::patronListLoaded()
-{
- QString patronListStr(patronListDownload->m_data);
- QString html = getCreditsHtml(patronListStr.split("\n", QString::SkipEmptyParts));
- ui->creditsText->setHtml(html);
-}
-
diff --git a/gui/dialogs/AboutDialog.h b/gui/dialogs/AboutDialog.h
deleted file mode 100644
index 2022e9a3..00000000
--- a/gui/dialogs/AboutDialog.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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 <QDialog>
-
-#include <logic/net/ByteArrayDownload.h>
-
-namespace Ui
-{
-class AboutDialog;
-}
-
-class AboutDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit AboutDialog(QWidget *parent = 0);
- ~AboutDialog();
-
-public
-slots:
- /// Starts loading a list of Patreon patrons.
- void loadPatronList();
-
- /// Slot for when the patron list loads successfully.
- void patronListLoaded();
-
-private:
- Ui::AboutDialog *ui;
-
- ByteArrayDownloadPtr patronListDownload;
-};
diff --git a/gui/dialogs/AboutDialog.ui b/gui/dialogs/AboutDialog.ui
deleted file mode 100644
index 2b5f8b78..00000000
--- a/gui/dialogs/AboutDialog.ui
+++ /dev/null
@@ -1,544 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AboutDialog</class>
- <widget class="QDialog" name="AboutDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>707</width>
- <height>593</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>450</width>
- <height>400</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>About MultiMC</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="icon">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>64</width>
- <height>64</height>
- </size>
- </property>
- <property name="baseSize">
- <size>
- <width>64</width>
- <height>64</height>
- </size>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLabel" name="title">
- <property name="font">
- <font>
- <pointsize>15</pointsize>
- </font>
- </property>
- <property name="text">
- <string>MultiMC 5</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolBox" name="toolBox">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="aboutPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>695</width>
- <height>297</height>
- </rect>
- </property>
- <attribute name="label">
- <string>About</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel" name="versionLabel">
- <property name="text">
- <string>Version:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="platformLabel">
- <property name="text">
- <string>Platform:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="buildNumLabel">
- <property name="text">
- <string>Build Number:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="channelLabel">
- <property name="text">
- <string>Channel:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="aboutLabel">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;MultiMC is a custom launcher that makes managing Minecraft easier by allowing you to have multiple instances of Minecraft at once.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="copyLabel">
- <property name="font">
- <font>
- <pointsize>8</pointsize>
- <kerning>true</kerning>
- </font>
- </property>
- <property name="text">
- <string>© 2013-2015 MultiMC Contributors</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="urlLabel">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://github.com/MultiMC/MultiMC5&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://github.com/MultiMC/MultiMC5&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="creditsPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>695</width>
- <height>297</height>
- </rect>
- </property>
- <attribute name="label">
- <string>Credits</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QTextEdit" name="creditsText">
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="html">
- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Oxygen-Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextBrowserInteraction</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="translationInfo">
- <property name="text">
- <string extracomment="Hey, Translator, feel free to put credit to you here">No Language file loaded.</string>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="licensePage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>695</width>
- <height>297</height>
- </rect>
- </property>
- <attribute name="label">
- <string>License</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QTextEdit" name="licenseText">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="font">
- <font>
- <family>DejaVu Sans Mono</family>
- </font>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="html">
- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans Mono'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;MultiMC&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Copyright 2012-2014 MultiMC Contributors&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;you may not use this file except in compliance with the License.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;You may obtain a copy of the License at&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; http://www.apache.org/licenses/LICENSE-2.0&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Unless required by applicable law or agreed to in writing, software&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;See the License for the specific language governing permissions and&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;limitations under the License.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;QSLog&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Copyright (c) 2010, Razvan Petru&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;All rights reserved.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Redistribution and use in source and binary forms, with or without modification,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;are permitted provided that the following conditions are met:&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;* Redistributions of source code must retain the above copyright notice, this&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; list of conditions and the following disclaimer.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;* Redistributions in binary form must reproduce the above copyright notice, this&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; list of conditions and the following disclaimer in the documentation and/or other&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; materials provided with the distribution.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;* The name of the contributors may not be used to endorse or promote products&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; derived from this software without specific prior written permission.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &amp;quot;AS IS&amp;quot; AND&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;OF THE POSSIBILITY OF SUCH DAMAGE.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;Group View (instance view)&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; /*&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Copyright (C) 2007 Rafael Fernández López &amp;lt;ereslibre@kde.org&amp;gt;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Copyright (C) 2007 John Tapsell &amp;lt;tapsell@kde.org&amp;gt;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; *&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * This library is free software; you can redistribute it and/or&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * modify it under the terms of the GNU Library General Public&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * License as published by the Free Software Foundation; either&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * version 2 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; *&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * This library is distributed in the hope that it will be useful,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Library General Public License for more details.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; *&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * You should have received a copy of the GNU Library General Public License&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * along with this library; see the file COPYING.LIB. If not, write to&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Boston, MA 02110-1301, USA.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; */&lt;/span&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;Batch icon set&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;You are free to use Batch (the &amp;quot;icon set&amp;quot;) or any part thereof (the &amp;quot;icons&amp;quot;)&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;in any personal, open-source or commercial work without obligation of payment&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;(monetary or otherwise) or attribution. Do not sell the icon set, host&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;the icon set or rent the icon set (either in existing or modified form).&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;While attribution is optional, it is always appreciated.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Intellectual property rights are not transferred with the download of the icons.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL ADAM WHITCROFT&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THE USE OF THE ICONS,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://adamwhitcroft.com/batch/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#68a0df;&quot;&gt;http://adamwhitcroft.com/batch/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;Pack200&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;The GNU General Public License (GPL)&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Version 2, June 1991&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;+ &amp;quot;CLASSPATH&amp;quot; EXCEPTION TO THE GPL&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Certain source files distributed by Oracle America and/or its affiliates are&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;subject to the following clarification and special exception to the GPL, but&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;only where Oracle has expressly included in the particular source file's header&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;the words &amp;quot;Oracle designates this particular file as subject to the &amp;quot;Classpath&amp;quot;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;exception as provided by Oracle in the LICENSE file that accompanied this code.&amp;quot;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; Linking this library statically or dynamically with other modules is making&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; a combined work based on this library. Thus, the terms and conditions of&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; the GNU General Public License cover the whole combination.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; As a special exception, the copyright holders of this library give you&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; permission to link this library with independent modules to produce an&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; executable, regardless of the license terms of these independent modules,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; and to copy and distribute the resulting executable under terms of your&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; choice, provided that you also meet, for each linked independent module,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; the terms and conditions of the license of that module. An independent&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; module is a module which is not derived from or based on this library. If&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; you modify this library, you may extend this exception to your version of&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; the library, but you are not obligated to do so. If you do not wish to do&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; so, delete this exception statement from your version.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;Quazip&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Copyright (C) 2005-2011 Sergey A. Tachenov&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;This program is free software; you can redistribute it and/or modify it&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;under the terms of the GNU Lesser General Public License as published by&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;the Free Software Foundation; either version 2 of the License, or (at&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;your option) any later version.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;This program is distributed in the hope that it will be useful, but&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;WITHOUT ANY WARRANTY; without even the implied warranty of&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;General Public License for more details.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;You should have received a copy of the GNU Lesser General Public License&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;along with this program; if not, write to the Free Software Foundation,&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;See COPYING file for the full LGPL text.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Original ZIP package is copyrighted by Gilles Vollant, see&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;quazip/(un)zip.h files for details, basically it's zlib license.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;xz-minidec&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;/*&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * XZ decompressor&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; *&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Authors: Lasse Collin &amp;lt;lasse.collin@tukaani.org&amp;gt;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Igor Pavlov &amp;lt;http://7-zip.org/&amp;gt;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; *&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * This file has been put into the public domain.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * You can do whatever you want with this file.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; */&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;Java IconLoader class&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Copyright (c) 2011, Chris Molini&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;All rights reserved.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Redistribution and use in source and binary forms, with or without&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;modification, are permitted provided that the following conditions are met:&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Redistributions of source code must retain the above copyright&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; notice, this list of conditions and the following disclaimer.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Redistributions in binary form must reproduce the above copyright&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; notice, this list of conditions and the following disclaimer in the&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; documentation and/or other materials provided with the distribution.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Neither the name of the &amp;lt;organization&amp;gt; nor the&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; names of its contributors may be used to endorse or promote products&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; derived from this software without specific prior written permission.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &amp;quot;AS IS&amp;quot; AND&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;DISCLAIMED. IN NO EVENT SHALL &amp;lt;COPYRIGHT HOLDER&amp;gt; BE LIABLE FOR ANY&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;/span&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;&quot;&gt;ColumnResizer&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;/*&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * Copyright 2011 Aurélien Gâteau &amp;lt;agateau@kde.org&amp;gt;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; * License: LGPL v2.1 or later (see COPYING)&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; */&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextBrowserInteraction</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="forkPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>695</width>
- <height>297</height>
- </rect>
- </property>
- <attribute name="label">
- <string>Forking/Redistribution</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_33">
- <item>
- <widget class="QTextEdit" name="textEdit">
- <property name="html">
- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Oxygen-Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans';&quot;&gt;We keep MultiMC open source because we think it's important to be able to see the source code for a project like this, and we do so using the Apache license.&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Bitstream Vera Sans';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans';&quot;&gt;Part of the reason for using the Apache license is we don't want people using the &amp;quot;MultiMC&amp;quot; name when redistributing the project. This means people must take the time to go through the source code and remove all references to &amp;quot;MultiMC&amp;quot;, including but not limited to the project icon and the title of windows, (no *MultiMC-fork* in the title).&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Bitstream Vera Sans';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans';&quot;&gt;The Apache license covers reasonable use for the name - a mention of the project's origins in the About dialog and the license is acceptable. However, it should be abundantly clear that the project is a fork &lt;/span&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-weight:600;&quot;&gt;without&lt;/span&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans';&quot;&gt; implying that you have our blessing.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QPushButton" name="aboutQt">
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>About Qt</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="closeButton">
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources>
- <include location="../../resources/multimc/multimc.qrc"/>
- </resources>
- <connections/>
-</ui>
diff --git a/gui/dialogs/AccountSelectDialog.cpp b/gui/dialogs/AccountSelectDialog.cpp
deleted file mode 100644
index 6ae60738..00000000
--- a/gui/dialogs/AccountSelectDialog.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* 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 "AccountSelectDialog.h"
-#include "ui_AccountSelectDialog.h"
-
-#include <QItemSelectionModel>
-
-#include <QDebug>
-
-#include <gui/dialogs/ProgressDialog.h>
-
-#include <MultiMC.h>
-
-AccountSelectDialog::AccountSelectDialog(const QString &message, int flags, QWidget *parent)
- : QDialog(parent), ui(new Ui::AccountSelectDialog)
-{
- ui->setupUi(this);
-
- m_accounts = MMC->accounts();
- ui->listView->setModel(m_accounts.get());
- ui->listView->hideColumn(MojangAccountList::ActiveColumn);
-
- // Set the message label.
- ui->msgLabel->setVisible(!message.isEmpty());
- ui->msgLabel->setText(message);
-
- // Flags...
- ui->globalDefaultCheck->setVisible(flags & GlobalDefaultCheckbox);
- ui->instDefaultCheck->setVisible(flags & InstanceDefaultCheckbox);
- qDebug() << flags;
-
- // Select the first entry in the list.
- ui->listView->setCurrentIndex(ui->listView->model()->index(0, 0));
-
- connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), SLOT(on_buttonBox_accepted()));
-}
-
-AccountSelectDialog::~AccountSelectDialog()
-{
- delete ui;
-}
-
-MojangAccountPtr AccountSelectDialog::selectedAccount() const
-{
- return m_selected;
-}
-
-bool AccountSelectDialog::useAsGlobalDefault() const
-{
- return ui->globalDefaultCheck->isChecked();
-}
-
-bool AccountSelectDialog::useAsInstDefaullt() const
-{
- return ui->instDefaultCheck->isChecked();
-}
-
-void AccountSelectDialog::on_buttonBox_accepted()
-{
- QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
- if (selection.size() > 0)
- {
- QModelIndex selected = selection.first();
- m_selected = selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>();
- }
- close();
-}
-
-void AccountSelectDialog::on_buttonBox_rejected()
-{
- close();
-}
diff --git a/gui/dialogs/AccountSelectDialog.h b/gui/dialogs/AccountSelectDialog.h
deleted file mode 100644
index 0bf9b403..00000000
--- a/gui/dialogs/AccountSelectDialog.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* 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 <QDialog>
-
-#include <memory>
-
-#include "logic/auth/MojangAccountList.h"
-
-namespace Ui
-{
-class AccountSelectDialog;
-}
-
-class AccountSelectDialog : public QDialog
-{
- Q_OBJECT
-public:
- enum Flags
- {
- NoFlags = 0,
-
- /*!
- * Shows a check box on the dialog that allows the user to specify that the account
- * they've selected should be used as the global default for all instances.
- */
- GlobalDefaultCheckbox,
-
- /*!
- * Shows a check box on the dialog that allows the user to specify that the account
- * they've selected should be used as the default for the instance they are currently launching.
- * This is not currently implemented.
- */
- InstanceDefaultCheckbox,
- };
-
- /*!
- * Constructs a new account select dialog with the given parent and message.
- * The message will be shown at the top of the dialog. It is an empty string by default.
- */
- explicit AccountSelectDialog(const QString& message="", int flags=0, QWidget *parent = 0);
- ~AccountSelectDialog();
-
- /*!
- * Gets a pointer to the account that the user selected.
- * This is null if the user clicked cancel or hasn't clicked OK yet.
- */
- MojangAccountPtr selectedAccount() const;
-
- /*!
- * Returns true if the user checked the "use as global default" checkbox.
- * If the checkbox wasn't shown, this function returns false.
- */
- bool useAsGlobalDefault() const;
-
- /*!
- * Returns true if the user checked the "use as instance default" checkbox.
- * If the checkbox wasn't shown, this function returns false.
- */
- bool useAsInstDefaullt() const;
-
-public
-slots:
- void on_buttonBox_accepted();
-
- void on_buttonBox_rejected();
-
-protected:
- std::shared_ptr<MojangAccountList> m_accounts;
-
- //! The account that was selected when the user clicked OK.
- MojangAccountPtr m_selected;
-
-private:
- Ui::AccountSelectDialog *ui;
-};
diff --git a/gui/dialogs/AccountSelectDialog.ui b/gui/dialogs/AccountSelectDialog.ui
deleted file mode 100644
index 7af1512a..00000000
--- a/gui/dialogs/AccountSelectDialog.ui
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AccountSelectDialog</class>
- <widget class="QDialog" name="AccountSelectDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>413</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Select an Account</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="msgLabel">
- <property name="text">
- <string>Select an account.</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTreeView" name="listView"/>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="globalDefaultCheck">
- <property name="text">
- <string>Use as default?</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="instDefaultCheck">
- <property name="text">
- <string>Use as default for this instance only?</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/dialogs/CopyInstanceDialog.cpp b/gui/dialogs/CopyInstanceDialog.cpp
deleted file mode 100644
index 038fb896..00000000
--- a/gui/dialogs/CopyInstanceDialog.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 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 <QLayout>
-#include <QPushButton>
-
-#include "MultiMC.h"
-#include "CopyInstanceDialog.h"
-#include "ui_CopyInstanceDialog.h"
-
-#include "gui/Platform.h"
-#include "gui/dialogs/VersionSelectDialog.h"
-#include "gui/dialogs/ProgressDialog.h"
-#include "gui/dialogs/IconPickerDialog.h"
-
-#include "logic/BaseVersion.h"
-#include "logic/icons/IconList.h"
-#include "logic/tasks/Task.h"
-#include "logic/BaseInstance.h"
-#include "logic/InstanceList.h"
-
-CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent)
- :QDialog(parent), ui(new Ui::CopyInstanceDialog), m_original(original)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- ui->setupUi(this);
- resize(minimumSizeHint());
- layout()->setSizeConstraint(QLayout::SetFixedSize);
-
- InstIconKey = original->iconKey();
- ui->iconButton->setIcon(ENV.icons()->getIcon(InstIconKey));
- ui->instNameTextBox->setText(original->name());
- ui->instNameTextBox->setFocus();
- auto groups = MMC->instances()->getGroups().toSet();
- auto groupList = QStringList(groups.toList());
- groupList.sort(Qt::CaseInsensitive);
- groupList.removeOne("");
- groupList.push_front("");
- ui->groupBox->addItems(groupList);
- int index = groupList.indexOf(m_original->group());
- if(index == -1)
- {
- index = 0;
- }
- ui->groupBox->setCurrentIndex(index);
- ui->groupBox->lineEdit()->setPlaceholderText(tr("No group"));
-}
-
-CopyInstanceDialog::~CopyInstanceDialog()
-{
- delete ui;
-}
-
-void CopyInstanceDialog::updateDialogState()
-{
- ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!instName().isEmpty());
-}
-
-QString CopyInstanceDialog::instName() const
-{
- return ui->instNameTextBox->text();
-}
-
-QString CopyInstanceDialog::iconKey() const
-{
- return InstIconKey;
-}
-
-QString CopyInstanceDialog::instGroup() const
-{
- return ui->groupBox->currentText();
-}
-
-void CopyInstanceDialog::on_iconButton_clicked()
-{
- IconPickerDialog dlg(this);
- dlg.exec(InstIconKey);
-
- if (dlg.result() == QDialog::Accepted)
- {
- InstIconKey = dlg.selectedIconKey;
- ui->iconButton->setIcon(ENV.icons()->getIcon(InstIconKey));
- }
-}
-
-void CopyInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1)
-{
- updateDialogState();
-}
diff --git a/gui/dialogs/CopyInstanceDialog.h b/gui/dialogs/CopyInstanceDialog.h
deleted file mode 100644
index 9e27d4ea..00000000
--- a/gui/dialogs/CopyInstanceDialog.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* 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 <QDialog>
-#include "logic/BaseVersion.h"
-#include <logic/BaseInstance.h>
-
-class BaseInstance;
-
-namespace Ui
-{
-class CopyInstanceDialog;
-}
-
-class CopyInstanceDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit CopyInstanceDialog(InstancePtr original, QWidget *parent = 0);
- ~CopyInstanceDialog();
-
- void updateDialogState();
-
- QString instName() const;
- QString instGroup() const;
- QString iconKey() const;
-
-private
-slots:
- void on_iconButton_clicked();
- void on_instNameTextBox_textChanged(const QString &arg1);
-
-private:
- Ui::CopyInstanceDialog *ui;
- QString InstIconKey;
- InstancePtr m_original;
-};
diff --git a/gui/dialogs/CopyInstanceDialog.ui b/gui/dialogs/CopyInstanceDialog.ui
deleted file mode 100644
index 2615168c..00000000
--- a/gui/dialogs/CopyInstanceDialog.ui
+++ /dev/null
@@ -1,161 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>CopyInstanceDialog</class>
- <widget class="QDialog" name="CopyInstanceDialog">
- <property name="windowModality">
- <enum>Qt::ApplicationModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>345</width>
- <height>205</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Copy Instance</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>:/icons/toolbar/copy</normaloff>:/icons/toolbar/copy</iconset>
- </property>
- <property name="modal">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="iconBtnLayout">
- <item>
- <spacer name="iconBtnLeftSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="iconButton">
- <property name="icon">
- <iconset>
- <normaloff>:/icons/instances/infinity</normaloff>:/icons/instances/infinity</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>80</width>
- <height>80</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="iconBtnRightSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLineEdit" name="instNameTextBox">
- <property name="placeholderText">
- <string>Name</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="labelVersion_3">
- <property name="text">
- <string>Group</string>
- </property>
- <property name="buddy">
- <cstring>groupBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2">
- <widget class="QComboBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </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>
- </widget>
- <resources>
- <include location="../../graphics.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>CopyInstanceDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>CopyInstanceDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/gui/dialogs/CustomMessageBox.cpp b/gui/dialogs/CustomMessageBox.cpp
deleted file mode 100644
index 0fb5bd19..00000000
--- a/gui/dialogs/CustomMessageBox.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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 "CustomMessageBox.h"
-
-namespace CustomMessageBox
-{
-QMessageBox *selectable(QWidget *parent, const QString &title, const QString &text,
- QMessageBox::Icon icon, QMessageBox::StandardButtons buttons,
- QMessageBox::StandardButton defaultButton)
-{
- QMessageBox *messageBox = new QMessageBox(parent);
- messageBox->setWindowTitle(title);
- messageBox->setText(text);
- messageBox->setStandardButtons(buttons);
- messageBox->setDefaultButton(defaultButton);
- messageBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
- messageBox->setIcon(icon);
- messageBox->setTextInteractionFlags(Qt::TextBrowserInteraction);
-
- return messageBox;
-}
-}
diff --git a/gui/dialogs/CustomMessageBox.h b/gui/dialogs/CustomMessageBox.h
deleted file mode 100644
index 0a7202d7..00000000
--- a/gui/dialogs/CustomMessageBox.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* 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 <QMessageBox>
-
-namespace CustomMessageBox
-{
-QMessageBox *selectable(QWidget *parent, const QString &title, const QString &text,
- QMessageBox::Icon icon = QMessageBox::NoIcon,
- QMessageBox::StandardButtons buttons = QMessageBox::Ok,
- QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
-}
diff --git a/gui/dialogs/EditAccountDialog.cpp b/gui/dialogs/EditAccountDialog.cpp
deleted file mode 100644
index b78cebee..00000000
--- a/gui/dialogs/EditAccountDialog.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/* 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 "EditAccountDialog.h"
-#include "ui_EditAccountDialog.h"
-#include <QDesktopServices>
-#include <QUrl>
-
-EditAccountDialog::EditAccountDialog(const QString &text, QWidget *parent, int flags)
- : QDialog(parent), ui(new Ui::EditAccountDialog)
-{
- ui->setupUi(this);
-
- ui->label->setText(text);
- ui->label->setVisible(!text.isEmpty());
-
- ui->userTextBox->setVisible(flags & UsernameField);
- ui->passTextBox->setVisible(flags & PasswordField);
-}
-
-EditAccountDialog::~EditAccountDialog()
-{
- delete ui;
-}
-
-void EditAccountDialog::on_label_linkActivated(const QString &link)
-{
- QDesktopServices::openUrl(QUrl(link));
-}
-
-QString EditAccountDialog::username() const
-{
- return ui->userTextBox->text();
-}
-
-QString EditAccountDialog::password() const
-{
- return ui->passTextBox->text();
-}
diff --git a/gui/dialogs/EditAccountDialog.h b/gui/dialogs/EditAccountDialog.h
deleted file mode 100644
index df8b21bf..00000000
--- a/gui/dialogs/EditAccountDialog.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* 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 <QDialog>
-
-namespace Ui
-{
-class EditAccountDialog;
-}
-
-class EditAccountDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit EditAccountDialog(const QString &text = "", QWidget *parent = 0,
- int flags = UsernameField | PasswordField);
- ~EditAccountDialog();
-
- /*!
- * Gets the text entered in the dialog's username field.
- */
- QString username() const;
-
- /*!
- * Gets the text entered in the dialog's password field.
- */
- QString password() const;
-
- enum Flags
- {
- NoFlags = 0,
-
- //! Specifies that the dialog should have a username field.
- UsernameField,
-
- //! Specifies that the dialog should have a password field.
- PasswordField,
- };
-
-private slots:
- void on_label_linkActivated(const QString &link);
-
-private:
- Ui::EditAccountDialog *ui;
-};
diff --git a/gui/dialogs/EditAccountDialog.ui b/gui/dialogs/EditAccountDialog.ui
deleted file mode 100644
index 5f727bd4..00000000
--- a/gui/dialogs/EditAccountDialog.ui
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>EditAccountDialog</class>
- <widget class="QDialog" name="EditAccountDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>148</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Edit Account</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Message label placeholder.</string>
- </property>
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="userTextBox">
- <property name="placeholderText">
- <string>Email / Username</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="passTextBox">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- <property name="placeholderText">
- <string>Password</string>
- </property>
- </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>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>EditAccountDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>EditAccountDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/gui/dialogs/IconPickerDialog.cpp b/gui/dialogs/IconPickerDialog.cpp
deleted file mode 100644
index 90bf2ef4..00000000
--- a/gui/dialogs/IconPickerDialog.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/* 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 <QKeyEvent>
-#include <QPushButton>
-#include <QFileDialog>
-
-#include "MultiMC.h"
-
-#include "IconPickerDialog.h"
-#include "ui_IconPickerDialog.h"
-
-#include "gui/Platform.h"
-#include "gui/groupview/InstanceDelegate.h"
-
-#include "logic/icons/IconList.h"
-
-IconPickerDialog::IconPickerDialog(QWidget *parent)
- : QDialog(parent), ui(new Ui::IconPickerDialog)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- ui->setupUi(this);
- setWindowModality(Qt::WindowModal);
-
- auto contentsWidget = ui->iconView;
- contentsWidget->setViewMode(QListView::IconMode);
- contentsWidget->setFlow(QListView::LeftToRight);
- contentsWidget->setIconSize(QSize(48, 48));
- contentsWidget->setMovement(QListView::Static);
- contentsWidget->setResizeMode(QListView::Adjust);
- contentsWidget->setSelectionMode(QAbstractItemView::SingleSelection);
- contentsWidget->setSpacing(5);
- contentsWidget->setWordWrap(false);
- contentsWidget->setWrapping(true);
- contentsWidget->setUniformItemSizes(true);
- contentsWidget->setTextElideMode(Qt::ElideRight);
- contentsWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- contentsWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
- contentsWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- contentsWidget->setItemDelegate(new ListViewDelegate());
-
- // contentsWidget->setAcceptDrops(true);
- contentsWidget->setDropIndicatorShown(true);
- contentsWidget->viewport()->setAcceptDrops(true);
- contentsWidget->setDragDropMode(QAbstractItemView::DropOnly);
- contentsWidget->setDefaultDropAction(Qt::CopyAction);
-
- contentsWidget->installEventFilter(this);
-
- contentsWidget->setModel(ENV.icons().get());
-
- auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"), QDialogButtonBox::ResetRole);
- auto buttonRemove =
- ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole);
-
- connect(buttonAdd, SIGNAL(clicked(bool)), SLOT(addNewIcon()));
- connect(buttonRemove, SIGNAL(clicked(bool)), SLOT(removeSelectedIcon()));
-
- connect(contentsWidget, SIGNAL(doubleClicked(QModelIndex)), SLOT(activated(QModelIndex)));
-
- connect(contentsWidget->selectionModel(),
- SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
- SLOT(selectionChanged(QItemSelection, QItemSelection)));
-}
-bool IconPickerDialog::eventFilter(QObject *obj, QEvent *evt)
-{
- if (obj != ui->iconView)
- return QDialog::eventFilter(obj, evt);
- if (evt->type() != QEvent::KeyPress)
- {
- return QDialog::eventFilter(obj, evt);
- }
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(evt);
- switch (keyEvent->key())
- {
- case Qt::Key_Delete:
- removeSelectedIcon();
- return true;
- case Qt::Key_Plus:
- addNewIcon();
- return true;
- default:
- break;
- }
- return QDialog::eventFilter(obj, evt);
-}
-
-void IconPickerDialog::addNewIcon()
-{
- //: The title of the select icons open file dialog
- QString selectIcons = tr("Select Icons");
- //: The type of icon files
- QStringList fileNames = QFileDialog::getOpenFileNames(this, selectIcons, QString(),
- tr("Icons") + "(*.png *.jpg *.jpeg *.ico)");
- ENV.icons()->installIcons(fileNames);
-}
-
-void IconPickerDialog::removeSelectedIcon()
-{
- ENV.icons()->deleteIcon(selectedIconKey);
-}
-
-void IconPickerDialog::activated(QModelIndex index)
-{
- selectedIconKey = index.data(Qt::UserRole).toString();
- accept();
-}
-
-void IconPickerDialog::selectionChanged(QItemSelection selected, QItemSelection deselected)
-{
- if (selected.empty())
- return;
-
- QString key = selected.first().indexes().first().data(Qt::UserRole).toString();
- if (!key.isEmpty())
- selectedIconKey = key;
-}
-
-int IconPickerDialog::exec(QString selection)
-{
- auto list = ENV.icons();
- auto contentsWidget = ui->iconView;
- selectedIconKey = selection;
-
- int index_nr = list->getIconIndex(selection);
- auto model_index = list->index(index_nr);
- contentsWidget->selectionModel()->select(
- model_index, QItemSelectionModel::Current | QItemSelectionModel::Select);
-
- QMetaObject::invokeMethod(this, "delayed_scroll", Qt::QueuedConnection,
- Q_ARG(QModelIndex, model_index));
- return QDialog::exec();
-}
-
-void IconPickerDialog::delayed_scroll(QModelIndex model_index)
-{
- auto contentsWidget = ui->iconView;
- contentsWidget->scrollTo(model_index);
-}
-
-IconPickerDialog::~IconPickerDialog()
-{
- delete ui;
-}
diff --git a/gui/dialogs/IconPickerDialog.h b/gui/dialogs/IconPickerDialog.h
deleted file mode 100644
index 610d9306..00000000
--- a/gui/dialogs/IconPickerDialog.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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 <QDialog>
-#include <QItemSelection>
-
-namespace Ui
-{
-class IconPickerDialog;
-}
-
-class IconPickerDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit IconPickerDialog(QWidget *parent = 0);
- ~IconPickerDialog();
- int exec(QString selection);
- QString selectedIconKey;
-
-protected:
- virtual bool eventFilter(QObject *, QEvent *);
-
-private:
- Ui::IconPickerDialog *ui;
-
-private
-slots:
- void selectionChanged(QItemSelection, QItemSelection);
- void activated(QModelIndex);
- void delayed_scroll(QModelIndex);
- void addNewIcon();
- void removeSelectedIcon();
-};
diff --git a/gui/dialogs/IconPickerDialog.ui b/gui/dialogs/IconPickerDialog.ui
deleted file mode 100644
index c548edfb..00000000
--- a/gui/dialogs/IconPickerDialog.ui
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>IconPickerDialog</class>
- <widget class="QDialog" name="IconPickerDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>676</width>
- <height>555</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Pick icon</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QListView" name="iconView"/>
- </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>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>IconPickerDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>IconPickerDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/gui/dialogs/LoginDialog.cpp b/gui/dialogs/LoginDialog.cpp
deleted file mode 100644
index 75fdd502..00000000
--- a/gui/dialogs/LoginDialog.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/* 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 "LoginDialog.h"
-#include "ui_LoginDialog.h"
-
-#include "logic/auth/YggdrasilTask.h"
-
-#include <QtWidgets/QPushButton>
-
-LoginDialog::LoginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LoginDialog)
-{
- ui->setupUi(this);
- ui->progressBar->setVisible(false);
- ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
-
- connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
- connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
-}
-
-LoginDialog::~LoginDialog()
-{
- delete ui;
-}
-
-// Stage 1: User interaction
-void LoginDialog::accept()
-{
- setUserInputsEnabled(false);
- ui->progressBar->setVisible(true);
-
- // Setup the login task and start it
- m_account = MojangAccount::createFromUsername(ui->userTextBox->text());
- m_loginTask = m_account->login(nullptr, ui->passTextBox->text());
- connect(m_loginTask.get(), &ProgressProvider::failed, this, &LoginDialog::onTaskFailed);
- connect(m_loginTask.get(), &ProgressProvider::succeeded, this,
- &LoginDialog::onTaskSucceeded);
- connect(m_loginTask.get(), &ProgressProvider::status, this, &LoginDialog::onTaskStatus);
- connect(m_loginTask.get(), &ProgressProvider::progress, this, &LoginDialog::onTaskProgress);
- m_loginTask->start();
-}
-
-void LoginDialog::setUserInputsEnabled(bool enable)
-{
- ui->userTextBox->setEnabled(enable);
- ui->passTextBox->setEnabled(enable);
- ui->buttonBox->setEnabled(enable);
-}
-
-// Enable the OK button only when both textboxes contain something.
-void LoginDialog::on_userTextBox_textEdited(const QString &newText)
-{
- ui->buttonBox->button(QDialogButtonBox::Ok)
- ->setEnabled(!newText.isEmpty() && !ui->passTextBox->text().isEmpty());
-}
-void LoginDialog::on_passTextBox_textEdited(const QString &newText)
-{
- ui->buttonBox->button(QDialogButtonBox::Ok)
- ->setEnabled(!newText.isEmpty() && !ui->userTextBox->text().isEmpty());
-}
-
-void LoginDialog::onTaskFailed(const QString &reason)
-{
- // Set message
- ui->label->setText("<span style='color:red'>" + reason + "</span>");
-
- // Re-enable user-interaction
- setUserInputsEnabled(true);
- ui->progressBar->setVisible(false);
-}
-
-void LoginDialog::onTaskSucceeded()
-{
- QDialog::accept();
-}
-
-void LoginDialog::onTaskStatus(const QString &status)
-{
- ui->label->setText(status);
-}
-
-void LoginDialog::onTaskProgress(qint64 current, qint64 total)
-{
- ui->progressBar->setMaximum(total);
- ui->progressBar->setValue(current);
-}
-
-// Public interface
-MojangAccountPtr LoginDialog::newAccount(QWidget *parent, QString msg)
-{
- LoginDialog dlg(parent);
- dlg.ui->label->setText(msg);
- if (dlg.exec() == QDialog::Accepted)
- {
- return dlg.m_account;
- }
- return 0;
-}
diff --git a/gui/dialogs/LoginDialog.h b/gui/dialogs/LoginDialog.h
deleted file mode 100644
index 79bad76a..00000000
--- a/gui/dialogs/LoginDialog.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 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 <QtWidgets/QDialog>
-#include <QtCore/QEventLoop>
-
-#include "logic/auth/MojangAccount.h"
-
-namespace Ui
-{
-class LoginDialog;
-}
-
-class LoginDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- ~LoginDialog();
-
- static MojangAccountPtr newAccount(QWidget *parent, QString message);
-
-private:
- explicit LoginDialog(QWidget *parent = 0);
-
- void setUserInputsEnabled(bool enable);
-
-protected
-slots:
- void accept();
-
- void onTaskFailed(const QString &reason);
- void onTaskSucceeded();
- void onTaskStatus(const QString &status);
- void onTaskProgress(qint64 current, qint64 total);
-
- void on_userTextBox_textEdited(const QString &newText);
- void on_passTextBox_textEdited(const QString &newText);
-
-private:
- Ui::LoginDialog *ui;
- MojangAccountPtr m_account;
- std::shared_ptr<Task> m_loginTask;
-};
diff --git a/gui/dialogs/LoginDialog.ui b/gui/dialogs/LoginDialog.ui
deleted file mode 100644
index b24b1c0c..00000000
--- a/gui/dialogs/LoginDialog.ui
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>LoginDialog</class>
- <widget class="QDialog" name="LoginDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>162</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Add Account</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Message label placeholder.</string>
- </property>
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="userTextBox">
- <property name="placeholderText">
- <string>Email / Username</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="passTextBox">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- <property name="placeholderText">
- <string>Password</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QProgressBar" name="progressBar">
- <property name="value">
- <number>24</number>
- </property>
- <property name="textVisible">
- <bool>false</bool>
- </property>
- </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>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/dialogs/ModEditDialogCommon.cpp b/gui/dialogs/ModEditDialogCommon.cpp
deleted file mode 100644
index 4a2115d8..00000000
--- a/gui/dialogs/ModEditDialogCommon.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "ModEditDialogCommon.h"
-#include "CustomMessageBox.h"
-#include <QUrl>
-
-bool lastfirst(QModelIndexList &list, int &first, int &last)
-{
- if (list.isEmpty())
- return false;
- first = last = list[0].row();
- for (auto item : list)
- {
- int row = item.row();
- if (row < first)
- first = row;
- if (row > last)
- last = row;
- }
- return true;
-}
-
-void showWebsiteForMod(QWidget *parentDlg, Mod &m)
-{
- QString url = m.homeurl();
- if (url.size())
- {
- // catch the cases where the protocol is missing
- if (!url.startsWith("http"))
- {
- url = "http://" + url;
- }
- QDesktopServices::openUrl(url);
- }
- else
- {
- CustomMessageBox::selectable(
- parentDlg, QObject::tr("How sad!"),
- QObject::tr("The mod author didn't provide a website link for this mod."),
- QMessageBox::Warning);
- }
-}
diff --git a/gui/dialogs/ModEditDialogCommon.h b/gui/dialogs/ModEditDialogCommon.h
deleted file mode 100644
index 227e638c..00000000
--- a/gui/dialogs/ModEditDialogCommon.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-#include <QModelIndex>
-#include <QDesktopServices>
-#include <QWidget>
-#include <logic/minecraft/Mod.h>
-
-bool lastfirst(QModelIndexList &list, int &first, int &last);
-
-void showWebsiteForMod(QWidget *parentDlg, Mod &m);
diff --git a/gui/dialogs/NewInstanceDialog.cpp b/gui/dialogs/NewInstanceDialog.cpp
deleted file mode 100644
index 86ffc5b8..00000000
--- a/gui/dialogs/NewInstanceDialog.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/* 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 "MultiMC.h"
-#include "NewInstanceDialog.h"
-#include "ui_NewInstanceDialog.h"
-
-#include "logic/BaseVersion.h"
-#include "logic/icons/IconList.h"
-#include "logic/minecraft/MinecraftVersionList.h"
-#include "logic/tasks/Task.h"
-#include "logic/InstanceList.h"
-
-#include "gui/Platform.h"
-#include "VersionSelectDialog.h"
-#include "ProgressDialog.h"
-#include "IconPickerDialog.h"
-
-#include <QLayout>
-#include <QPushButton>
-#include <QFileDialog>
-#include <QValidator>
-
-class UrlValidator : public QValidator
-{
-public:
- using QValidator::QValidator;
-
- State validate(QString &in, int &pos) const
- {
- const QUrl url(in);
- if (url.isValid() && !url.isRelative() && !url.isEmpty())
- {
- return Acceptable;
- }
- else if (QFile::exists(in))
- {
- return Acceptable;
- }
- else
- {
- return Intermediate;
- }
- }
-};
-
-NewInstanceDialog::NewInstanceDialog(QWidget *parent)
- : QDialog(parent), ui(new Ui::NewInstanceDialog)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- ui->setupUi(this);
- resize(minimumSizeHint());
- layout()->setSizeConstraint(QLayout::SetFixedSize);
-
- setSelectedVersion(MMC->minecraftlist()->getLatestStable(), true);
- InstIconKey = "infinity";
- ui->iconButton->setIcon(ENV.icons()->getIcon(InstIconKey));
-
- ui->modpackEdit->setValidator(new UrlValidator(ui->modpackEdit));
- connect(ui->modpackEdit, &QLineEdit::textChanged, this, &NewInstanceDialog::updateDialogState);
- connect(ui->modpackBox, &QRadioButton::clicked, this, &NewInstanceDialog::updateDialogState);
- connect(ui->versionBox, &QRadioButton::clicked, this, &NewInstanceDialog::updateDialogState);
-
- auto groups = MMC->instances()->getGroups().toSet();
- auto groupList = QStringList(groups.toList());
- groupList.sort(Qt::CaseInsensitive);
- groupList.removeOne("");
- QString oldValue = MMC->settings()->get("LastUsedGroupForNewInstance").toString();
- groupList.push_front(oldValue);
- groupList.push_front("");
- ui->groupBox->addItems(groupList);
- int index = groupList.indexOf(oldValue);
- if(index == -1)
- {
- index = 0;
- }
- ui->groupBox->setCurrentIndex(index);
- ui->groupBox->lineEdit()->setPlaceholderText(tr("No group"));
-}
-
-NewInstanceDialog::~NewInstanceDialog()
-{
- delete ui;
-}
-
-void NewInstanceDialog::updateDialogState()
-{
- bool allowOK = !instName().isEmpty() &&
- (ui->versionBox->isChecked() && m_selectedVersion ||
- (ui->modpackBox->isChecked() && ui->modpackEdit->hasAcceptableInput()));
- ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK);
-}
-
-void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version, bool initial)
-{
- m_selectedVersion = version;
-
- if (m_selectedVersion)
- {
- ui->versionTextBox->setText(version->name());
- if(ui->instNameTextBox->text().isEmpty() && !initial)
- {
- ui->instNameTextBox->setText(version->name());
- }
- }
- else
- {
- ui->versionTextBox->setText("");
- }
-
- updateDialogState();
-}
-
-QString NewInstanceDialog::instName() const
-{
- return ui->instNameTextBox->text();
-}
-QString NewInstanceDialog::instGroup() const
-{
- return ui->groupBox->currentText();
-}
-QString NewInstanceDialog::iconKey() const
-{
- return InstIconKey;
-}
-QUrl NewInstanceDialog::modpackUrl() const
-{
- if (ui->modpackBox->isChecked())
- {
- const QUrl url(ui->modpackEdit->text());
- if (url.isValid() && !url.isRelative() && !url.host().isEmpty())
- {
- return url;
- }
- else
- {
- return QUrl::fromLocalFile(ui->modpackEdit->text());
- }
- }
- else
- {
- return QUrl();
- }
-}
-
-BaseVersionPtr NewInstanceDialog::selectedVersion() const
-{
- return m_selectedVersion;
-}
-
-void NewInstanceDialog::on_btnChangeVersion_clicked()
-{
- VersionSelectDialog vselect(MMC->minecraftlist().get(), tr("Change Minecraft version"),
- this);
- vselect.exec();
- if (vselect.result() == QDialog::Accepted)
- {
- BaseVersionPtr version = vselect.selectedVersion();
- if (version)
- setSelectedVersion(version);
- }
-}
-
-void NewInstanceDialog::on_iconButton_clicked()
-{
- IconPickerDialog dlg(this);
- dlg.exec(InstIconKey);
-
- if (dlg.result() == QDialog::Accepted)
- {
- InstIconKey = dlg.selectedIconKey;
- ui->iconButton->setIcon(ENV.icons()->getIcon(InstIconKey));
- }
-}
-
-void NewInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1)
-{
- updateDialogState();
-}
-
-void NewInstanceDialog::on_modpackBtn_clicked()
-{
- const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), tr("Zip (*.zip)"));
- if (url.isValid())
- {
- if (url.isLocalFile())
- {
- ui->modpackEdit->setText(url.toLocalFile());
- }
- else
- {
- ui->modpackEdit->setText(url.toString());
- }
- }
-}
diff --git a/gui/dialogs/NewInstanceDialog.h b/gui/dialogs/NewInstanceDialog.h
deleted file mode 100644
index 1e1b0bea..00000000
--- a/gui/dialogs/NewInstanceDialog.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* 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 <QDialog>
-
-#include "logic/BaseVersion.h"
-
-namespace Ui
-{
-class NewInstanceDialog;
-}
-
-class NewInstanceDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit NewInstanceDialog(QWidget *parent = 0);
- ~NewInstanceDialog();
-
- void updateDialogState();
-
- void setSelectedVersion(BaseVersionPtr version, bool initial = false);
-
- void loadVersionList();
-
- QString instName() const;
- QString instGroup() const;
- QString iconKey() const;
- QUrl modpackUrl() const;
- BaseVersionPtr selectedVersion() const;
-
-private
-slots:
- void on_btnChangeVersion_clicked();
- void on_iconButton_clicked();
- void on_modpackBtn_clicked();
- void on_instNameTextBox_textChanged(const QString &arg1);
-
-private:
- Ui::NewInstanceDialog *ui;
-
- BaseVersionPtr m_selectedVersion;
- QString InstIconKey;
-};
diff --git a/gui/dialogs/NewInstanceDialog.ui b/gui/dialogs/NewInstanceDialog.ui
deleted file mode 100644
index 6cb0c97c..00000000
--- a/gui/dialogs/NewInstanceDialog.ui
+++ /dev/null
@@ -1,309 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>NewInstanceDialog</class>
- <widget class="QDialog" name="NewInstanceDialog">
- <property name="windowModality">
- <enum>Qt::ApplicationModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>277</width>
- <height>404</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>New Instance</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>:/icons/toolbar/new</normaloff>:/icons/toolbar/new</iconset>
- </property>
- <property name="modal">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="iconBtnLayout">
- <item>
- <spacer name="iconBtnLeftSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="iconButton">
- <property name="icon">
- <iconset>
- <normaloff>:/icons/instances/infinity</normaloff>:/icons/instances/infinity</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>80</width>
- <height>80</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="iconBtnRightSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLineEdit" name="instNameTextBox">
- <property name="placeholderText">
- <string>Name</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="labelVersion_3">
- <property name="text">
- <string>&amp;Group:</string>
- </property>
- <property name="buddy">
- <cstring>groupBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="4" column="2">
- <widget class="QToolButton" name="modpackBtn">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0" colspan="2">
- <widget class="QLineEdit" name="modpackEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>http://</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLineEdit" name="versionTextBox">
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QToolButton" name="btnChangeVersion">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="3">
- <widget class="QRadioButton" name="modpackBox">
- <property name="text">
- <string>Impor&amp;t Modpack (local file or link):</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="3">
- <widget class="QRadioButton" name="versionBox">
- <property name="text">
- <string>Vani&amp;lla Minecraft (select version):</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="Line" name="line_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </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>
- </widget>
- <tabstops>
- <tabstop>instNameTextBox</tabstop>
- <tabstop>groupBox</tabstop>
- <tabstop>versionBox</tabstop>
- <tabstop>versionTextBox</tabstop>
- <tabstop>btnChangeVersion</tabstop>
- <tabstop>modpackBox</tabstop>
- <tabstop>modpackEdit</tabstop>
- <tabstop>modpackBtn</tabstop>
- <tabstop>iconButton</tabstop>
- </tabstops>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>NewInstanceDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>257</x>
- <y>333</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>NewInstanceDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>325</x>
- <y>333</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>modpackBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>modpackEdit</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>81</x>
- <y>229</y>
- </hint>
- <hint type="destinationlabel">
- <x>236</x>
- <y>221</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>modpackBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>modpackBtn</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>129</x>
- <y>225</y>
- </hint>
- <hint type="destinationlabel">
- <x>328</x>
- <y>229</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>versionBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>versionTextBox</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>93</x>
- <y>195</y>
- </hint>
- <hint type="destinationlabel">
- <x>213</x>
- <y>191</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>versionBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>btnChangeVersion</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>104</x>
- <y>198</y>
- </hint>
- <hint type="destinationlabel">
- <x>322</x>
- <y>192</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/gui/dialogs/NotificationDialog.cpp b/gui/dialogs/NotificationDialog.cpp
deleted file mode 100644
index 8f920371..00000000
--- a/gui/dialogs/NotificationDialog.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "NotificationDialog.h"
-#include "ui_NotificationDialog.h"
-
-#include <QTimerEvent>
-
-NotificationDialog::NotificationDialog(const NotificationChecker::NotificationEntry &entry, QWidget *parent) :
- QDialog(parent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::CustomizeWindowHint),
- ui(new Ui::NotificationDialog)
-{
- ui->setupUi(this);
-
- QStyle::StandardPixmap icon;
- switch (entry.type)
- {
- case NotificationChecker::NotificationEntry::Critical:
- icon = QStyle::SP_MessageBoxCritical;
- break;
- case NotificationChecker::NotificationEntry::Warning:
- icon = QStyle::SP_MessageBoxWarning;
- break;
- case NotificationChecker::NotificationEntry::Information:
- icon = QStyle::SP_MessageBoxInformation;
- break;
- }
- ui->iconLabel->setPixmap(style()->standardPixmap(icon, 0, this));
- ui->messageLabel->setText(entry.message);
-
- m_dontShowAgainText = tr("Don't show again");
- m_closeText = tr("Close");
-
- ui->dontShowAgainBtn->setText(m_dontShowAgainText + QString(" (%1)").arg(m_dontShowAgainTime));
- ui->closeBtn->setText(m_closeText + QString(" (%1)").arg(m_closeTime));
-
- startTimer(1000);
-}
-
-NotificationDialog::~NotificationDialog()
-{
- delete ui;
-}
-
-void NotificationDialog::timerEvent(QTimerEvent *event)
-{
- if (m_dontShowAgainTime > 0)
- {
- m_dontShowAgainTime--;
- if (m_dontShowAgainTime == 0)
- {
- ui->dontShowAgainBtn->setText(m_dontShowAgainText);
- ui->dontShowAgainBtn->setEnabled(true);
- }
- else
- {
- ui->dontShowAgainBtn->setText(m_dontShowAgainText + QString(" (%1)").arg(m_dontShowAgainTime));
- }
- }
- if (m_closeTime > 0)
- {
- m_closeTime--;
- if (m_closeTime == 0)
- {
- ui->closeBtn->setText(m_closeText);
- ui->closeBtn->setEnabled(true);
- }
- else
- {
- ui->closeBtn->setText(m_closeText + QString(" (%1)").arg(m_closeTime));
- }
- }
-
- if (m_closeTime == 0 && m_dontShowAgainTime == 0)
- {
- killTimer(event->timerId());
- }
-}
-
-void NotificationDialog::on_dontShowAgainBtn_clicked()
-{
- done(DontShowAgain);
-}
-void NotificationDialog::on_closeBtn_clicked()
-{
- done(Normal);
-}
diff --git a/gui/dialogs/NotificationDialog.h b/gui/dialogs/NotificationDialog.h
deleted file mode 100644
index 4717abd8..00000000
--- a/gui/dialogs/NotificationDialog.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef NOTIFICATIONDIALOG_H
-#define NOTIFICATIONDIALOG_H
-
-#include <QDialog>
-
-#include "logic/notifications/NotificationChecker.h"
-
-namespace Ui {
-class NotificationDialog;
-}
-
-class NotificationDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit NotificationDialog(const NotificationChecker::NotificationEntry &entry, QWidget *parent = 0);
- ~NotificationDialog();
-
- enum ExitCode
- {
- Normal,
- DontShowAgain
- };
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- Ui::NotificationDialog *ui;
-
- int m_dontShowAgainTime = 10;
- int m_closeTime = 5;
-
- QString m_dontShowAgainText;
- QString m_closeText;
-
-private
-slots:
- void on_dontShowAgainBtn_clicked();
- void on_closeBtn_clicked();
-};
-
-#endif // NOTIFICATIONDIALOG_H
diff --git a/gui/dialogs/NotificationDialog.ui b/gui/dialogs/NotificationDialog.ui
deleted file mode 100644
index a2a276e9..00000000
--- a/gui/dialogs/NotificationDialog.ui
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>NotificationDialog</class>
- <widget class="QDialog" name="NotificationDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>320</width>
- <height>240</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
- <item>
- <widget class="QLabel" name="iconLabel">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="messageLabel">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="openExternalLinks">
- <bool>true</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextBrowserInteraction</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="dontShowAgainBtn">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Don't show again</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="closeBtn">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/dialogs/ProgressDialog.cpp b/gui/dialogs/ProgressDialog.cpp
deleted file mode 100644
index db483a73..00000000
--- a/gui/dialogs/ProgressDialog.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/* 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 "ProgressDialog.h"
-#include "ui_ProgressDialog.h"
-
-#include <QKeyEvent>
-
-#include "logic/tasks/Task.h"
-#include "gui/Platform.h"
-
-ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- ui->setupUi(this);
- this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
- setSkipButton(false);
- changeProgress(0, 100);
-}
-
-void ProgressDialog::setSkipButton(bool present, QString label)
-{
- ui->skipButton->setEnabled(present);
- ui->skipButton->setVisible(present);
- ui->skipButton->setText(label);
- updateSize();
-}
-
-void ProgressDialog::on_skipButton_clicked(bool checked)
-{
- Q_UNUSED(checked);
- task->abort();
-}
-
-ProgressDialog::~ProgressDialog()
-{
- delete ui;
-}
-
-void ProgressDialog::updateSize()
-{
- resize(QSize(480, minimumSizeHint().height()));
-}
-
-int ProgressDialog::exec(ProgressProvider *task)
-{
- this->task = task;
-
- // Connect signals.
- connect(task, SIGNAL(started()), SLOT(onTaskStarted()));
- connect(task, SIGNAL(failed(QString)), SLOT(onTaskFailed(QString)));
- connect(task, SIGNAL(succeeded()), SLOT(onTaskSucceeded()));
- connect(task, SIGNAL(status(QString)), SLOT(changeStatus(const QString &)));
- connect(task, SIGNAL(progress(qint64, qint64)), SLOT(changeProgress(qint64, qint64)));
-
- // if this didn't connect to an already running task, invoke start
- if(!task->isRunning())
- task->start();
- if(task->isRunning())
- return QDialog::exec();
- else
- return QDialog::Accepted;
-}
-
-ProgressProvider *ProgressDialog::getTask()
-{
- return task;
-}
-
-void ProgressDialog::onTaskStarted()
-{
-}
-
-void ProgressDialog::onTaskFailed(QString failure)
-{
- reject();
-}
-
-void ProgressDialog::onTaskSucceeded()
-{
- accept();
-}
-
-void ProgressDialog::changeStatus(const QString &status)
-{
- ui->statusLabel->setText(status);
- updateSize();
-}
-
-void ProgressDialog::changeProgress(qint64 current, qint64 total)
-{
- ui->taskProgressBar->setMaximum(total);
- ui->taskProgressBar->setValue(current);
-}
-
-void ProgressDialog::keyPressEvent(QKeyEvent *e)
-{
- if (e->key() == Qt::Key_Escape)
- return;
- QDialog::keyPressEvent(e);
-}
-
-void ProgressDialog::closeEvent(QCloseEvent *e)
-{
- if (task && task->isRunning())
- {
- e->ignore();
- }
- else
- {
- QDialog::closeEvent(e);
- }
-}
diff --git a/gui/dialogs/ProgressDialog.h b/gui/dialogs/ProgressDialog.h
deleted file mode 100644
index d5153680..00000000
--- a/gui/dialogs/ProgressDialog.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 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 <QDialog>
-
-class ProgressProvider;
-
-namespace Ui
-{
-class ProgressDialog;
-}
-
-class ProgressDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit ProgressDialog(QWidget *parent = 0);
- ~ProgressDialog();
-
- void updateSize();
-
- int exec(ProgressProvider *task);
-
- void setSkipButton(bool present, QString label = QString());
-
- ProgressProvider *getTask();
-
-public
-slots:
- void onTaskStarted();
- void onTaskFailed(QString failure);
- void onTaskSucceeded();
-
- void changeStatus(const QString &status);
- void changeProgress(qint64 current, qint64 total);
-
-
-private
-slots:
- void on_skipButton_clicked(bool checked);
-
-protected:
- virtual void keyPressEvent(QKeyEvent *e);
- virtual void closeEvent(QCloseEvent *e);
-
-private:
- Ui::ProgressDialog *ui;
-
- ProgressProvider *task;
-};
diff --git a/gui/dialogs/ProgressDialog.ui b/gui/dialogs/ProgressDialog.ui
deleted file mode 100644
index 04b8fef3..00000000
--- a/gui/dialogs/ProgressDialog.ui
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ProgressDialog</class>
- <widget class="QDialog" name="ProgressDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>100</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>400</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>600</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Please wait...</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="statusLabel">
- <property name="text">
- <string>Task Status...</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QProgressBar" name="taskProgressBar">
- <property name="value">
- <number>24</number>
- </property>
- <property name="textVisible">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QPushButton" name="skipButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Skip</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/dialogs/UpdateDialog.cpp b/gui/dialogs/UpdateDialog.cpp
deleted file mode 100644
index 1fcc156a..00000000
--- a/gui/dialogs/UpdateDialog.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-#include "UpdateDialog.h"
-#include "ui_UpdateDialog.h"
-#include "gui/Platform.h"
-#include <QDebug>
-#include "MultiMC.h"
-#include <logic/settings/SettingsObject.h>
-
-UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- ui->setupUi(this);
- auto channel = MMC->settings()->get("UpdateChannel").toString();
- if(hasUpdate)
- {
- ui->label->setText(tr("A new %1 update is available!").arg(channel));
- }
- else
- {
- ui->label->setText(tr("No %1 updates found. You are running the latest version.").arg(channel));
- ui->btnUpdateNow->setDisabled(true);
- ui->btnUpdateOnExit->setDisabled(true);
- }
- loadChangelog();
-}
-
-UpdateDialog::~UpdateDialog()
-{
-}
-
-void UpdateDialog::loadChangelog()
-{
- auto channel = MMC->settings()->get("UpdateChannel").toString();
- dljob.reset(new NetJob("Changelog"));
- auto url = QString("https://raw.githubusercontent.com/MultiMC/MultiMC5/%1/changelog.md").arg(channel);
- changelogDownload = ByteArrayDownload::make(QUrl(url));
- dljob->addNetAction(changelogDownload);
- connect(dljob.get(), &NetJob::succeeded, this, &UpdateDialog::changelogLoaded);
- connect(dljob.get(), &NetJob::failed, this, &UpdateDialog::changelogFailed);
- dljob->start();
-}
-
-// TODO: this will be replaced.
-QString reprocessMarkdown(QString markdown)
-{
- QString htmlData;
- QTextStream html(&htmlData);
- auto lines = markdown.split(QRegExp("[\r]?[\n]"),QString::KeepEmptyParts);
- enum
- {
- BASE,
- LIST1,
- LIST2
- }state = BASE;
- html << "<html>";
- int i = 0;
- auto procLine = [&](QString line) -> QString
- {
- // [GitHub issues](https://github.com/MultiMC/MultiMC5/issues)
- line.replace(QRegExp("\\[([^\\]]+)\\]\\(([^\\)]+)\\)"), "<a href=\"\\2\">\\1</a>");
- return line;
- };
- for(auto line: lines)
- {
- if(line.isEmpty())
- {
- // html << "<br />\n";
- }
- else switch (state)
- {
- case BASE:
- if(line.startsWith("##"))
- {
- html << "<h2>" << procLine(line.mid(2)) << "</h2>\n";
- }
- else if(line.startsWith("#"))
- {
- html << "<h1>" << procLine(line.mid(1)) << "</h1>\n";
- }
- else if(line.startsWith("- "))
- {
- state = LIST1;
- html << "<ul>\n";
- html << "<li>" << procLine(line.mid(2)) << "</li>\n";
- }
- else qCritical() << "Invalid input on line " << i << ": " << line;
- break;
- case LIST1:
- if(line.startsWith("##"))
- {
- state = BASE;
- html << "</ul>\n";
- html << "<h2>" << procLine(line.mid(2)) << "</h2>\n";
- }
- else if(line.startsWith("#"))
- {
- state = BASE;
- html << "</ul>\n";
- html << "<h1>" << procLine(line.mid(1)) << "</h1>\n";
- }
- else if(line.startsWith("- "))
- {
- html << "<li>" << procLine(line.mid(2)) << "</li>\n";
- }
- else if(line.startsWith(" - "))
- {
- state = LIST2;
- html << "<ul>\n";
- html << "<li>" << procLine(line.mid(4)) << "</li>\n";
- }
- else qCritical() << "Invalid input on line " << i << ": " << line;
- break;
- case LIST2:
- if(line.startsWith("##"))
- {
- state = BASE;
- html << "</ul>\n";
- html << "</ul>\n";
- html << "<h2>" << procLine(line.mid(2)) << "</h2>\n";
- }
- else if(line.startsWith("#"))
- {
- state = BASE;
- html << "</ul>\n";
- html << "</ul>\n";
- html << "<h1>" << procLine(line.mid(1)) << "</h1>\n";
- }
- else if(line.startsWith("- "))
- {
- state = LIST1;
- html << "</ul>\n";
- html << "<li>" << procLine(line.mid(2)) << "</li>\n";
- }
- else if(line.startsWith(" - "))
- {
- html << "<li>" << procLine(line.mid(4)) << "</li>\n";
- }
- else qCritical() << "Invalid input on line " << i << ": " << line;
- break;
- }
- i++;
- }
- if(state == LIST2)
- {
- html << "</ul>\n";
- state = LIST1;
- }
- if(state == LIST1)
- {
- html << "</ul>\n";
- state = BASE;
- }
- if (state != BASE)
- {
- qCritical() << "Reprocessing markdown didn't end in a final state!";
- }
- html << "</html>\n";
- qDebug() << htmlData;
- return htmlData;
-}
-
-void UpdateDialog::changelogLoaded()
-{
- auto rawMarkdown = QString::fromUtf8(changelogDownload->m_data);
- auto html = reprocessMarkdown(rawMarkdown);
- ui->changelogBrowser->setHtml(html);
-}
-
-void UpdateDialog::changelogFailed()
-{
- ui->changelogBrowser->setHtml(tr("<p align=\"center\" <span style=\"font-size:22pt;\">Failed to fetch changelog...</span></p>"));
-}
-
-void UpdateDialog::on_btnUpdateLater_clicked()
-{
- reject();
-}
-
-void UpdateDialog::on_btnUpdateNow_clicked()
-{
- done(UPDATE_NOW);
-}
-
-void UpdateDialog::on_btnUpdateOnExit_clicked()
-{
- done(UPDATE_ONEXIT);
-}
diff --git a/gui/dialogs/UpdateDialog.h b/gui/dialogs/UpdateDialog.h
deleted file mode 100644
index bfbc0f27..00000000
--- a/gui/dialogs/UpdateDialog.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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 <QDialog>
-#include "logic/net/ByteArrayDownload.h"
-#include "logic/net/NetJob.h"
-
-namespace Ui
-{
-class UpdateDialog;
-}
-
-enum UpdateAction
-{
- UPDATE_LATER = QDialog::Rejected,
- UPDATE_NOW = QDialog::Accepted,
- UPDATE_ONEXIT = 2
-};
-
-class UpdateDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit UpdateDialog(bool hasUpdate = true, QWidget *parent = 0);
- ~UpdateDialog();
-
-private:
- Ui::UpdateDialog *ui;
-public slots:
- void on_btnUpdateNow_clicked();
- void on_btnUpdateOnExit_clicked();
- void on_btnUpdateLater_clicked();
-
- /// Starts loading the changelog
- void loadChangelog();
-
- /// Slot for when the chengelog loads successfully.
- void changelogLoaded();
-
- /// Slot for when the chengelog fails to load...
- void changelogFailed();
-
-private:
- ByteArrayDownloadPtr changelogDownload;
- NetJobPtr dljob;
-};
diff --git a/gui/dialogs/UpdateDialog.ui b/gui/dialogs/UpdateDialog.ui
deleted file mode 100644
index 06f4f086..00000000
--- a/gui/dialogs/UpdateDialog.ui
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UpdateDialog</class>
- <widget class="QDialog" name="UpdateDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>657</width>
- <height>673</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>MultiMC Update</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>:/icons/toolbar/checkupdate</normaloff>:/icons/toolbar/checkupdate</iconset>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label">
- <property name="font">
- <font>
- <pointsize>14</pointsize>
- </font>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- <property name="buddy">
- <cstring>changelogBrowser</cstring>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTextBrowser" name="changelogBrowser">
- <property name="html">
- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:22pt;&quot;&gt;Loading changelog...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="openExternalLinks">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QPushButton" name="btnUpdateNow">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Update now</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnUpdateOnExit">
- <property name="text">
- <string>Update after MultiMC closes</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnUpdateLater">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Don't update yet</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>changelogBrowser</tabstop>
- <tabstop>btnUpdateNow</tabstop>
- <tabstop>btnUpdateOnExit</tabstop>
- <tabstop>btnUpdateLater</tabstop>
- </tabstops>
- <resources>
- <include location="../../resources/multimc/multimc.qrc"/>
- </resources>
- <connections/>
-</ui>
diff --git a/gui/dialogs/VersionSelectDialog.cpp b/gui/dialogs/VersionSelectDialog.cpp
deleted file mode 100644
index a0a58699..00000000
--- a/gui/dialogs/VersionSelectDialog.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/* 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 "VersionSelectDialog.h"
-#include "ui_VersionSelectDialog.h"
-
-#include <QHeaderView>
-
-#include <gui/dialogs/ProgressDialog.h>
-#include "gui/Platform.h"
-
-#include <logic/BaseVersion.h>
-#include <logic/BaseVersionList.h>
-#include <logic/tasks/Task.h>
-#include <depends/util/include/modutils.h>
-#include <QDebug>
-
-class VersionSelectProxyModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-public:
- VersionSelectProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent)
- {
- }
-
- struct Filter
- {
- QString string;
- bool exact = false;
- };
-
- QHash<int, Filter> filters() const
- {
- return m_filters;
- }
- void setFilter(const int column, const QString &filter, const bool exact)
- {
- Filter f;
- f.string = filter;
- f.exact = exact;
- m_filters[column] = f;
- invalidateFilter();
- }
- void clearFilters()
- {
- m_filters.clear();
- invalidateFilter();
- }
-
-protected:
- bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
- {
- for (auto it = m_filters.begin(); it != m_filters.end(); ++it)
- {
- const QString version =
- sourceModel()->index(source_row, it.key()).data().toString();
-
- if (it.value().exact)
- {
- if (version != it.value().string)
- {
- return false;
- }
- continue;
- }
-
- if (!Util::versionIsInInterval(version, it.value().string))
- {
- return false;
- }
- }
- return true;
- }
-
- QHash<int, Filter> m_filters;
-};
-
-VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent,
- bool cancelable)
- : QDialog(parent), ui(new Ui::VersionSelectDialog)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- ui->setupUi(this);
- setWindowModality(Qt::WindowModal);
- setWindowTitle(title);
-
- m_vlist = vlist;
-
- m_proxyModel = new VersionSelectProxyModel(this);
- m_proxyModel->setSourceModel(vlist);
-
- ui->listView->setModel(m_proxyModel);
- ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
- ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch);
-
- if (!cancelable)
- {
- ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false);
- }
-}
-
-void VersionSelectDialog::setEmptyString(QString emptyString)
-{
- ui->listView->setEmptyString(emptyString);
-}
-
-VersionSelectDialog::~VersionSelectDialog()
-{
- delete ui;
-}
-
-void VersionSelectDialog::setResizeOn(int column)
-{
- ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::ResizeToContents);
- resizeOnColumn = column;
- ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch);
-}
-
-int VersionSelectDialog::exec()
-{
- QDialog::open();
- if (!m_vlist->isLoaded())
- {
- loadList();
- }
- m_proxyModel->invalidate();
- return QDialog::exec();
-}
-
-void VersionSelectDialog::loadList()
-{
- Task *loadTask = m_vlist->getLoadTask();
- if (!loadTask)
- {
- return;
- }
- ProgressDialog *taskDlg = new ProgressDialog(this);
- loadTask->setParent(taskDlg);
- taskDlg->exec(loadTask);
- delete taskDlg;
-}
-
-BaseVersionPtr VersionSelectDialog::selectedVersion() const
-{
- auto currentIndex = ui->listView->selectionModel()->currentIndex();
- auto variant = m_proxyModel->data(currentIndex, BaseVersionList::VersionPointerRole);
- return variant.value<BaseVersionPtr>();
-}
-
-void VersionSelectDialog::on_refreshButton_clicked()
-{
- loadList();
-}
-
-void VersionSelectDialog::setExactFilter(int column, QString filter)
-{
- m_proxyModel->setFilter(column, filter, true);
-}
-
-void VersionSelectDialog::setFuzzyFilter(int column, QString filter)
-{
- m_proxyModel->setFilter(column, filter, false);
-}
-
-#include "VersionSelectDialog.moc"
diff --git a/gui/dialogs/VersionSelectDialog.h b/gui/dialogs/VersionSelectDialog.h
deleted file mode 100644
index 3bb28b83..00000000
--- a/gui/dialogs/VersionSelectDialog.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* 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 <QDialog>
-#include <QSortFilterProxyModel>
-
-#include "logic/BaseVersion.h"
-
-class BaseVersionList;
-
-namespace Ui
-{
-class VersionSelectDialog;
-}
-
-class VersionSelectProxyModel;
-
-class VersionSelectDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent = 0,
- bool cancelable = true);
- ~VersionSelectDialog();
-
- virtual int exec();
-
- //! Starts a task that loads the list.
- void loadList();
-
- BaseVersionPtr selectedVersion() const;
-
- void setFuzzyFilter(int column, QString filter);
- void setExactFilter(int column, QString filter);
- void setEmptyString(QString emptyString);
- void setResizeOn(int column);
- void setUseLatest(const bool useLatest);
-
-private
-slots:
- void on_refreshButton_clicked();
-
-private:
- Ui::VersionSelectDialog *ui;
-
- BaseVersionList *m_vlist;
-
- VersionSelectProxyModel *m_proxyModel;
-
- int resizeOnColumn = 0;
-};
diff --git a/gui/dialogs/VersionSelectDialog.ui b/gui/dialogs/VersionSelectDialog.ui
deleted file mode 100644
index 07e9e73e..00000000
--- a/gui/dialogs/VersionSelectDialog.ui
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>VersionSelectDialog</class>
- <widget class="QDialog" name="VersionSelectDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>347</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Choose Version</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="VersionListView" name="listView">
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
- <property name="rootIsDecorated">
- <bool>false</bool>
- </property>
- <property name="itemsExpandable">
- <bool>false</bool>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <attribute name="headerCascadingSectionResizes">
- <bool>true</bool>
- </attribute>
- <attribute name="headerStretchLastSection">
- <bool>false</bool>
- </attribute>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QPushButton" name="refreshButton">
- <property name="toolTip">
- <string>Reloads the version list.</string>
- </property>
- <property name="text">
- <string>&amp;Refresh</string>
- </property>
- </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>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>VersionListView</class>
- <extends>QTreeView</extends>
- <header>gui/widgets/VersionListView.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>VersionSelectDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>257</x>
- <y>290</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>VersionSelectDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>325</x>
- <y>290</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/gui/groupview/GroupView.cpp b/gui/groupview/GroupView.cpp
deleted file mode 100644
index 89694b87..00000000
--- a/gui/groupview/GroupView.cpp
+++ /dev/null
@@ -1,1003 +0,0 @@
-#include "GroupView.h"
-
-#include <QPainter>
-#include <QApplication>
-#include <QtMath>
-#include <QMouseEvent>
-#include <QListView>
-#include <QPersistentModelIndex>
-#include <QDrag>
-#include <QMimeData>
-#include <QCache>
-#include <QScrollBar>
-
-#include "VisualGroup.h"
-#include <QDebug>
-
-template <typename T> bool listsIntersect(const QList<T> &l1, const QList<T> t2)
-{
- for (auto &item : l1)
- {
- if (t2.contains(item))
- {
- return true;
- }
- }
- return false;
-}
-
-GroupView::GroupView(QWidget *parent)
- : QAbstractItemView(parent)
-{
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
- setAcceptDrops(true);
- setAutoScroll(true);
-}
-
-GroupView::~GroupView()
-{
- qDeleteAll(m_groups);
- m_groups.clear();
-}
-
-void GroupView::setModel(QAbstractItemModel *model)
-{
- QAbstractItemView::setModel(model);
- connect(model, &QAbstractItemModel::modelReset, this, &GroupView::modelReset);
-}
-
-void GroupView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
- const QVector<int> &roles)
-{
- scheduleDelayedItemsLayout();
-}
-void GroupView::rowsInserted(const QModelIndex &parent, int start, int end)
-{
- scheduleDelayedItemsLayout();
-}
-
-void GroupView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
-{
- scheduleDelayedItemsLayout();
-}
-
-class LocaleString : public QString
-{
-public:
- LocaleString(const char *s) : QString(s)
- {
- }
- LocaleString(const QString &s) : QString(s)
- {
- }
-};
-
-inline bool operator<(const LocaleString &lhs, const LocaleString &rhs)
-{
- return (QString::localeAwareCompare(lhs, rhs) < 0);
-}
-
-void GroupView::updateGeometries()
-{
- geometryCache.clear();
- int previousScroll = verticalScrollBar()->value();
-
- QMap<LocaleString, VisualGroup *> cats;
-
- for (int i = 0; i < model()->rowCount(); ++i)
- {
- const QString groupName =
- model()->index(i, 0).data(GroupViewRoles::GroupRole).toString();
- if (!cats.contains(groupName))
- {
- VisualGroup *old = this->category(groupName);
- if (old)
- {
- cats.insert(groupName, new VisualGroup(old));
- }
- else
- {
- cats.insert(groupName, new VisualGroup(groupName, this));
- }
- }
- }
-
- /*if (m_editedCategory)
- {
- m_editedCategory = cats[m_editedCategory->text];
- }*/
-
- qDeleteAll(m_groups);
- m_groups = cats.values();
-
- for (auto cat : m_groups)
- {
- cat->update();
- }
-
- if (m_groups.isEmpty())
- {
- verticalScrollBar()->setRange(0, 0);
- }
- else
- {
- int totalHeight = 0;
- // top margin
- totalHeight += m_categoryMargin;
- int itemScroll = 0;
- for (auto category : m_groups)
- {
- category->m_verticalPosition = totalHeight;
- totalHeight += category->totalHeight() + m_categoryMargin;
- if(!itemScroll && category->totalHeight() != 0)
- {
- itemScroll = category->contentHeight() / category->numRows();
- }
- }
- // do not divide by zero
- if(itemScroll == 0)
- itemScroll = 64;
-
- totalHeight += m_bottomMargin;
- verticalScrollBar()->setSingleStep ( itemScroll );
- const int rowsPerPage = qMax ( viewport()->height() / itemScroll, 1 );
- verticalScrollBar()->setPageStep ( rowsPerPage * itemScroll );
-
- verticalScrollBar()->setRange(0, totalHeight - height());
- }
-
- verticalScrollBar()->setValue(qMin(previousScroll, verticalScrollBar()->maximum()));
-
- viewport()->update();
-}
-
-void GroupView::modelReset()
-{
- scheduleDelayedItemsLayout();
- executeDelayedItemsLayout();
-}
-
-bool GroupView::isIndexHidden(const QModelIndex &index) const
-{
- VisualGroup *cat = category(index);
- if (cat)
- {
- return cat->collapsed;
- }
- else
- {
- return false;
- }
-}
-
-VisualGroup *GroupView::category(const QModelIndex &index) const
-{
- return category(index.data(GroupViewRoles::GroupRole).toString());
-}
-
-VisualGroup *GroupView::category(const QString &cat) const
-{
- for (auto group : m_groups)
- {
- if (group->text == cat)
- {
- return group;
- }
- }
- return nullptr;
-}
-
-VisualGroup *GroupView::categoryAt(const QPoint &pos) const
-{
- for (auto group : m_groups)
- {
- if(group->hitScan(pos) & VisualGroup::CheckboxHit)
- {
- return group;
- }
- }
- return nullptr;
-}
-
-int GroupView::calculateItemsPerRow() const
-{
- return qFloor((qreal)(contentWidth()) / (qreal)(itemWidth() + m_spacing));
-}
-
-int GroupView::contentWidth() const
-{
- return width() - m_leftMargin - m_rightMargin;
-}
-
-int GroupView::itemWidth() const
-{
- return m_itemWidth;
-}
-
-void GroupView::mousePressEvent(QMouseEvent *event)
-{
- // endCategoryEditor();
-
- QPoint visualPos = event->pos();
- QPoint geometryPos = event->pos() + offset();
-
- QPersistentModelIndex index = indexAt(visualPos);
-
- m_pressedIndex = index;
- m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex);
- m_pressedPosition = geometryPos;
-
- m_pressedCategory = categoryAt(geometryPos);
- if (m_pressedCategory)
- {
- setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
- event->accept();
- return;
- }
-
- if (index.isValid() && (index.flags() & Qt::ItemIsEnabled))
- {
- if(index != currentIndex())
- {
- // FIXME: better!
- m_currentCursorColumn = -1;
- }
- // we disable scrollTo for mouse press so the item doesn't change position
- // when the user is interacting with it (ie. clicking on it)
- bool autoScroll = hasAutoScroll();
- setAutoScroll(false);
- selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
-
- setAutoScroll(autoScroll);
- QRect rect(visualPos, visualPos);
- setSelection(rect, QItemSelectionModel::ClearAndSelect);
-
- // signal handlers may change the model
- emit pressed(index);
- }
- else
- {
- // Forces a finalize() even if mouse is pressed, but not on a item
- selectionModel()->select(QModelIndex(), QItemSelectionModel::Select);
- }
-}
-
-void GroupView::mouseMoveEvent(QMouseEvent *event)
-{
- QPoint topLeft;
- QPoint visualPos = event->pos();
- QPoint geometryPos = event->pos() + offset();
-
- if (state() == ExpandingState || state() == CollapsingState)
- {
- return;
- }
-
- if (state() == DraggingState)
- {
- topLeft = m_pressedPosition - offset();
- if ((topLeft - event->pos()).manhattanLength() > QApplication::startDragDistance())
- {
- m_pressedIndex = QModelIndex();
- startDrag(model()->supportedDragActions());
- setState(NoState);
- stopAutoScroll();
- }
- return;
- }
-
- if (selectionMode() != SingleSelection)
- {
- topLeft = m_pressedPosition - offset();
- }
- else
- {
- topLeft = geometryPos;
- }
-
- if (m_pressedIndex.isValid() && (state() != DragSelectingState) &&
- (event->buttons() != Qt::NoButton) && !selectedIndexes().isEmpty())
- {
- setState(DraggingState);
- return;
- }
-
- if ((event->buttons() & Qt::LeftButton) && selectionModel())
- {
- setState(DragSelectingState);
-
- setSelection(QRect(visualPos, visualPos), QItemSelectionModel::ClearAndSelect);
- QModelIndex index = indexAt(visualPos);
-
- // set at the end because it might scroll the view
- if (index.isValid() && (index != selectionModel()->currentIndex()) &&
- (index.flags() & Qt::ItemIsEnabled))
- {
- selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
- }
- }
-}
-
-void GroupView::mouseReleaseEvent(QMouseEvent *event)
-{
- QPoint visualPos = event->pos();
- QPoint geometryPos = event->pos() + offset();
- QPersistentModelIndex index = indexAt(visualPos);
-
- bool click = (index == m_pressedIndex && index.isValid()) ||
- (m_pressedCategory && m_pressedCategory == categoryAt(geometryPos));
-
- if (click && m_pressedCategory)
- {
- if (state() == ExpandingState)
- {
- m_pressedCategory->collapsed = false;
- updateGeometries();
- viewport()->update();
- event->accept();
- return;
- }
- else if (state() == CollapsingState)
- {
- m_pressedCategory->collapsed = true;
- updateGeometries();
- viewport()->update();
- event->accept();
- return;
- }
- }
-
- m_ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
-
- setState(NoState);
-
- if (click)
- {
- if (event->button() == Qt::LeftButton)
- {
- emit clicked(index);
- }
- QStyleOptionViewItem option = viewOptions();
- if (m_pressedAlreadySelected)
- {
- option.state |= QStyle::State_Selected;
- }
- if ((model()->flags(index) & Qt::ItemIsEnabled) &&
- style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this))
- {
- emit activated(index);
- }
- }
-}
-
-void GroupView::mouseDoubleClickEvent(QMouseEvent *event)
-{
- QModelIndex index = indexAt(event->pos());
- if (!index.isValid() || !(index.flags() & Qt::ItemIsEnabled) || (m_pressedIndex != index))
- {
- QMouseEvent me(QEvent::MouseButtonPress, event->localPos(), event->windowPos(),
- event->screenPos(), event->button(), event->buttons(),
- event->modifiers());
- mousePressEvent(&me);
- return;
- }
- // signal handlers may change the model
- QPersistentModelIndex persistent = index;
- emit doubleClicked(persistent);
-}
-
-void GroupView::paintEvent(QPaintEvent *event)
-{
- executeDelayedItemsLayout();
-
- QPainter painter(this->viewport());
-
- QStyleOptionViewItemV4 option(viewOptions());
- option.widget = this;
-
- int wpWidth = viewport()->width();
- option.rect.setWidth(wpWidth);
- for (int i = 0; i < m_groups.size(); ++i)
- {
- VisualGroup *category = m_groups.at(i);
- int y = category->verticalPosition();
- y -= verticalOffset();
- QRect backup = option.rect;
- int height = category->totalHeight();
- option.rect.setTop(y);
- option.rect.setHeight(height);
- option.rect.setLeft(m_leftMargin);
- option.rect.setRight(wpWidth - m_rightMargin);
- category->drawHeader(&painter, option);
- y += category->totalHeight() + m_categoryMargin;
- option.rect = backup;
- }
-
- for (int i = 0; i < model()->rowCount(); ++i)
- {
- const QModelIndex index = model()->index(i, 0);
- if (isIndexHidden(index))
- {
- continue;
- }
- Qt::ItemFlags flags = index.flags();
- option.rect = visualRect(index);
- option.features |=
- QStyleOptionViewItemV2::WrapText; // FIXME: what is the meaning of this anyway?
- if (flags & Qt::ItemIsSelectable && selectionModel()->isSelected(index))
- {
- option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected
- : QStyle::State_None;
- }
- else
- {
- option.state &= ~QStyle::State_Selected;
- }
- option.state |= (index == currentIndex()) ? QStyle::State_HasFocus : QStyle::State_None;
- if (!(flags & Qt::ItemIsEnabled))
- {
- option.state &= ~QStyle::State_Enabled;
- }
- itemDelegate()->paint(&painter, option, index);
- }
-
- /*
- * Drop indicators for manual reordering...
- */
-#if 0
- if (!m_lastDragPosition.isNull())
- {
- QPair<Group *, int> pair = rowDropPos(m_lastDragPosition);
- Group *category = pair.first;
- int row = pair.second;
- if (category)
- {
- int internalRow = row - category->firstItemIndex;
- QLine line;
- if (internalRow >= category->numItems())
- {
- QRect toTheRightOfRect = visualRect(category->lastItem());
- line = QLine(toTheRightOfRect.topRight(), toTheRightOfRect.bottomRight());
- }
- else
- {
- QRect toTheLeftOfRect = visualRect(model()->index(row, 0));
- line = QLine(toTheLeftOfRect.topLeft(), toTheLeftOfRect.bottomLeft());
- }
- painter.save();
- painter.setPen(QPen(Qt::black, 3));
- painter.drawLine(line);
- painter.restore();
- }
- }
-#endif
-}
-
-void GroupView::resizeEvent(QResizeEvent *event)
-{
- int newItemsPerRow = calculateItemsPerRow();
- if(newItemsPerRow != m_currentItemsPerRow)
- {
- m_currentCursorColumn = -1;
- m_currentItemsPerRow = newItemsPerRow;
- updateGeometries();
- }
-}
-
-void GroupView::dragEnterEvent(QDragEnterEvent *event)
-{
- if (!isDragEventAccepted(event))
- {
- return;
- }
- m_lastDragPosition = event->pos() + offset();
- viewport()->update();
- event->accept();
-}
-
-void GroupView::dragMoveEvent(QDragMoveEvent *event)
-{
- if (!isDragEventAccepted(event))
- {
- return;
- }
- m_lastDragPosition = event->pos() + offset();
- viewport()->update();
- event->accept();
-}
-
-void GroupView::dragLeaveEvent(QDragLeaveEvent *event)
-{
- m_lastDragPosition = QPoint();
- viewport()->update();
-}
-
-void GroupView::dropEvent(QDropEvent *event)
-{
- m_lastDragPosition = QPoint();
-
- stopAutoScroll();
- setState(NoState);
-
- if (event->source() != this || !(event->possibleActions() & Qt::MoveAction))
- {
- return;
- }
-
- QPair<VisualGroup *, int> dropPos = rowDropPos(event->pos() + offset());
- const VisualGroup *category = dropPos.first;
- const int row = dropPos.second;
-
- if (row == -1)
- {
- viewport()->update();
- return;
- }
-
- const QString categoryText = category->text;
- if (model()->dropMimeData(event->mimeData(), Qt::MoveAction, row, 0, QModelIndex()))
- {
- model()->setData(model()->index(row, 0), categoryText,
- GroupViewRoles::GroupRole);
- event->setDropAction(Qt::MoveAction);
- event->accept();
- }
- updateGeometries();
- viewport()->update();
-}
-
-void GroupView::startDrag(Qt::DropActions supportedActions)
-{
- QModelIndexList indexes = selectionModel()->selectedIndexes();
- if(indexes.count() == 0)
- return;
-
- QMimeData *data = model()->mimeData(indexes);
- if (!data)
- {
- return;
- }
- QRect rect;
- QPixmap pixmap = renderToPixmap(indexes, &rect);
- //rect.translate(offset());
- // rect.adjust(horizontalOffset(), verticalOffset(), 0, 0);
- QDrag *drag = new QDrag(this);
- drag->setPixmap(pixmap);
- drag->setMimeData(data);
- Qt::DropAction defaultDropAction = Qt::IgnoreAction;
- if (this->defaultDropAction() != Qt::IgnoreAction &&
- (supportedActions & this->defaultDropAction()))
- {
- defaultDropAction = this->defaultDropAction();
- }
- if (drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction)
- {
- const QItemSelection selection = selectionModel()->selection();
-
- for (auto it = selection.constBegin(); it != selection.constEnd(); ++it)
- {
- QModelIndex parent = (*it).parent();
- if ((*it).left() != 0)
- {
- continue;
- }
- if ((*it).right() != (model()->columnCount(parent) - 1))
- {
- continue;
- }
- int count = (*it).bottom() - (*it).top() + 1;
- model()->removeRows((*it).top(), count, parent);
- }
- }
-}
-
-QRect GroupView::visualRect(const QModelIndex &index) const
-{
- return geometryRect(index).translated(-offset());
-}
-
-QRect GroupView::geometryRect(const QModelIndex &index) const
-{
- if (!index.isValid() || isIndexHidden(index) || index.column() > 0)
- {
- return QRect();
- }
-
- int row = index.row();
- if(geometryCache.contains(row))
- {
- return *geometryCache[row];
- }
-
- const VisualGroup *cat = category(index);
- QPair<int, int> pos = cat->positionOf(index);
- int x = pos.first;
- // int y = pos.second;
-
- QRect out;
- out.setTop(cat->verticalPosition() + cat->headerHeight() + 5 + cat->rowTopOf(index));
- out.setLeft(m_spacing + x * (itemWidth() + m_spacing));
- out.setSize(itemDelegate()->sizeHint(viewOptions(), index));
- geometryCache.insert(row, new QRect(out));
- return out;
-}
-
-QModelIndex GroupView::indexAt(const QPoint &point) const
-{
- for (int i = 0; i < model()->rowCount(); ++i)
- {
- QModelIndex index = model()->index(i, 0);
- if (visualRect(index).contains(point))
- {
- return index;
- }
- }
- return QModelIndex();
-}
-
-void GroupView::setSelection(const QRect &rect,
- const QItemSelectionModel::SelectionFlags commands)
-{
- for (int i = 0; i < model()->rowCount(); ++i)
- {
- QModelIndex index = model()->index(i, 0);
- QRect itemRect = visualRect(index);
- if (itemRect.intersects(rect))
- {
- selectionModel()->select(index, commands);
- update(itemRect.translated(-offset()));
- }
- }
-}
-
-QPixmap GroupView::renderToPixmap(const QModelIndexList &indices, QRect *r) const
-{
- Q_ASSERT(r);
- auto paintPairs = draggablePaintPairs(indices, r);
- if (paintPairs.isEmpty())
- {
- return QPixmap();
- }
- QPixmap pixmap(r->size());
- pixmap.fill(Qt::transparent);
- QPainter painter(&pixmap);
- QStyleOptionViewItem option = viewOptions();
- option.state |= QStyle::State_Selected;
- for (int j = 0; j < paintPairs.count(); ++j)
- {
- option.rect = paintPairs.at(j).first.translated(-r->topLeft());
- const QModelIndex &current = paintPairs.at(j).second;
- itemDelegate()->paint(&painter, option, current);
- }
- return pixmap;
-}
-
-QList<QPair<QRect, QModelIndex>> GroupView::draggablePaintPairs(const QModelIndexList &indices,
- QRect *r) const
-{
- Q_ASSERT(r);
- QRect &rect = *r;
- QList<QPair<QRect, QModelIndex>> ret;
- for (int i = 0; i < indices.count(); ++i)
- {
- const QModelIndex &index = indices.at(i);
- const QRect current = geometryRect(index);
- ret += qMakePair(current, index);
- rect |= current;
- }
- return ret;
-}
-
-bool GroupView::isDragEventAccepted(QDropEvent *event)
-{
- return false;
-}
-
-QPair<VisualGroup *, int> GroupView::rowDropPos(const QPoint &pos)
-{
- return qMakePair<VisualGroup*, int>(nullptr, -1);
- // FIXME: PIXIE DUST.
- /*
- // check that we aren't on a category header and calculate which category we're in
- VisualGroup *category = 0;
- {
- int y = 0;
- for (auto cat : m_groups)
- {
- if (pos.y() > y && pos.y() < (y + cat->headerHeight()))
- {
- return qMakePair<VisualGroup*, int>(nullptr, -1);
- }
- y += cat->totalHeight() + m_categoryMargin;
- if (pos.y() < y)
- {
- category = cat;
- break;
- }
- }
- if (category == 0)
- {
- return qMakePair<VisualGroup*, int>(nullptr, -1);
- }
- }
-
- QList<QModelIndex> indices = category->items();
-
- // calculate the internal column
- int internalColumn = -1;
- {
- const int itemWidth = this->itemWidth();
- if (pos.x() >= (itemWidth * itemsPerRow()))
- {
- internalColumn = itemsPerRow();
- }
- else
- {
- for (int i = 0, c = 0; i < contentWidth(); i += itemWidth + 10 , ++c)
- {
- if (pos.x() > (i - itemWidth / 2) && pos.x() <= (i + itemWidth / 2))
- {
- internalColumn = c;
- break;
- }
- }
- }
- if (internalColumn == -1)
- {
- return qMakePair<VisualGroup*, int>(nullptr, -1);
- }
- }
-
- // calculate the internal row
- int internalRow = -1;
- {
- // FIXME rework the drag and drop code
- const int top = category->verticalPosition();
- for (int r = 0, h = top; r < category->numRows();
- h += itemHeightForCategoryRow(category, r), ++r)
- {
- if (pos.y() > h && pos.y() < (h + itemHeightForCategoryRow(category, r)))
- {
- internalRow = r;
- break;
- }
- }
- if (internalRow == -1)
- {
- return qMakePair<VisualGroup*, int>(nullptr, -1);
- }
- // this happens if we're in the margin between a one category and another
- // categories header
- if (internalRow > (indices.size() / itemsPerRow()))
- {
- return qMakePair<VisualGroup*, int>(nullptr, -1);
- }
- }
-
- // flaten the internalColumn/internalRow to one row
- int categoryRow = internalRow * itemsPerRow() + internalColumn;
-
- // this is used if we're past the last item
- if (categoryRow >= indices.size())
- {
- return qMakePair(category, indices.last().row() + 1);
- }
-
- return qMakePair(category, indices.at(categoryRow).row());
- */
-}
-
-QPoint GroupView::offset() const
-{
- return QPoint(horizontalOffset(), verticalOffset());
-}
-
-QRegion GroupView::visualRegionForSelection(const QItemSelection &selection) const
-{
- QRegion region;
- for (auto &range : selection)
- {
- int start_row = range.top();
- int end_row = range.bottom();
- for (int row = start_row; row <= end_row; ++row)
- {
- int start_column = range.left();
- int end_column = range.right();
- for (int column = start_column; column <= end_column; ++column)
- {
- QModelIndex index = model()->index(row, column, rootIndex());
- region += visualRect(index); // OK
- }
- }
- }
- return region;
-}
-
-QModelIndex GroupView::moveCursor(QAbstractItemView::CursorAction cursorAction,
- Qt::KeyboardModifiers modifiers)
-{
- auto current = currentIndex();
- if(!current.isValid())
- {
- return current;
- }
- auto cat = category(current);
- int group_index = m_groups.indexOf(cat);
- if(group_index < 0)
- return current;
-
- auto real_group = m_groups[group_index];
- int beginning_row = 0;
- for(auto group: m_groups)
- {
- if(group == real_group)
- break;
- beginning_row += group->numRows();
- }
-
- QPair<int, int> pos = cat->positionOf(current);
- int column = pos.first;
- int row = pos.second;
- if(m_currentCursorColumn < 0)
- {
- m_currentCursorColumn = column;
- }
- switch(cursorAction)
- {
- case MoveUp:
- {
- if(row == 0)
- {
- int prevgroupindex = group_index-1;
- while(prevgroupindex >= 0)
- {
- auto prevgroup = m_groups[prevgroupindex];
- if(prevgroup->collapsed)
- {
- prevgroupindex--;
- continue;
- }
- int newRow = prevgroup->numRows() - 1;
- int newRowSize = prevgroup->rows[newRow].size();
- int newColumn = m_currentCursorColumn;
- if (m_currentCursorColumn >= newRowSize)
- {
- newColumn = newRowSize - 1;
- }
- return prevgroup->rows[newRow][newColumn];
- }
- }
- else
- {
- int newRow = row - 1;
- int newRowSize = cat->rows[newRow].size();
- int newColumn = m_currentCursorColumn;
- if (m_currentCursorColumn >= newRowSize)
- {
- newColumn = newRowSize - 1;
- }
- return cat->rows[newRow][newColumn];
- }
- return current;
- }
- case MoveDown:
- {
- if(row == cat->rows.size() - 1)
- {
- int nextgroupindex = group_index+1;
- while (nextgroupindex < m_groups.size())
- {
- auto nextgroup = m_groups[nextgroupindex];
- if(nextgroup->collapsed)
- {
- nextgroupindex++;
- continue;
- }
- int newRowSize = nextgroup->rows[0].size();
- int newColumn = m_currentCursorColumn;
- if (m_currentCursorColumn >= newRowSize)
- {
- newColumn = newRowSize - 1;
- }
- return nextgroup->rows[0][newColumn];
- }
- }
- else
- {
- int newRow = row + 1;
- int newRowSize = cat->rows[newRow].size();
- int newColumn = m_currentCursorColumn;
- if (m_currentCursorColumn >= newRowSize)
- {
- newColumn = newRowSize - 1;
- }
- return cat->rows[newRow][newColumn];
- }
- return current;
- }
- case MoveLeft:
- {
- if(column > 0)
- {
- m_currentCursorColumn = column - 1;
- return cat->rows[row][column - 1];
- }
- // TODO: moving to previous line
- return current;
- }
- case MoveRight:
- {
- if(column < cat->rows[row].size() - 1)
- {
- m_currentCursorColumn = column + 1;
- return cat->rows[row][column + 1];
- }
- // TODO: moving to next line
- return current;
- }
- case MoveHome:
- {
- m_currentCursorColumn = 0;
- return cat->rows[row][0];
- }
- case MoveEnd:
- {
- auto last = cat->rows[row].size() - 1;
- m_currentCursorColumn = last;
- return cat->rows[row][last];
- }
- default:
- break;
- }
- return current;
-}
-
-int GroupView::horizontalOffset() const
-{
- return horizontalScrollBar()->value();
-}
-
-int GroupView::verticalOffset() const
-{
- return verticalScrollBar()->value();
-}
-
-void GroupView::scrollContentsBy(int dx, int dy)
-{
- scrollDirtyRegion(dx, dy);
- viewport()->scroll(dx, dy);
-}
-
-void GroupView::scrollTo(const QModelIndex &index, ScrollHint hint)
-{
- if (!index.isValid())
- return;
-
- const QRect rect = visualRect(index);
- if (hint == EnsureVisible && viewport()->rect().contains(rect))
- {
- viewport()->update(rect);
- return;
- }
-
- verticalScrollBar()->setValue(verticalScrollToValue(index, rect, hint));
-}
-
-int GroupView::verticalScrollToValue(const QModelIndex &index, const QRect &rect,
- QListView::ScrollHint hint) const
-{
- const QRect area = viewport()->rect();
- const bool above = (hint == QListView::EnsureVisible && rect.top() < area.top());
- const bool below = (hint == QListView::EnsureVisible && rect.bottom() > area.bottom());
-
- int verticalValue = verticalScrollBar()->value();
- QRect adjusted = rect.adjusted(-spacing(), -spacing(), spacing(), spacing());
- if (hint == QListView::PositionAtTop || above)
- verticalValue += adjusted.top();
- else if (hint == QListView::PositionAtBottom || below)
- verticalValue += qMin(adjusted.top(), adjusted.bottom() - area.height() + 1);
- else if (hint == QListView::PositionAtCenter)
- verticalValue += adjusted.top() - ((area.height() - adjusted.height()) / 2);
- return verticalValue;
-}
diff --git a/gui/groupview/GroupView.h b/gui/groupview/GroupView.h
deleted file mode 100644
index 93e45ed7..00000000
--- a/gui/groupview/GroupView.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#pragma once
-
-#include <QListView>
-#include <QLineEdit>
-#include <QScrollBar>
-#include <QCache>
-
-struct GroupViewRoles
-{
- enum
- {
- GroupRole = Qt::UserRole,
- ProgressValueRole,
- ProgressMaximumRole
- };
-};
-
-struct VisualGroup;
-
-class GroupView : public QAbstractItemView
-{
- Q_OBJECT
-
-public:
- GroupView(QWidget *parent = 0);
- ~GroupView();
-
- void setModel(QAbstractItemModel *model) override;
-
- /// return geometry rectangle occupied by the specified model item
- QRect geometryRect(const QModelIndex &index) const;
- /// return visual rectangle occupied by the specified model item
- virtual QRect visualRect(const QModelIndex &index) const override;
- /// get the model index at the specified visual point
- virtual QModelIndex indexAt(const QPoint &point) const override;
- void setSelection(const QRect &rect,
- const QItemSelectionModel::SelectionFlags commands) override;
-
- virtual int horizontalOffset() const override;
- virtual int verticalOffset() const override;
- virtual void scrollContentsBy(int dx, int dy) override;
- virtual void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
-
- virtual QModelIndex moveCursor(CursorAction cursorAction,
- Qt::KeyboardModifiers modifiers) override;
-
- virtual QRegion visualRegionForSelection(const QItemSelection &selection) const override;
-
- int spacing() const
- {
- return m_spacing;
- };
-protected
-slots:
- virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
- const QVector<int> &roles) override;
- virtual void rowsInserted(const QModelIndex &parent, int start, int end) override;
- virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
- virtual void updateGeometries() override;
- void modelReset();
-
-protected:
- virtual bool isIndexHidden(const QModelIndex &index) const override;
- void mousePressEvent(QMouseEvent *event) override;
- void mouseMoveEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
- void mouseDoubleClickEvent(QMouseEvent *event) override;
- void paintEvent(QPaintEvent *event) override;
- void resizeEvent(QResizeEvent *event) override;
-
- void dragEnterEvent(QDragEnterEvent *event) override;
- void dragMoveEvent(QDragMoveEvent *event) override;
- void dragLeaveEvent(QDragLeaveEvent *event) override;
- void dropEvent(QDropEvent *event) override;
-
- void startDrag(Qt::DropActions supportedActions) override;
-
-private:
- friend struct VisualGroup;
- QList<VisualGroup *> m_groups;
-
- // geometry
- int m_leftMargin = 5;
- int m_rightMargin = 5;
- int m_bottomMargin = 5;
- int m_categoryMargin = 5;
- int m_spacing = 5;
- int m_itemWidth = 100;
- int m_currentItemsPerRow = -1;
- int m_currentCursorColumn= -1;
- mutable QCache<int, QRect> geometryCache;
-
- // point where the currently active mouse action started in geometry coordinates
- QPoint m_pressedPosition;
- QPersistentModelIndex m_pressedIndex;
- bool m_pressedAlreadySelected;
- VisualGroup *m_pressedCategory;
- QItemSelectionModel::SelectionFlag m_ctrlDragSelectionFlag;
- QPoint m_lastDragPosition;
-
- VisualGroup *category(const QModelIndex &index) const;
- VisualGroup *category(const QString &cat) const;
- VisualGroup *categoryAt(const QPoint &pos) const;
-
- int itemsPerRow() const
- {
- return m_currentItemsPerRow;
- };
- int contentWidth() const;
-
-private: /* methods */
- int itemWidth() const;
- int calculateItemsPerRow() const;
- int verticalScrollToValue(const QModelIndex &index, const QRect &rect,
- QListView::ScrollHint hint) const;
- QPixmap renderToPixmap(const QModelIndexList &indices, QRect *r) const;
- QList<QPair<QRect, QModelIndex>> draggablePaintPairs(const QModelIndexList &indices,
- QRect *r) const;
-
- bool isDragEventAccepted(QDropEvent *event);
-
- QPair<VisualGroup *, int> rowDropPos(const QPoint &pos);
-
- QPoint offset() const;
-};
diff --git a/gui/groupview/GroupedProxyModel.cpp b/gui/groupview/GroupedProxyModel.cpp
deleted file mode 100644
index a45c5ae9..00000000
--- a/gui/groupview/GroupedProxyModel.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "GroupedProxyModel.h"
-
-#include "GroupView.h"
-#include <QDebug>
-
-GroupedProxyModel::GroupedProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
-{
-}
-
-bool GroupedProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
-{
- const QString leftCategory = left.data(GroupViewRoles::GroupRole).toString();
- const QString rightCategory = right.data(GroupViewRoles::GroupRole).toString();
- if (leftCategory == rightCategory)
- {
- return subSortLessThan(left, right);
- }
- else
- {
- // FIXME: real group sorting happens in GroupView::updateGeometries(), see LocaleString
- auto result = leftCategory.localeAwareCompare(rightCategory);
- if(result < 0)
- {
- qDebug() << leftCategory << "<" << rightCategory;
- }
- if(result == 0)
- {
- qDebug() << leftCategory << "=" << rightCategory;
- return subSortLessThan(left, right);
- }
- if(result > 0)
- {
- qDebug() << leftCategory << ">" << rightCategory;
- }
- return result < 0;
- }
-}
-
-bool GroupedProxyModel::subSortLessThan(const QModelIndex &left, const QModelIndex &right) const
-{
- return left.row() < right.row();
-}
diff --git a/gui/groupview/GroupedProxyModel.h b/gui/groupview/GroupedProxyModel.h
deleted file mode 100644
index 12edee0f..00000000
--- a/gui/groupview/GroupedProxyModel.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#include <QSortFilterProxyModel>
-
-class GroupedProxyModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-
-public:
- GroupedProxyModel(QObject *parent = 0);
-
-protected:
- virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
- virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const;
-};
diff --git a/gui/groupview/InstanceDelegate.cpp b/gui/groupview/InstanceDelegate.cpp
deleted file mode 100644
index a195baf6..00000000
--- a/gui/groupview/InstanceDelegate.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/* 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 "InstanceDelegate.h"
-#include <QPainter>
-#include <QTextOption>
-#include <QTextLayout>
-#include <QApplication>
-#include <QtMath>
-
-#include "GroupView.h"
-#include "logic/BaseInstance.h"
-#include "logic/InstanceList.h"
-
-QCache<QString, QPixmap> ListViewDelegate::m_pixmapCache;
-
-// Origin: Qt
-static void viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height,
- qreal &widthUsed)
-{
- 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();
- widthUsed = qMax(widthUsed, line.naturalTextWidth());
- }
- textLayout.endLayout();
-}
-
-ListViewDelegate::ListViewDelegate(QObject *parent) : QStyledItemDelegate(parent)
-{
-}
-
-void drawSelectionRect(QPainter *painter, const QStyleOptionViewItemV4 &option,
- const QRect &rect)
-{
- if ((option.state & QStyle::State_Selected))
- painter->fillRect(rect, option.palette.brush(QPalette::Highlight));
- else
- {
- QColor backgroundColor = option.palette.color(QPalette::Background);
- backgroundColor.setAlpha(160);
- painter->fillRect(rect, QBrush(backgroundColor));
- }
-}
-
-void drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option, const QRect &rect)
-{
- if (!(option.state & QStyle::State_HasFocus))
- return;
- QStyleOptionFocusRect opt;
- opt.direction = option.direction;
- opt.fontMetrics = option.fontMetrics;
- opt.palette = option.palette;
- opt.rect = rect;
- // opt.state = option.state | QStyle::State_KeyboardFocusChange |
- // QStyle::State_Item;
- auto col = option.state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base;
- opt.backgroundColor = option.palette.color(col);
- // Apparently some widget styles expect this hint to not be set
- painter->setRenderHint(QPainter::Antialiasing, false);
-
- QStyle *style = option.widget ? option.widget->style() : QApplication::style();
-
- style->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, painter, option.widget);
-
- painter->setRenderHint(QPainter::Antialiasing);
-}
-
-// TODO this can be made a lot prettier
-void drawProgressOverlay(QPainter *painter, const QStyleOptionViewItemV4 &option,
- const int value, const int maximum)
-{
- if (maximum == 0 || value == maximum)
- {
- return;
- }
-
- painter->save();
-
- qreal percent = (qreal)value / (qreal)maximum;
- QColor color = option.palette.color(QPalette::Dark);
- color.setAlphaF(0.70f);
- painter->setBrush(color);
- painter->setPen(QPen(QBrush(), 0));
- painter->drawPie(option.rect, 90 * 16, -percent * 360 * 16);
-
- painter->restore();
-}
-
-void drawBadges(QPainter *painter, const QStyleOptionViewItemV4 &option, BaseInstance *instance)
-{
- QList<QString> pixmaps;
- const BaseInstance::InstanceFlags flags = instance->flags();
- if (flags & BaseInstance::VersionBrokenFlag)
- {
- pixmaps.append("broken");
- }
- if (flags & BaseInstance::UpdateAvailable)
- {
- pixmaps.append("updateavailable");
- }
-
- // begin easter eggs
- if (instance->name().contains("btw", Qt::CaseInsensitive) ||
- instance->name().contains("better then wolves", Qt::CaseInsensitive) ||
- instance->name().contains("better than wolves", Qt::CaseInsensitive))
- {
- pixmaps.append("herobrine");
- }
- if (instance->name().contains("direwolf", Qt::CaseInsensitive))
- {
- pixmaps.append("enderman");
- }
- if (instance->name().contains("kitten", Qt::CaseInsensitive))
- {
- pixmaps.append("kitten");
- }
- if (instance->name().contains("derp", Qt::CaseInsensitive))
- {
- pixmaps.append("derp");
- }
- // end easter eggs
-
- static const int itemSide = 24;
- static const int spacing = 1;
- const int itemsPerRow = qMax(1, qFloor(double(option.rect.width() + spacing) / double(itemSide + spacing)));
- const int rows = qCeil((double)pixmaps.size() / (double)itemsPerRow);
- QListIterator<QString> it(pixmaps);
- painter->translate(option.rect.topLeft());
- for (int y = 0; y < rows; ++y)
- {
- for (int x = 0; x < itemsPerRow; ++x)
- {
- if (!it.hasNext())
- {
- return;
- }
- const QPixmap pixmap = ListViewDelegate::requestBadgePixmap(it.next()).scaled(
- itemSide, itemSide, Qt::KeepAspectRatio, Qt::FastTransformation);
- painter->drawPixmap(option.rect.width() - x * itemSide + qMax(x - 1, 0) * spacing - itemSide,
- y * itemSide + qMax(y - 1, 0) * spacing, itemSide, itemSide,
- pixmap);
- }
- }
- painter->translate(-option.rect.topLeft());
-}
-
-static QSize viewItemTextSize(const QStyleOptionViewItemV4 *option)
-{
- QStyle *style = option->widget ? option->widget->style() : QApplication::style();
- QTextOption textOption;
- textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
- QTextLayout textLayout;
- textLayout.setTextOption(textOption);
- textLayout.setFont(option->font);
- textLayout.setText(option->text);
- const int textMargin =
- style->pixelMetric(QStyle::PM_FocusFrameHMargin, option, option->widget) + 1;
- QRect bounds(0, 0, 100 - 2 * textMargin, 600);
- qreal height = 0, widthUsed = 0;
- viewItemTextLayout(textLayout, bounds.width(), height, widthUsed);
- const QSize size(qCeil(widthUsed), qCeil(height));
- return QSize(size.width() + 2 * textMargin, size.height());
-}
-
-void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const
-{
- QStyleOptionViewItemV4 opt = option;
- initStyleOption(&opt, index);
- painter->save();
- painter->setClipRect(opt.rect);
-
- opt.features |= QStyleOptionViewItem::WrapText;
- opt.text = index.data().toString();
- opt.textElideMode = Qt::ElideRight;
- opt.displayAlignment = Qt::AlignTop | Qt::AlignHCenter;
-
- QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
-
- // const int iconSize = style->pixelMetric(QStyle::PM_IconViewIconSize);
- const int iconSize = 48;
- QRect iconbox = opt.rect;
- const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, opt.widget) + 1;
- QRect textRect = opt.rect;
- QRect textHighlightRect = textRect;
- // clip the decoration on top, remove width padding
- textRect.adjust(textMargin, iconSize + textMargin + 5, -textMargin, 0);
-
- textHighlightRect.adjust(0, iconSize + 5, 0, 0);
-
- // draw background
- {
- // FIXME: unused
- // QSize textSize = viewItemTextSize ( &opt );
- QPalette::ColorGroup cg;
- QStyleOptionViewItemV4 opt2(opt);
-
- if ((opt.widget && opt.widget->isEnabled()) || (opt.state & QStyle::State_Enabled))
- {
- if (!(opt.state & QStyle::State_Active))
- cg = QPalette::Inactive;
- else
- cg = QPalette::Normal;
- }
- else
- {
- cg = QPalette::Disabled;
- }
- opt2.palette.setCurrentColorGroup(cg);
-
- // fill in background, if any
-
- if (opt.backgroundBrush.style() != Qt::NoBrush)
- {
- QPointF oldBO = painter->brushOrigin();
- painter->setBrushOrigin(opt.rect.topLeft());
- painter->fillRect(opt.rect, opt.backgroundBrush);
- painter->setBrushOrigin(oldBO);
- }
-
- drawSelectionRect(painter, opt2, textHighlightRect);
-
- /*
- if (opt.showDecorationSelected)
- {
- drawSelectionRect(painter, opt2, opt.rect);
- drawFocusRect(painter, opt2, opt.rect);
- // painter->fillRect ( opt.rect, opt.palette.brush ( cg, QPalette::Highlight ) );
- }
- else
- {
-
- // if ( opt.state & QStyle::State_Selected )
- {
- // QRect textRect = subElementRect ( QStyle::SE_ItemViewItemText, opt,
- // opt.widget );
- // painter->fillRect ( textHighlightRect, opt.palette.brush ( cg,
- // QPalette::Highlight ) );
- drawSelectionRect(painter, opt2, textHighlightRect);
- drawFocusRect(painter, opt2, textHighlightRect);
- }
- }
- */
- }
-
- // draw the icon
- {
- QIcon::Mode mode = QIcon::Normal;
- if (!(opt.state & QStyle::State_Enabled))
- mode = QIcon::Disabled;
- else if (opt.state & QStyle::State_Selected)
- mode = QIcon::Selected;
- QIcon::State state = opt.state & QStyle::State_Open ? QIcon::On : QIcon::Off;
-
- iconbox.setHeight(iconSize);
- opt.icon.paint(painter, iconbox, Qt::AlignCenter, mode, state);
- }
- // set the text colors
- QPalette::ColorGroup cg =
- opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
- if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active))
- cg = QPalette::Inactive;
- if (opt.state & QStyle::State_Selected)
- {
- painter->setPen(opt.palette.color(cg, QPalette::HighlightedText));
- }
- else
- {
- painter->setPen(opt.palette.color(cg, QPalette::Text));
- }
-
- // draw the text
- QTextOption textOption;
- textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
- textOption.setTextDirection(opt.direction);
- textOption.setAlignment(QStyle::visualAlignment(opt.direction, opt.displayAlignment));
- QTextLayout textLayout;
- textLayout.setTextOption(textOption);
- textLayout.setFont(opt.font);
- textLayout.setText(opt.text);
-
- qreal width, height;
- viewItemTextLayout(textLayout, textRect.width(), height, width);
-
- const int lineCount = textLayout.lineCount();
-
- const QRect layoutRect = QStyle::alignedRect(
- opt.direction, opt.displayAlignment, QSize(textRect.width(), int(height)), textRect);
- const QPointF position = layoutRect.topLeft();
- for (int i = 0; i < lineCount; ++i)
- {
- const QTextLine line = textLayout.lineAt(i);
- line.draw(painter, position);
- }
-
- // FIXME: this really has no business of being here. Make generic.
- auto instance = (BaseInstance*)index.data(InstanceList::InstancePointerRole)
- .value<void *>();
- if (instance)
- {
- drawBadges(painter, opt, instance);
- }
-
- drawProgressOverlay(painter, opt, index.data(GroupViewRoles::ProgressValueRole).toInt(),
- index.data(GroupViewRoles::ProgressMaximumRole).toInt());
-
- painter->restore();
-}
-
-QSize ListViewDelegate::sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const
-{
- QStyleOptionViewItemV4 opt = option;
- initStyleOption(&opt, index);
- opt.features |= QStyleOptionViewItem::WrapText;
- opt.text = index.data().toString();
- opt.textElideMode = Qt::ElideRight;
- opt.displayAlignment = Qt::AlignTop | Qt::AlignHCenter;
-
- QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
- const int textMargin =
- style->pixelMetric(QStyle::PM_FocusFrameHMargin, &option, opt.widget) + 1;
- int height = 48 + textMargin * 2 + 5; // TODO: turn constants into variables
- QSize szz = viewItemTextSize(&opt);
- height += szz.height();
- // FIXME: maybe the icon items could scale and keep proportions?
- QSize sz(100, height);
- return sz;
-}
-
-QPixmap ListViewDelegate::requestBadgePixmap(const QString &key)
-{
- if (!m_pixmapCache.contains(key))
- {
- m_pixmapCache.insert(key, new QPixmap(":/icons/badges/" + key + ".png"));
- }
- return *m_pixmapCache.object(key);
-}
diff --git a/gui/groupview/InstanceDelegate.h b/gui/groupview/InstanceDelegate.h
deleted file mode 100644
index 2b5439cb..00000000
--- a/gui/groupview/InstanceDelegate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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 <QStyledItemDelegate>
-#include <QCache>
-
-class ListViewDelegate : public QStyledItemDelegate
-{
-public:
- explicit ListViewDelegate(QObject *parent = 0);
-
- static QPixmap requestBadgePixmap(const QString &key);
-
-protected:
- void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
-private:
- static QCache<QString, QPixmap> m_pixmapCache;
-};
diff --git a/gui/groupview/VisualGroup.cpp b/gui/groupview/VisualGroup.cpp
deleted file mode 100644
index 560fc9ca..00000000
--- a/gui/groupview/VisualGroup.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-#include "VisualGroup.h"
-
-#include <QModelIndex>
-#include <QPainter>
-#include <QtMath>
-#include <QApplication>
-
-#include "GroupView.h"
-
-VisualGroup::VisualGroup(const QString &text, GroupView *view) : view(view), text(text), collapsed(false)
-{
-}
-
-VisualGroup::VisualGroup(const VisualGroup *other)
- : view(other->view), text(other->text), collapsed(other->collapsed)
-{
-}
-
-void VisualGroup::update()
-{
- auto temp_items = items();
- auto itemsPerRow = view->itemsPerRow();
-
- int numRows = qMax(1, qCeil((qreal)temp_items.size() / (qreal)itemsPerRow));
- rows = QVector<VisualRow>(numRows);
-
- int maxRowHeight = 0;
- int positionInRow = 0;
- int currentRow = 0;
- int offsetFromTop = 0;
- for (auto item: temp_items)
- {
- if(positionInRow == itemsPerRow)
- {
- rows[currentRow].height = maxRowHeight;
- rows[currentRow].top = offsetFromTop;
- currentRow ++;
- offsetFromTop += maxRowHeight + 5;
- positionInRow = 0;
- maxRowHeight = 0;
- }
- auto itemHeight = view->itemDelegate()->sizeHint(view->viewOptions(), item).height();
- if(itemHeight > maxRowHeight)
- {
- maxRowHeight = itemHeight;
- }
- rows[currentRow].items.append(item);
- positionInRow++;
- }
- rows[currentRow].height = maxRowHeight;
- rows[currentRow].top = offsetFromTop;
-}
-
-QPair<int, int> VisualGroup::positionOf(const QModelIndex &index) const
-{
- int x = 0;
- int y = 0;
- for (auto & row: rows)
- {
- for(auto x = 0; x < row.items.size(); x++)
- {
- if(row.items[x] == index)
- {
- return qMakePair(x,y);
- }
- }
- y++;
- }
- return qMakePair(x, y);
-}
-
-int VisualGroup::rowTopOf(const QModelIndex &index) const
-{
- auto position = positionOf(index);
- return rows[position.second].top;
-}
-
-int VisualGroup::rowHeightOf(const QModelIndex &index) const
-{
- auto position = positionOf(index);
- return rows[position.second].height;
-}
-
-VisualGroup::HitResults VisualGroup::hitScan(const QPoint &pos) const
-{
- VisualGroup::HitResults results = VisualGroup::NoHit;
- int y_start = verticalPosition();
- int body_start = y_start + headerHeight();
- int body_end = body_start + contentHeight() + 5; // FIXME: wtf is this 5?
- int y = pos.y();
- // int x = pos.x();
- if (y < y_start)
- {
- results = VisualGroup::NoHit;
- }
- else if (y < body_start)
- {
- results = VisualGroup::HeaderHit;
- int collapseSize = headerHeight() - 4;
-
- // the icon
- QRect iconRect = QRect(view->m_leftMargin + 2, 2 + y_start, collapseSize, collapseSize);
- if (iconRect.contains(pos))
- {
- results |= VisualGroup::CheckboxHit;
- }
- }
- else if (y < body_end)
- {
- results |= VisualGroup::BodyHit;
- }
- return results;
-}
-
-void VisualGroup::drawHeader(QPainter *painter, const QStyleOptionViewItem &option)
-{
- painter->setRenderHint(QPainter::Antialiasing);
-
- const QRect optRect = option.rect;
- QFont font(QApplication::font());
- font.setBold(true);
- const QFontMetrics fontMetrics = QFontMetrics(font);
-
- QColor outlineColor = option.palette.text().color();
- outlineColor.setAlphaF(0.35);
-
- //BEGIN: top left corner
- {
- painter->save();
- painter->setPen(outlineColor);
- const QPointF topLeft(optRect.topLeft());
- QRectF arc(topLeft, QSizeF(4, 4));
- arc.translate(0.5, 0.5);
- painter->drawArc(arc, 1440, 1440);
- painter->restore();
- }
- //END: top left corner
-
- //BEGIN: left vertical line
- {
- QPoint start(optRect.topLeft());
- start.ry() += 3;
- QPoint verticalGradBottom(optRect.topLeft());
- verticalGradBottom.ry() += fontMetrics.height() + 5;
- QLinearGradient gradient(start, verticalGradBottom);
- gradient.setColorAt(0, outlineColor);
- gradient.setColorAt(1, Qt::transparent);
- painter->fillRect(QRect(start, QSize(1, fontMetrics.height() + 5)), gradient);
- }
- //END: left vertical line
-
- //BEGIN: horizontal line
- {
- QPoint start(optRect.topLeft());
- start.rx() += 3;
- QPoint horizontalGradTop(optRect.topLeft());
- horizontalGradTop.rx() += optRect.width() - 6;
- painter->fillRect(QRect(start, QSize(optRect.width() - 6, 1)), outlineColor);
- }
- //END: horizontal line
-
- //BEGIN: top right corner
- {
- painter->save();
- painter->setPen(outlineColor);
- QPointF topRight(optRect.topRight());
- topRight.rx() -= 4;
- QRectF arc(topRight, QSizeF(4, 4));
- arc.translate(0.5, 0.5);
- painter->drawArc(arc, 0, 1440);
- painter->restore();
- }
- //END: top right corner
-
- //BEGIN: right vertical line
- {
- QPoint start(optRect.topRight());
- start.ry() += 3;
- QPoint verticalGradBottom(optRect.topRight());
- verticalGradBottom.ry() += fontMetrics.height() + 5;
- QLinearGradient gradient(start, verticalGradBottom);
- gradient.setColorAt(0, outlineColor);
- gradient.setColorAt(1, Qt::transparent);
- painter->fillRect(QRect(start, QSize(1, fontMetrics.height() + 5)), gradient);
- }
- //END: right vertical line
-
- //BEGIN: checkboxy thing
- {
- painter->save();
- painter->setRenderHint(QPainter::Antialiasing, false);
- painter->setFont(font);
- QColor penColor(option.palette.text().color());
- penColor.setAlphaF(0.6);
- painter->setPen(penColor);
- QRect iconSubRect(option.rect);
- iconSubRect.setTop(iconSubRect.top() + 7);
- iconSubRect.setLeft(iconSubRect.left() + 7);
-
- int sizing = fontMetrics.height();
- int even = ( (sizing - 1) % 2 );
-
- iconSubRect.setHeight(sizing - even);
- iconSubRect.setWidth(sizing - even);
- painter->drawRect(iconSubRect);
-
-
- /*
- if(collapsed)
- painter->drawText(iconSubRect, Qt::AlignHCenter | Qt::AlignVCenter, "+");
- else
- painter->drawText(iconSubRect, Qt::AlignHCenter | Qt::AlignVCenter, "-");
- */
- painter->setBrush(option.palette.text());
- painter->fillRect(iconSubRect.x(), iconSubRect.y() + iconSubRect.height() / 2,
- iconSubRect.width(), 2, penColor);
- if (collapsed)
- {
- painter->fillRect(iconSubRect.x() + iconSubRect.width() / 2, iconSubRect.y(), 2,
- iconSubRect.height(), penColor);
- }
-
- painter->restore();
- }
- //END: checkboxy thing
-
- //BEGIN: text
- {
- QRect textRect(option.rect);
- textRect.setTop(textRect.top() + 7);
- textRect.setLeft(textRect.left() + 7 + fontMetrics.height() + 7);
- textRect.setHeight(fontMetrics.height());
- textRect.setRight(textRect.right() - 7);
-
- painter->save();
- painter->setFont(font);
- QColor penColor(option.palette.text().color());
- penColor.setAlphaF(0.6);
- painter->setPen(penColor);
- painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text);
- painter->restore();
- }
- //END: text
-}
-
-int VisualGroup::totalHeight() const
-{
- return headerHeight() + 5 + contentHeight(); // FIXME: wtf is that '5'?
-}
-
-int VisualGroup::headerHeight() const
-{
- QFont font(QApplication::font());
- font.setBold(true);
- QFontMetrics fontMetrics(font);
-
- const int height = fontMetrics.height() + 1 /* 1 pixel-width gradient */
- + 11 /* top and bottom separation */;
- return height;
- /*
- int raw = view->viewport()->fontMetrics().height() + 4;
- // add english. maybe. depends on font height.
- if (raw % 2 == 0)
- raw++;
- return std::min(raw, 25);
- */
-}
-
-int VisualGroup::contentHeight() const
-{
- if (collapsed)
- {
- return 0;
- }
- auto last = rows[numRows() - 1];
- return last.top + last.height;
-}
-
-int VisualGroup::numRows() const
-{
- return rows.size();
-}
-
-int VisualGroup::verticalPosition() const
-{
- return m_verticalPosition;
-}
-
-QList<QModelIndex> VisualGroup::items() const
-{
- QList<QModelIndex> indices;
- for (int i = 0; i < view->model()->rowCount(); ++i)
- {
- const QModelIndex index = view->model()->index(i, 0);
- if (index.data(GroupViewRoles::GroupRole).toString() == text)
- {
- indices.append(index);
- }
- }
- return indices;
-}
diff --git a/gui/groupview/VisualGroup.h b/gui/groupview/VisualGroup.h
deleted file mode 100644
index d8d1f145..00000000
--- a/gui/groupview/VisualGroup.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#pragma once
-
-#include <QString>
-#include <QRect>
-#include <QVector>
-#include <QStyleOption>
-
-class GroupView;
-class QPainter;
-class QModelIndex;
-
-struct VisualRow
-{
- QList<QModelIndex> items;
- int height = 0;
- int top = 0;
- inline int size() const
- {
- return items.size();
- }
- inline QModelIndex &operator[](int i)
- {
- return items[i];
- }
-};
-
-struct VisualGroup
-{
-/* constructors */
- VisualGroup(const QString &text, GroupView *view);
- VisualGroup(const VisualGroup *other);
-
-/* data */
- GroupView *view = nullptr;
- QString text;
- bool collapsed = false;
- QVector<VisualRow> rows;
- int firstItemIndex = 0;
- int m_verticalPosition = 0;
-
-/* logic */
- /// update the internal list of items and flow them into the rows.
- void update();
-
- /// draw the header at y-position.
- void drawHeader(QPainter *painter, const QStyleOptionViewItem &option);
-
- /// height of the group, in total. includes a small bit of padding.
- int totalHeight() const;
-
- /// height of the group header, in pixels
- int headerHeight() const;
-
- /// height of the group content, in pixels
- int contentHeight() const;
-
- /// the number of visual rows this group has
- int numRows() const;
-
- /// actually calculate the above value
- int calculateNumRows() const;
-
- /// the height at which this group starts, in pixels
- int verticalPosition() const;
-
- /// relative geometry - top of the row of the given item
- int rowTopOf(const QModelIndex &index) const;
-
- /// height of the row of the given item
- int rowHeightOf(const QModelIndex &index) const;
-
- /// x/y position of the given item inside the group (in items!)
- QPair<int, int> positionOf(const QModelIndex &index) const;
-
- enum HitResult
- {
- NoHit = 0x0,
- TextHit = 0x1,
- CheckboxHit = 0x2,
- HeaderHit = 0x4,
- BodyHit = 0x8
- };
- Q_DECLARE_FLAGS(HitResults, HitResult)
-
- /// shoot! BANG! what did we hit?
- HitResults hitScan (const QPoint &pos) const;
-
- QList<QModelIndex> items() const;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(VisualGroup::HitResults)
diff --git a/gui/pagedialog/PageDialog.cpp b/gui/pagedialog/PageDialog.cpp
deleted file mode 100644
index 5399294c..00000000
--- a/gui/pagedialog/PageDialog.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/* 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 "PageDialog.h"
-
-#include <QDialogButtonBox>
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <QKeyEvent>
-
-#include "MultiMC.h"
-#include "logic/settings/SettingsObject.h"
-#include "gui/Platform.h"
-#include "gui/widgets/IconLabel.h"
-#include "gui/widgets/PageContainer.h"
-
-PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWidget *parent)
- : QDialog(parent)
-{
- MultiMCPlatform::fixWM_CLASS(this);
- setWindowTitle(pageProvider->dialogTitle());
- m_container = new PageContainer(pageProvider, defaultId, this);
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(m_container);
- mainLayout->setSpacing(0);
- mainLayout->setContentsMargins(0, 0, 0, 0);
- setLayout(mainLayout);
-
- QDialogButtonBox *buttons =
- new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Close);
- buttons->button(QDialogButtonBox::Close)->setDefault(true);
- m_container->addButtons(buttons);
-
- connect(buttons->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close()));
- connect(buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()), m_container,
- SLOT(help()));
-
- restoreGeometry(
- QByteArray::fromBase64(MMC->settings()->get("PagedGeometry").toByteArray()));
-}
-
-void PageDialog::closeEvent(QCloseEvent *event)
-{
- if (m_container->requestClose(event))
- {
- MMC->settings()->set("PagedGeometry", saveGeometry().toBase64());
- QDialog::closeEvent(event);
- }
-}
diff --git a/gui/pagedialog/PageDialog.h b/gui/pagedialog/PageDialog.h
deleted file mode 100644
index 9248c942..00000000
--- a/gui/pagedialog/PageDialog.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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 <QDialog>
-#include "gui/pages/BasePageProvider.h"
-
-class PageContainer;
-class PageDialog : public QDialog
-{
- Q_OBJECT
-public:
- explicit PageDialog(BasePageProviderPtr pageProvider, QString defaultId = QString(),
- QWidget *parent = 0);
- virtual ~PageDialog() {}
-
-private
-slots:
- virtual void closeEvent(QCloseEvent *event);
-
-private:
- PageContainer * m_container;
-};
diff --git a/gui/pages/BasePage.h b/gui/pages/BasePage.h
deleted file mode 100644
index ecf0692c..00000000
--- a/gui/pages/BasePage.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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 <QString>
-#include <QIcon>
-#include <memory>
-
-class BasePage
-{
-public:
- virtual ~BasePage() {}
- virtual QString id() const = 0;
- virtual QString displayName() const = 0;
- virtual QIcon icon() const = 0;
- virtual bool apply() { return true; }
- virtual bool shouldDisplay() const { return true; }
- virtual QString helpPage() const { return QString(); }
- virtual void opened() {}
- virtual void closed() {}
- int stackIndex = -1;
- int listIndex = -1;
-};
-
-typedef std::shared_ptr<BasePage> BasePagePtr;
diff --git a/gui/pages/BasePageProvider.h b/gui/pages/BasePageProvider.h
deleted file mode 100644
index c55683e0..00000000
--- a/gui/pages/BasePageProvider.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* 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 "BasePage.h"
-#include <memory>
-#include <functional>
-
-class BasePageProvider
-{
-public:
- virtual QList<BasePage *> getPages() = 0;
- 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;
diff --git a/gui/pages/InstanceSettingsPage.cpp b/gui/pages/InstanceSettingsPage.cpp
deleted file mode 100644
index e1a9c666..00000000
--- a/gui/pages/InstanceSettingsPage.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-#include "InstanceSettingsPage.h"
-#include "ui_InstanceSettingsPage.h"
-
-#include <QFileDialog>
-#include <QDialog>
-#include <QMessageBox>
-
-#include "gui/dialogs/VersionSelectDialog.h"
-#include "gui/NagUtils.h"
-#include "logic/java/JavaVersionList.h"
-#include "MultiMC.h"
-
-InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
- : QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst)
-{
- m_settings = &(inst->settings());
- ui->setupUi(this);
- loadSettings();
-}
-
-bool InstanceSettingsPage::shouldDisplay() const
-{
- return !m_instance->isRunning();
-}
-
-InstanceSettingsPage::~InstanceSettingsPage()
-{
- delete ui;
-}
-
-bool InstanceSettingsPage::apply()
-{
- applySettings();
- return true;
-}
-
-void InstanceSettingsPage::applySettings()
-{
- // Console
- bool console = ui->consoleSettingsBox->isChecked();
- m_settings->set("OverrideConsole", console);
- if (console)
- {
- m_settings->set("ShowConsole", ui->showConsoleCheck->isChecked());
- m_settings->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
- }
- else
- {
- m_settings->reset("ShowConsole");
- m_settings->reset("AutoCloseConsole");
- }
-
- // Window Size
- bool window = ui->windowSizeGroupBox->isChecked();
- m_settings->set("OverrideWindow", window);
- if (window)
- {
- m_settings->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
- m_settings->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
- m_settings->set("MinecraftWinHeight", ui->windowHeightSpinBox->value());
- }
- else
- {
- m_settings->reset("LaunchMaximized");
- m_settings->reset("MinecraftWinWidth");
- m_settings->reset("MinecraftWinHeight");
- }
-
- // Memory
- bool memory = ui->memoryGroupBox->isChecked();
- m_settings->set("OverrideMemory", memory);
- if (memory)
- {
- m_settings->set("MinMemAlloc", ui->minMemSpinBox->value());
- m_settings->set("MaxMemAlloc", ui->maxMemSpinBox->value());
- m_settings->set("PermGen", ui->permGenSpinBox->value());
- }
- else
- {
- m_settings->reset("MinMemAlloc");
- m_settings->reset("MaxMemAlloc");
- m_settings->reset("PermGen");
- }
-
- // Java Install Settings
- bool javaInstall = ui->javaSettingsGroupBox->isChecked();
- m_settings->set("OverrideJavaLocation", javaInstall);
- if (javaInstall)
- {
- m_settings->set("JavaPath", ui->javaPathTextBox->text());
- }
- else
- {
- m_settings->reset("JavaPath");
- }
-
- // Java arguments
- bool javaArgs = ui->javaArgumentsGroupBox->isChecked();
- m_settings->set("OverrideJavaArgs", javaArgs);
- if(javaArgs)
- {
- m_settings->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " "));
- NagUtils::checkJVMArgs(m_settings->get("JvmArgs").toString(), this->parentWidget());
- }
- else
- {
- m_settings->reset("JvmArgs");
- }
-
- // old generic 'override both' is removed.
- m_settings->reset("OverrideJava");
-
- // Custom Commands
- bool custcmd = ui->customCommandsGroupBox->isChecked();
- m_settings->set("OverrideCommands", custcmd);
- if (custcmd)
- {
- m_settings->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
- m_settings->set("PostExitCommand", ui->postExitCmdTextBox->text());
- }
- else
- {
- m_settings->reset("PreLaunchCommand");
- m_settings->reset("PostExitCommand");
- }
-}
-
-void InstanceSettingsPage::loadSettings()
-{
- // Console
- ui->consoleSettingsBox->setChecked(m_settings->get("OverrideConsole").toBool());
- ui->showConsoleCheck->setChecked(m_settings->get("ShowConsole").toBool());
- ui->autoCloseConsoleCheck->setChecked(m_settings->get("AutoCloseConsole").toBool());
-
- // Window Size
- ui->windowSizeGroupBox->setChecked(m_settings->get("OverrideWindow").toBool());
- ui->maximizedCheckBox->setChecked(m_settings->get("LaunchMaximized").toBool());
- ui->windowWidthSpinBox->setValue(m_settings->get("MinecraftWinWidth").toInt());
- ui->windowHeightSpinBox->setValue(m_settings->get("MinecraftWinHeight").toInt());
-
- // Memory
- ui->memoryGroupBox->setChecked(m_settings->get("OverrideMemory").toBool());
- ui->minMemSpinBox->setValue(m_settings->get("MinMemAlloc").toInt());
- ui->maxMemSpinBox->setValue(m_settings->get("MaxMemAlloc").toInt());
- ui->permGenSpinBox->setValue(m_settings->get("PermGen").toInt());
-
- // Java Settings
- 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());
-
- ui->javaArgumentsGroupBox->setChecked(overrideArgs);
- ui->jvmArgsTextBox->setPlainText(m_settings->get("JvmArgs").toString());
-
- // Custom Commands
- ui->customCommandsGroupBox->setChecked(m_settings->get("OverrideCommands").toBool());
- ui->preLaunchCmdTextBox->setText(m_settings->get("PreLaunchCommand").toString());
- ui->postExitCmdTextBox->setText(m_settings->get("PostExitCommand").toString());
-}
-
-void InstanceSettingsPage::on_javaDetectBtn_clicked()
-{
- JavaVersionPtr java;
-
- VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true);
- vselect.setResizeOn(2);
- vselect.exec();
-
- if (vselect.result() == QDialog::Accepted && vselect.selectedVersion())
- {
- java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
- ui->javaPathTextBox->setText(java->path);
- }
-}
-
-void InstanceSettingsPage::on_javaBrowseBtn_clicked()
-{
- QString dir = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
- if (!dir.isNull())
- {
- ui->javaPathTextBox->setText(dir);
- }
-}
-
-void InstanceSettingsPage::on_javaTestBtn_clicked()
-{
- checker.reset(new JavaChecker());
- connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this,
- SLOT(checkFinished(JavaCheckResult)));
- checker->path = ui->javaPathTextBox->text();
- checker->performCheck();
-}
-
-void InstanceSettingsPage::checkFinished(JavaCheckResult result)
-{
- if (result.valid)
- {
- QString text;
- text += "Java test succeeded!\n";
- if (result.is_64bit)
- text += "Using 64bit java.\n";
- text += "\n";
- text += "Platform reported: " + result.realPlatform;
- QMessageBox::information(this, tr("Java test success"), text);
- }
- else
- {
- QMessageBox::warning(
- this, tr("Java test failure"),
- tr("The specified java binary didn't work. You should use the auto-detect feature, "
- "or set the path to the java executable."));
- }
-}
diff --git a/gui/pages/InstanceSettingsPage.h b/gui/pages/InstanceSettingsPage.h
deleted file mode 100644
index 8835d02e..00000000
--- a/gui/pages/InstanceSettingsPage.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 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>
-
-#include "logic/net/NetJob.h"
-#include "logic/java/JavaChecker.h"
-#include "logic/BaseInstance.h"
-#include "BasePage.h"
-#include "MultiMC.h"
-
-class JavaChecker;
-namespace Ui
-{
-class InstanceSettingsPage;
-}
-
-class InstanceSettingsPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit InstanceSettingsPage(BaseInstance *inst, QWidget *parent = 0);
- virtual ~InstanceSettingsPage();
- virtual QString displayName() const override
- {
- return tr("Settings");
- }
- virtual QIcon icon() const override
- {
- return MMC->getThemedIcon("instance-settings");
- }
- virtual QString id() const override
- {
- return "settings";
- }
- virtual bool apply();
- virtual QString helpPage() const override
- {
- return "Instance-settings";
- }
- virtual bool shouldDisplay() const;
-private slots:
- void on_javaDetectBtn_clicked();
-
- void on_javaTestBtn_clicked();
-
- void on_javaBrowseBtn_clicked();
-
- void checkFinished(JavaCheckResult result);
-
- void applySettings();
- void loadSettings();
-
-private:
- Ui::InstanceSettingsPage *ui;
- BaseInstance *m_instance;
- SettingsObject *m_settings;
- std::shared_ptr<JavaChecker> checker;
-};
diff --git a/gui/pages/InstanceSettingsPage.ui b/gui/pages/InstanceSettingsPage.ui
deleted file mode 100644
index 64109378..00000000
--- a/gui/pages/InstanceSettingsPage.ui
+++ /dev/null
@@ -1,453 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>InstanceSettingsPage</class>
- <widget class="QWidget" name="InstanceSettingsPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>458</width>
- <height>426</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="settingsTabs">
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="minecraftTab">
- <attribute name="title">
- <string>Java</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QGroupBox" name="javaSettingsGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Java installation</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="3">
- <widget class="QLineEdit" name="javaPathTextBox"/>
- </item>
- <item row="1" column="0">
- <widget class="QPushButton" name="javaDetectBtn">
- <property name="text">
- <string>Auto-detect...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="javaBrowseBtn">
- <property name="text">
- <string>Browse...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="javaTestBtn">
- <property name="text">
- <string>Test</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="memoryGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Memory</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="1" column="1">
- <widget class="QSpinBox" name="maxMemSpinBox">
- <property name="toolTip">
- <string>The maximum amount of memory Minecraft is allowed to use.</string>
- </property>
- <property name="suffix">
- <string> MB</string>
- </property>
- <property name="minimum">
- <number>512</number>
- </property>
- <property name="maximum">
- <number>65536</number>
- </property>
- <property name="singleStep">
- <number>128</number>
- </property>
- <property name="value">
- <number>1024</number>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelMinMem">
- <property name="text">
- <string>Minimum memory allocation:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="labelMaxMem">
- <property name="text">
- <string>Maximum memory allocation:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="minMemSpinBox">
- <property name="toolTip">
- <string>The amount of memory Minecraft is started with.</string>
- </property>
- <property name="suffix">
- <string> MB</string>
- </property>
- <property name="minimum">
- <number>256</number>
- </property>
- <property name="maximum">
- <number>65536</number>
- </property>
- <property name="singleStep">
- <number>128</number>
- </property>
- <property name="value">
- <number>256</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="permGenSpinBox">
- <property name="toolTip">
- <string>The amount of memory available to store loaded Java classes.</string>
- </property>
- <property name="suffix">
- <string> MB</string>
- </property>
- <property name="minimum">
- <number>64</number>
- </property>
- <property name="maximum">
- <number>999999999</number>
- </property>
- <property name="singleStep">
- <number>8</number>
- </property>
- <property name="value">
- <number>64</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="labelPermGen">
- <property name="text">
- <string>PermGen:</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="javaArgumentsGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Java arguments</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="1" column="1">
- <widget class="QPlainTextEdit" name="jvmArgsTextBox"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacerMinecraft">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="javaTab">
- <attribute name="title">
- <string>Game windows</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="windowSizeGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Game Window</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QCheckBox" name="maximizedCheckBox">
- <property name="text">
- <string>Start Minecraft maximized?</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayoutWindowSize">
- <item row="1" column="0">
- <widget class="QLabel" name="labelWindowHeight">
- <property name="text">
- <string>Window height:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelWindowWidth">
- <property name="text">
- <string>Window width:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="windowWidthSpinBox">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>65536</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- <property name="value">
- <number>854</number>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="windowHeightSpinBox">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>65536</number>
- </property>
- <property name="value">
- <number>480</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="consoleSettingsBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Console Settings</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="showConsoleCheck">
- <property name="text">
- <string>Show console while the game is running?</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="autoCloseConsoleCheck">
- <property name="text">
- <string>Automatically close console when the game quits?</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacerMinecraft_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>88</width>
- <height>125</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Custom commands</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <widget class="QGroupBox" name="customCommandsGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Custom Commands</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="1">
- <widget class="QLineEdit" name="preLaunchCmdTextBox"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="labelPostExitCmd">
- <property name="text">
- <string>Post-exit command:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelPreLaunchCmd">
- <property name="text">
- <string>Pre-launch command:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="postExitCmdTextBox"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelCustomCmdsDescription">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Pre-launch command runs before the instance launches and post-exit command runs after it exits.&lt;/p&gt;&lt;p&gt;Both will be run in MultiMC's working directory with extra environment variables:&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;INST_NAME - Name of the instance&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;INST_ID - ID of the instance&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;INST_DIR - absolute path of the instance&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;INST_MC_DIR - absolute path of minecraft&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;INST_JAVA - java binary used for launch&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;INST_JAVA_ARGS - command-line parameters used for launch&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacerMinecraft_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>88</width>
- <height>186</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>settingsTabs</tabstop>
- <tabstop>javaSettingsGroupBox</tabstop>
- <tabstop>javaPathTextBox</tabstop>
- <tabstop>javaDetectBtn</tabstop>
- <tabstop>javaBrowseBtn</tabstop>
- <tabstop>javaTestBtn</tabstop>
- <tabstop>memoryGroupBox</tabstop>
- <tabstop>minMemSpinBox</tabstop>
- <tabstop>maxMemSpinBox</tabstop>
- <tabstop>permGenSpinBox</tabstop>
- <tabstop>javaArgumentsGroupBox</tabstop>
- <tabstop>jvmArgsTextBox</tabstop>
- <tabstop>windowSizeGroupBox</tabstop>
- <tabstop>maximizedCheckBox</tabstop>
- <tabstop>windowWidthSpinBox</tabstop>
- <tabstop>windowHeightSpinBox</tabstop>
- <tabstop>consoleSettingsBox</tabstop>
- <tabstop>showConsoleCheck</tabstop>
- <tabstop>autoCloseConsoleCheck</tabstop>
- <tabstop>customCommandsGroupBox</tabstop>
- <tabstop>preLaunchCmdTextBox</tabstop>
- <tabstop>postExitCmdTextBox</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/LogPage.cpp b/gui/pages/LogPage.cpp
deleted file mode 100644
index 4e9e4f52..00000000
--- a/gui/pages/LogPage.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-#include "LogPage.h"
-#include "ui_LogPage.h"
-
-#include "MultiMC.h"
-
-#include <QIcon>
-#include <QScrollBar>
-#include <QShortcut>
-
-#include "logic/BaseProcess.h"
-#include "gui/GuiUtil.h"
-
-LogPage::LogPage(BaseProcess *proc, QWidget *parent)
- : QWidget(parent), ui(new Ui::LogPage), m_process(proc)
-{
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
- connect(m_process, SIGNAL(log(QString, MessageLevel::Enum)), this,
- SLOT(write(QString, MessageLevel::Enum)));
-
- // create the format and set its font
- defaultFormat = new QTextCharFormat(ui->text->currentCharFormat());
- QString fontFamily = MMC->settings()->get("ConsoleFont").toString();
- bool conversionOk = false;
- int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk);
- if(!conversionOk)
- {
- fontSize = 11;
- }
- defaultFormat->setFont(QFont(fontFamily, fontSize));
-
- auto findShortcut = new QShortcut(QKeySequence(QKeySequence::Find), this);
- connect(findShortcut, SIGNAL(activated()), SLOT(findActivated()));
- auto findNextShortcut = new QShortcut(QKeySequence(QKeySequence::FindNext), this);
- connect(findNextShortcut, SIGNAL(activated()), SLOT(findNextActivated()));
- connect(ui->searchBar, SIGNAL(returnPressed()), SLOT(on_findButton_clicked()));
- auto findPreviousShortcut = new QShortcut(QKeySequence(QKeySequence::FindPrevious), this);
- connect(findPreviousShortcut, SIGNAL(activated()), SLOT(findPreviousActivated()));
-}
-
-LogPage::~LogPage()
-{
- delete ui;
- delete defaultFormat;
-}
-
-bool LogPage::apply()
-{
- return true;
-}
-
-bool LogPage::shouldDisplay() const
-{
- return m_process->instance()->isRunning();
-}
-
-void LogPage::on_btnPaste_clicked()
-{
- GuiUtil::uploadPaste(ui->text->toPlainText(), this);
-}
-
-void LogPage::on_btnCopy_clicked()
-{
- GuiUtil::setClipboardText(ui->text->toPlainText());
-}
-
-void LogPage::on_btnClear_clicked()
-{
- ui->text->clear();
-}
-
-void LogPage::on_trackLogCheckbox_clicked(bool checked)
-{
- m_write_active = checked;
-}
-
-void LogPage::on_findButton_clicked()
-{
- auto modifiers = QApplication::keyboardModifiers();
- if (modifiers & Qt::ShiftModifier)
- {
- findPreviousActivated();
- }
- else
- {
- findNextActivated();
- }
-}
-
-void LogPage::findActivated()
-{
- // focus the search bar if it doesn't have focus
- if (!ui->searchBar->hasFocus())
- {
- auto searchForCursor = ui->text->textCursor();
- auto searchForString = searchForCursor.selectedText();
- if (searchForString.size())
- {
- ui->searchBar->setText(searchForString);
- }
- ui->searchBar->setFocus();
- ui->searchBar->selectAll();
- }
-}
-
-void LogPage::findNextActivated()
-{
- auto toSearch = ui->searchBar->text();
- if (toSearch.size())
- {
- ui->text->find(toSearch);
- }
-}
-
-void LogPage::findPreviousActivated()
-{
- auto toSearch = ui->searchBar->text();
- if (toSearch.size())
- {
- ui->text->find(toSearch, QTextDocument::FindBackward);
- }
-}
-
-void LogPage::write(QString data, MessageLevel::Enum mode)
-{
- if (!m_write_active)
- {
- if (mode != MessageLevel::PrePost && mode != MessageLevel::MultiMC)
- {
- return;
- }
- }
-
- // save the cursor so it can be restored.
- auto savedCursor = ui->text->cursor();
-
- QScrollBar *bar = ui->text->verticalScrollBar();
- int max_bar = bar->maximum();
- int val_bar = bar->value();
- if (isVisible())
- {
- if (m_scroll_active)
- {
- m_scroll_active = (max_bar - val_bar) <= 1;
- }
- else
- {
- m_scroll_active = val_bar == max_bar;
- }
- }
- if (data.endsWith('\n'))
- data = data.left(data.length() - 1);
- QStringList paragraphs = data.split('\n');
- QStringList filtered;
- for (QString &paragraph : paragraphs)
- {
- //TODO: implement filtering here.
- filtered.append(paragraph);
- }
- QListIterator<QString> iter(filtered);
- QTextCharFormat format(*defaultFormat);
-
- switch(mode)
- {
- case MessageLevel::MultiMC:
- {
- format.setForeground(QColor("blue"));
- break;
- }
- case MessageLevel::Debug:
- {
- format.setForeground(QColor("green"));
- break;
- }
- case MessageLevel::Warning:
- {
- format.setForeground(QColor("orange"));
- break;
- }
- case MessageLevel::Error:
- {
- format.setForeground(QColor("red"));
- break;
- }
- case MessageLevel::Fatal:
- {
- format.setForeground(QColor("red"));
- format.setBackground(QColor("black"));
- break;
- }
- case MessageLevel::PrePost:
- {
- format.setForeground(QColor("grey"));
- break;
- }
- case MessageLevel::Info:
- case MessageLevel::Message:
- default:
- {
- // do nothing, keep original
- }
- }
-
- while (iter.hasNext())
- {
- // append a paragraph/line
- auto workCursor = ui->text->textCursor();
- workCursor.movePosition(QTextCursor::End);
- workCursor.insertText(iter.next(), format);
- workCursor.insertBlock();
- }
-
- if (isVisible())
- {
- if (m_scroll_active)
- {
- bar->setValue(bar->maximum());
- }
- m_last_scroll_value = bar->value();
- }
- ui->text->setCursor(savedCursor);
-}
diff --git a/gui/pages/LogPage.h b/gui/pages/LogPage.h
deleted file mode 100644
index fea438c0..00000000
--- a/gui/pages/LogPage.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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>
-
-#include "logic/BaseInstance.h"
-#include "logic/net/NetJob.h"
-#include "logic/BaseProcess.h"
-#include "BasePage.h"
-#include <MultiMC.h>
-
-namespace Ui
-{
-class LogPage;
-}
-class QTextCharFormat;
-
-class LogPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit LogPage(BaseProcess *proc, QWidget *parent = 0);
- virtual ~LogPage();
- virtual QString displayName() const override
- {
- return tr("Minecraft Log");
- }
- virtual QIcon icon() const override
- {
- return MMC->getThemedIcon("log");
- }
- virtual QString id() const override
- {
- return "console";
- }
- virtual bool apply();
- virtual QString helpPage() const override
- {
- return "Minecraft-Logs";
- }
- virtual bool shouldDisplay() const;
-
-private slots:
- /**
- * @brief write a string
- * @param data the string
- * @param mode the WriteMode
- * lines have to be put through this as a whole!
- */
- void write(QString data, MessageLevel::Enum level = MessageLevel::MultiMC);
- void on_btnPaste_clicked();
- void on_btnCopy_clicked();
- void on_btnClear_clicked();
-
- void on_trackLogCheckbox_clicked(bool checked);
-
- void on_findButton_clicked();
- void findActivated();
- void findNextActivated();
- void findPreviousActivated();
-
-private:
- Ui::LogPage *ui;
- BaseProcess *m_process;
- int m_last_scroll_value = 0;
- bool m_scroll_active = true;
- int m_saved_offset = 0;
- bool m_write_active = true;
-
- QTextCharFormat * defaultFormat;
-};
diff --git a/gui/pages/LogPage.ui b/gui/pages/LogPage.ui
deleted file mode 100644
index 089bc906..00000000
--- a/gui/pages/LogPage.ui
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>LogPage</class>
- <widget class="QWidget" name="LogPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>825</width>
- <height>782</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Log</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout">
- <item row="2" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Search:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QPushButton" name="findButton">
- <property name="text">
- <string>Find</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="3">
- <widget class="QPlainTextEdit" name="text">
- <property name="undoRedoEnabled">
- <bool>false</bool>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="plainText">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- <property name="centerOnScroll">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="3">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="trackLogCheckbox">
- <property name="text">
- <string>Keep updating</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="btnCopy">
- <property name="toolTip">
- <string>Copy the whole log into the clipboard</string>
- </property>
- <property name="text">
- <string>&amp;Copy</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnPaste">
- <property name="toolTip">
- <string>Upload the log to paste.ee - it will stay online for a month</string>
- </property>
- <property name="text">
- <string>Upload</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnClear">
- <property name="toolTip">
- <string>Clear the log</string>
- </property>
- <property name="text">
- <string>Clear</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="searchBar"/>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/ModFolderPage.cpp b/gui/pages/ModFolderPage.cpp
deleted file mode 100644
index 167ba471..00000000
--- a/gui/pages/ModFolderPage.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/* 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 "ModFolderPage.h"
-#include "ui_ModFolderPage.h"
-
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QEvent>
-#include <QKeyEvent>
-#include <QDesktopServices>
-#include <QAbstractItemModel>
-
-#include <pathutils.h>
-
-#include "MultiMC.h"
-#include "gui/dialogs/CustomMessageBox.h"
-#include "gui/dialogs/ModEditDialogCommon.h"
-#include "logic/minecraft/ModList.h"
-#include "logic/minecraft/Mod.h"
-#include "logic/minecraft/VersionFilterData.h"
-
-ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods, QString id,
- QString iconName, QString displayName, QString helpPage,
- QWidget *parent)
- : QWidget(parent), ui(new Ui::ModFolderPage)
-{
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
- m_inst = inst;
- m_mods = mods;
- m_id = id;
- m_displayName = displayName;
- m_iconName = iconName;
- m_helpName = helpPage;
- ui->modTreeView->setModel(m_mods.get());
- ui->modTreeView->installEventFilter(this);
- m_mods->startWatching();
- auto smodel = ui->modTreeView->selectionModel();
- connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
- SLOT(modCurrent(QModelIndex, QModelIndex)));
-}
-
-CoreModFolderPage::CoreModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods,
- QString id, QString iconName, QString displayName,
- QString helpPage, QWidget *parent)
- : ModFolderPage(inst, mods, id, iconName, displayName, helpPage, parent)
-{
-}
-
-ModFolderPage::~ModFolderPage()
-{
- m_mods->stopWatching();
- delete ui;
-}
-
-bool ModFolderPage::shouldDisplay() const
-{
- if (m_inst)
- return !m_inst->isRunning();
- return true;
-}
-
-bool CoreModFolderPage::shouldDisplay() const
-{
- if (ModFolderPage::shouldDisplay())
- {
- auto inst = dynamic_cast<OneSixInstance *>(m_inst);
- if (!inst)
- return true;
- auto version = inst->getMinecraftProfile();
- if (!version)
- return true;
- if (version->m_releaseTime < g_VersionFilterData.legacyCutoffDate)
- {
- return true;
- }
- }
- return false;
-}
-
-bool ModFolderPage::modListFilter(QKeyEvent *keyEvent)
-{
- switch (keyEvent->key())
- {
- case Qt::Key_Delete:
- on_rmModBtn_clicked();
- return true;
- case Qt::Key_Plus:
- on_addModBtn_clicked();
- return true;
- default:
- break;
- }
- return QWidget::eventFilter(ui->modTreeView, keyEvent);
-}
-
-bool ModFolderPage::eventFilter(QObject *obj, QEvent *ev)
-{
- if (ev->type() != QEvent::KeyPress)
- {
- return QWidget::eventFilter(obj, ev);
- }
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
- if (obj == ui->modTreeView)
- return modListFilter(keyEvent);
- return QWidget::eventFilter(obj, ev);
-}
-
-void ModFolderPage::on_addModBtn_clicked()
-{
- QStringList fileNames = QFileDialog::getOpenFileNames(
- this, QApplication::translate("ModFolderPage", "Select Loader Mods"));
- for (auto filename : fileNames)
- {
- m_mods->stopWatching();
- m_mods->installMod(QFileInfo(filename));
- m_mods->startWatching();
- }
-}
-void ModFolderPage::on_rmModBtn_clicked()
-{
- int first, last;
- auto list = ui->modTreeView->selectionModel()->selectedRows();
-
- if (!lastfirst(list, first, last))
- return;
- m_mods->stopWatching();
- m_mods->deleteMods(first, last);
- m_mods->startWatching();
-}
-
-void ModFolderPage::on_viewModBtn_clicked()
-{
- openDirInDefaultProgram(m_mods->dir().absolutePath(), true);
-}
-
-void ModFolderPage::modCurrent(const QModelIndex &current, const QModelIndex &previous)
-{
- if (!current.isValid())
- {
- ui->frame->clear();
- return;
- }
- int row = current.row();
- Mod &m = m_mods->operator[](row);
- ui->frame->updateWithMod(m);
-}
diff --git a/gui/pages/ModFolderPage.h b/gui/pages/ModFolderPage.h
deleted file mode 100644
index bd5156d4..00000000
--- a/gui/pages/ModFolderPage.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* 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>
-
-#include "logic/minecraft/OneSixInstance.h"
-#include "logic/net/NetJob.h"
-#include "BasePage.h"
-#include <MultiMC.h>
-
-class ModList;
-namespace Ui
-{
-class ModFolderPage;
-}
-
-class ModFolderPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit ModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods, QString id,
- QString iconName, QString displayName, QString helpPage = "",
- QWidget *parent = 0);
- virtual ~ModFolderPage();
- virtual QString displayName() const override
- {
- return m_displayName;
- }
- virtual QIcon icon() const override
- {
- return MMC->getThemedIcon(m_iconName);
- }
- virtual QString id() const override
- {
- return m_id;
- }
- virtual QString helpPage() const override
- {
- return m_helpName;
- }
- virtual bool shouldDisplay() const;
-
-protected:
- bool eventFilter(QObject *obj, QEvent *ev);
- bool modListFilter(QKeyEvent *ev);
-
-protected:
- BaseInstance *m_inst;
-
-private:
- Ui::ModFolderPage *ui;
- std::shared_ptr<ModList> m_mods;
- QString m_iconName;
- QString m_id;
- QString m_displayName;
- QString m_helpName;
-
-public
-slots:
- void modCurrent(const QModelIndex &current, const QModelIndex &previous);
-
-private
-slots:
- void on_addModBtn_clicked();
- void on_rmModBtn_clicked();
- void on_viewModBtn_clicked();
-};
-
-class CoreModFolderPage : public ModFolderPage
-{
-public:
- explicit CoreModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods, QString id,
- QString iconName, QString displayName, QString helpPage = "",
- QWidget *parent = 0);
- virtual ~CoreModFolderPage()
- {
- }
- virtual bool shouldDisplay() const;
-};
diff --git a/gui/pages/ModFolderPage.ui b/gui/pages/ModFolderPage.ui
deleted file mode 100644
index 019b8faf..00000000
--- a/gui/pages/ModFolderPage.ui
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ModFolderPage</class>
- <widget class="QWidget" name="ModFolderPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>723</width>
- <height>532</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Mods</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="ModListView" name="modTreeView">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="acceptDrops">
- <bool>true</bool>
- </property>
- <property name="dragDropMode">
- <enum>QAbstractItemView::DropOnly</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QPushButton" name="addModBtn">
- <property name="text">
- <string>&amp;Add</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="rmModBtn">
- <property name="text">
- <string>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="viewModBtn">
- <property name="text">
- <string>&amp;View Folder</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="MCModInfoFrame" name="frame">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>ModListView</class>
- <extends>QTreeView</extends>
- <header>gui/widgets/ModListView.h</header>
- </customwidget>
- <customwidget>
- <class>MCModInfoFrame</class>
- <extends>QFrame</extends>
- <header>gui/widgets/MCModInfoFrame.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/NotesPage.cpp b/gui/pages/NotesPage.cpp
deleted file mode 100644
index 48bb468c..00000000
--- a/gui/pages/NotesPage.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "NotesPage.h"
-#include "ui_NotesPage.h"
-
-NotesPage::NotesPage(BaseInstance *inst, QWidget *parent)
- : QWidget(parent), ui(new Ui::NotesPage), m_inst(inst)
-{
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
- ui->noteEditor->setText(m_inst->notes());
-}
-
-NotesPage::~NotesPage()
-{
- delete ui;
-}
-
-bool NotesPage::apply()
-{
- m_inst->setNotes(ui->noteEditor->toPlainText());
- return true;
-}
diff --git a/gui/pages/NotesPage.h b/gui/pages/NotesPage.h
deleted file mode 100644
index 6dcdce32..00000000
--- a/gui/pages/NotesPage.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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>
-
-#include "logic/BaseInstance.h"
-#include "logic/net/NetJob.h"
-#include "BasePage.h"
-#include <MultiMC.h>
-
-namespace Ui
-{
-class NotesPage;
-}
-
-class NotesPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit NotesPage(BaseInstance *inst, QWidget *parent = 0);
- virtual ~NotesPage();
- virtual QString displayName() const override
- {
- return tr("Notes");
- }
- virtual QIcon icon() const override
- {
- auto icon = MMC->getThemedIcon("notes");
- if(icon.isNull())
- icon = MMC->getThemedIcon("news");
- return icon;
- }
- virtual QString id() const override
- {
- return "notes";
- }
- virtual bool apply();
- virtual QString helpPage() const override
- {
- return "Notes";
- }
-
-private:
- Ui::NotesPage *ui;
- BaseInstance *m_inst;
-};
diff --git a/gui/pages/NotesPage.ui b/gui/pages/NotesPage.ui
deleted file mode 100644
index 8da01c8b..00000000
--- a/gui/pages/NotesPage.ui
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>NotesPage</class>
- <widget class="QWidget" name="NotesPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>731</width>
- <height>538</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTextEdit" name="noteEditor">
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOn</enum>
- </property>
- <property name="acceptRichText">
- <bool>false</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/OtherLogsPage.cpp b/gui/pages/OtherLogsPage.cpp
deleted file mode 100644
index c9b0aa51..00000000
--- a/gui/pages/OtherLogsPage.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/* 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 "OtherLogsPage.h"
-#include "ui_OtherLogsPage.h"
-
-#include <QFileDialog>
-#include <QMessageBox>
-
-#include "gui/GuiUtil.h"
-#include "logic/RecursiveFileSystemWatcher.h"
-#include <pathutils.h>
-
-OtherLogsPage::OtherLogsPage(QString path, QWidget *parent)
- : QWidget(parent), ui(new Ui::OtherLogsPage), m_path(path),
- m_watcher(new RecursiveFileSystemWatcher(this))
-{
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
-
- m_watcher->setFileExpression("(.*\\.log(\\.[0-9]*)?$)|(crash-.*\\.txt)");
- m_watcher->setRootDir(QDir::current().absoluteFilePath(m_path));
-
- connect(m_watcher, &RecursiveFileSystemWatcher::filesChanged, this,
- &OtherLogsPage::populateSelectLogBox);
- populateSelectLogBox();
-}
-
-OtherLogsPage::~OtherLogsPage()
-{
- delete ui;
-}
-
-void OtherLogsPage::opened()
-{
- m_watcher->enable();
-}
-void OtherLogsPage::closed()
-{
- m_watcher->disable();
-}
-
-void OtherLogsPage::populateSelectLogBox()
-{
- ui->selectLogBox->clear();
- ui->selectLogBox->addItems(m_watcher->files());
- if (m_currentFile.isNull())
- {
- ui->selectLogBox->setCurrentIndex(-1);
- }
- else
- {
- const int index = ui->selectLogBox->findText(m_currentFile);
- if (index != -1)
- ui->selectLogBox->setCurrentIndex(index);
- }
-}
-
-void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index)
-{
- QString file;
- if (index != -1)
- {
- file = ui->selectLogBox->itemText(index);
- }
-
- if (file.isEmpty() || !QFile::exists(PathCombine(m_path, file)))
- {
- m_currentFile = QString();
- ui->text->clear();
- setControlsEnabled(false);
- }
- else
- {
- m_currentFile = file;
- on_btnReload_clicked();
- setControlsEnabled(true);
- }
-}
-
-void OtherLogsPage::on_btnReload_clicked()
-{
- QFile file(PathCombine(m_path, m_currentFile));
- if (!file.open(QFile::ReadOnly))
- {
- setControlsEnabled(false);
- ui->btnReload->setEnabled(true); // allow reload
- m_currentFile = QString();
- QMessageBox::critical(this, tr("Error"), tr("Unable to open %1 for reading: %2")
- .arg(m_currentFile, file.errorString()));
- }
- else
- {
- if (file.size() < 10000000ll)
- {
- ui->text->setPlainText(QString::fromUtf8(file.readAll()));
- }
- else
- {
- ui->text->setPlainText(
- tr("The file (%1) is too big. You may want to open it in a viewer optimized "
- "for large files.").arg(file.fileName()));
- }
- }
-}
-
-void OtherLogsPage::on_btnPaste_clicked()
-{
- GuiUtil::uploadPaste(ui->text->toPlainText(), this);
-}
-void OtherLogsPage::on_btnCopy_clicked()
-{
- GuiUtil::setClipboardText(ui->text->toPlainText());
-}
-void OtherLogsPage::on_btnDelete_clicked()
-{
- if (QMessageBox::question(this, tr("Delete"),
- tr("Do you really want to delete %1?").arg(m_currentFile),
- QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
- {
- return;
- }
- QFile file(PathCombine(m_path, m_currentFile));
- if (!file.remove())
- {
- QMessageBox::critical(this, tr("Error"), tr("Unable to delete %1: %2")
- .arg(m_currentFile, file.errorString()));
- }
-}
-
-void OtherLogsPage::setControlsEnabled(const bool enabled)
-{
- ui->btnReload->setEnabled(enabled);
- ui->btnDelete->setEnabled(enabled);
- ui->btnCopy->setEnabled(enabled);
- ui->btnPaste->setEnabled(enabled);
- ui->text->setEnabled(enabled);
-}
diff --git a/gui/pages/OtherLogsPage.h b/gui/pages/OtherLogsPage.h
deleted file mode 100644
index d6e4ec9f..00000000
--- a/gui/pages/OtherLogsPage.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* 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>
-
-#include "BasePage.h"
-#include <MultiMC.h>
-
-namespace Ui
-{
-class OtherLogsPage;
-}
-
-class RecursiveFileSystemWatcher;
-
-class OtherLogsPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit OtherLogsPage(QString path, QWidget *parent = 0);
- ~OtherLogsPage();
-
- QString id() const override
- {
- return "logs";
- }
- QString displayName() const override
- {
- return tr("Other logs");
- }
- QIcon icon() const override
- {
- return MMC->getThemedIcon("log");
- }
- QString helpPage() const override
- {
- return "Minecraft-Logs";
- }
- void opened() override;
- void closed() override;
-
-private slots:
- void populateSelectLogBox();
- void on_selectLogBox_currentIndexChanged(const int index);
- void on_btnReload_clicked();
- void on_btnPaste_clicked();
- void on_btnCopy_clicked();
- void on_btnDelete_clicked();
-
-private:
- Ui::OtherLogsPage *ui;
- QString m_path;
- RecursiveFileSystemWatcher *m_watcher;
- QString m_currentFile;
-
- void setControlsEnabled(const bool enabled);
-};
diff --git a/gui/pages/OtherLogsPage.ui b/gui/pages/OtherLogsPage.ui
deleted file mode 100644
index 08200684..00000000
--- a/gui/pages/OtherLogsPage.ui
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>OtherLogsPage</class>
- <widget class="QWidget" name="OtherLogsPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>657</width>
- <height>538</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QComboBox" name="selectLogBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnReload">
- <property name="text">
- <string>Reload</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnCopy">
- <property name="toolTip">
- <string>Copy the whole log into the clipboard</string>
- </property>
- <property name="text">
- <string>&amp;Copy</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnPaste">
- <property name="toolTip">
- <string>Upload the log to paste.ee - it will stay online for a month</string>
- </property>
- <property name="text">
- <string>Upload</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnDelete">
- <property name="toolTip">
- <string>Clear the log</string>
- </property>
- <property name="text">
- <string>Delete</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QPlainTextEdit" name="text">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOn</enum>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>text</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/ResourcePackPage.h b/gui/pages/ResourcePackPage.h
deleted file mode 100644
index d79590df..00000000
--- a/gui/pages/ResourcePackPage.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-#include "ModFolderPage.h"
-
-class ResourcePackPage : public ModFolderPage
-{
-public:
- explicit ResourcePackPage(MinecraftInstance *instance, QWidget *parent = 0)
- : ModFolderPage(instance, instance->resourcePackList(), "resourcepacks",
- "resourcepacks", tr("Resource packs"), "Resource-packs", parent)
- {
- }
-
- virtual ~ResourcePackPage() {}
- virtual bool shouldDisplay() const override
- {
- return !m_inst->traits().contains("no-texturepacks") &&
- !m_inst->traits().contains("texturepacks");
- }
-};
diff --git a/gui/pages/ScreenshotsPage.cpp b/gui/pages/ScreenshotsPage.cpp
deleted file mode 100644
index 219a47ae..00000000
--- a/gui/pages/ScreenshotsPage.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-#include "ScreenshotsPage.h"
-#include "ui_ScreenshotsPage.h"
-
-#include <QModelIndex>
-#include <QMutableListIterator>
-#include <QMap>
-#include <QSet>
-#include <QFileIconProvider>
-#include <QFileSystemModel>
-#include <QStyledItemDelegate>
-#include <QLineEdit>
-#include <QEvent>
-#include <QPainter>
-#include <QClipboard>
-#include <QDesktopServices>
-#include <QKeyEvent>
-
-#include <pathutils.h>
-#include <MultiMC.h>
-
-#include "gui/dialogs/ProgressDialog.h"
-#include "gui/dialogs/CustomMessageBox.h"
-#include "logic/net/NetJob.h"
-#include "logic/screenshots/ImgurUpload.h"
-#include "logic/screenshots/ImgurAlbumCreation.h"
-#include "logic/tasks/SequentialTask.h"
-
-#include "logic/RWStorage.h"
-
-typedef RWStorage<QString, QIcon> SharedIconCache;
-typedef std::shared_ptr<SharedIconCache> SharedIconCachePtr;
-
-class ThumbnailingResult : public QObject
-{
- Q_OBJECT
-public slots:
- inline void emitResultsReady(const QString &path) { emit resultsReady(path); }
- inline void emitResultsFailed(const QString &path) { emit resultsFailed(path); }
-signals:
- void resultsReady(const QString &path);
- void resultsFailed(const QString &path);
-};
-
-class ThumbnailRunnable : public QRunnable
-{
-public:
- ThumbnailRunnable(QString path, SharedIconCachePtr cache)
- {
- m_path = path;
- m_cache = cache;
- }
- void run()
- {
- QFileInfo info(m_path);
- if (info.isDir())
- return;
- if ((info.suffix().compare("png", Qt::CaseInsensitive) != 0))
- return;
- int tries = 5;
- while (tries)
- {
- if (!m_cache->stale(m_path))
- return;
- QImage image(m_path);
- if (image.isNull())
- {
- QThread::msleep(500);
- tries--;
- continue;
- }
- QImage small;
- if (image.width() > image.height())
- small = image.scaledToWidth(512).scaledToWidth(256, Qt::SmoothTransformation);
- else
- small = image.scaledToHeight(512).scaledToHeight(256, Qt::SmoothTransformation);
- auto smallSize = small.size();
- QPoint offset((256 - small.width()) / 2, (256 - small.height()) / 2);
- QImage square(QSize(256, 256), QImage::Format_ARGB32);
- square.fill(Qt::transparent);
-
- QPainter painter(&square);
- painter.drawImage(offset, small);
- painter.end();
-
- QIcon icon(QPixmap::fromImage(square));
- m_cache->add(m_path, icon);
- m_resultEmitter.emitResultsReady(m_path);
- return;
- }
- m_resultEmitter.emitResultsFailed(m_path);
- }
- QString m_path;
- SharedIconCachePtr m_cache;
- ThumbnailingResult m_resultEmitter;
-};
-
-// this is about as elegant and well written as a bag of bricks with scribbles done by insane
-// asylum patients.
-class FilterModel : public QIdentityProxyModel
-{
- Q_OBJECT
-public:
- explicit FilterModel(QObject *parent = 0) : QIdentityProxyModel(parent)
- {
- m_thumbnailingPool.setMaxThreadCount(4);
- m_thumbnailCache = std::make_shared<SharedIconCache>();
- m_thumbnailCache->add("placeholder", MMC->getThemedIcon("screenshot-placeholder"));
- connect(&watcher, SIGNAL(fileChanged(QString)), SLOT(fileChanged(QString)));
- // FIXME: the watched file set is not updated when files are removed
- }
- virtual ~FilterModel() { m_thumbnailingPool.waitForDone(500); }
- virtual QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const
- {
- auto model = sourceModel();
- if (!model)
- return QVariant();
- if (role == Qt::DisplayRole || role == Qt::EditRole)
- {
- QVariant result = sourceModel()->data(mapToSource(proxyIndex), role);
- return result.toString().remove(QRegExp("\\.png$"));
- }
- if (role == Qt::DecorationRole)
- {
- QVariant result =
- sourceModel()->data(mapToSource(proxyIndex), QFileSystemModel::FilePathRole);
- QString filePath = result.toString();
- QIcon temp;
- if (!watched.contains(filePath))
- {
- ((QFileSystemWatcher &)watcher).addPath(filePath);
- ((QSet<QString> &)watched).insert(filePath);
- }
- if (m_thumbnailCache->get(filePath, temp))
- {
- return temp;
- }
- if (!m_failed.contains(filePath))
- {
- ((FilterModel *)this)->thumbnailImage(filePath);
- }
- return (m_thumbnailCache->get("placeholder"));
- }
- return sourceModel()->data(mapToSource(proxyIndex), role);
- }
- virtual bool setData(const QModelIndex &index, const QVariant &value,
- int role = Qt::EditRole)
- {
- auto model = sourceModel();
- if (!model)
- return false;
- if (role != Qt::EditRole)
- return false;
- // FIXME: this is a workaround for a bug in QFileSystemModel, where it doesn't
- // sort after renames
- {
- ((QFileSystemModel *)model)->setNameFilterDisables(true);
- ((QFileSystemModel *)model)->setNameFilterDisables(false);
- }
- return model->setData(mapToSource(index), value.toString() + ".png", role);
- }
-
-private:
- void thumbnailImage(QString path)
- {
- auto runnable = new ThumbnailRunnable(path, m_thumbnailCache);
- connect(&(runnable->m_resultEmitter), SIGNAL(resultsReady(QString)),
- SLOT(thumbnailReady(QString)));
- connect(&(runnable->m_resultEmitter), SIGNAL(resultsFailed(QString)),
- SLOT(thumbnailFailed(QString)));
- ((QThreadPool &)m_thumbnailingPool).start(runnable);
- }
-private slots:
- void thumbnailReady(QString path) { emit layoutChanged(); }
- void thumbnailFailed(QString path) { m_failed.insert(path); }
- void fileChanged(QString filepath)
- {
- m_thumbnailCache->setStale(filepath);
- thumbnailImage(filepath);
- // reinsert the path...
- watcher.removePath(filepath);
- watcher.addPath(filepath);
- }
-
-private:
- SharedIconCachePtr m_thumbnailCache;
- QThreadPool m_thumbnailingPool;
- QSet<QString> m_failed;
- QSet<QString> watched;
- QFileSystemWatcher watcher;
-};
-
-class CenteredEditingDelegate : public QStyledItemDelegate
-{
-public:
- explicit CenteredEditingDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
- virtual ~CenteredEditingDelegate() {}
- virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const
- {
- auto widget = QStyledItemDelegate::createEditor(parent, option, index);
- auto foo = dynamic_cast<QLineEdit *>(widget);
- if (foo)
- {
- foo->setAlignment(Qt::AlignHCenter);
- foo->setFrame(true);
- foo->setMaximumWidth(192);
- }
- return widget;
- }
-};
-
-ScreenshotsPage::ScreenshotsPage(QString path, QWidget *parent)
- : QWidget(parent), ui(new Ui::ScreenshotsPage)
-{
- m_model.reset(new QFileSystemModel());
- m_filterModel.reset(new FilterModel());
- m_filterModel->setSourceModel(m_model.get());
- m_model->setFilter(QDir::Files | QDir::Writable | QDir::Readable);
- m_model->setReadOnly(false);
- m_model->setNameFilters({"*.png"});
- m_model->setNameFilterDisables(false);
- m_folder = path;
- m_valid = ensureFolderPathExists(m_folder);
-
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
- ui->listView->setModel(m_filterModel.get());
- ui->listView->setIconSize(QSize(128, 128));
- ui->listView->setGridSize(QSize(192, 160));
- ui->listView->setSpacing(9);
- // ui->listView->setUniformItemSizes(true);
- ui->listView->setLayoutMode(QListView::Batched);
- ui->listView->setViewMode(QListView::IconMode);
- ui->listView->setResizeMode(QListView::Adjust);
- ui->listView->installEventFilter(this);
- ui->listView->setEditTriggers(0);
- ui->listView->setItemDelegate(new CenteredEditingDelegate(this));
- connect(ui->listView, SIGNAL(activated(QModelIndex)), SLOT(onItemActivated(QModelIndex)));
-}
-
-bool ScreenshotsPage::eventFilter(QObject *obj, QEvent *evt)
-{
- if (obj != ui->listView)
- return QWidget::eventFilter(obj, evt);
- if (evt->type() != QEvent::KeyPress)
- {
- return QWidget::eventFilter(obj, evt);
- }
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(evt);
- switch (keyEvent->key())
- {
- case Qt::Key_Delete:
- on_deleteBtn_clicked();
- return true;
- case Qt::Key_F2:
- on_renameBtn_clicked();
- return true;
- default:
- break;
- }
- return QWidget::eventFilter(obj, evt);
-}
-
-ScreenshotsPage::~ScreenshotsPage()
-{
- delete ui;
-}
-
-void ScreenshotsPage::onItemActivated(QModelIndex index)
-{
- if (!index.isValid())
- return;
- auto info = m_model->fileInfo(index);
- QString fileName = info.absoluteFilePath();
- openFileInDefaultProgram(info.absoluteFilePath());
-}
-
-void ScreenshotsPage::on_viewFolderBtn_clicked()
-{
- openDirInDefaultProgram(m_folder, true);
-}
-
-void ScreenshotsPage::on_uploadBtn_clicked()
-{
- auto selection = ui->listView->selectionModel()->selectedIndexes();
- if (selection.isEmpty())
- return;
-
- QList<ScreenshotPtr> uploaded;
- auto job = std::make_shared<NetJob>("Screenshot Upload");
- for (auto item : selection)
- {
- auto info = m_model->fileInfo(item);
- auto screenshot = std::make_shared<ScreenShot>(info);
- uploaded.push_back(screenshot);
- job->addNetAction(ImgurUpload::make(screenshot));
- }
- SequentialTask task;
- auto albumTask = std::make_shared<NetJob>("Imgur Album Creation");
- auto imgurAlbum = ImgurAlbumCreation::make(uploaded);
- albumTask->addNetAction(imgurAlbum);
- task.addTask(job);
- task.addTask(albumTask);
- ProgressDialog prog(this);
- if (prog.exec(&task) != QDialog::Accepted)
- {
- CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"),
- tr("Unknown error"), QMessageBox::Warning)->exec();
- }
- else
- {
- auto link = QString("https://imgur.com/a/%1").arg(imgurAlbum->id());
- QClipboard *clipboard = QApplication::clipboard();
- clipboard->setText(link);
- QDesktopServices::openUrl(link);
- CustomMessageBox::selectable(
- this, tr("Upload finished"),
- tr("The <a href=\"%1\">link to the uploaded album</a> has been opened in the "
- "default browser and placed in your clipboard.<br/>Delete hash: %2 (save "
- "this if you want to be able to edit/delete the album)")
- .arg(link, imgurAlbum->deleteHash()),
- QMessageBox::Information)->exec();
- }
-}
-
-void ScreenshotsPage::on_deleteBtn_clicked()
-{
- auto mbox = CustomMessageBox::selectable(
- this, tr("Are you sure?"), tr("This will delete all selected screenshots."),
- QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No);
- std::unique_ptr<QMessageBox> box(mbox);
-
- if (box->exec() != QMessageBox::Yes)
- return;
-
- auto selected = ui->listView->selectionModel()->selectedIndexes();
- for (auto item : selected)
- {
- m_model->remove(item);
- }
-}
-
-void ScreenshotsPage::on_renameBtn_clicked()
-{
- auto selection = ui->listView->selectionModel()->selectedIndexes();
- if (selection.isEmpty())
- return;
- ui->listView->edit(selection[0]);
- // TODO: mass renaming
-}
-
-void ScreenshotsPage::opened()
-{
- if (m_valid)
- {
- QString path = QDir(m_folder).absolutePath();
- m_model->setRootPath(path);
- ui->listView->setRootIndex(m_filterModel->mapFromSource(m_model->index(path)));
- }
-}
-
-#include "ScreenshotsPage.moc"
diff --git a/gui/pages/ScreenshotsPage.h b/gui/pages/ScreenshotsPage.h
deleted file mode 100644
index f5700ba8..00000000
--- a/gui/pages/ScreenshotsPage.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* 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>
-
-#include "BasePage.h"
-#include <MultiMC.h>
-
-class QFileSystemModel;
-class QIdentityProxyModel;
-namespace Ui
-{
-class ScreenshotsPage;
-}
-
-struct ScreenShot;
-class ScreenshotList;
-class ImgurAlbumCreation;
-
-class ScreenshotsPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit ScreenshotsPage(QString path, QWidget *parent = 0);
- virtual ~ScreenshotsPage();
-
- virtual void opened() override;
-
- enum
- {
- NothingDone = 0x42
- };
-
- virtual bool eventFilter(QObject *, QEvent *);
- virtual QString displayName() const override
- {
- return tr("Screenshots");
- }
- virtual QIcon icon() const override
- {
- return MMC->getThemedIcon("screenshots");
- }
- virtual QString id() const override
- {
- return "screenshots";
- }
- virtual QString helpPage() const override
- {
- return "Screenshots-management";
- }
-private slots:
- void on_uploadBtn_clicked();
- void on_deleteBtn_clicked();
- void on_renameBtn_clicked();
- void on_viewFolderBtn_clicked();
- void onItemActivated(QModelIndex);
-
-private:
- Ui::ScreenshotsPage *ui;
- std::shared_ptr<QFileSystemModel> m_model;
- std::shared_ptr<QIdentityProxyModel> m_filterModel;
- QString m_folder;
- bool m_valid = false;
-};
diff --git a/gui/pages/ScreenshotsPage.ui b/gui/pages/ScreenshotsPage.ui
deleted file mode 100644
index 30b55092..00000000
--- a/gui/pages/ScreenshotsPage.ui
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ScreenshotsPage</class>
- <widget class="QWidget" name="ScreenshotsPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>723</width>
- <height>532</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Mods</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QListView" name="listView">
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectItems</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QPushButton" name="uploadBtn">
- <property name="text">
- <string>&amp;Upload</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="deleteBtn">
- <property name="text">
- <string>&amp;Delete</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="renameBtn">
- <property name="text">
- <string>&amp;Rename</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="viewFolderBtn">
- <property name="text">
- <string>&amp;View Folder</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>listView</tabstop>
- <tabstop>uploadBtn</tabstop>
- <tabstop>deleteBtn</tabstop>
- <tabstop>renameBtn</tabstop>
- <tabstop>viewFolderBtn</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/TexturePackPage.h b/gui/pages/TexturePackPage.h
deleted file mode 100644
index 3c5c27d7..00000000
--- a/gui/pages/TexturePackPage.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-#include "ModFolderPage.h"
-
-class TexturePackPage : public ModFolderPage
-{
-public:
- explicit TexturePackPage(MinecraftInstance *instance, QWidget *parent = 0)
- : ModFolderPage(instance, instance->texturePackList(), "texturepacks", "resourcepacks",
- tr("Texture packs"), "Texture-packs", parent)
- {
- }
- virtual ~TexturePackPage() {}
- virtual bool shouldDisplay() const override
- {
- return m_inst->traits().contains("texturepacks");
- }
-};
diff --git a/gui/pages/VersionPage.cpp b/gui/pages/VersionPage.cpp
deleted file mode 100644
index 712b496f..00000000
--- a/gui/pages/VersionPage.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-/* 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 "MultiMC.h"
-
-#include <pathutils.h>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QEvent>
-#include <QKeyEvent>
-
-#include "VersionPage.h"
-#include "ui_VersionPage.h"
-
-#include "gui/Platform.h"
-#include "gui/dialogs/CustomMessageBox.h"
-#include "gui/dialogs/VersionSelectDialog.h"
-#include "gui/dialogs/ModEditDialogCommon.h"
-
-#include "gui/dialogs/ProgressDialog.h"
-
-#include <QAbstractItemModel>
-#include <QMessageBox>
-#include <QListView>
-#include <QString>
-#include <QUrl>
-
-#include "logic/minecraft/MinecraftProfile.h"
-#include "logic/forge/ForgeVersionList.h"
-#include "logic/forge/ForgeInstaller.h"
-#include "logic/liteloader/LiteLoaderVersionList.h"
-#include "logic/liteloader/LiteLoaderInstaller.h"
-#include "logic/minecraft/VersionBuilder.h"
-#include "logic/auth/MojangAccountList.h"
-#include "logic/minecraft/Mod.h"
-#include "logic/icons/IconList.h"
-
-
-QIcon VersionPage::icon() const
-{
- return ENV.icons()->getIcon(m_inst->iconKey());
-}
-bool VersionPage::shouldDisplay() const
-{
- return !m_inst->isRunning();
-}
-
-VersionPage::VersionPage(OneSixInstance *inst, QWidget *parent)
- : QWidget(parent), ui(new Ui::VersionPage), m_inst(inst)
-{
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
-
- m_version = m_inst->getMinecraftProfile();
- if (m_version)
- {
- ui->libraryTreeView->setModel(m_version.get());
- ui->libraryTreeView->installEventFilter(this);
- ui->libraryTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
- connect(ui->libraryTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
- this, &VersionPage::versionCurrent);
- updateVersionControls();
- // select first item.
- auto index = ui->libraryTreeView->model()->index(0,0);
- if(index.isValid())
- ui->libraryTreeView->setCurrentIndex(index);
- }
- else
- {
- disableVersionControls();
- }
- connect(m_inst, &OneSixInstance::versionReloaded, this,
- &VersionPage::updateVersionControls);
-}
-
-VersionPage::~VersionPage()
-{
- delete ui;
-}
-
-void VersionPage::updateVersionControls()
-{
- ui->forgeBtn->setEnabled(true);
- ui->liteloaderBtn->setEnabled(true);
-}
-
-void VersionPage::disableVersionControls()
-{
- ui->forgeBtn->setEnabled(false);
- ui->liteloaderBtn->setEnabled(false);
- ui->reloadLibrariesBtn->setEnabled(false);
- ui->removeLibraryBtn->setEnabled(false);
-}
-
-bool VersionPage::reloadMinecraftProfile()
-{
- try
- {
- m_inst->reloadProfile();
- return true;
- }
- catch (MMCError &e)
- {
- QMessageBox::critical(this, tr("Error"), e.cause());
- return false;
- }
- catch (...)
- {
- QMessageBox::critical(
- this, tr("Error"),
- tr("Failed to load the version description file for reasons unknown."));
- return false;
- }
-}
-
-void VersionPage::on_reloadLibrariesBtn_clicked()
-{
- reloadMinecraftProfile();
-}
-
-void VersionPage::on_removeLibraryBtn_clicked()
-{
- if (ui->libraryTreeView->currentIndex().isValid())
- {
- // FIXME: use actual model, not reloading.
- if (!m_version->remove(ui->libraryTreeView->currentIndex().row()))
- {
- QMessageBox::critical(this, tr("Error"), tr("Couldn't remove file"));
- }
- }
-}
-
-void VersionPage::on_jarmodBtn_clicked()
-{
- QFileDialog w;
- QSet<QString> locations;
- QString modsFolder = MMC->settings()->get("CentralModsDir").toString();
- auto f = [&](QStandardPaths::StandardLocation l)
- {
- QString location = QStandardPaths::writableLocation(l);
- QFileInfo finfo(location);
- if (!finfo.exists())
- return;
- locations.insert(location);
- };
- f(QStandardPaths::DesktopLocation);
- f(QStandardPaths::DocumentsLocation);
- f(QStandardPaths::DownloadLocation);
- f(QStandardPaths::HomeLocation);
- QList<QUrl> urls;
- for (auto location : locations)
- {
- urls.append(QUrl::fromLocalFile(location));
- }
- urls.append(QUrl::fromLocalFile(modsFolder));
-
- w.setFileMode(QFileDialog::ExistingFiles);
- w.setAcceptMode(QFileDialog::AcceptOpen);
- w.setNameFilter(tr("Minecraft jar mods (*.zip *.jar)"));
- w.setDirectory(modsFolder);
- w.setSidebarUrls(urls);
-
- if (w.exec())
- m_version->installJarMods(w.selectedFiles());
-}
-
-void VersionPage::on_resetLibraryOrderBtn_clicked()
-{
- try
- {
- m_version->resetOrder();
- }
- catch (MMCError &e)
- {
- QMessageBox::critical(this, tr("Error"), e.cause());
- }
-}
-
-void VersionPage::on_moveLibraryUpBtn_clicked()
-{
- if (ui->libraryTreeView->selectionModel()->selectedRows().isEmpty())
- {
- return;
- }
- try
- {
- const int row = ui->libraryTreeView->selectionModel()->selectedRows().first().row();
- m_version->move(row, MinecraftProfile::MoveUp);
- }
- catch (MMCError &e)
- {
- QMessageBox::critical(this, tr("Error"), e.cause());
- }
-}
-
-void VersionPage::on_moveLibraryDownBtn_clicked()
-{
- if (ui->libraryTreeView->selectionModel()->selectedRows().isEmpty())
- {
- return;
- }
- try
- {
- const int row = ui->libraryTreeView->selectionModel()->selectedRows().first().row();
- m_version->move(row, MinecraftProfile::MoveDown);
- }
- catch (MMCError &e)
- {
- QMessageBox::critical(this, tr("Error"), e.cause());
- }
-}
-
-void VersionPage::on_changeMCVersionBtn_clicked()
-{
- VersionSelectDialog vselect(m_inst->versionList().get(), tr("Change Minecraft version"),
- this);
- if (!vselect.exec() || !vselect.selectedVersion())
- return;
-
- if (!MMC->accounts()->anyAccountIsValid())
- {
- CustomMessageBox::selectable(
- this, tr("Error"),
- tr("MultiMC cannot download Minecraft or update instances unless you have at least "
- "one account added.\nPlease add your Mojang or Minecraft account."),
- QMessageBox::Warning)->show();
- return;
- }
-
- if (!m_version->isVanilla())
- {
- auto result = CustomMessageBox::selectable(
- this, tr("Are you sure?"),
- tr("This will remove any library/version customization you did previously. "
- "This includes things like Forge install and similar."),
- QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Abort,
- QMessageBox::Abort)->exec();
-
- if (result != QMessageBox::Ok)
- return;
- m_version->revertToVanilla();
- reloadMinecraftProfile();
- }
- m_inst->setIntendedVersionId(vselect.selectedVersion()->descriptor());
-
- auto updateTask = m_inst->doUpdate();
- if (!updateTask)
- {
- return;
- }
- ProgressDialog tDialog(this);
- connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
- tDialog.exec(updateTask.get());
-}
-
-void VersionPage::on_forgeBtn_clicked()
-{
- VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this);
- vselect.setExactFilter(1, m_inst->currentVersionId());
- vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") +
- m_inst->currentVersionId());
- if (vselect.exec() && vselect.selectedVersion())
- {
- ProgressDialog dialog(this);
- dialog.exec(
- ForgeInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this));
- }
-}
-
-void VersionPage::on_liteloaderBtn_clicked()
-{
- VersionSelectDialog vselect(MMC->liteloaderlist().get(), tr("Select LiteLoader version"),
- this);
- vselect.setExactFilter(1, m_inst->currentVersionId());
- vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") +
- m_inst->currentVersionId());
- if (vselect.exec() && vselect.selectedVersion())
- {
- ProgressDialog dialog(this);
- dialog.exec(
- LiteLoaderInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this));
- }
-}
-
-void VersionPage::versionCurrent(const QModelIndex &current, const QModelIndex &previous)
-{
- if (!current.isValid())
- {
- ui->removeLibraryBtn->setDisabled(true);
- ui->moveLibraryDownBtn->setDisabled(true);
- ui->moveLibraryUpBtn->setDisabled(true);
- }
- else
- {
- bool enabled = m_version->canRemove(current.row());
- ui->removeLibraryBtn->setEnabled(enabled);
- ui->moveLibraryDownBtn->setEnabled(enabled);
- ui->moveLibraryUpBtn->setEnabled(enabled);
- }
- QString selectedId = m_version->versionFileId(current.row());
- if (selectedId == "net.minecraft")
- {
- ui->changeMCVersionBtn->setEnabled(true);
- }
- else
- {
- ui->changeMCVersionBtn->setEnabled(false);
- }
-}
diff --git a/gui/pages/VersionPage.h b/gui/pages/VersionPage.h
deleted file mode 100644
index 3b90d0c6..00000000
--- a/gui/pages/VersionPage.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* 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>
-
-#include "logic/minecraft/OneSixInstance.h"
-#include "logic/net/NetJob.h"
-#include "BasePage.h"
-
-namespace Ui
-{
-class VersionPage;
-}
-
-class VersionPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit VersionPage(OneSixInstance *inst, QWidget *parent = 0);
- virtual ~VersionPage();
- virtual QString displayName() const override
- {
- return tr("Version");
- }
- virtual QIcon icon() const override;
- virtual QString id() const override
- {
- return "version";
- }
- virtual QString helpPage() const override
- {
- return "Instance-version";
- }
- virtual bool shouldDisplay() const;
-private
-slots:
-
- // version tab
- void on_forgeBtn_clicked();
- void on_liteloaderBtn_clicked();
- void on_reloadLibrariesBtn_clicked();
- void on_removeLibraryBtn_clicked();
- void on_resetLibraryOrderBtn_clicked();
- void on_moveLibraryUpBtn_clicked();
- void on_moveLibraryDownBtn_clicked();
- void on_jarmodBtn_clicked();
-
- void updateVersionControls();
- void disableVersionControls();
- void on_changeMCVersionBtn_clicked();
-
-protected:
- /// FIXME: this shouldn't be necessary!
- bool reloadMinecraftProfile();
-
-private:
- Ui::VersionPage *ui;
- std::shared_ptr<MinecraftProfile> m_version;
- OneSixInstance *m_inst;
- NetJobPtr forgeJob;
-
-public
-slots:
- void versionCurrent(const QModelIndex &current, const QModelIndex &previous);
-};
diff --git a/gui/pages/VersionPage.ui b/gui/pages/VersionPage.ui
deleted file mode 100644
index 9b270d01..00000000
--- a/gui/pages/VersionPage.ui
+++ /dev/null
@@ -1,204 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>VersionPage</class>
- <widget class="QWidget" name="VersionPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>693</width>
- <height>575</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Version</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="ModListView" name="libraryTreeView">
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOn</enum>
- </property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="headerHidden">
- <bool>false</bool>
- </property>
- <attribute name="headerVisible">
- <bool>true</bool>
- </attribute>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Selection</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="changeMCVersionBtn">
- <property name="text">
- <string>Change version</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="moveLibraryUpBtn">
- <property name="toolTip">
- <string>This isn't implemented yet.</string>
- </property>
- <property name="text">
- <string>Move up</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="moveLibraryDownBtn">
- <property name="toolTip">
- <string>This isn't implemented yet.</string>
- </property>
- <property name="text">
- <string>Move down</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="removeLibraryBtn">
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="LineSeparator" name="separator" native="true"/>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Install</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="forgeBtn">
- <property name="toolTip">
- <string>Replace any current custom version with Minecraft Forge</string>
- </property>
- <property name="text">
- <string>Install Forge</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="liteloaderBtn">
- <property name="text">
- <string>Install LiteLoader</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="jarmodBtn">
- <property name="text">
- <string>Add jar mod</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="LineSeparator" name="widget" native="true"/>
- </item>
- <item>
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>List</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="resetLibraryOrderBtn">
- <property name="toolTip">
- <string>This isn't implemented yet.</string>
- </property>
- <property name="text">
- <string>Reset order</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="reloadLibrariesBtn">
- <property name="text">
- <string>Reload</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_7">
- <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>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>ModListView</class>
- <extends>QTreeView</extends>
- <header>gui/widgets/ModListView.h</header>
- </customwidget>
- <customwidget>
- <class>LineSeparator</class>
- <extends>QWidget</extends>
- <header>gui/widgets/LineSeparator.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/global/AccountListPage.cpp b/gui/pages/global/AccountListPage.cpp
deleted file mode 100644
index 72e18405..00000000
--- a/gui/pages/global/AccountListPage.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/* 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 "AccountListPage.h"
-#include "ui_AccountListPage.h"
-
-#include <QItemSelectionModel>
-
-#include <QDebug>
-
-#include "logic/net/NetJob.h"
-#include "logic/net/URLConstants.h"
-#include "logic/Env.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>
-
-AccountListPage::AccountListPage(QWidget *parent)
- : QWidget(parent), ui(new Ui::AccountListPage)
-{
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
-
- m_accounts = MMC->accounts();
-
- ui->listView->setModel(m_accounts.get());
- ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
-
- // Expand the account column
- ui->listView->header()->setSectionResizeMode(1, QHeaderView::Stretch);
-
- QItemSelectionModel *selectionModel = ui->listView->selectionModel();
-
- connect(selectionModel, &QItemSelectionModel::selectionChanged,
- [this](const QItemSelection &sel, const QItemSelection &dsel)
- { updateButtonStates(); });
-
- connect(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged()));
- connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged()));
-
- updateButtonStates();
-}
-
-AccountListPage::~AccountListPage()
-{
- delete ui;
-}
-
-void AccountListPage::listChanged()
-{
- updateButtonStates();
-}
-
-void AccountListPage::on_addAccountBtn_clicked()
-{
- addAccount(tr("Please enter your Mojang or Minecraft account username and password to add "
- "your account."));
-}
-
-void AccountListPage::on_rmAccountBtn_clicked()
-{
- QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
- if (selection.size() > 0)
- {
- QModelIndex selected = selection.first();
- m_accounts->removeAccount(selected);
- }
-}
-
-void AccountListPage::on_setDefaultBtn_clicked()
-{
- QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
- if (selection.size() > 0)
- {
- QModelIndex selected = selection.first();
- MojangAccountPtr account =
- selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>();
- m_accounts->setActiveAccount(account->username());
- }
-}
-
-void AccountListPage::on_noDefaultBtn_clicked()
-{
- m_accounts->setActiveAccount("");
-}
-
-void AccountListPage::updateButtonStates()
-{
- // If there is no selection, disable buttons that require something selected.
- QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
-
- ui->rmAccountBtn->setEnabled(selection.size() > 0);
- ui->setDefaultBtn->setEnabled(selection.size() > 0);
-
- ui->noDefaultBtn->setDown(m_accounts->activeAccount().get() == nullptr);
-}
-
-void AccountListPage::addAccount(const QString &errMsg)
-{
- // TODO: The login dialog isn't quite done yet
- MojangAccountPtr account = LoginDialog::newAccount(this, errMsg);
-
- if (account != nullptr)
- {
- m_accounts->addAccount(account);
- if (m_accounts->count() == 1)
- m_accounts->setActiveAccount(account->username());
-
- // Grab associated player skins
- auto job = new NetJob("Player skins: " + account->username());
-
- for (AccountProfile profile : account->profiles())
- {
- auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.name + ".png");
- auto action = CacheDownload::make(
- QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta);
- job->addNetAction(action);
- meta->stale = true;
- }
-
- job->start();
- }
-}
diff --git a/gui/pages/global/AccountListPage.h b/gui/pages/global/AccountListPage.h
deleted file mode 100644
index 9fd894b8..00000000
--- a/gui/pages/global/AccountListPage.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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 <QDialog>
-#include <memory>
-
-#include "gui/pages/BasePage.h"
-
-#include "logic/auth/MojangAccountList.h"
-#include <MultiMC.h>
-
-namespace Ui
-{
-class AccountListPage;
-}
-
-class AuthenticateTask;
-
-class AccountListPage : public QWidget, public BasePage
-{
- Q_OBJECT
-public:
- explicit AccountListPage(QWidget *parent = 0);
- ~AccountListPage();
-
- QString displayName() const override
- {
- return tr("Accounts");
- }
- QIcon icon() const override
- {
- auto icon = MMC->getThemedIcon("accounts");
- if(icon.isNull())
- {
- icon = MMC->getThemedIcon("noaccount");
- }
- return icon;
- }
- QString id() const override
- {
- return "accounts";
- }
- QString helpPage() const override
- {
- return "Accounts";
- }
-
-public
-slots:
- void on_addAccountBtn_clicked();
-
- void on_rmAccountBtn_clicked();
-
- void on_setDefaultBtn_clicked();
-
- void on_noDefaultBtn_clicked();
-
- void listChanged();
-
- //! Updates the states of the dialog's buttons.
- void updateButtonStates();
-
-protected:
- std::shared_ptr<MojangAccountList> m_accounts;
-
-protected
-slots:
- void addAccount(const QString& errMsg="");
-
-private:
- Ui::AccountListPage *ui;
-};
diff --git a/gui/pages/global/AccountListPage.ui b/gui/pages/global/AccountListPage.ui
deleted file mode 100644
index 8ad78cf4..00000000
--- a/gui/pages/global/AccountListPage.ui
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AccountListPage</class>
- <widget class="QWidget" name="AccountListPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>694</width>
- <height>609</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Manage Accounts</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="welcomeLabel">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Welcome! If you're new here, you can click the &amp;quot;Add&amp;quot; button to add your Mojang or Minecraft account.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QTreeView" name="listView"/>
- </item>
- <item>
- <layout class="QVBoxLayout" name="manageAcctsBtnBox">
- <item>
- <widget class="QPushButton" name="addAccountBtn">
- <property name="text">
- <string>&amp;Add</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="rmAccountBtn">
- <property name="text">
- <string>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="buttonSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="setDefaultBtn">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the currently selected account as the active account. The active account is the account that is used to log in (unless it is overridden in an instance-specific setting).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="text">
- <string>&amp;Set Default</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="noDefaultBtn">
- <property name="toolTip">
- <string>Set no default account. This will cause MultiMC to prompt you to select an account every time you launch an instance that doesn't have its own default set.</string>
- </property>
- <property name="text">
- <string>&amp;No Default</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/global/ExternalToolsPage.cpp b/gui/pages/global/ExternalToolsPage.cpp
deleted file mode 100644
index e2dd70dd..00000000
--- a/gui/pages/global/ExternalToolsPage.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/* 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 "ExternalToolsPage.h"
-#include "ui_ExternalToolsPage.h"
-
-#include <QMessageBox>
-#include <QFileDialog>
-#include <QStandardPaths>
-
-#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->tabWidget->tabBar()->hide();
-
- #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
- ui->jsonEditorTextBox->setClearButtonEnabled(true);
- #endif
-
- ui->mceditLink->setOpenExternalLinks(true);
- ui->jvisualvmLink->setOpenExternalLinks(true);
- ui->jprofilerLink->setOpenExternalLinks(true);
- loadSettings();
-}
-
-ExternalToolsPage::~ExternalToolsPage()
-{
- delete ui;
-}
-
-void ExternalToolsPage::loadSettings()
-{
- auto s = MMC->settings();
- ui->jprofilerPathEdit->setText(s->get("JProfilerPath").toString());
- ui->jvisualvmPathEdit->setText(s->get("JVisualVMPath").toString());
- ui->mceditPathEdit->setText(s->get("MCEditPath").toString());
-
- // Editors
- ui->jsonEditorTextBox->setText(s->get("JsonEditor").toString());
-}
-void ExternalToolsPage::applySettings()
-{
- auto s = MMC->settings();
- s->set("JProfilerPath", ui->jprofilerPathEdit->text());
- s->set("JVisualVMPath", ui->jvisualvmPathEdit->text());
- s->set("MCEditPath", ui->mceditPathEdit->text());
-
- // Editors
- QString jsonEditor = ui->jsonEditorTextBox->text();
- if (!jsonEditor.isEmpty() &&
- (!QFileInfo(jsonEditor).exists() || !QFileInfo(jsonEditor).isExecutable()))
- {
- QString found = QStandardPaths::findExecutable(jsonEditor);
- if (!found.isEmpty())
- {
- jsonEditor = found;
- }
- }
- s->set("JsonEditor", jsonEditor);
-}
-
-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"));
- }
-}
-
-void ExternalToolsPage::on_jsonEditorBrowseBtn_clicked()
-{
- QString raw_file = QFileDialog::getOpenFileName(
- this, tr("JSON Editor"),
- ui->jsonEditorTextBox->text().isEmpty()
-#if defined(Q_OS_LINUX)
- ? QString("/usr/bin")
-#else
- ? QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first()
-#endif
- : ui->jsonEditorTextBox->text());
- QString cooked_file = NormalizePath(raw_file);
-
- if (cooked_file.isEmpty())
- {
- return;
- }
-
- // it has to exist and be an executable
- if (QFileInfo(cooked_file).exists() && QFileInfo(cooked_file).isExecutable())
- {
- ui->jsonEditorTextBox->setText(cooked_file);
- }
- else
- {
- QMessageBox::warning(this, tr("Invalid"),
- tr("The file chosen does not seem to be an executable"));
- }
-}
-
-bool ExternalToolsPage::apply()
-{
- applySettings();
- return true;
-}
diff --git a/gui/pages/global/ExternalToolsPage.h b/gui/pages/global/ExternalToolsPage.h
deleted file mode 100644
index 7c5efad6..00000000
--- a/gui/pages/global/ExternalToolsPage.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 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>
-
-#include "gui/pages/BasePage.h"
-#include <MultiMC.h>
-
-namespace Ui {
-class ExternalToolsPage;
-}
-
-class ExternalToolsPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit ExternalToolsPage(QWidget *parent = 0);
- ~ExternalToolsPage();
-
- QString displayName() const override
- {
- return tr("External Tools");
- }
- QIcon icon() const override
- {
- auto icon = MMC->getThemedIcon("externaltools");
- if(icon.isNull())
- {
- icon = MMC->getThemedIcon("loadermods");
- }
- return icon;
- }
- QString id() const override
- {
- return "external-tools";
- }
- QString helpPage() const override
- {
- return "External-tools";
- }
- virtual bool apply();
-
-private:
- void loadSettings();
- void applySettings();
-
-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();
- void on_jsonEditorBrowseBtn_clicked();
-};
diff --git a/gui/pages/global/ExternalToolsPage.ui b/gui/pages/global/ExternalToolsPage.ui
deleted file mode 100644
index ba1b6f01..00000000
--- a/gui/pages/global/ExternalToolsPage.ui
+++ /dev/null
@@ -1,197 +0,0 @@
-<?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>673</width>
- <height>751</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://www.ej-technologies.com/products/jprofiler/overview.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.ej-technologies.com/products/jprofiler/overview.html&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://visualvm.java.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://visualvm.java.net/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://www.mcedit.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.mcedit.net/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="editorsBox">
- <property name="title">
- <string>External Editors (leave empty for system default)</string>
- </property>
- <layout class="QGridLayout" name="foldersBoxLayout_2">
- <item row="0" column="1">
- <widget class="QLineEdit" name="jsonEditorTextBox"/>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelJsonEditor">
- <property name="text">
- <string>Text Editor:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QToolButton" name="jsonEditorBrowseBtn">
- <property name="text">
- <string>...</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>216</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/global/JavaPage.cpp b/gui/pages/global/JavaPage.cpp
deleted file mode 100644
index b0ed23ea..00000000
--- a/gui/pages/global/JavaPage.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/* 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 "JavaPage.h"
-#include "ui_JavaPage.h"
-
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QDir>
-
-#include <pathutils.h>
-
-#include "gui/NagUtils.h"
-
-#include "gui/Platform.h"
-#include "gui/dialogs/VersionSelectDialog.h"
-#include <gui/ColumnResizer.h>
-
-#include "logic/java/JavaUtils.h"
-#include "logic/java/JavaVersionList.h"
-#include "logic/java/JavaChecker.h"
-
-#include "logic/settings/SettingsObject.h"
-#include "MultiMC.h"
-
-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();
-}
-
-JavaPage::~JavaPage()
-{
- delete ui;
-}
-
-bool JavaPage::apply()
-{
- applySettings();
- return true;
-}
-
-void JavaPage::applySettings()
-{
- auto s = MMC->settings();
- // Memory
- s->set("MinMemAlloc", ui->minMemSpinBox->value());
- s->set("MaxMemAlloc", ui->maxMemSpinBox->value());
- s->set("PermGen", ui->permGenSpinBox->value());
-
- // Java Settings
- s->set("JavaPath", ui->javaPathTextBox->text());
- s->set("JvmArgs", ui->jvmArgsTextBox->text());
- NagUtils::checkJVMArgs(s->get("JvmArgs").toString(), this->parentWidget());
-
- // Custom Commands
- s->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
- s->set("PostExitCommand", ui->postExitCmdTextBox->text());
-}
-void JavaPage::loadSettings()
-{
- auto s = MMC->settings();
- // Memory
- ui->minMemSpinBox->setValue(s->get("MinMemAlloc").toInt());
- ui->maxMemSpinBox->setValue(s->get("MaxMemAlloc").toInt());
- ui->permGenSpinBox->setValue(s->get("PermGen").toInt());
-
- // Java Settings
- ui->javaPathTextBox->setText(s->get("JavaPath").toString());
- ui->jvmArgsTextBox->setText(s->get("JvmArgs").toString());
-
- // Custom Commands
- ui->preLaunchCmdTextBox->setText(s->get("PreLaunchCommand").toString());
- ui->postExitCmdTextBox->setText(s->get("PostExitCommand").toString());
-}
-
-void JavaPage::on_javaDetectBtn_clicked()
-{
- JavaVersionPtr java;
-
- VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true);
- vselect.setResizeOn(2);
- vselect.exec();
-
- if (vselect.result() == QDialog::Accepted && vselect.selectedVersion())
- {
- java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
- ui->javaPathTextBox->setText(java->path);
- }
-}
-void JavaPage::on_javaBrowseBtn_clicked()
-{
- QString dir = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
- if (!dir.isNull())
- {
- ui->javaPathTextBox->setText(dir);
- }
-}
-void JavaPage::on_javaTestBtn_clicked()
-{
- checker.reset(new JavaChecker());
- connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this,
- SLOT(checkFinished(JavaCheckResult)));
- checker->path = ui->javaPathTextBox->text();
- checker->performCheck();
-}
-
-void JavaPage::checkFinished(JavaCheckResult result)
-{
- if (result.valid)
- {
- QString text;
- text += "Java test succeeded!\n";
- if (result.is_64bit)
- text += "Using 64bit java.\n";
- text += "\n";
- text += "Platform reported: " + result.realPlatform + "\n";
- text += "Java version reported: " + result.javaVersion;
- QMessageBox::information(this, tr("Java test success"), text);
- }
- else
- {
- QMessageBox::warning(
- this, tr("Java test failure"),
- tr("The specified java binary didn't work. You should use the auto-detect feature, "
- "or set the path to the java executable."));
- }
-}
diff --git a/gui/pages/global/JavaPage.h b/gui/pages/global/JavaPage.h
deleted file mode 100644
index f70d9dbd..00000000
--- a/gui/pages/global/JavaPage.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* 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 <memory>
-#include <QDialog>
-
-#include "logic/java/JavaChecker.h"
-#include "gui/pages/BasePage.h"
-#include <MultiMC.h>
-
-class SettingsObject;
-
-namespace Ui
-{
-class JavaPage;
-}
-
-class JavaPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit JavaPage(QWidget *parent = 0);
- ~JavaPage();
-
- QString displayName() const override
- {
- return tr("Java");
- }
- QIcon icon() const override
- {
- return MMC->getThemedIcon("java");
- }
- QString id() const override
- {
- return "java-settings";
- }
- QString helpPage() const override
- {
- return "Java-settings";
- }
- bool apply() override;
-
-private:
- void applySettings();
- void loadSettings();
-
-private
-slots:
- void on_javaDetectBtn_clicked();
- void on_javaTestBtn_clicked();
- void on_javaBrowseBtn_clicked();
-
- void checkFinished(JavaCheckResult result);
-
-private:
- Ui::JavaPage *ui;
- std::shared_ptr<JavaChecker> checker;
-};
diff --git a/gui/pages/global/JavaPage.ui b/gui/pages/global/JavaPage.ui
deleted file mode 100644
index 6ae41a49..00000000
--- a/gui/pages/global/JavaPage.ui
+++ /dev/null
@@ -1,303 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>JavaPage</class>
- <widget class="QWidget" name="JavaPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>545</width>
- <height>609</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Settings</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>:/icons/toolbar/settings</normaloff>:/icons/toolbar/settings</iconset>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Tab 1</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QGroupBox" name="memoryGroupBox">
- <property name="title">
- <string>Memory</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="1" column="1">
- <widget class="QSpinBox" name="maxMemSpinBox">
- <property name="toolTip">
- <string>The maximum amount of memory Minecraft is allowed to use.</string>
- </property>
- <property name="suffix">
- <string> MB</string>
- </property>
- <property name="minimum">
- <number>512</number>
- </property>
- <property name="maximum">
- <number>65536</number>
- </property>
- <property name="singleStep">
- <number>128</number>
- </property>
- <property name="value">
- <number>1024</number>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelMinMem">
- <property name="text">
- <string>Minimum memory allocation:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="labelMaxMem">
- <property name="text">
- <string>Maximum memory allocation:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="minMemSpinBox">
- <property name="toolTip">
- <string>The amount of memory Minecraft is started with.</string>
- </property>
- <property name="suffix">
- <string> MB</string>
- </property>
- <property name="minimum">
- <number>256</number>
- </property>
- <property name="maximum">
- <number>65536</number>
- </property>
- <property name="singleStep">
- <number>128</number>
- </property>
- <property name="value">
- <number>256</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="labelPermGen">
- <property name="text">
- <string>PermGen:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="permGenSpinBox">
- <property name="toolTip">
- <string>The amount of memory available to store loaded Java classes.</string>
- </property>
- <property name="suffix">
- <string> MB</string>
- </property>
- <property name="minimum">
- <number>64</number>
- </property>
- <property name="maximum">
- <number>999999999</number>
- </property>
- <property name="singleStep">
- <number>8</number>
- </property>
- <property name="value">
- <number>64</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="javaSettingsGroupBox">
- <property name="title">
- <string>Java Runtime</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <widget class="QLabel" name="labelJavaPath">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Java path:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="javaDetectBtn">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Auto-detect...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="javaTestBtn">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Test</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="labelJVMArgs">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>JVM arguments:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLineEdit" name="javaPathTextBox"/>
- </item>
- <item>
- <widget class="QPushButton" name="javaBrowseBtn">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>28</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="1" colspan="2">
- <widget class="QLineEdit" name="jvmArgsTextBox"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="customCommandsGroupBox">
- <property name="title">
- <string>Custom Commands</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="1" column="0">
- <widget class="QLabel" name="labelPostExitCmd">
- <property name="text">
- <string>Post-exit command:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelPreLaunchCmd">
- <property name="text">
- <string>Pre-launch command:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="preLaunchCmdTextBox"/>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="postExitCmdTextBox"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelCustomCmdsDescription">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Pre-launch command runs before the instance launches and post-exit command runs after it exits. Both will be run in MultiMC's working directory with INST_ID, INST_DIR, and INST_NAME as environment variables.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>minMemSpinBox</tabstop>
- <tabstop>maxMemSpinBox</tabstop>
- <tabstop>permGenSpinBox</tabstop>
- <tabstop>javaPathTextBox</tabstop>
- <tabstop>javaBrowseBtn</tabstop>
- <tabstop>javaDetectBtn</tabstop>
- <tabstop>javaTestBtn</tabstop>
- <tabstop>jvmArgsTextBox</tabstop>
- <tabstop>preLaunchCmdTextBox</tabstop>
- <tabstop>postExitCmdTextBox</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/global/MinecraftPage.cpp b/gui/pages/global/MinecraftPage.cpp
deleted file mode 100644
index 5f752206..00000000
--- a/gui/pages/global/MinecraftPage.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/* 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 "MinecraftPage.h"
-#include "ui_MinecraftPage.h"
-
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QDir>
-
-#include <pathutils.h>
-
-#include "gui/Platform.h"
-#include "gui/dialogs/VersionSelectDialog.h"
-#include "gui/dialogs/CustomMessageBox.h"
-
-#include "gui/NagUtils.h"
-
-#include "logic/java/JavaUtils.h"
-#include "logic/java/JavaVersionList.h"
-#include "logic/java/JavaChecker.h"
-
-#include "logic/updater/UpdateChecker.h"
-
-#include "logic/tools/BaseProfiler.h"
-
-#include "logic/settings/SettingsObject.h"
-#include "MultiMC.h"
-
-MinecraftPage::MinecraftPage(QWidget *parent) : QWidget(parent), ui(new Ui::MinecraftPage)
-{
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
- loadSettings();
- updateCheckboxStuff();
-}
-
-MinecraftPage::~MinecraftPage()
-{
- delete ui;
-}
-
-bool MinecraftPage::apply()
-{
- applySettings();
- return true;
-}
-
-void MinecraftPage::updateCheckboxStuff()
-{
- ui->windowWidthSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked());
- ui->windowHeightSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked());
-}
-
-void MinecraftPage::on_maximizedCheckBox_clicked(bool checked)
-{
- Q_UNUSED(checked);
- updateCheckboxStuff();
-}
-
-
-void MinecraftPage::applySettings()
-{
- auto s = MMC->settings();
-
- // Window Size
- s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
- s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
- s->set("MinecraftWinHeight", ui->windowHeightSpinBox->value());
-}
-
-void MinecraftPage::loadSettings()
-{
- auto s = MMC->settings();
-
- // Window Size
- ui->maximizedCheckBox->setChecked(s->get("LaunchMaximized").toBool());
- ui->windowWidthSpinBox->setValue(s->get("MinecraftWinWidth").toInt());
- ui->windowHeightSpinBox->setValue(s->get("MinecraftWinHeight").toInt());
-}
diff --git a/gui/pages/global/MinecraftPage.h b/gui/pages/global/MinecraftPage.h
deleted file mode 100644
index 6dd86338..00000000
--- a/gui/pages/global/MinecraftPage.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* 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 <memory>
-#include <QDialog>
-
-#include "logic/java/JavaChecker.h"
-#include "gui/pages/BasePage.h"
-#include <MultiMC.h>
-
-class SettingsObject;
-
-namespace Ui
-{
-class MinecraftPage;
-}
-
-class MinecraftPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit MinecraftPage(QWidget *parent = 0);
- ~MinecraftPage();
-
- QString displayName() const override
- {
- return tr("Minecraft");
- }
- QIcon icon() const override
- {
- return MMC->getThemedIcon("minecraft");
- }
- QString id() const override
- {
- return "minecraft-settings";
- }
- QString helpPage() const override
- {
- return "Minecraft-settings";
- }
- bool apply() override;
-
-private:
- void updateCheckboxStuff();
- void applySettings();
- void loadSettings();
-
-private
-slots:
- void on_maximizedCheckBox_clicked(bool checked);
-
-private:
- Ui::MinecraftPage *ui;
-
-};
diff --git a/gui/pages/global/MinecraftPage.ui b/gui/pages/global/MinecraftPage.ui
deleted file mode 100644
index 825f6a56..00000000
--- a/gui/pages/global/MinecraftPage.ui
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MinecraftPage</class>
- <widget class="QWidget" name="MinecraftPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>545</width>
- <height>195</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Settings</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>:/icons/toolbar/settings</normaloff>:/icons/toolbar/settings</iconset>
- </property>
- <layout class="QVBoxLayout" name="mainLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="minecraftTab">
- <attribute name="title">
- <string>Minecraft</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="windowSizeGroupBox">
- <property name="title">
- <string>Window Size</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QCheckBox" name="maximizedCheckBox">
- <property name="text">
- <string>Start Minecraft maximized?</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayoutWindowSize">
- <item row="1" column="0">
- <widget class="QLabel" name="labelWindowHeight">
- <property name="text">
- <string>Window hei&amp;ght:</string>
- </property>
- <property name="buddy">
- <cstring>windowHeightSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelWindowWidth">
- <property name="text">
- <string>W&amp;indow width:</string>
- </property>
- <property name="buddy">
- <cstring>windowWidthSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="windowWidthSpinBox">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>65536</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- <property name="value">
- <number>854</number>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="windowHeightSpinBox">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>65536</number>
- </property>
- <property name="value">
- <number>480</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacerMinecraft">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>tabWidget</tabstop>
- <tabstop>maximizedCheckBox</tabstop>
- <tabstop>windowWidthSpinBox</tabstop>
- <tabstop>windowHeightSpinBox</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/pages/global/MultiMCPage.cpp b/gui/pages/global/MultiMCPage.cpp
deleted file mode 100644
index d2934666..00000000
--- a/gui/pages/global/MultiMCPage.cpp
+++ /dev/null
@@ -1,459 +0,0 @@
-/* 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 "MultiMCPage.h"
-#include "ui_MultiMCPage.h"
-
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QDir>
-#include <QTextCharFormat>
-
-#include <pathutils.h>
-
-#include "gui/Platform.h"
-#include "gui/dialogs/VersionSelectDialog.h"
-#include "gui/dialogs/CustomMessageBox.h"
-#include <gui/ColumnResizer.h>
-
-#include "gui/NagUtils.h"
-
-#include "logic/java/JavaUtils.h"
-#include "logic/java/JavaVersionList.h"
-#include "logic/java/JavaChecker.h"
-
-#include "logic/updater/UpdateChecker.h"
-
-#include "logic/tools/BaseProfiler.h"
-
-#include "logic/settings/SettingsObject.h"
-#include "MultiMC.h"
-
-// FIXME: possibly move elsewhere
-enum InstSortMode
-{
- // Sort alphabetically by name.
- Sort_Name,
- // Sort by which instance was launched most recently.
- Sort_LastLaunch
-};
-
-MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCPage)
-{
- ui->setupUi(this);
- ui->sortingModeGroup->setId(ui->sortByNameBtn, Sort_Name);
- ui->sortingModeGroup->setId(ui->sortLastLaunchedBtn, Sort_LastLaunch);
-
- auto resizer = new ColumnResizer(this);
- resizer->addWidgetsFromLayout(ui->groupBox->layout(), 1);
- resizer->addWidgetsFromLayout(ui->foldersBox->layout(), 1);
-
- defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat());
-
- loadSettings();
-
- QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this,
- &MultiMCPage::refreshUpdateChannelList);
-
- if (MMC->updateChecker()->hasChannels())
- {
- refreshUpdateChannelList();
- }
- else
- {
- MMC->updateChecker()->updateChanList(false);
- }
- connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview()));
- connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview()));
-}
-
-MultiMCPage::~MultiMCPage()
-{
- delete ui;
-}
-
-bool MultiMCPage::apply()
-{
- applySettings();
- return true;
-}
-
-void MultiMCPage::on_ftbLauncherBrowseBtn_clicked()
-{
- QString raw_dir = QFileDialog::getExistingDirectory(this, tr("FTB Launcher Directory"),
- ui->ftbLauncherBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
-
- // do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
- {
- ui->ftbLauncherBox->setText(cooked_dir);
- }
-}
-void MultiMCPage::on_ftbBrowseBtn_clicked()
-{
- QString raw_dir =
- QFileDialog::getExistingDirectory(this, tr("FTB Directory"), ui->ftbBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
-
- // do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
- {
- ui->ftbBox->setText(cooked_dir);
- }
-}
-
-void MultiMCPage::on_instDirBrowseBtn_clicked()
-{
- QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"),
- ui->instDirTextBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
-
- // do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
- {
- if (checkProblemticPathJava(QDir(cooked_dir)))
- {
- QMessageBox warning;
- warning.setText(tr("You're trying to specify an instance folder which\'s path "
- "contains at least one \'!\'. "
- "Java is known to cause problems if that is the case, your "
- "instances (probably) won't start!"));
- warning.setInformativeText(
- tr("Do you really want to use this path? "
- "Selecting \"No\" will close this and not alter your instance path."));
- warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- int result = warning.exec();
- if (result == QMessageBox::Yes)
- {
- ui->instDirTextBox->setText(cooked_dir);
- }
- }
- else
- {
- ui->instDirTextBox->setText(cooked_dir);
- }
- }
-}
-
-void MultiMCPage::on_iconsDirBrowseBtn_clicked()
-{
- QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Directory"),
- ui->iconsDirTextBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
-
- // do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
- {
- ui->iconsDirTextBox->setText(cooked_dir);
- }
-}
-void MultiMCPage::on_modsDirBrowseBtn_clicked()
-{
- QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Directory"),
- ui->modsDirTextBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
-
- // do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
- {
- ui->modsDirTextBox->setText(cooked_dir);
- }
-}
-void MultiMCPage::on_lwjglDirBrowseBtn_clicked()
-{
- QString raw_dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Directory"),
- ui->lwjglDirTextBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
-
- // do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
- {
- ui->lwjglDirTextBox->setText(cooked_dir);
- }
-}
-
-void MultiMCPage::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
- // description label constantly.
- QObject::disconnect(ui->updateChannelComboBox, SIGNAL(currentIndexChanged(int)), this,
- SLOT(updateChannelSelectionChanged(int)));
-
- QList<UpdateChecker::ChannelListEntry> channelList = MMC->updateChecker()->getChannelList();
- ui->updateChannelComboBox->clear();
- int selection = -1;
- for (int i = 0; i < channelList.count(); i++)
- {
- UpdateChecker::ChannelListEntry entry = channelList.at(i);
-
- // When it comes to selection, we'll rely on the indexes of a channel entry being the
- // same in the
- // combo box as it is in the update checker's channel list.
- // This probably isn't very safe, but the channel list doesn't change often enough (or
- // at all) for
- // this to be a big deal. Hope it doesn't break...
- ui->updateChannelComboBox->addItem(entry.name);
-
- // If the update channel we just added was the selected one, set the current index in
- // the combo box to it.
- if (entry.id == m_currentUpdateChannel)
- {
- qDebug() << "Selected index" << i << "channel id" << m_currentUpdateChannel;
- selection = i;
- }
- }
-
- ui->updateChannelComboBox->setCurrentIndex(selection);
-
- // Start listening for selection changes again and update the description label.
- QObject::connect(ui->updateChannelComboBox, SIGNAL(currentIndexChanged(int)), this,
- SLOT(updateChannelSelectionChanged(int)));
- refreshUpdateChannelDesc();
-
- // Now that we've updated the channel list, we can enable the combo box.
- // It starts off disabled so that if the channel list hasn't been loaded, it will be
- // disabled.
- ui->updateChannelComboBox->setEnabled(true);
-}
-
-void MultiMCPage::updateChannelSelectionChanged(int index)
-{
- refreshUpdateChannelDesc();
-}
-
-void MultiMCPage::refreshUpdateChannelDesc()
-{
- // Get the channel list.
- QList<UpdateChecker::ChannelListEntry> channelList = MMC->updateChecker()->getChannelList();
- int selectedIndex = ui->updateChannelComboBox->currentIndex();
- if (selectedIndex < 0)
- {
- return;
- }
- if (selectedIndex < channelList.count())
- {
- // Find the channel list entry with the given index.
- UpdateChecker::ChannelListEntry selected = channelList.at(selectedIndex);
-
- // Set the description text.
- ui->updateChannelDescLabel->setText(selected.description);
-
- // Set the currently selected channel ID.
- m_currentUpdateChannel = selected.id;
- }
-}
-
-void MultiMCPage::applySettings()
-{
- auto s = MMC->settings();
- // Language
- s->set("Language",
- ui->languageBox->itemData(ui->languageBox->currentIndex()).toLocale().bcp47Name());
-
- if (ui->resetNotificationsBtn->isChecked())
- {
- s->set("ShownNotifications", QString());
- }
-
- // Updates
- s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked());
- s->set("UpdateChannel", m_currentUpdateChannel);
- auto original = s->get("IconTheme").toString();
- //FIXME: make generic
- switch (ui->themeComboBox->currentIndex())
- {
- case 1:
- s->set("IconTheme", "pe_dark");
- break;
- case 2:
- s->set("IconTheme", "pe_light");
- break;
- case 3:
- s->set("IconTheme", "pe_blue");
- break;
- case 4:
- s->set("IconTheme", "pe_colored");
- break;
- case 5:
- s->set("IconTheme", "OSX");
- break;
- case 6:
- s->set("IconTheme", "iOS");
- break;
- case 0:
- default:
- s->set("IconTheme", "multimc");
- break;
- }
-
- if(original != s->get("IconTheme"))
- {
- MMC->setIconTheme(s->get("IconTheme").toString());
- }
-
- // Console settings
- s->set("ShowConsole", ui->showConsoleCheck->isChecked());
- s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
- QString consoleFontFamily = ui->consoleFont->currentFont().family();
- s->set("ConsoleFont", consoleFontFamily);
- s->set("ConsoleFontSize", ui->fontSizeBox->value());
-
- // FTB
- s->set("TrackFTBInstances", ui->trackFtbBox->isChecked());
- s->set("FTBLauncherRoot", ui->ftbLauncherBox->text());
- s->set("FTBRoot", ui->ftbBox->text());
-
- // Folders
- // TODO: Offer to move instances to new instance folder.
- s->set("InstanceDir", ui->instDirTextBox->text());
- s->set("CentralModsDir", ui->modsDirTextBox->text());
- s->set("LWJGLDir", ui->lwjglDirTextBox->text());
- s->set("IconsDir", ui->iconsDirTextBox->text());
-
- auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId();
- switch (sortMode)
- {
- case Sort_LastLaunch:
- s->set("InstSortMode", "LastLaunch");
- break;
- case Sort_Name:
- default:
- s->set("InstSortMode", "Name");
- break;
- }
-}
-void MultiMCPage::loadSettings()
-{
- auto s = MMC->settings();
- // Language
- ui->languageBox->clear();
- ui->languageBox->addItem(tr("English"), QLocale(QLocale::English));
- foreach(const QString & lang, QDir(MMC->staticData() + "/translations")
- .entryList(QStringList() << "*.qm", QDir::Files))
- {
- QLocale locale(lang.section(QRegExp("[_\\.]"), 1));
- ui->languageBox->addItem(QLocale::languageToString(locale.language()), locale);
- }
- ui->languageBox->setCurrentIndex(
- ui->languageBox->findData(QLocale(s->get("Language").toString())));
-
- // Updates
- ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool());
- m_currentUpdateChannel = s->get("UpdateChannel").toString();
- //FIXME: make generic
- auto theme = s->get("IconTheme").toString();
- if (theme == "pe_dark")
- {
- ui->themeComboBox->setCurrentIndex(1);
- }
- else if (theme == "pe_light")
- {
- ui->themeComboBox->setCurrentIndex(2);
- }
- else if (theme == "pe_blue")
- {
- ui->themeComboBox->setCurrentIndex(3);
- }
- else if (theme == "pe_colored")
- {
- ui->themeComboBox->setCurrentIndex(4);
- }
- else if (theme == "OSX")
- {
- ui->themeComboBox->setCurrentIndex(5);
- }
- else if (theme == "iOS")
- {
- ui->themeComboBox->setCurrentIndex(6);
- }
- else
- {
- ui->themeComboBox->setCurrentIndex(0);
- }
-
- // Console settings
- ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool());
- ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool());
- QString fontFamily = MMC->settings()->get("ConsoleFont").toString();
- QFont consoleFont(fontFamily);
- ui->consoleFont->setCurrentFont(consoleFont);
-
- bool conversionOk = true;
- int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk);
- if(!conversionOk)
- {
- fontSize = 11;
- }
- ui->fontSizeBox->setValue(fontSize);
- refreshFontPreview();
-
- // FTB
- ui->trackFtbBox->setChecked(s->get("TrackFTBInstances").toBool());
- ui->ftbLauncherBox->setText(s->get("FTBLauncherRoot").toString());
- ui->ftbBox->setText(s->get("FTBRoot").toString());
-
- // Folders
- ui->instDirTextBox->setText(s->get("InstanceDir").toString());
- ui->modsDirTextBox->setText(s->get("CentralModsDir").toString());
- ui->lwjglDirTextBox->setText(s->get("LWJGLDir").toString());
- ui->iconsDirTextBox->setText(s->get("IconsDir").toString());
-
- QString sortMode = s->get("InstSortMode").toString();
-
- if (sortMode == "LastLaunch")
- {
- ui->sortLastLaunchedBtn->setChecked(true);
- }
- else
- {
- ui->sortByNameBtn->setChecked(true);
- }
-}
-
-void MultiMCPage::refreshFontPreview()
-{
- int fontSize = ui->fontSizeBox->value();
- QString fontFamily = ui->consoleFont->currentFont().family();
- ui->fontPreview->clear();
- defaultFormat->setFont(QFont(fontFamily, fontSize));
- {
- QTextCharFormat format(*defaultFormat);
- format.setForeground(QColor("red"));
- // append a paragraph/line
- auto workCursor = ui->fontPreview->textCursor();
- workCursor.movePosition(QTextCursor::End);
- workCursor.insertText(tr("[Something/ERROR] A spooky error!"), format);
- workCursor.insertBlock();
- }
- {
- QTextCharFormat format(*defaultFormat);
- // append a paragraph/line
- auto workCursor = ui->fontPreview->textCursor();
- workCursor.movePosition(QTextCursor::End);
- workCursor.insertText(tr("[Test/INFO] A harmless message..."), format);
- workCursor.insertBlock();
- }
- {
- QTextCharFormat format(*defaultFormat);
- format.setForeground(QColor("orange"));
- // append a paragraph/line
- auto workCursor = ui->fontPreview->textCursor();
- workCursor.movePosition(QTextCursor::End);
- workCursor.insertText(tr("[Something/WARN] A not so spooky warning."), format);
- workCursor.insertBlock();
- }
-} \ No newline at end of file
diff --git a/gui/pages/global/MultiMCPage.h b/gui/pages/global/MultiMCPage.h
deleted file mode 100644
index 96e56f47..00000000
--- a/gui/pages/global/MultiMCPage.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* 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 <memory>
-#include <QDialog>
-
-#include "logic/java/JavaChecker.h"
-#include "gui/pages/BasePage.h"
-#include <MultiMC.h>
-
-class QTextCharFormat;
-class SettingsObject;
-
-namespace Ui
-{
-class MultiMCPage;
-}
-
-class MultiMCPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit MultiMCPage(QWidget *parent = 0);
- ~MultiMCPage();
-
- QString displayName() const override
- {
- return tr("MultiMC");
- }
- QIcon icon() const override
- {
- return MMC->getThemedIcon("multimc");
- }
- QString id() const override
- {
- return "multimc-settings";
- }
- QString helpPage() const override
- {
- return "MultiMC-settings";
- }
- bool apply() override;
-
-private:
- void applySettings();
- void loadSettings();
-
-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();
-
- /*!
- * Updates the list of update channels in the combo box.
- */
- void refreshUpdateChannelList();
-
- /*!
- * Updates the channel description label.
- */
- void refreshUpdateChannelDesc();
-
- /*!
- * Updates the font preview
- */
- void refreshFontPreview();
-
- void updateChannelSelectionChanged(int index);
-
-private:
- Ui::MultiMCPage *ui;
-
- /*!
- * Stores the currently selected update channel.
- */
- QString m_currentUpdateChannel;
-
- // default format for the font preview...
- QTextCharFormat *defaultFormat;
-};
diff --git a/gui/pages/global/MultiMCPage.ui b/gui/pages/global/MultiMCPage.ui
deleted file mode 100644
index 38d1bb1d..00000000
--- a/gui/pages/global/MultiMCPage.ui
+++ /dev/null
@@ -1,532 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MultiMCPage</class>
- <widget class="QWidget" name="MultiMCPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>487</width>
- <height>519</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Settings</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>:/icons/toolbar/settings</normaloff>:/icons/toolbar/settings</iconset>
- </property>
- <layout class="QVBoxLayout" name="mainLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="featuresTab">
- <attribute name="title">
- <string>Features</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_9">
- <item>
- <widget class="QGroupBox" name="updateSettingsBox">
- <property name="title">
- <string>Update Settings</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_7">
- <item>
- <widget class="QCheckBox" name="autoUpdateCheckBox">
- <property name="text">
- <string>Check for updates when MultiMC starts?</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="updateChannelLabel">
- <property name="text">
- <string>Up&amp;date Channel:</string>
- </property>
- <property name="buddy">
- <cstring>updateChannelComboBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="updateChannelComboBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="updateChannelDescLabel">
- <property name="text">
- <string>No channel selected.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>FTB</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="2" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>&amp;Launcher:</string>
- </property>
- <property name="buddy">
- <cstring>ftbLauncherBox</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="ftbLauncherBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="ftbBox"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Files:</string>
- </property>
- <property name="buddy">
- <cstring>ftbBox</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QToolButton" name="ftbBrowseBtn">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QToolButton" name="ftbLauncherBrowseBtn">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="focusPolicy">
- <enum>Qt::TabFocus</enum>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="3">
- <widget class="QCheckBox" name="trackFtbBox">
- <property name="text">
- <string>Track FTB instances</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="foldersBox">
- <property name="title">
- <string>Folders</string>
- </property>
- <layout class="QGridLayout" name="foldersBoxLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="labelInstDir">
- <property name="text">
- <string>I&amp;nstances:</string>
- </property>
- <property name="buddy">
- <cstring>instDirTextBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="instDirTextBox"/>
- </item>
- <item row="0" column="2">
- <widget class="QToolButton" name="instDirBrowseBtn">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="labelModsDir">
- <property name="text">
- <string>&amp;Mods:</string>
- </property>
- <property name="buddy">
- <cstring>modsDirTextBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="modsDirTextBox"/>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="lwjglDirTextBox"/>
- </item>
- <item row="1" column="2">
- <widget class="QToolButton" name="modsDirBrowseBtn">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="labelLWJGLDir">
- <property name="text">
- <string>LW&amp;JGL:</string>
- </property>
- <property name="buddy">
- <cstring>lwjglDirTextBox</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QToolButton" name="lwjglDirBrowseBtn">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="iconsDirTextBox"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="labelIconsDir">
- <property name="text">
- <string>&amp;Icons:</string>
- </property>
- <property name="buddy">
- <cstring>iconsDirTextBox</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QToolButton" name="iconsDirBrowseBtn">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="generalTab">
- <attribute name="title">
- <string>User Interface</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>MultiMC notifications</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QPushButton" name="resetNotificationsBtn">
- <property name="text">
- <string>Reset hidden notifications</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="sortingModeBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Instance view sorting mode</string>
- </property>
- <layout class="QHBoxLayout" name="sortingModeBoxLayout">
- <item>
- <widget class="QRadioButton" name="sortLastLaunchedBtn">
- <property name="text">
- <string>By &amp;last launched</string>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">sortingModeGroup</string>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="sortByNameBtn">
- <property name="text">
- <string>By &amp;name</string>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">sortingModeGroup</string>
- </attribute>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Language (needs restart):</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QComboBox" name="languageBox"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="themeBox">
- <property name="title">
- <string>Icon Theme (needs restart, work in progress)</string>
- </property>
- <layout class="QHBoxLayout" name="themeBoxLayout">
- <item>
- <widget class="QComboBox" name="themeComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <item>
- <property name="text">
- <string>Default</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Simple (Dark Icons)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Simple (Light Icons)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Simple (Blue Icons)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Simple (Colored Icons)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>OSX</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>iOS</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="generalTabSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Console</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QGroupBox" name="consoleSettingsBox">
- <property name="title">
- <string>Console Settings</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QCheckBox" name="showConsoleCheck">
- <property name="text">
- <string>Show console while the game is running?</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="autoCloseConsoleCheck">
- <property name="text">
- <string>Automatically close console when the game quits?</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="themeBox_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Console font</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="1" column="0" colspan="2">
- <widget class="QTextEdit" name="fontPreview">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="undoRedoEnabled">
- <bool>false</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QFontComboBox" name="consoleFont">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="fontSizeBox">
- <property name="minimum">
- <number>5</number>
- </property>
- <property name="maximum">
- <number>16</number>
- </property>
- <property name="value">
- <number>11</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>tabWidget</tabstop>
- <tabstop>autoUpdateCheckBox</tabstop>
- <tabstop>updateChannelComboBox</tabstop>
- <tabstop>trackFtbBox</tabstop>
- <tabstop>ftbLauncherBox</tabstop>
- <tabstop>ftbLauncherBrowseBtn</tabstop>
- <tabstop>ftbBox</tabstop>
- <tabstop>ftbBrowseBtn</tabstop>
- <tabstop>instDirTextBox</tabstop>
- <tabstop>instDirBrowseBtn</tabstop>
- <tabstop>modsDirTextBox</tabstop>
- <tabstop>modsDirBrowseBtn</tabstop>
- <tabstop>lwjglDirTextBox</tabstop>
- <tabstop>lwjglDirBrowseBtn</tabstop>
- <tabstop>iconsDirTextBox</tabstop>
- <tabstop>iconsDirBrowseBtn</tabstop>
- <tabstop>resetNotificationsBtn</tabstop>
- <tabstop>sortLastLaunchedBtn</tabstop>
- <tabstop>sortByNameBtn</tabstop>
- <tabstop>languageBox</tabstop>
- <tabstop>themeComboBox</tabstop>
- <tabstop>showConsoleCheck</tabstop>
- <tabstop>autoCloseConsoleCheck</tabstop>
- <tabstop>consoleFont</tabstop>
- <tabstop>fontSizeBox</tabstop>
- <tabstop>fontPreview</tabstop>
- </tabstops>
- <resources/>
- <connections/>
- <buttongroups>
- <buttongroup name="sortingModeGroup"/>
- </buttongroups>
-</ui>
diff --git a/gui/pages/global/ProxyPage.cpp b/gui/pages/global/ProxyPage.cpp
deleted file mode 100644
index 02a5beb4..00000000
--- a/gui/pages/global/ProxyPage.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/* 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 "ProxyPage.h"
-#include "ui_ProxyPage.h"
-
-#include "logic/settings/SettingsObject.h"
-#include "MultiMC.h"
-
-ProxyPage::ProxyPage(QWidget *parent) : QWidget(parent), ui(new Ui::ProxyPage)
-{
- ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
- loadSettings();
- updateCheckboxStuff();
-
- connect(ui->proxyGroup, SIGNAL(buttonClicked(int)), SLOT(proxyChanged(int)));
-}
-
-ProxyPage::~ProxyPage()
-{
- delete ui;
-}
-
-bool ProxyPage::apply()
-{
- applySettings();
- return true;
-}
-
-void ProxyPage::updateCheckboxStuff()
-{
- ui->proxyAddrBox->setEnabled(!ui->proxyNoneBtn->isChecked() &&
- !ui->proxyDefaultBtn->isChecked());
- ui->proxyAuthBox->setEnabled(!ui->proxyNoneBtn->isChecked() &&
- !ui->proxyDefaultBtn->isChecked());
-}
-
-void ProxyPage::proxyChanged(int)
-{
- updateCheckboxStuff();
-}
-
-void ProxyPage::applySettings()
-{
- auto s = MMC->settings();
-
- // Proxy
- QString proxyType = "None";
- if (ui->proxyDefaultBtn->isChecked())
- proxyType = "Default";
- else if (ui->proxyNoneBtn->isChecked())
- proxyType = "None";
- else if (ui->proxySOCKS5Btn->isChecked())
- proxyType = "SOCKS5";
- else if (ui->proxyHTTPBtn->isChecked())
- proxyType = "HTTP";
-
- s->set("ProxyType", proxyType);
- s->set("ProxyAddr", ui->proxyAddrEdit->text());
- s->set("ProxyPort", ui->proxyPortEdit->value());
- s->set("ProxyUser", ui->proxyUserEdit->text());
- s->set("ProxyPass", ui->proxyPassEdit->text());
-}
-void ProxyPage::loadSettings()
-{
- auto s = MMC->settings();
- // Proxy
- QString proxyType = s->get("ProxyType").toString();
- if (proxyType == "Default")
- ui->proxyDefaultBtn->setChecked(true);
- else if (proxyType == "None")
- ui->proxyNoneBtn->setChecked(true);
- else if (proxyType == "SOCKS5")
- ui->proxySOCKS5Btn->setChecked(true);
- else if (proxyType == "HTTP")
- ui->proxyHTTPBtn->setChecked(true);
-
- ui->proxyAddrEdit->setText(s->get("ProxyAddr").toString());
- ui->proxyPortEdit->setValue(s->get("ProxyPort").value<qint16>());
- ui->proxyUserEdit->setText(s->get("ProxyUser").toString());
- ui->proxyPassEdit->setText(s->get("ProxyPass").toString());
-}
diff --git a/gui/pages/global/ProxyPage.h b/gui/pages/global/ProxyPage.h
deleted file mode 100644
index edb7587a..00000000
--- a/gui/pages/global/ProxyPage.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* 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 <memory>
-#include <QDialog>
-
-#include "logic/java/JavaChecker.h"
-#include "gui/pages/BasePage.h"
-#include <MultiMC.h>
-
-namespace Ui
-{
-class ProxyPage;
-}
-
-class ProxyPage : public QWidget, public BasePage
-{
- Q_OBJECT
-
-public:
- explicit ProxyPage(QWidget *parent = 0);
- ~ProxyPage();
-
- QString displayName() const override
- {
- return tr("Proxy");
- }
- QIcon icon() const override
- {
- return MMC->getThemedIcon("proxy");
- }
- QString id() const override
- {
- return "proxy-settings";
- }
- QString helpPage() const override
- {
- return "Proxy-settings";
- }
- bool apply() override;
-
-private:
- void updateCheckboxStuff();
- void applySettings();
- void loadSettings();
-
-private
-slots:
- void proxyChanged(int);
-
-private:
- Ui::ProxyPage *ui;
-};
diff --git a/gui/pages/global/ProxyPage.ui b/gui/pages/global/ProxyPage.ui
deleted file mode 100644
index 7cddd66d..00000000
--- a/gui/pages/global/ProxyPage.ui
+++ /dev/null
@@ -1,197 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ProxyPage</class>
- <widget class="QWidget" name="ProxyPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>607</width>
- <height>632</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Settings</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>:/icons/toolbar/settings</normaloff>:/icons/toolbar/settings</iconset>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <widget class="QWidget" name="tabWidgetPage1" native="true">
- <attribute name="title">
- <string/>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="proxyTypeBox">
- <property name="title">
- <string>Type</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QRadioButton" name="proxyDefaultBtn">
- <property name="toolTip">
- <string>Uses your system's default proxy settings.</string>
- </property>
- <property name="text">
- <string>Default</string>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">proxyGroup</string>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="proxyNoneBtn">
- <property name="text">
- <string>None</string>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">proxyGroup</string>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="proxySOCKS5Btn">
- <property name="text">
- <string>SOCKS5</string>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">proxyGroup</string>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="proxyHTTPBtn">
- <property name="text">
- <string>HTTP</string>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">proxyGroup</string>
- </attribute>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="proxyAddrBox">
- <property name="title">
- <string>Address and Port</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLineEdit" name="proxyAddrEdit">
- <property name="placeholderText">
- <string>127.0.0.1</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="proxyPortEdit">
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="buttonSymbols">
- <enum>QAbstractSpinBox::PlusMinus</enum>
- </property>
- <property name="maximum">
- <number>65535</number>
- </property>
- <property name="value">
- <number>8080</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="proxyAuthBox">
- <property name="title">
- <string>Authentication</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="1">
- <widget class="QLineEdit" name="proxyUserEdit"/>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="proxyUsernameLabel">
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="proxyPasswordLabel">
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="proxyPassEdit">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="proxyPlainTextWarningLabel">
- <property name="text">
- <string>Note: Proxy username and password are stored in plain text inside MultiMC's configuration file!</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </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>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
- <buttongroups>
- <buttongroup name="proxyGroup"/>
- </buttongroups>
-</ui>
diff --git a/gui/widgets/Common.cpp b/gui/widgets/Common.cpp
deleted file mode 100644
index 9b730d6c..00000000
--- a/gui/widgets/Common.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "Common.h"
-
-// Origin: Qt
-QStringList viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height,
- qreal &widthUsed)
-{
- QStringList lines;
- height = 0;
- widthUsed = 0;
- textLayout.beginLayout();
- QString str = textLayout.text();
- while (true)
- {
- QTextLine line = textLayout.createLine();
- if (!line.isValid())
- break;
- if (line.textLength() == 0)
- break;
- line.setLineWidth(lineWidth);
- line.setPosition(QPointF(0, height));
- height += line.height();
- lines.append(str.mid(line.textStart(), line.textLength()));
- widthUsed = qMax(widthUsed, line.naturalTextWidth());
- }
- textLayout.endLayout();
- return lines;
-}
diff --git a/gui/widgets/Common.h b/gui/widgets/Common.h
deleted file mode 100644
index fc46e08f..00000000
--- a/gui/widgets/Common.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-#include <QStringList>
-#include <QTextLayout>
-
-QStringList viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height,
- qreal &widthUsed); \ No newline at end of file
diff --git a/gui/widgets/IconLabel.cpp b/gui/widgets/IconLabel.cpp
deleted file mode 100644
index 86c8a431..00000000
--- a/gui/widgets/IconLabel.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "IconLabel.h"
-
-#include <QStyle>
-#include <QStyleOption>
-#include <QLayout>
-#include <QPainter>
-#include <QRect>
-
-IconLabel::IconLabel(QWidget *parent, QIcon icon, QSize size)
- : QWidget(parent), m_size(size), m_icon(icon)
-{
- setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-}
-
-QSize IconLabel::sizeHint() const
-{
- return m_size;
-}
-
-void IconLabel::setIcon(QIcon icon)
-{
- m_icon = icon;
- update();
-}
-
-void IconLabel::paintEvent(QPaintEvent *)
-{
- QPainter p(this);
- QRect rect = contentsRect();
- int width = rect.width();
- int height = rect.height();
- if(width < height)
- {
- rect.setHeight(width);
- rect.translate(0, (height - width) / 2);
- }
- else if (width > height)
- {
- rect.setWidth(height);
- rect.translate((width - height) / 2, 0);
- }
- m_icon.paint(&p, rect);
-}
diff --git a/gui/widgets/IconLabel.h b/gui/widgets/IconLabel.h
deleted file mode 100644
index a2f1eef3..00000000
--- a/gui/widgets/IconLabel.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-#include <QWidget>
-#include <QIcon>
-
-class QStyleOption;
-
-/**
- * This is a trivial widget that paints a QIcon of the specified size.
- */
-class IconLabel : public QWidget
-{
- Q_OBJECT
-
-public:
- /// Create a line separator. orientation is the orientation of the line.
- explicit IconLabel(QWidget *parent, QIcon icon, QSize size);
-
- virtual QSize sizeHint() const;
- virtual void paintEvent(QPaintEvent *);
-
- void setIcon(QIcon icon);
-
-private:
- QSize m_size;
- QIcon m_icon;
-};
diff --git a/gui/widgets/LabeledToolButton.cpp b/gui/widgets/LabeledToolButton.cpp
deleted file mode 100644
index dfdde1bc..00000000
--- a/gui/widgets/LabeledToolButton.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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 <QLabel>
-#include <QVBoxLayout>
-#include <QResizeEvent>
-#include <QStyleOption>
-#include "LabeledToolButton.h"
-#include <QApplication>
-
-/*
- *
- * Tool Button with a label on it, instead of the normal text rendering
- *
- */
-
-LabeledToolButton::LabeledToolButton(QWidget * parent)
- : QToolButton(parent)
- , m_label(new QLabel(this))
-{
- //QToolButton::setText(" ");
- m_label->setWordWrap(true);
- m_label->setMouseTracking(false);
- m_label->setAlignment(Qt::AlignCenter);
- m_label->setTextInteractionFlags(Qt::NoTextInteraction);
- // somehow, this makes word wrap work in the QLabel. yay.
- m_label->setMinimumWidth(100);
-}
-
-QString LabeledToolButton::text() const
-{
- return m_label->text();
-}
-
-void LabeledToolButton::setText(const QString & text)
-{
- m_label->setText(text);
-}
-
-/*!
- \reimp
-*/
-QSize LabeledToolButton::sizeHint() const
-{
- /*
- Q_D(const QToolButton);
- if (d->sizeHint.isValid())
- return d->sizeHint;
- */
- ensurePolished();
-
- int w = 0, h = 0;
- QStyleOptionToolButton opt;
- initStyleOption(&opt);
- QSize sz =m_label->sizeHint();
- w = sz.width();
- h = sz.height();
-
- opt.rect.setSize(QSize(w, h)); // PM_MenuButtonIndicator depends on the height
- if (popupMode() == MenuButtonPopup)
- w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this);
-
- QSize rawSize = style()->sizeFromContents(QStyle::CT_ToolButton, &opt, QSize(w, h), this);
- QSize sizeHint = rawSize.expandedTo(QApplication::globalStrut());
- return sizeHint;
-}
-
-
-
-void LabeledToolButton::resizeEvent(QResizeEvent * event)
-{
- m_label->setGeometry(QRect(4, 4, width()-8, height()-8));
- QWidget::resizeEvent(event);
-}
diff --git a/gui/widgets/LabeledToolButton.h b/gui/widgets/LabeledToolButton.h
deleted file mode 100644
index 1b74c4ee..00000000
--- a/gui/widgets/LabeledToolButton.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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 <QPushButton>
-#include <QToolButton>
-
-class QLabel;
-
-class LabeledToolButton : public QToolButton
-{
- Q_OBJECT
-
- QLabel * m_label;
-
-public:
- LabeledToolButton(QWidget * parent = 0);
-
- QString text() const;
- void setText(const QString & text);
- virtual QSize sizeHint() const;
-protected:
- void resizeEvent(QResizeEvent * event);
-};
diff --git a/gui/widgets/LineSeparator.cpp b/gui/widgets/LineSeparator.cpp
deleted file mode 100644
index f4ee173d..00000000
--- a/gui/widgets/LineSeparator.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "LineSeparator.h"
-
-#include <QStyle>
-#include <QStyleOption>
-#include <QLayout>
-#include <QPainter>
-
-void LineSeparator::initStyleOption(QStyleOption *option) const
-{
- option->initFrom(this);
- // in a horizontal layout, the line is vertical (and vice versa)
- if (m_orientation == Qt::Vertical)
- option->state |= QStyle::State_Horizontal;
-}
-
-LineSeparator::LineSeparator(QWidget *parent, Qt::Orientation orientation)
- : QWidget(parent), m_orientation(orientation)
-{
- setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-}
-
-QSize LineSeparator::sizeHint() const
-{
- QStyleOption opt;
- initStyleOption(&opt);
- const int extent =
- style()->pixelMetric(QStyle::PM_ToolBarSeparatorExtent, &opt, parentWidget());
- return QSize(extent, extent);
-}
-
-void LineSeparator::paintEvent(QPaintEvent *)
-{
- QPainter p(this);
- QStyleOption opt;
- initStyleOption(&opt);
- style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, &p, parentWidget());
-}
diff --git a/gui/widgets/LineSeparator.h b/gui/widgets/LineSeparator.h
deleted file mode 100644
index 9546e747..00000000
--- a/gui/widgets/LineSeparator.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-#include <QWidget>
-
-class QStyleOption;
-
-class LineSeparator : public QWidget
-{
- Q_OBJECT
-
-public:
- /// Create a line separator. orientation is the orientation of the line.
- explicit LineSeparator(QWidget *parent, Qt::Orientation orientation = Qt::Horizontal);
- QSize sizeHint() const;
- void paintEvent(QPaintEvent *);
- void initStyleOption(QStyleOption *option) const;
-private:
- Qt::Orientation m_orientation = Qt::Horizontal;
-};
diff --git a/gui/widgets/MCModInfoFrame.cpp b/gui/widgets/MCModInfoFrame.cpp
deleted file mode 100644
index b87147aa..00000000
--- a/gui/widgets/MCModInfoFrame.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/* 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 <QMessageBox>
-#include <QtGui>
-
-#include "MCModInfoFrame.h"
-#include "ui_MCModInfoFrame.h"
-#include "gui/dialogs/CustomMessageBox.h"
-
-void MCModInfoFrame::updateWithMod(Mod &m)
-{
- if(m.type() == m.MOD_FOLDER)
- {
- clear();
- return;
- }
-
- QString text = "";
- QString name = "";
- if(m.name().isEmpty()) name = m.mmc_id();
- else name = m.name();
-
- if(m.homeurl().isEmpty()) text = name;
- else text = "<a href=\"" + m.homeurl() + "\">" + name + "</a>";
- if(!m.authors().isEmpty()) text += " by " + m.authors();
-
- setModText(text);
-
- if(m.description().isEmpty())
- {
- setModDescription(tr("No description provided in mcmod.info"));
- }
- else
- {
- setModDescription(m.description());
- }
-}
-
-void MCModInfoFrame::clear()
-{
- setModText(tr("Select a mod to view title and authors..."));
- setModDescription(tr("Select a mod to view description..."));
-}
-
-MCModInfoFrame::MCModInfoFrame(QWidget *parent) :
- QFrame(parent),
- ui(new Ui::MCModInfoFrame)
-{
- ui->setupUi(this);
-}
-
-MCModInfoFrame::~MCModInfoFrame()
-{
- delete ui;
-}
-
-void MCModInfoFrame::setModText(QString text)
-{
- ui->label_ModText->setText(text);
-}
-
-void MCModInfoFrame::setModDescription(QString text)
-{
- ui->label_ModDescription->setToolTip("");
- QString intermediatetext = text.trimmed();
- bool prev(false);
- QChar rem('\n');
- QString finaltext;
- finaltext.reserve(intermediatetext.size());
- foreach(const QChar& c, intermediatetext)
- {
- if(c == rem && prev){
- continue;
- }
- prev = c == rem;
- finaltext += c;
- }
- QString labeltext;
- labeltext.reserve(300);
- if(finaltext.length() > 290)
- {
- ui->label_ModDescription->setOpenExternalLinks(false);
- ui->label_ModDescription->setTextFormat(Qt::TextFormat::RichText);
- desc = text;
- labeltext.append("<html><body>" + finaltext.left(287) + "<a href=\"#mod_desc\">...</a></body></html>");
- QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler);
- }
- else
- {
- ui->label_ModDescription->setTextFormat(Qt::TextFormat::PlainText);
- labeltext.append(finaltext);
- }
- ui->label_ModDescription->setText(labeltext);
-}
-void MCModInfoFrame::modDescEllipsisHandler(const QString &link)
-{
- CustomMessageBox::selectable(this, tr(""), desc)->show();
-}
diff --git a/gui/widgets/MCModInfoFrame.h b/gui/widgets/MCModInfoFrame.h
deleted file mode 100644
index 9e63d29a..00000000
--- a/gui/widgets/MCModInfoFrame.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 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 <QFrame>
-#include "logic/minecraft/Mod.h"
-
-namespace Ui
-{
-class MCModInfoFrame;
-}
-
-class MCModInfoFrame : public QFrame
-{
- Q_OBJECT
-
-public:
- explicit MCModInfoFrame(QWidget *parent = 0);
- ~MCModInfoFrame();
-
- void setModText(QString text);
- void setModDescription(QString text);
-
- void updateWithMod(Mod &m);
- void clear();
-
-public slots:
- void modDescEllipsisHandler(const QString& link );
-
-private:
- Ui::MCModInfoFrame *ui;
- QString desc;
-};
diff --git a/gui/widgets/MCModInfoFrame.ui b/gui/widgets/MCModInfoFrame.ui
deleted file mode 100644
index 60e0a65c..00000000
--- a/gui/widgets/MCModInfoFrame.ui
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MCModInfoFrame</class>
- <widget class="QFrame" name="MCModInfoFrame">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>527</width>
- <height>113</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>120</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Frame</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel" name="label_ModText">
- <property name="text">
- <string>Select a mod to view title and authors...</string>
- </property>
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="openExternalLinks">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_ModDescription">
- <property name="text">
- <string>Select a mod to view description...</string>
- </property>
- <property name="textFormat">
- <enum>Qt::PlainText</enum>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/gui/widgets/ModListView.cpp b/gui/widgets/ModListView.cpp
deleted file mode 100644
index aa16ad05..00000000
--- a/gui/widgets/ModListView.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/* 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 "ModListView.h"
-#include <QHeaderView>
-#include <QMouseEvent>
-#include <QPainter>
-#include <QDrag>
-#include <QRect>
-
-ModListView::ModListView ( QWidget* parent )
- :QTreeView ( parent )
-{
- setAllColumnsShowFocus ( true );
- setExpandsOnDoubleClick ( false );
- setRootIsDecorated ( false );
- setSortingEnabled ( false );
- setAlternatingRowColors ( true );
- setSelectionMode ( QAbstractItemView::ContiguousSelection );
- setHeaderHidden ( false );
- setSelectionBehavior(QAbstractItemView::SelectRows);
- setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOn );
- setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
- setDropIndicatorShown(true);
- setDragEnabled(true);
- setDragDropMode(QAbstractItemView::DropOnly);
- viewport()->setAcceptDrops(true);
-}
-
-void ModListView::setModel ( QAbstractItemModel* model )
-{
- QTreeView::setModel ( model );
- auto head = header();
- head->setStretchLastSection(false);
- // HACK: this is true for the checkbox column of mod lists
- auto string = model->headerData(0,head->orientation()).toString();
- if(!string.size())
- {
- head->setSectionResizeMode(0, QHeaderView::ResizeToContents);
- head->setSectionResizeMode(1, QHeaderView::Stretch);
- for(int i = 2; i < head->count(); i++)
- head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
- }
- else
- {
- head->setSectionResizeMode(0, QHeaderView::Stretch);
- for(int i = 1; i < head->count(); i++)
- head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
- }
-}
diff --git a/gui/widgets/ModListView.h b/gui/widgets/ModListView.h
deleted file mode 100644
index 43de9811..00000000
--- a/gui/widgets/ModListView.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* 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 <QTreeView>
-
-class Mod;
-
-class ModListView: public QTreeView
-{
- Q_OBJECT
-public:
- explicit ModListView ( QWidget* parent = 0 );
- virtual void setModel ( QAbstractItemModel* model );
-};
diff --git a/gui/widgets/PageContainer.cpp b/gui/widgets/PageContainer.cpp
deleted file mode 100644
index 59b800cc..00000000
--- a/gui/widgets/PageContainer.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/* 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 "PageContainer.h"
-
-#include <QStackedLayout>
-#include <QPushButton>
-#include <QSortFilterProxyModel>
-#include <QUrl>
-#include <QStyledItemDelegate>
-#include <QListView>
-#include <QLineEdit>
-#include <QLabel>
-#include <QDialogButtonBox>
-#include <QGridLayout>
-#include <QDesktopServices>
-
-#include "MultiMC.h"
-#include "logic/settings/SettingsObject.h"
-#include "gui/widgets/IconLabel.h"
-#include "gui/Platform.h"
-#include "PageContainer_p.h"
-#include <MultiMC.h>
-
-class PageEntryFilterModel : public QSortFilterProxyModel
-{
-public:
- explicit PageEntryFilterModel(QObject *parent = 0) : QSortFilterProxyModel(parent)
- {
- }
-
-protected:
- bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
- {
- const QString pattern = filterRegExp().pattern();
- const auto model = static_cast<PageModel *>(sourceModel());
- const auto page = model->pages().at(sourceRow);
- if (!page->shouldDisplay())
- return false;
- // Regular contents check, then check page-filter.
- return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
- }
-};
-
-PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId,
- QWidget *parent)
- : QWidget(parent)
-{
- createUI();
- m_model = new PageModel(this);
- m_proxyModel = new PageEntryFilterModel(this);
- int firstIndex = -1;
- int counter = 0;
- auto pages = pageProvider->getPages();
- for (auto page : pages)
- {
- page->stackIndex = m_pageStack->addWidget(dynamic_cast<QWidget *>(page));
- page->listIndex = counter;
- counter++;
- if (firstIndex == -1)
- {
- firstIndex = page->stackIndex;
- }
- }
- m_model->setPages(pages);
-
- m_proxyModel->setSourceModel(m_model);
- m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
-
- m_pageList->setIconSize(QSize(pageIconSize, pageIconSize));
- m_pageList->setSelectionMode(QAbstractItemView::SingleSelection);
- m_pageList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- m_pageList->setModel(m_proxyModel);
- connect(m_pageList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
- this, SLOT(currentChanged(QModelIndex)));
- m_pageStack->setStackingMode(QStackedLayout::StackOne);
- m_pageList->setFocus();
- // now find what we want to have selected...
- auto page = m_model->findPageEntryById(defaultId);
- QModelIndex index;
- if (page)
- {
- index = m_proxyModel->mapFromSource(m_model->index(page->listIndex));
- }
- else
- {
- index = m_proxyModel->index(0, 0);
- }
- if (index.isValid())
- m_pageList->setCurrentIndex(index);
-}
-
-void PageContainer::createUI()
-{
- m_pageStack = new QStackedLayout;
- m_filter = new QLineEdit;
- m_pageList = new PageView;
- m_header = new QLabel();
- m_iconHeader = new IconLabel(this, QIcon(), QSize(24, 24));
-
- QFont headerLabelFont = m_header->font();
- headerLabelFont.setBold(true);
- const int pointSize = headerLabelFont.pointSize();
- if (pointSize > 0)
- headerLabelFont.setPointSize(pointSize + 2);
- m_header->setFont(headerLabelFont);
-
- QHBoxLayout *headerHLayout = new QHBoxLayout;
- const int leftMargin = MMC->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
- headerHLayout->addSpacerItem(
- new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored));
- headerHLayout->addWidget(m_header);
- headerHLayout->addSpacerItem(
- new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
- headerHLayout->addWidget(m_iconHeader);
- const int rightMargin = MMC->style()->pixelMetric(QStyle::PM_LayoutRightMargin);
- headerHLayout->addSpacerItem(
- new QSpacerItem(rightMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored));
-
- m_pageStack->setMargin(0);
- m_pageStack->addWidget(new QWidget(this));
-
- m_layout = new QGridLayout;
- m_layout->addLayout(headerHLayout, 0, 1, 1, 1);
- m_layout->addWidget(m_pageList, 0, 0, 2, 1);
- m_layout->addLayout(m_pageStack, 1, 1, 1, 1);
- m_layout->setColumnStretch(1, 4);
- setLayout(m_layout);
-}
-
-void PageContainer::addButtons(QWidget *buttons)
-{
- m_layout->addWidget(buttons, 2, 0, 1, 2);
-}
-
-void PageContainer::addButtons(QLayout *buttons)
-{
- m_layout->addLayout(buttons, 2, 0, 1, 2);
-}
-
-void PageContainer::showPage(int row)
-{
- if (m_currentPage)
- {
- m_currentPage->closed();
- }
- if (row != -1)
- {
- m_currentPage = m_model->pages().at(row);
- }
- else
- {
- m_currentPage = nullptr;
- }
- if (m_currentPage)
- {
- m_pageStack->setCurrentIndex(m_currentPage->stackIndex);
- m_header->setText(m_currentPage->displayName());
- m_iconHeader->setIcon(m_currentPage->icon());
- m_currentPage->opened();
- }
- else
- {
- m_pageStack->setCurrentIndex(0);
- m_header->setText(QString());
- m_iconHeader->setIcon(MMC->getThemedIcon("bug"));
- }
-}
-
-void PageContainer::help()
-{
- if (m_currentPage)
- {
- QString pageId = m_currentPage->helpPage();
- if (pageId.isEmpty())
- return;
- QDesktopServices::openUrl(QUrl("https://github.com/MultiMC/MultiMC5/wiki/" + pageId));
- }
-}
-
-void PageContainer::currentChanged(const QModelIndex &current)
-{
- showPage(current.isValid() ? m_proxyModel->mapToSource(current).row() : -1);
-}
-
-bool PageContainer::requestClose(QCloseEvent *event)
-{
- for (auto page : m_model->pages())
- {
- if (!page->apply())
- return false;
- }
- if (m_currentPage)
- {
- m_currentPage->closed();
- }
- return true;
-}
diff --git a/gui/widgets/PageContainer.h b/gui/widgets/PageContainer.h
deleted file mode 100644
index 9795625b..00000000
--- a/gui/widgets/PageContainer.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* 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>
-#include <QModelIndex>
-
-#include "gui/pages/BasePageProvider.h"
-
-class QLayout;
-class IconLabel;
-class QSortFilterProxyModel;
-class PageModel;
-class QLabel;
-class QListView;
-class QLineEdit;
-class QStackedLayout;
-class QGridLayout;
-
-class PageContainer : public QWidget
-{
- Q_OBJECT
-public:
- explicit PageContainer(BasePageProviderPtr pageProvider, QString defaultId = QString(),
- QWidget *parent = 0);
- virtual ~PageContainer() {}
-
- void addButtons(QWidget * buttons);
- void addButtons(QLayout * buttons);
- bool requestClose(QCloseEvent *event);
-
-private:
- void createUI();
-private
-slots:
- void currentChanged(const QModelIndex &current);
- void showPage(int row);
- void help();
-
-private:
- BasePage * m_currentPage = 0;
- QSortFilterProxyModel *m_proxyModel;
- PageModel *m_model;
- QStackedLayout *m_pageStack;
- QLineEdit *m_filter;
- QListView *m_pageList;
- QLabel *m_header;
- IconLabel *m_iconHeader;
- QGridLayout *m_layout;
-};
diff --git a/gui/widgets/PageContainer_p.h b/gui/widgets/PageContainer_p.h
deleted file mode 100644
index 4c720e4c..00000000
--- a/gui/widgets/PageContainer_p.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* 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 <QListView>
-#include <QStyledItemDelegate>
-#include <QEvent>
-#include <QScrollBar>
-
-class BasePage;
-const int pageIconSize = 24;
-
-class PageViewDelegate : public QStyledItemDelegate
-{
-public:
- PageViewDelegate(QObject *parent) : QStyledItemDelegate(parent)
- {
- }
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
- {
- QSize size = QStyledItemDelegate::sizeHint(option, index);
- size.setHeight(qMax(size.height(), 32));
- return size;
- }
-};
-
-class PageModel : public QAbstractListModel
-{
-public:
- PageModel(QObject *parent = 0) : QAbstractListModel(parent)
- {
- QPixmap empty(pageIconSize, pageIconSize);
- empty.fill(Qt::transparent);
- m_emptyIcon = QIcon(empty);
- }
- virtual ~PageModel() {}
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const
- {
- return parent.isValid() ? 0 : m_pages.size();
- }
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
- {
- switch (role)
- {
- case Qt::DisplayRole:
- return m_pages.at(index.row())->displayName();
- case Qt::DecorationRole:
- {
- QIcon icon = m_pages.at(index.row())->icon();
- if (icon.isNull())
- icon = m_emptyIcon;
- // HACK: fixes icon stretching on windows. TODO: report Qt bug for this
- return QIcon(icon.pixmap(QSize(48,48)));
- }
- }
- return QVariant();
- }
-
- void setPages(const QList<BasePage *> &pages)
- {
- beginResetModel();
- m_pages = pages;
- endResetModel();
- }
- const QList<BasePage *> &pages() const
- {
- return m_pages;
- }
-
- BasePage * findPageEntryById(QString id)
- {
- for(auto page: m_pages)
- {
- if (page->id() == id)
- return page;
- }
- return nullptr;
- }
-
- QList<BasePage *> m_pages;
- QIcon m_emptyIcon;
-};
-
-class PageView : public QListView
-{
-public:
- PageView(QWidget *parent = 0) : QListView(parent)
- {
- setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
- setItemDelegate(new PageViewDelegate(this));
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- }
-
- virtual QSize sizeHint() const
- {
- int width = sizeHintForColumn(0) + frameWidth() * 2 + 5;
- if (verticalScrollBar()->isVisible())
- width += verticalScrollBar()->width();
- return QSize(width, 100);
- }
-
- virtual bool eventFilter(QObject *obj, QEvent *event)
- {
- if (obj == verticalScrollBar() &&
- (event->type() == QEvent::Show || event->type() == QEvent::Hide))
- updateGeometry();
- return QListView::eventFilter(obj, event);
- }
-};
diff --git a/gui/widgets/ServerStatus.cpp b/gui/widgets/ServerStatus.cpp
deleted file mode 100644
index a73f499e..00000000
--- a/gui/widgets/ServerStatus.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-#include "ServerStatus.h"
-#include "LineSeparator.h"
-#include "IconLabel.h"
-#include "logic/status/StatusChecker.h"
-
-#include "MultiMC.h"
-
-#include <QHBoxLayout>
-#include <QFrame>
-#include <QLabel>
-#include <QMap>
-#include <QToolButton>
-#include <QAction>
-
-ServerStatus::ServerStatus(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
-{
- layout = new QHBoxLayout(this);
- layout->setContentsMargins(0, 0, 0, 0);
- goodIcon = MMC->getThemedIcon("status-good");
- yellowIcon = MMC->getThemedIcon("status-yellow");
- badIcon = MMC->getThemedIcon("status-bad");
-
- addStatus("minecraft.net", tr("Web"));
- addLine();
- addStatus("account.mojang.com", tr("Account"));
- addLine();
- addStatus("skins.minecraft.net", tr("Skins"));
- addLine();
- addStatus("authserver.mojang.com", tr("Auth"));
- addLine();
- addStatus("sessionserver.mojang.com", tr("Session"));
-
- m_statusRefresh = new QToolButton(this);
- m_statusRefresh->setCheckable(true);
- m_statusRefresh->setToolButtonStyle(Qt::ToolButtonIconOnly);
- m_statusRefresh->setIcon(MMC->getThemedIcon("refresh"));
- layout->addWidget(m_statusRefresh);
-
- setLayout(layout);
-
- // Start status checker
- m_statusChecker.reset(new StatusChecker());
- {
- auto reloader = m_statusChecker.get();
- connect(reloader, &StatusChecker::statusChanged, this, &ServerStatus::StatusChanged);
- connect(reloader, &StatusChecker::statusLoading, this, &ServerStatus::StatusReloading);
- connect(m_statusRefresh, &QAbstractButton::clicked, this, &ServerStatus::reloadStatus);
- m_statusChecker->startTimer(60000);
- reloadStatus();
- }
-}
-
-ServerStatus::~ServerStatus()
-{
-}
-
-void ServerStatus::reloadStatus()
-{
- m_statusChecker->reloadStatus();
-}
-
-void ServerStatus::addLine()
-{
- layout->addWidget(new LineSeparator(this, Qt::Vertical));
-}
-
-void ServerStatus::addStatus(QString key, QString name)
-{
- {
- auto label = new IconLabel(this, badIcon, QSize(16, 16));
- label->setToolTip(key);
- serverLabels[key] = label;
- layout->addWidget(label);
- }
- {
- auto label = new QLabel(this);
- label->setText(name);
- label->setToolTip(key);
- layout->addWidget(label);
- }
-}
-
-void ServerStatus::setStatus(QString key, int value)
-{
- if (!serverLabels.contains(key))
- return;
- IconLabel *label = serverLabels[key];
- switch(value)
- {
- case 0:
- label->setIcon(goodIcon);
- break;
- case 1:
- label->setIcon(yellowIcon);
- break;
- default:
- case 2:
- label->setIcon(badIcon);
- break;
- }
-}
-
-void ServerStatus::StatusChanged(const QMap<QString, QString> statusEntries)
-{
- auto convertStatus = [&](QString status)->int
- {
- if (status == "green")
- return 0;
- else if (status == "yellow")
- return 1;
- else if (status == "red")
- return 2;
- return 2;
- }
- ;
- auto iter = statusEntries.begin();
- while (iter != statusEntries.end())
- {
- QString key = iter.key();
- auto value = convertStatus(iter.value());
- setStatus(key, value);
- iter++;
- }
-}
-
-void ServerStatus::StatusReloading(bool is_reloading)
-{
- m_statusRefresh->setChecked(is_reloading);
-}
diff --git a/gui/widgets/ServerStatus.h b/gui/widgets/ServerStatus.h
deleted file mode 100644
index fdd43677..00000000
--- a/gui/widgets/ServerStatus.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-#include <QString>
-#include <QWidget>
-#include <QMap>
-#include <QIcon>
-#include <memory>
-
-class IconLabel;
-class QToolButton;
-class QHBoxLayout;
-class StatusChecker;
-
-class ServerStatus: public QWidget
-{
- Q_OBJECT
-public:
- explicit ServerStatus(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
- virtual ~ServerStatus();
- ;
-public slots:
- void reloadStatus();
- void StatusChanged(const QMap<QString, QString> statuses);
- void StatusReloading(bool is_reloading);
-
-private: /* methods */
- void addLine();
- void addStatus(QString key, QString name);
- void setStatus(QString key, int value);
-private: /* data */
- QHBoxLayout * layout = nullptr;
- QToolButton *m_statusRefresh = nullptr;
- QMap<QString, IconLabel *> serverLabels;
- QIcon goodIcon;
- QIcon yellowIcon;
- QIcon badIcon;
- std::shared_ptr<StatusChecker> m_statusChecker;
-};
diff --git a/gui/widgets/VersionListView.cpp b/gui/widgets/VersionListView.cpp
deleted file mode 100644
index fc0bcd0a..00000000
--- a/gui/widgets/VersionListView.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/* 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 <QHeaderView>
-#include <QApplication>
-#include <QMouseEvent>
-#include <QDrag>
-#include <QPainter>
-#include "VersionListView.h"
-#include "Common.h"
-
-VersionListView::VersionListView(QWidget *parent)
- :QTreeView ( parent )
-{
- m_emptyString = tr("No versions are currently available.");
-}
-
-void VersionListView::rowsInserted(const QModelIndex &parent, int start, int end)
-{
- if(!m_itemCount)
- viewport()->update();
- m_itemCount += end-start+1;
- QTreeView::rowsInserted(parent, start, end);
-}
-
-
-void VersionListView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
-{
- m_itemCount -= end-start+1;
- if(!m_itemCount)
- viewport()->update();
- QTreeView::rowsInserted(parent, start, end);
-}
-
-void VersionListView::setModel(QAbstractItemModel *model)
-{
- m_itemCount = model->rowCount();
- if(!m_itemCount)
- viewport()->update();
- QTreeView::setModel(model);
-}
-
-void VersionListView::reset()
-{
- if(model())
- {
- m_itemCount = model()->rowCount();
- }
- viewport()->update();
- QTreeView::reset();
-}
-
-void VersionListView::setEmptyString(QString emptyString)
-{
- m_emptyString = emptyString;
- if(!m_itemCount)
- {
- viewport()->update();
- }
-}
-
-void VersionListView::paintEvent(QPaintEvent *event)
-{
- if(m_itemCount)
- {
- QTreeView::paintEvent(event);
- }
- else
- {
- paintInfoLabel(event);
- }
-}
-
-void VersionListView::paintInfoLabel(QPaintEvent *event)
-{
- //calculate the rect for the overlay
- QPainter painter(viewport());
- painter.setRenderHint(QPainter::Antialiasing, true);
- QFont font("sans", 20);
- font.setBold(true);
-
- QRect bounds = viewport()->geometry();
- bounds.moveTop(0);
- QTextLayout layout(m_emptyString, font);
- qreal height = 0.0;
- qreal widthUsed = 0.0;
- QStringList lines = viewItemTextLayout(layout, bounds.width() - 20, height, widthUsed);
- QRect rect (0,0, widthUsed, height);
- rect.setWidth(rect.width()+20);
- rect.setHeight(rect.height()+20);
- rect.moveCenter(bounds.center());
- //check if we are allowed to draw in our area
- if (!event->rect().intersects(rect)) {
- return;
- }
- //draw the letter of the topmost item semitransparent in the middle
- QColor background = QApplication::palette().color(QPalette::Foreground);
- QColor foreground = QApplication::palette().color(QPalette::Base);
- /*
- background.setAlpha(128 - scrollFade);
- foreground.setAlpha(128 - scrollFade);
- */
- painter.setBrush(QBrush(background));
- painter.setPen(foreground);
- painter.drawRoundedRect(rect, 5.0, 5.0);
- foreground.setAlpha(190);
- painter.setPen(foreground);
- painter.setFont(font);
- painter.drawText(rect, Qt::AlignCenter, lines.join("\n"));
-
-}
-
-/*
-void ModListView::setModel ( QAbstractItemModel* model )
-{
- QTreeView::setModel ( model );
- auto head = header();
- head->setStretchLastSection(false);
- // HACK: this is true for the checkbox column of mod lists
- auto string = model->headerData(0,head->orientation()).toString();
- if(!string.size())
- {
- head->setSectionResizeMode(0, QHeaderView::ResizeToContents);
- head->setSectionResizeMode(1, QHeaderView::Stretch);
- for(int i = 2; i < head->count(); i++)
- head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
- }
- else
- {
- head->setSectionResizeMode(0, QHeaderView::Stretch);
- for(int i = 1; i < head->count(); i++)
- head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
- }
-}
-*/
diff --git a/gui/widgets/VersionListView.h b/gui/widgets/VersionListView.h
deleted file mode 100644
index f33a6fdb..00000000
--- a/gui/widgets/VersionListView.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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 <QTreeView>
-
-class Mod;
-
-class VersionListView : public QTreeView
-{
- Q_OBJECT
-public:
- explicit VersionListView(QWidget *parent = 0);
- virtual void paintEvent(QPaintEvent *event) override;
- void setEmptyString(QString emptyString);
- virtual void setModel ( QAbstractItemModel* model );
-
-public slots:
- virtual void reset() override;
-
-protected slots:
- virtual void rowsAboutToBeRemoved(const QModelIndex & parent, int start, int end) override;
- virtual void rowsInserted(const QModelIndex &parent, int start, int end) override;
-
-private: /* methods */
- void paintInfoLabel(QPaintEvent *event);
-
-private: /* variables */
- int m_itemCount = 0;
- QString m_emptyString;
-};