diff options
| author | Petr Mrázek <peterix@gmail.com> | 2013-11-04 02:53:05 +0100 |
|---|---|---|
| committer | Petr Mrázek <peterix@gmail.com> | 2013-11-04 02:53:05 +0100 |
| commit | bb7e8985f6d189de0acac6a1c3033cb16378c1fb (patch) | |
| tree | 7c2e88c7184a7f5acf5e7a03be5c5f0bf6904113 /gui | |
| parent | d6e4fb29713d6ce55b092c0e22412f6121e7f516 (diff) | |
| download | PrismLauncher-bb7e8985f6d189de0acac6a1c3033cb16378c1fb.tar.gz PrismLauncher-bb7e8985f6d189de0acac6a1c3033cb16378c1fb.tar.bz2 PrismLauncher-bb7e8985f6d189de0acac6a1c3033cb16378c1fb.zip | |
Reformat and (slightly) decruft all the things.
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/ConsoleWindow.cpp (renamed from gui/consolewindow.cpp) | 23 | ||||
| -rw-r--r-- | gui/ConsoleWindow.h (renamed from gui/consolewindow.h) | 32 | ||||
| -rw-r--r-- | gui/ConsoleWindow.ui (renamed from gui/consolewindow.ui) | 0 | ||||
| -rw-r--r-- | gui/CustomMessageBox.cpp | 19 | ||||
| -rw-r--r-- | gui/CustomMessageBox.h | 11 | ||||
| -rw-r--r-- | gui/EditNotesDialog.cpp | 29 | ||||
| -rw-r--r-- | gui/EditNotesDialog.h | 20 | ||||
| -rw-r--r-- | gui/IconPickerDialog.cpp | 147 | ||||
| -rw-r--r-- | gui/IconPickerDialog.h | 29 | ||||
| -rw-r--r-- | gui/LabeledToolButton.h | 22 | ||||
| -rw-r--r-- | gui/MainWindow.cpp (renamed from gui/mainwindow.cpp) | 42 | ||||
| -rw-r--r-- | gui/MainWindow.h (renamed from gui/mainwindow.h) | 5 | ||||
| -rw-r--r-- | gui/MainWindow.ui (renamed from gui/mainwindow.ui) | 0 | ||||
| -rw-r--r-- | gui/ModEditDialogCommon.cpp | 41 | ||||
| -rw-r--r-- | gui/ModEditDialogCommon.h | 7 | ||||
| -rw-r--r-- | gui/ModListView.h | 13 | ||||
| -rw-r--r-- | gui/Platform.h (renamed from gui/platform.h) | 7 | ||||
| -rw-r--r-- | gui/Platform_Other.cpp (renamed from gui/platform_other.cpp) | 2 | ||||
| -rw-r--r-- | gui/Platform_X11.cpp (renamed from gui/platform_x11.cpp) | 2 | ||||
| -rw-r--r-- | gui/aboutdialog.cpp | 24 | ||||
| -rw-r--r-- | gui/aboutdialog.h | 22 | ||||
| -rw-r--r-- | gui/dialogs/AboutDialog.cpp | 37 | ||||
| -rw-r--r-- | gui/dialogs/AboutDialog.h | 35 | ||||
| -rw-r--r-- | gui/dialogs/AboutDialog.ui (renamed from gui/aboutdialog.ui) | 31 | ||||
| -rw-r--r-- | gui/dialogs/CopyInstanceDialog.cpp (renamed from gui/CopyInstanceDialog.cpp) | 20 | ||||
| -rw-r--r-- | gui/dialogs/CopyInstanceDialog.h (renamed from gui/CopyInstanceDialog.h) | 0 | ||||
| -rw-r--r-- | gui/dialogs/CopyInstanceDialog.ui (renamed from gui/CopyInstanceDialog.ui) | 6 | ||||
| -rw-r--r-- | gui/dialogs/CustomMessageBox.cpp | 34 | ||||
| -rw-r--r-- | gui/dialogs/CustomMessageBox.h | 26 | ||||
| -rw-r--r-- | gui/dialogs/EditNotesDialog.cpp | 42 | ||||
| -rw-r--r-- | gui/dialogs/EditNotesDialog.h | 38 | ||||
| -rw-r--r-- | gui/dialogs/EditNotesDialog.ui (renamed from gui/EditNotesDialog.ui) | 0 | ||||
| -rw-r--r-- | gui/dialogs/IconPickerDialog.cpp | 156 | ||||
| -rw-r--r-- | gui/dialogs/IconPickerDialog.h | 48 | ||||
| -rw-r--r-- | gui/dialogs/IconPickerDialog.ui (renamed from gui/IconPickerDialog.ui) | 0 | ||||
| -rw-r--r-- | gui/dialogs/InstanceSettings.cpp (renamed from gui/instancesettings.cpp) | 39 | ||||
| -rw-r--r-- | gui/dialogs/InstanceSettings.h | 50 | ||||
| -rw-r--r-- | gui/dialogs/InstanceSettings.ui (renamed from gui/instancesettings.ui) | 0 | ||||
| -rw-r--r-- | gui/dialogs/LegacyModEditDialog.cpp (renamed from gui/LegacyModEditDialog.cpp) | 12 | ||||
| -rw-r--r-- | gui/dialogs/LegacyModEditDialog.h (renamed from gui/LegacyModEditDialog.h) | 0 | ||||
| -rw-r--r-- | gui/dialogs/LegacyModEditDialog.ui (renamed from gui/LegacyModEditDialog.ui) | 4 | ||||
| -rw-r--r-- | gui/dialogs/LoginDialog.cpp (renamed from gui/logindialog.cpp) | 120 | ||||
| -rw-r--r-- | gui/dialogs/LoginDialog.h (renamed from gui/logindialog.h) | 38 | ||||
| -rw-r--r-- | gui/dialogs/LoginDialog.ui (renamed from gui/logindialog.ui) | 5 | ||||
| -rw-r--r-- | gui/dialogs/LwjglSelectDialog.cpp (renamed from gui/lwjglselectdialog.cpp) | 26 | ||||
| -rw-r--r-- | gui/dialogs/LwjglSelectDialog.h (renamed from gui/lwjglselectdialog.h) | 20 | ||||
| -rw-r--r-- | gui/dialogs/LwjglSelectDialog.ui (renamed from gui/lwjglselectdialog.ui) | 0 | ||||
| -rw-r--r-- | gui/dialogs/ModEditDialogCommon.cpp | 57 | ||||
| -rw-r--r-- | gui/dialogs/ModEditDialogCommon.h | 22 | ||||
| -rw-r--r-- | gui/dialogs/NewInstanceDialog.cpp (renamed from gui/newinstancedialog.cpp) | 12 | ||||
| -rw-r--r-- | gui/dialogs/NewInstanceDialog.h (renamed from gui/newinstancedialog.h) | 0 | ||||
| -rw-r--r-- | gui/dialogs/NewInstanceDialog.ui (renamed from gui/newinstancedialog.ui) | 6 | ||||
| -rw-r--r-- | gui/dialogs/OneSixModEditDialog.cpp (renamed from gui/OneSixModEditDialog.cpp) | 43 | ||||
| -rw-r--r-- | gui/dialogs/OneSixModEditDialog.h (renamed from gui/OneSixModEditDialog.h) | 0 | ||||
| -rw-r--r-- | gui/dialogs/OneSixModEditDialog.ui (renamed from gui/OneSixModEditDialog.ui) | 4 | ||||
| -rw-r--r-- | gui/dialogs/ProgressDialog.cpp (renamed from gui/ProgressDialog.cpp) | 29 | ||||
| -rw-r--r-- | gui/dialogs/ProgressDialog.h (renamed from gui/ProgressDialog.h) | 46 | ||||
| -rw-r--r-- | gui/dialogs/ProgressDialog.ui (renamed from gui/ProgressDialog.ui) | 0 | ||||
| -rw-r--r-- | gui/dialogs/SettingsDialog.cpp (renamed from gui/settingsdialog.cpp) | 44 | ||||
| -rw-r--r-- | gui/dialogs/SettingsDialog.h (renamed from gui/settingsdialog.h) | 37 | ||||
| -rw-r--r-- | gui/dialogs/SettingsDialog.ui (renamed from gui/settingsdialog.ui) | 4 | ||||
| -rw-r--r-- | gui/dialogs/VersionSelectDialog.cpp (renamed from gui/versionselectdialog.cpp) | 15 | ||||
| -rw-r--r-- | gui/dialogs/VersionSelectDialog.h (renamed from gui/versionselectdialog.h) | 32 | ||||
| -rw-r--r-- | gui/dialogs/VersionSelectDialog.ui (renamed from gui/versionselectdialog.ui) | 0 | ||||
| -rw-r--r-- | gui/instancedelegate.h | 12 | ||||
| -rw-r--r-- | gui/instancesettings.h | 35 | ||||
| -rw-r--r-- | gui/newmodeditwindow.ui | 159 | ||||
| -rw-r--r-- | gui/widgets/InstanceDelegate.cpp (renamed from gui/instancedelegate.cpp) | 17 | ||||
| -rw-r--r-- | gui/widgets/InstanceDelegate.h | 27 | ||||
| -rw-r--r-- | gui/widgets/LabeledToolButton.cpp (renamed from gui/LabeledToolButton.cpp) | 16 | ||||
| -rw-r--r-- | gui/widgets/LabeledToolButton.h | 37 | ||||
| -rw-r--r-- | gui/widgets/MCModInfoFrame.cpp (renamed from gui/MCModInfoFrame.cpp) | 8 | ||||
| -rw-r--r-- | gui/widgets/MCModInfoFrame.h (renamed from gui/MCModInfoFrame.h) | 0 | ||||
| -rw-r--r-- | gui/widgets/MCModInfoFrame.ui (renamed from gui/MCModInfoFrame.ui) | 0 | ||||
| -rw-r--r-- | gui/widgets/ModListView.cpp (renamed from gui/ModListView.cpp) | 15 | ||||
| -rw-r--r-- | gui/widgets/ModListView.h | 27 |
76 files changed, 1055 insertions, 933 deletions
diff --git a/gui/consolewindow.cpp b/gui/ConsoleWindow.cpp index 49e12339..ec25b9cf 100644 --- a/gui/consolewindow.cpp +++ b/gui/ConsoleWindow.cpp @@ -1,11 +1,26 @@ -#include "consolewindow.h" -#include "ui_consolewindow.h" +/* Copyright 2013 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 "ui_ConsoleWindow.h" #include <QScrollBar> #include <QMessageBox> -#include <gui/platform.h> -#include <gui/CustomMessageBox.h> +#include <gui/Platform.h> +#include <gui/dialogs/CustomMessageBox.h> ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) : QDialog(parent), diff --git a/gui/consolewindow.h b/gui/ConsoleWindow.h index e8790c92..0ed35554 100644 --- a/gui/consolewindow.h +++ b/gui/ConsoleWindow.h @@ -1,10 +1,25 @@ -#ifndef CONSOLEWINDOW_H -#define CONSOLEWINDOW_H +/* Copyright 2013 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/MinecraftProcess.h" -namespace Ui { +namespace Ui +{ class ConsoleWindow; } @@ -23,14 +38,15 @@ public: */ void setMayClose(bool mayclose); -public slots: +public +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 write(QString data, MessageLevel::Enum level = MessageLevel::MultiMC); /** * @brief write a colored paragraph @@ -39,14 +55,15 @@ public slots: * this will only insert a single paragraph. * \n are ignored. a real \n is always appended. */ - void writeColor(QString data, const char *color=nullptr); + void writeColor(QString data, const char *color = nullptr); /** * @brief clear the text widget */ void clear(); -private slots: +private +slots: void on_closeButton_clicked(); void on_btnKillMinecraft_clicked(); void onEnded(BaseInstance *instance); @@ -60,4 +77,3 @@ private: bool m_mayclose; }; -#endif // CONSOLEWINDOW_H diff --git a/gui/consolewindow.ui b/gui/ConsoleWindow.ui index 8dc80015..8dc80015 100644 --- a/gui/consolewindow.ui +++ b/gui/ConsoleWindow.ui diff --git a/gui/CustomMessageBox.cpp b/gui/CustomMessageBox.cpp deleted file mode 100644 index e55ebbbb..00000000 --- a/gui/CustomMessageBox.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#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); - - return messageBox; - } -} diff --git a/gui/CustomMessageBox.h b/gui/CustomMessageBox.h deleted file mode 100644 index 145651ec..00000000 --- a/gui/CustomMessageBox.h +++ /dev/null @@ -1,11 +0,0 @@ -#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/EditNotesDialog.cpp b/gui/EditNotesDialog.cpp deleted file mode 100644 index 535ca804..00000000 --- a/gui/EditNotesDialog.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "EditNotesDialog.h" -#include "ui_EditNotesDialog.h" -#include "gui/platform.h" - -#include <QIcon> -#include <QApplication> - -EditNotesDialog::EditNotesDialog( QString notes, QString name, QWidget* parent ) : - m_instance_notes(notes), - m_instance_name(name), - QDialog(parent), - ui(new Ui::EditNotesDialog) -{ - MultiMCPlatform::fixWM_CLASS(this); - ui->setupUi(this); - ui->noteEditor->setText(notes); - setWindowTitle(tr("Edit notes of %1").arg(m_instance_name)); - //connect(ui->closeButton, SIGNAL(clicked()), SLOT(close())); -} - -EditNotesDialog::~EditNotesDialog() -{ - delete ui; -} - -QString EditNotesDialog::getText() -{ - return ui->noteEditor->toPlainText(); -} diff --git a/gui/EditNotesDialog.h b/gui/EditNotesDialog.h deleted file mode 100644 index 582e019f..00000000 --- a/gui/EditNotesDialog.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include <QDialog> - -namespace Ui { -class EditNotesDialog; -} - -class EditNotesDialog : public QDialog -{ - Q_OBJECT - -public: - explicit EditNotesDialog(QString notes, QString name, QWidget *parent = 0); - ~EditNotesDialog(); - QString getText(); -private: - Ui::EditNotesDialog *ui; - QString m_instance_name; - QString m_instance_notes; -}; diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp deleted file mode 100644 index ebacf87c..00000000 --- a/gui/IconPickerDialog.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include <MultiMC.h> -#include "IconPickerDialog.h" -#include "instancedelegate.h" -#include "ui_IconPickerDialog.h" -#include "logic/lists/IconList.h" -#include "gui/platform.h" -#include <QKeyEvent> -#include <QPushButton> -#include <QFileDialog> - -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(MMC->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)"); - MMC->icons()->installIcons(fileNames); -} - -void IconPickerDialog::removeSelectedIcon() -{ - MMC->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 = MMC->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/IconPickerDialog.h b/gui/IconPickerDialog.h deleted file mode 100644 index 96fc61ff..00000000 --- a/gui/IconPickerDialog.h +++ /dev/null @@ -1,29 +0,0 @@ -#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/LabeledToolButton.h b/gui/LabeledToolButton.h deleted file mode 100644 index 24ef798a..00000000 --- a/gui/LabeledToolButton.h +++ /dev/null @@ -1,22 +0,0 @@ -#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/mainwindow.cpp b/gui/MainWindow.cpp index 20a2b84b..39e6dff2 100644 --- a/gui/mainwindow.cpp +++ b/gui/MainWindow.cpp @@ -16,10 +16,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include <MultiMC.h> +#include "MultiMC.h" -#include "mainwindow.h" -#include "ui_mainwindow.h" +#include "MainWindow.h" +#include "ui_MainWindow.h" #include "keyring.h" #include <QMenu> @@ -40,17 +40,25 @@ #include "categorizedview.h" #include "categorydrawer.h" -#include "gui/settingsdialog.h" -#include "gui/newinstancedialog.h" -#include "gui/logindialog.h" -#include "gui/ProgressDialog.h" -#include "gui/aboutdialog.h" -#include "gui/versionselectdialog.h" -#include "gui/lwjglselectdialog.h" -#include "gui/consolewindow.h" -#include "gui/instancesettings.h" -#include "gui/platform.h" -#include "gui/CustomMessageBox.h" +#include "gui/Platform.h" + +#include "gui/widg |
