Reformat and (slightly) decruft all the things.

This commit is contained in:
Petr Mrázek
2013-11-04 02:53:05 +01:00
parent d6e4fb2971
commit bb7e8985f6
208 changed files with 4492 additions and 3767 deletions

View File

@ -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),

View File

@ -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

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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;
};

View File

@ -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;
}

View File

@ -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();
};

View File

@ -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);
};

View File

@ -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/widgets/InstanceDelegate.h"
#include "gui/widgets/LabeledToolButton.h"
#include "gui/dialogs/SettingsDialog.h"
#include "gui/dialogs/NewInstanceDialog.h"
#include "gui/dialogs/LoginDialog.h"
#include "gui/dialogs/ProgressDialog.h"
#include "gui/dialogs/AboutDialog.h"
#include "gui/dialogs/VersionSelectDialog.h"
#include "gui/dialogs/CustomMessageBox.h"
#include "gui/dialogs/LwjglSelectDialog.h"
#include "gui/dialogs/InstanceSettings.h"
#include "gui/dialogs/IconPickerDialog.h"
#include "gui/dialogs/EditNotesDialog.h"
#include "gui/dialogs/CopyInstanceDialog.h"
#include "gui/ConsoleWindow.h"
#include "logic/lists/InstanceList.h"
#include "logic/lists/MinecraftVersionList.h"
@ -70,12 +78,6 @@
#include "logic/LegacyInstance.h"
#include "instancedelegate.h"
#include "IconPickerDialog.h"
#include "LabeledToolButton.h"
#include "EditNotesDialog.h"
#include "CopyInstanceDialog.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
MultiMCPlatform::fixWM_CLASS(this);

View File

@ -13,8 +13,7 @@
* limitations under the License.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#pragma once
#include <QMainWindow>
@ -166,5 +165,3 @@ private:
QLabel *m_statusLeft;
QLabel *m_statusRight;
};
#endif // MAINWINDOW_H

View File

@ -1,41 +0,0 @@
#include "ModEditDialogCommon.h"
#include "CustomMessageBox.h"
#include <QDesktopServices>
#include <QMessageBox>
#include <QString>
#include <QUrl>
bool lastfirst(QModelIndexList &list, int &first, int &last)
{
if (!list.size())
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, parentDlg->tr("How sad!"),
parentDlg->tr("The mod author didn't provide a website link for this mod."),
QMessageBox::Warning);
}
}

View File

@ -1,7 +0,0 @@
#pragma once
#include <QAbstractItemModel>
#include <logic/Mod.h>
bool lastfirst (QModelIndexList & list, int & first, int & last);
void showWebsiteForMod(QWidget * parentDlg, Mod& m);

View File

@ -1,13 +0,0 @@
#pragma once
#include <QTreeView>
class Mod;
class ModListView: public QTreeView
{
Q_OBJECT
public:
explicit ModListView ( QWidget* parent = 0 );
virtual void setModel ( QAbstractItemModel* model );
};

View File

@ -15,11 +15,10 @@
* limitations under the License.
*/
#ifndef PLATFORM_H
#define PLATFORM_H
#pragma once
/**
* @file platform.h
* @file Platform.h
* This file contains platform-specific functions, tweaks and fixes.
*/
@ -31,5 +30,3 @@ public:
// X11 WM_CLASS
static void fixWM_CLASS(QWidget *widget);
};
#endif // PLATFORM_H

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
#include <gui/platform.h>
#include <gui/Platform.h>
/**
* Stub for non-X11 platforms
* @brief MultiMCPlatform::fixWM_CLASS

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
#include <gui/platform.h>
#include <gui/Platform.h>
#include <QtX11Extras/QX11Info>
#include <xcb/xcb.h>

View File

@ -1,24 +0,0 @@
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include <QIcon>
#include <MultiMC.h>
#include "gui/platform.h"
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64));
ui->title->setText("MultiMC " + MMC->version().toString());
connect(ui->closeButton, SIGNAL(clicked()), SLOT(close()));
MMC->connect(ui->aboutQt, SIGNAL(clicked()), SLOT(aboutQt()));
}
AboutDialog::~AboutDialog()
{
delete ui;
}

View File

@ -1,22 +0,0 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
private:
Ui::AboutDialog *ui;
};
#endif // ABOUTDIALOG_H

View File

@ -0,0 +1,37 @@
/* 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 "AboutDialog.h"
#include "ui_AboutDialog.h"
#include <QIcon>
#include "MultiMC.h"
#include "gui/Platform.h"
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64));
ui->title->setText("MultiMC " + MMC->version().toString());
connect(ui->closeButton, SIGNAL(clicked()), SLOT(close()));
MMC->connect(ui->aboutQt, SIGNAL(clicked()), SLOT(aboutQt()));
}
AboutDialog::~AboutDialog()
{
delete ui;
}

35
gui/dialogs/AboutDialog.h Normal file
View File

@ -0,0 +1,35 @@
/* 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>
namespace Ui
{
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
private:
Ui::AboutDialog *ui;
};

View File

@ -59,7 +59,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../multimc.qrc">:/icons/multimc/scalable/apps/multimc.svg</pixmap>
<pixmap resource="../../multimc.qrc">:/icons/multimc/scalable/apps/multimc.svg</pixmap>
</property>
</widget>
</item>
@ -101,7 +101,7 @@
<x>0</x>
<y>0</y>
<width>432</width>
<height>197</height>
<height>179</height>
</rect>
</property>
<attribute name="label">
@ -159,8 +159,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>197</height>
<width>98</width>
<height>120</height>
</rect>
</property>
<attribute name="label">
@ -176,13 +176,13 @@
<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:'MS Shell Dlg 2'; font-size:8.25pt; 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:'Ubuntu'; font-size:11pt;&quot;&gt;Andrew Okin &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:forkk@forkk.net&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;&quot;&gt;forkk@forkk.net&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&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-family:'Ubuntu'; font-size:11pt;&quot;&gt;Petr Mrázek &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:peterix@gmail.com&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;&quot;&gt;peterix@gmail.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&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-family:'Ubuntu'; font-size:11pt;&quot;&gt;Orochimarufan &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:orochimarufan.x3@gmail.com&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;&quot;&gt;orochimarufan.x3@gmail.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&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-family:'Ubuntu'; font-size:11pt;&quot;&gt;TakSuyu &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:taksuyu@gmail.com&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;&quot;&gt;taksuyu@gmail.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&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-family:'Ubuntu'; font-size:11pt;&quot;&gt;Sky (Drayshak) &amp;lt;&lt;/span&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;&quot;&gt;multimc@bunnies.cc&lt;/span&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&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-family:'Ubuntu'; font-size:11pt;&quot;&gt;Kilobyte &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:stiepen22@gmx.de&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;&quot;&gt;stiepen22@gmx.de&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&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 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:'Ubuntu';&quot;&gt;Andrew Okin &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:forkk@forkk.net&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;&quot;&gt;forkk@forkk.net&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;&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-family:'Ubuntu';&quot;&gt;Petr Mrázek &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:peterix@gmail.com&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;&quot;&gt;peterix@gmail.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;&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-family:'Ubuntu';&quot;&gt;Orochimarufan &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:orochimarufan.x3@gmail.com&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;&quot;&gt;orochimarufan.x3@gmail.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;&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-family:'Ubuntu';&quot;&gt;TakSuyu &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:taksuyu@gmail.com&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;&quot;&gt;taksuyu@gmail.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;&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-family:'Ubuntu';&quot;&gt;Sky (Drayshak) &amp;lt;&lt;/span&gt;&lt;span style=&quot; font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;&quot;&gt;multimc@bunnies.cc&lt;/span&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;&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-family:'Ubuntu';&quot;&gt;Kilobyte &amp;lt;&lt;/span&gt;&lt;a href=&quot;mailto:stiepen22@gmx.de&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;&quot;&gt;stiepen22@gmx.de&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -203,8 +203,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>197</height>
<width>98</width>
<height>88</height>
</rect>
</property>
<attribute name="label">
@ -226,7 +226,7 @@ p, li { white-space: pre-wrap; }
<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:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&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 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:'Ubuntu'; font-size:10pt;&quot;&gt;Copyright 2012 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-family:'Ubuntu'; 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-family:'Ubuntu'; font-size:10pt;&quot;&gt;you may not use this file except in compliance with the License.&lt;/span&gt;&lt;/p&gt;
@ -309,7 +309,8 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<resources>
<include location="../multimc.qrc"/>
<include location="../../multimc.qrc"/>
<include location="../../multimc.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -13,24 +13,24 @@
* limitations under the License.
*/
#include <MultiMC.h>
#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/InstanceFactory.h"
#include "logic/BaseVersion.h"
#include "logic/lists/IconList.h"
#include "logic/lists/MinecraftVersionList.h"
#include "logic/tasks/Task.h"
#include <logic/BaseInstance.h>
#include "gui/platform.h"
#include "versionselectdialog.h"
#include "ProgressDialog.h"
#include "IconPickerDialog.h"
#include <QLayout>
#include <QPushButton>
#include "logic/BaseInstance.h"
CopyInstanceDialog::CopyInstanceDialog(BaseInstance *original, QWidget *parent)
: m_original(original), QDialog(parent), ui(new Ui::CopyInstanceDialog)

View File

@ -17,7 +17,7 @@
<string>Copy Instance</string>
</property>
<property name="windowIcon">
<iconset resource="../multimc.qrc">
<iconset resource="../../multimc.qrc">
<normaloff>:/icons/toolbar/copy</normaloff>:/icons/toolbar/copy</iconset>
</property>
<property name="modal">
@ -42,7 +42,7 @@
<item>
<widget class="QToolButton" name="iconButton">
<property name="icon">
<iconset resource="../multimc.qrc">
<iconset resource="../../multimc.qrc">
<normaloff>:/icons/instances/infinity</normaloff>:/icons/instances/infinity</iconset>
</property>
<property name="iconSize">
@ -95,7 +95,7 @@
</layout>
</widget>
<resources>
<include location="../multimc.qrc"/>
<include location="../../multimc.qrc"/>
</resources>
<connections>
<connection>

View File

@ -0,0 +1,34 @@
/* 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 "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;
}
}

View File

@ -0,0 +1,26 @@
/* 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 <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);
}

View File

@ -0,0 +1,42 @@
/* 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 "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();
}

View File

@ -0,0 +1,38 @@
/* 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>
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;
};

View File

@ -0,0 +1,156 @@
/* 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 <QKeyEvent>
#include <QPushButton>
#include <QFileDialog>
#include "MultiMC.h"
#include "IconPickerDialog.h"
#include "ui_IconPickerDialog.h"
#include "gui/Platform.h"
#include "gui/widgets/InstanceDelegate.h"
#include "logic/lists/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(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;
}

View File

@ -0,0 +1,48 @@
/* 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 <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();
};

View File

@ -17,16 +17,14 @@
* limitations under the License.
*/
#include "instancesettings.h"
#include "ui_instancesettings.h"
#include "gui/platform.h"
#include "InstanceSettings.h"
#include "ui_InstanceSettings.h"
#include "gui/Platform.h"
InstanceSettings::InstanceSettings( SettingsObject * obj, QWidget *parent) :
m_obj(obj),
QDialog(parent),
ui(new Ui::InstanceSettings)
InstanceSettings::InstanceSettings(SettingsObject *obj, QWidget *parent)
: m_obj(obj), QDialog(parent), ui(new Ui::InstanceSettings)
{
MultiMCPlatform::fixWM_CLASS(this);
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
loadSettings();
}
@ -36,7 +34,7 @@ InstanceSettings::~InstanceSettings()
delete ui;
}
void InstanceSettings::showEvent ( QShowEvent* ev )
void InstanceSettings::showEvent(QShowEvent *ev)
{
QDialog::showEvent(ev);
adjustSize();
@ -58,13 +56,12 @@ void InstanceSettings::on_buttonBox_rejected()
reject();
}
void InstanceSettings::applySettings()
{
// Console
bool console = ui->consoleSettingsBox->isChecked();
m_obj->set("OverrideConsole", console);
if(console)
if (console)
{
m_obj->set("ShowConsole", ui->showConsoleCheck->isChecked());
m_obj->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
@ -78,7 +75,7 @@ void InstanceSettings::applySettings()
// Window Size
bool window = ui->windowSizeGroupBox->isChecked();
m_obj->set("OverrideWindow", window);
if(window)
if (window)
{
m_obj->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
m_obj->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
@ -90,12 +87,11 @@ void InstanceSettings::applySettings()
m_obj->reset("MinecraftWinWidth");
m_obj->reset("MinecraftWinHeight");
}
// Auto Login
bool login = ui->accountSettingsGroupBox->isChecked();
m_obj->set("OverrideLogin", login);
if(login)
if (login)
{
m_obj->set("AutoLogin", ui->autoLoginChecBox->isChecked());
}
@ -103,12 +99,11 @@ void InstanceSettings::applySettings()
{
m_obj->reset("AutoLogin");
}
// Memory
bool memory = ui->memoryGroupBox->isChecked();
m_obj->set("OverrideMemory", memory);
if(memory)
if (memory)
{
m_obj->set("MinMemAlloc", ui->minMemSpinBox->value());
m_obj->set("MaxMemAlloc", ui->maxMemSpinBox->value());
@ -120,12 +115,11 @@ void InstanceSettings::applySettings()
m_obj->reset("MaxMemAlloc");
m_obj->reset("PermGen");
}
// Java Settings
bool java = ui->javaSettingsGroupBox->isChecked();
bool java = ui->javaSettingsGroupBox->isChecked();
m_obj->set("OverrideJava", java);
if(java)
if (java)
{
m_obj->set("JavaPath", ui->javaPathTextBox->text());
m_obj->set("JvmArgs", ui->jvmArgsTextBox->text());
@ -135,12 +129,11 @@ void InstanceSettings::applySettings()
m_obj->reset("JavaPath");
m_obj->reset("JvmArgs");
}
// Custom Commands
bool custcmd = ui->customCommandsGroupBox->isChecked();
m_obj->set("OverrideCommands", custcmd);
if(custcmd)
if (custcmd)
{
m_obj->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
m_obj->set("PostExitCommand", ui->postExitCmdTextBox->text());
@ -150,7 +143,6 @@ void InstanceSettings::applySettings()
m_obj->reset("PreLaunchCommand");
m_obj->reset("PostExitCommand");
}
}
void InstanceSettings::loadSettings()
@ -165,7 +157,6 @@ void InstanceSettings::loadSettings()
ui->maximizedCheckBox->setChecked(m_obj->get("LaunchMaximized").toBool());
ui->windowWidthSpinBox->setValue(m_obj->get("MinecraftWinWidth").toInt());
ui->windowHeightSpinBox->setValue(m_obj->get("MinecraftWinHeight").toInt());
// Auto Login
ui->accountSettingsGroupBox->setChecked(m_obj->get("OverrideLogin").toBool());

View File

@ -0,0 +1,50 @@
/* 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 "settingsobject.h"
namespace Ui
{
class InstanceSettings;
}
class InstanceSettings : public QDialog
{
Q_OBJECT
public:
explicit InstanceSettings(SettingsObject *s, QWidget *parent = 0);
~InstanceSettings();
void updateCheckboxStuff();
void applySettings();
void loadSettings();
protected:
virtual void showEvent(QShowEvent *);
private
slots:
void on_customCommandsGroupBox_toggled(bool arg1);
void on_buttonBox_accepted();
void on_buttonBox_rejected();
private:
Ui::InstanceSettings *ui;
SettingsObject *m_obj;
};

View File

@ -16,12 +16,12 @@
#include "MultiMC.h"
#include "LegacyModEditDialog.h"
#include "ModEditDialogCommon.h"
#include "versionselectdialog.h"
#include "VersionSelectDialog.h"
#include "ProgressDialog.h"
#include "ui_LegacyModEditDialog.h"
#include "logic/ModList.h"
#include "logic/lists/ForgeVersionList.h"
#include "gui/platform.h"
#include "gui/Platform.h"
#include <pathutils.h>
#include <QFileDialog>
@ -33,7 +33,7 @@
LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
: m_inst(inst), QDialog(parent), ui(new Ui::LegacyModEditDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
// Jar mods
@ -358,7 +358,7 @@ void LegacyModEditDialog::on_buttonBox_rejected()
void LegacyModEditDialog::jarCurrent(QModelIndex current, QModelIndex previous)
{
if(!current.isValid())
if (!current.isValid())
{
ui->jarMIFrame->clear();
return;
@ -370,7 +370,7 @@ void LegacyModEditDialog::jarCurrent(QModelIndex current, QModelIndex previous)
void LegacyModEditDialog::coreCurrent(QModelIndex current, QModelIndex previous)
{
if(!current.isValid())
if (!current.isValid())
{
ui->coreMIFrame->clear();
return;
@ -382,7 +382,7 @@ void LegacyModEditDialog::coreCurrent(QModelIndex current, QModelIndex previous)
void LegacyModEditDialog::loaderCurrent(QModelIndex current, QModelIndex previous)
{
if(!current.isValid())
if (!current.isValid())
{
ui->loaderMIFrame->clear();
return;

View File

@ -307,12 +307,12 @@
<customwidget>
<class>ModListView</class>
<extends>QTreeView</extends>
<header>gui/ModListView.h</header>
<header>gui/widgets/ModListView.h</header>
</customwidget>
<customwidget>
<class>MCModInfoFrame</class>
<extends>QFrame</extends>
<header>gui/MCModInfoFrame.h</header>
<header>gui/widgets/MCModInfoFrame.h</header>
<container>1</container>
</customwidget>
</customwidgets>

View File

@ -3,7 +3,7 @@
* 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
@ -13,10 +13,10 @@
* limitations under the License.
*/
#include "logindialog.h"
#include "ui_logindialog.h"
#include "LoginDialog.h"
#include "ui_LoginDialog.h"
#include "keyring.h"
#include "gui/platform.h"
#include "gui/Platform.h"
#include "MultiMC.h"
#include <QFile>
@ -24,58 +24,58 @@
#include <QJsonArray>
#include <QJsonParseError>
#include "logic/net/HttpMetaCache.h"
#include <logger/QsLog.h>
#include "logger/QsLog.h"
LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) :
QDialog(parent),
ui(new Ui::LoginDialog)
LoginDialog::LoginDialog(QWidget *parent, const QString &loginErrMsg)
: QDialog(parent), ui(new Ui::LoginDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
//: Use offline mode one time
offlineButton = new QPushButton(tr("Offline Once"));
ui->loginButtonBox->addButton(offlineButton, QDialogButtonBox::ActionRole);
blockToggles = false;
isOnline_ = true;
onlineForced = false;
//: The username during login (placeholder)
ui->usernameTextBox->lineEdit()->setPlaceholderText(tr("Name"));
connect(ui->usernameTextBox, SIGNAL(currentTextChanged(QString)), this, SLOT(userTextChanged(QString)));
connect(ui->usernameTextBox, SIGNAL(currentTextChanged(QString)), this,
SLOT(userTextChanged(QString)));
connect(ui->forgetButton, SIGNAL(clicked(bool)), this, SLOT(forgetCurrentUser()));
connect(offlineButton, SIGNAL(clicked(bool)), this, SLOT(launchOffline()));
if (loginErrMsg.isEmpty())
ui->loginErrorLabel->setVisible(false);
else
{
ui->loginErrorLabel->setVisible(true);
ui->loginErrorLabel->setText(QString("<span style=\" color:#ff0000;\">%1</span>").
arg(loginErrMsg));
ui->loginErrorLabel->setText(
QString("<span style=\" color:#ff0000;\">%1</span>").arg(loginErrMsg));
}
ui->lblFace->setVisible(false);
resize(minimumSizeHint());
layout()->setSizeConstraint(QLayout::SetFixedSize);
Keyring * k = Keyring::instance();
Keyring *k = Keyring::instance();
QStringList accounts = k->getStoredAccounts("minecraft");
ui->usernameTextBox->addItems(accounts);
// TODO: restore last selected account here, if applicable
int index = ui->usernameTextBox->currentIndex();
if(index != -1)
if (index != -1)
{
ui->passwordTextBox->setFocus(Qt::OtherFocusReason);
}
connect(ui->rememberUsernameCheckbox,SIGNAL(toggled(bool)), SLOT(usernameToggled(bool)));
connect(ui->rememberPasswordCheckbox,SIGNAL(toggled(bool)), SLOT(passwordToggled(bool)));
connect(ui->rememberUsernameCheckbox, SIGNAL(toggled(bool)), SLOT(usernameToggled(bool)));
connect(ui->rememberPasswordCheckbox, SIGNAL(toggled(bool)), SLOT(passwordToggled(bool)));
}
LoginDialog::~LoginDialog()
@ -96,14 +96,14 @@ QString LoginDialog::getPassword() const
void LoginDialog::forgetCurrentUser()
{
Keyring * k = Keyring::instance();
Keyring *k = Keyring::instance();
QString acct = ui->usernameTextBox->currentText();
k->removeStoredAccount("minecraft", acct);
ui->passwordTextBox->clear();
int index = ui->usernameTextBox->findText(acct);
if(index != -1)
if (index != -1)
ui->usernameTextBox->removeItem(index);
if(!ui->usernameTextBox->count())
if (!ui->usernameTextBox->count())
{
blockToggles = true;
ui->rememberUsernameCheckbox->setChecked(false);
@ -112,19 +112,19 @@ void LoginDialog::forgetCurrentUser()
}
}
void LoginDialog::passwordToggled ( bool state )
void LoginDialog::passwordToggled(bool state)
{
// if toggled off
if(blockToggles)
if (blockToggles)
return;
blockToggles = true;
if(!state)
if (!state)
{
QLOG_DEBUG() << "password disabled";
}
else
{
if(!ui->rememberUsernameCheckbox->isChecked())
if (!ui->rememberUsernameCheckbox->isChecked())
{
ui->rememberUsernameCheckbox->setChecked(true);
}
@ -133,15 +133,15 @@ void LoginDialog::passwordToggled ( bool state )
blockToggles = false;
}
void LoginDialog::usernameToggled ( bool state )
void LoginDialog::usernameToggled(bool state)
{
// if toggled off
if(blockToggles)
if (blockToggles)
return;
blockToggles = true;
if(!state)
if (!state)
{
if(ui->rememberPasswordCheckbox->isChecked())
if (ui->rememberPasswordCheckbox->isChecked())
{
ui->rememberPasswordCheckbox->setChecked(false);
}
@ -154,26 +154,26 @@ void LoginDialog::usernameToggled ( bool state )
blockToggles = false;
}
void LoginDialog::userTextChanged ( const QString& user )
void LoginDialog::userTextChanged(const QString &user)
{
blockToggles = true;
Keyring * k = Keyring::instance();
Keyring *k = Keyring::instance();
QStringList sl = k->getStoredAccounts("minecraft");
bool gotFace = false;
if(sl.contains(user))
if (sl.contains(user))
{
ui->rememberUsernameCheckbox->setChecked(true);
QString passwd = k->getPassword("minecraft",user);
QString passwd = k->getPassword("minecraft", user);
ui->rememberPasswordCheckbox->setChecked(!passwd.isEmpty());
ui->passwordTextBox->setText(passwd);
QByteArray data;
{
auto filename = MMC->metacache()->resolveEntry("skins", "skins.json")->getFullPath();
auto filename =
MMC->metacache()->resolveEntry("skins", "skins.json")->getFullPath();
QFile listFile(filename);
if(!listFile.open(QIODevice::ReadOnly))
if (!listFile.open(QIODevice::ReadOnly))
return;
data = listFile.readAll();
}
@ -183,20 +183,25 @@ void LoginDialog::userTextChanged ( const QString& user )
QJsonObject root = jsonDoc.object();
QJsonObject mappings = root.value("mappings").toObject();
if(!mappings[user].isUndefined())
if (!mappings[user].isUndefined())
{
QJsonArray usernames = mappings.value(user).toArray();
if(!usernames.isEmpty())
if (!usernames.isEmpty())
{
QString mapped_username = usernames[0].toString();
if(!mapped_username.isEmpty())
if (!mapped_username.isEmpty())
{
QFile fskin(MMC->metacache()->resolveEntry("skins", mapped_username + ".png")->getFullPath());
if(fskin.exists())
QFile fskin(MMC->metacache()
->resolveEntry("skins", mapped_username + ".png")
->getFullPath());
if (fskin.exists())
{
QPixmap skin(MMC->metacache()->resolveEntry("skins", mapped_username + ".png")->getFullPath());
QPixmap face = skin.copy(8, 8, 8, 8).scaled(48, 48, Qt::KeepAspectRatio);
QPixmap skin(MMC->metacache()
->resolveEntry("skins", mapped_username + ".png")
->getFullPath());
QPixmap face =
skin.copy(8, 8, 8, 8).scaled(48, 48, Qt::KeepAspectRatio);
ui->lblFace->setPixmap(face);
gotFace = true;
@ -210,21 +215,20 @@ void LoginDialog::userTextChanged ( const QString& user )
blockToggles = false;
}
void LoginDialog::accept()
{
bool saveName = ui->rememberUsernameCheckbox->isChecked();
bool savePass = ui->rememberPasswordCheckbox->isChecked();
Keyring * k = Keyring::instance();
if(saveName)
Keyring *k = Keyring::instance();
if (saveName)
{
if(savePass)
if (savePass)
{
k->storePassword("minecraft",getUsername(),getPassword());
k->storePassword("minecraft", getUsername(), getPassword());
}
else
{
k->storePassword("minecraft",getUsername(),QString());
k->storePassword("minecraft", getUsername(), QString());
}
}
else
@ -235,7 +239,7 @@ void LoginDialog::accept()
QDialog::accept();
}
void LoginDialog::launchOffline()
void LoginDialog::launchOffline()
{
isOnline_ = false;
QDialog::accept();

View File

@ -3,7 +3,7 @@
* 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
@ -13,39 +13,45 @@
* limitations under the License.
*/
#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H
#pragma once
#include <QDialog>
#include <QPushButton>
namespace Ui {
namespace Ui
{
class LoginDialog;
}
class LoginDialog : public QDialog
{
Q_OBJECT
public:
explicit LoginDialog(QWidget *parent = 0, const QString& loginErrMsg = "");
explicit LoginDialog(QWidget *parent = 0, const QString &loginErrMsg = "");
~LoginDialog();
QString getUsername() const;
QString getPassword() const;
inline bool isOnline() { return isOnline_; }
inline bool isOnline()
{
return isOnline_;
}
void forceOnline();
public slots:
public
slots:
virtual void accept();
virtual void userTextChanged(const QString& user);
virtual void userTextChanged(const QString &user);
virtual void forgetCurrentUser();
private slots:
void usernameToggled ( bool );
void passwordToggled ( bool );
private
slots:
void usernameToggled(bool);
void passwordToggled(bool);
void launchOffline();
private:
Ui::LoginDialog *ui;
bool blockToggles;
@ -53,5 +59,3 @@ private:
bool isOnline_;
bool onlineForced;
};
#endif // LOGINDIALOG_H

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<width>496</width>
<height>168</height>
</rect>
</property>
@ -50,7 +50,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../multimc.qrc">:/icons/instances/steve</pixmap>
<pixmap resource="../../multimc.qrc">:/icons/instances/steve</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@ -146,6 +146,7 @@
</layout>
</widget>
<resources>
<include location="../../multimc.qrc"/>
<include location="../multimc.qrc"/>
</resources>
<connections>

View File

@ -3,7 +3,7 @@
* 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
@ -14,23 +14,23 @@
*/
#include "MultiMC.h"
#include "lwjglselectdialog.h"
#include "ui_lwjglselectdialog.h"
#include "gui/platform.h"
#include "LwjglSelectDialog.h"
#include "ui_LwjglSelectDialog.h"
#include "gui/Platform.h"
#include "logic/lists/LwjglVersionList.h"
LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::LWJGLSelectDialog)
LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::LWJGLSelectDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
ui->labelStatus->setVisible(false);
auto lwjgllist = MMC->lwjgllist();
ui->lwjglListView->setModel(lwjgllist.get());
connect(lwjgllist.get(), SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool)));
connect(lwjgllist.get(), SIGNAL(loadingStateUpdated(bool)),
SLOT(loadingStateUpdated(bool)));
connect(lwjgllist.get(), SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString)));
loadingStateUpdated(lwjgllist->isLoading());
}
@ -42,9 +42,9 @@ LWJGLSelectDialog::~LWJGLSelectDialog()
QString LWJGLSelectDialog::selectedVersion() const
{
return MMC->lwjgllist()->data(
ui->lwjglListView->selectionModel()->currentIndex(),
Qt::DisplayRole).toString();
return MMC->lwjgllist()
->data(ui->lwjglListView->selectionModel()->currentIndex(), Qt::DisplayRole)
.toString();
}
void LWJGLSelectDialog::on_refreshButton_clicked()

View File

@ -3,7 +3,7 @@
* 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
@ -13,8 +13,7 @@
* limitations under the License.
*/
#ifndef LWJGLSELECTDIALOG_H
#define LWJGLSELECTDIALOG_H
#pragma once
#include <QDialog>
@ -26,21 +25,20 @@ class LWJGLSelectDialog;
class LWJGLSelectDialog : public QDialog
{
Q_OBJECT
public:
explicit LWJGLSelectDialog(QWidget *parent = 0);
~LWJGLSelectDialog();
QString selectedVersion() const;
private slots:
private
slots:
void on_refreshButton_clicked();
void loadingStateUpdated(bool loading);
void loadingFailed(QString error);
private:
Ui::LWJGLSelectDialog *ui;
};
#endif // LWJGLSELECTDIALOG_H

View File

@ -0,0 +1,57 @@
/* 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 "ModEditDialogCommon.h"
#include "CustomMessageBox.h"
#include <QDesktopServices>
#include <QMessageBox>
#include <QString>
#include <QUrl>
bool lastfirst(QModelIndexList &list, int &first, int &last)
{
if (!list.size())
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, parentDlg->tr("How sad!"),
parentDlg->tr("The mod author didn't provide a website link for this mod."),
QMessageBox::Warning);
}
}

View File

@ -0,0 +1,22 @@
/* 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 <QAbstractItemModel>
#include <logic/Mod.h>
bool lastfirst(QModelIndexList &list, int &first, int &last);
void showWebsiteForMod(QWidget *parentDlg, Mod &m);

View File

@ -13,9 +13,9 @@
* limitations under the License.
*/
#include <MultiMC.h>
#include "newinstancedialog.h"
#include "ui_newinstancedialog.h"
#include "MultiMC.h"
#include "NewInstanceDialog.h"
#include "ui_NewInstanceDialog.h"
#include "logic/InstanceFactory.h"
#include "logic/BaseVersion.h"
@ -23,8 +23,8 @@
#include "logic/lists/MinecraftVersionList.h"
#include "logic/tasks/Task.h"
#include "gui/platform.h"
#include "versionselectdialog.h"
#include "gui/Platform.h"
#include "VersionSelectDialog.h"
#include "ProgressDialog.h"
#include "IconPickerDialog.h"
@ -34,7 +34,7 @@
NewInstanceDialog::NewInstanceDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::NewInstanceDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
resize(minimumSizeHint());
layout()->setSizeConstraint(QLayout::SetFixedSize);

View File

@ -17,7 +17,7 @@
<string>New Instance</string>
</property>
<property name="windowIcon">
<iconset resource="../multimc.qrc">
<iconset resource="../../multimc.qrc">
<normaloff>:/icons/toolbar/new</normaloff>:/icons/toolbar/new</iconset>
</property>
<property name="modal">
@ -42,7 +42,7 @@
<item>
<widget class="QToolButton" name="iconButton">
<property name="icon">
<iconset resource="../multimc.qrc">
<iconset resource="../../multimc.qrc">
<normaloff>:/icons/instances/infinity</normaloff>:/icons/instances/infinity</iconset>
</property>
<property name="iconSize">
@ -140,7 +140,7 @@
</layout>
</widget>
<resources>
<include location="../multimc.qrc"/>
<include location="../../multimc.qrc"/>
</resources>
<connections>
<connection>

View File

@ -12,19 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "MultiMC.h"
#include "OneSixModEditDialog.h"
#include "ModEditDialogCommon.h"
#include "ui_OneSixModEditDialog.h"
#include "logic/ModList.h"
#include "logic/OneSixVersion.h"
#include "logic/EnabledItemFilter.h"
#include "logic/lists/ForgeVersionList.h"
#include "logic/ForgeInstaller.h"
#include "gui/versionselectdialog.h"
#include "gui/platform.h"
#include "gui/CustomMessageBox.h"
#include "ProgressDialog.h"
#include <pathutils.h>
#include <QFileDialog>
@ -34,10 +23,26 @@
#include <QKeyEvent>
#include <QDesktopServices>
#include "OneSixModEditDialog.h"
#include "ModEditDialogCommon.h"
#include "ui_OneSixModEditDialog.h"
#include "gui/Platform.h"
#include "gui/dialogs/CustomMessageBox.h"
#include "gui/dialogs/VersionSelectDialog.h"
#include "gui/dialogs/ProgressDialog.h"
#include "logic/ModList.h"
#include "logic/OneSixVersion.h"
#include "logic/EnabledItemFilter.h"
#include "logic/lists/ForgeVersionList.h"
#include "logic/ForgeInstaller.h"
OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent)
: m_inst(inst), QDialog(parent), ui(new Ui::OneSixModEditDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
// libraries!
@ -65,7 +70,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent)
m_mods->startWatching();
auto smodel = ui->loaderModTreeView->selectionModel();
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
SLOT(loaderCurrent(QModelIndex,QModelIndex)));
SLOT(loaderCurrent(QModelIndex, QModelIndex)));
}
// resource packs
{
@ -111,10 +116,10 @@ void OneSixModEditDialog::on_customizeBtn_clicked()
void OneSixModEditDialog::on_revertBtn_clicked()
{
auto response = CustomMessageBox::selectable(this, tr("Revert?"),
tr("Do you want to revert the "
"version of this instance to its original configuration?"),
QMessageBox::Question, QMessageBox::Yes | QMessageBox::No)->exec();
auto response = CustomMessageBox::selectable(
this, tr("Revert?"), tr("Do you want to revert the "
"version of this instance to its original configuration?"),
QMessageBox::Question, QMessageBox::Yes | QMessageBox::No)->exec();
if (response == QMessageBox::Yes)
{
if (m_inst->revertCustomVersion())
@ -306,7 +311,7 @@ void OneSixModEditDialog::on_viewResPackBtn_clicked()
void OneSixModEditDialog::loaderCurrent(QModelIndex current, QModelIndex previous)
{
if(!current.isValid())
if (!current.isValid())
{
ui->frame->clear();
return;

View File

@ -305,12 +305,12 @@
<customwidget>
<class>ModListView</class>
<extends>QTreeView</extends>
<header>gui/ModListView.h</header>
<header>gui/widgets/ModListView.h</header>
</customwidget>
<customwidget>
<class>MCModInfoFrame</class>
<extends>QFrame</extends>
<header>gui/MCModInfoFrame.h</header>
<header>gui/widgets/MCModInfoFrame.h</header>
<container>1</container>
</customwidget>
</customwidgets>

View File

@ -3,7 +3,7 @@
* 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
@ -19,17 +19,15 @@
#include <QKeyEvent>
#include "logic/tasks/Task.h"
#include "gui/platform.h"
#include "gui/Platform.h"
ProgressDialog::ProgressDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ProgressDialog)
ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
updateSize();
changeProgress(0,100);
changeProgress(0, 100);
}
ProgressDialog::~ProgressDialog()
@ -45,27 +43,26 @@ void ProgressDialog::updateSize()
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)));
connect(task, SIGNAL(status(QString)), SLOT(changeStatus(const QString &)));
connect(task, SIGNAL(progress(qint64, qint64)), SLOT(changeProgress(qint64, qint64)));
// this makes sure that the task is started after the dialog is created
QMetaObject::invokeMethod(task, "start", Qt::QueuedConnection);
return QDialog::exec();
}
ProgressProvider* ProgressDialog::getTask()
ProgressProvider *ProgressDialog::getTask()
{
return task;
}
void ProgressDialog::onTaskStarted()
{
}
void ProgressDialog::onTaskFailed(QString failure)
@ -90,14 +87,14 @@ void ProgressDialog::changeProgress(qint64 current, qint64 total)
ui->taskProgressBar->setValue(current);
}
void ProgressDialog::keyPressEvent(QKeyEvent* e)
void ProgressDialog::keyPressEvent(QKeyEvent *e)
{
if (e->key() == Qt::Key_Escape)
return;
QDialog::keyPressEvent(e);
}
void ProgressDialog::closeEvent(QCloseEvent* e)
void ProgressDialog::closeEvent(QCloseEvent *e)
{
if (task && task->isRunning())
{

View File

@ -3,7 +3,7 @@
* 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
@ -13,50 +13,48 @@
* limitations under the License.
*/
#ifndef TASKDIALOG_H
#define TASKDIALOG_H
#pragma once
#include <QDialog>
class ProgressProvider;
namespace Ui {
namespace Ui
{
class ProgressDialog;
}
class ProgressDialog : public QDialog
{
Q_OBJECT
public:
explicit ProgressDialog(QWidget *parent = 0);
~ProgressDialog();
void updateSize();
int exec(ProgressProvider* task);
ProgressProvider* getTask();
public slots:
int exec(ProgressProvider *task);
ProgressProvider *getTask();
public
slots:
void onTaskStarted();
void onTaskFailed(QString failure);
void onTaskSucceeded();
void changeStatus(const QString& status);
void changeStatus(const QString &status);
void changeProgress(qint64 current, qint64 total);
signals:
protected:
virtual void keyPressEvent(QKeyEvent* e);
virtual void closeEvent(QCloseEvent* e);
virtual void keyPressEvent(QKeyEvent *e);
virtual void closeEvent(QCloseEvent *e);
private:
Ui::ProgressDialog *ui;
ProgressProvider* task;
};
#endif // TASKDIALOG_H
ProgressProvider *task;
};

View File

@ -13,14 +13,17 @@
* limitations under the License.
*/
#include <MultiMC.h>
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
#include "MultiMC.h"
#include "gui/dialogs/SettingsDialog.h"
#include "ui_SettingsDialog.h"
#include "gui/Platform.h"
#include "gui/dialogs/VersionSelectDialog.h"
#include "gui/dialogs/CustomMessageBox.h"
#include "logic/JavaUtils.h"
#include "logic/NagUtils.h"
#include "gui/versionselectdialog.h"
#include "gui/platform.h"
#include "gui/CustomMessageBox.h"
#include "logic/lists/JavaVersionList.h"
#include <settingsobject.h>
@ -123,10 +126,11 @@ void SettingsDialog::applySettings(SettingsObject *s)
}
else if (!s->get("UseDevBuilds").toBool())
{
auto response = CustomMessageBox::selectable(this, tr("Development builds"),
tr("Development builds contain experimental features "
"and may be unstable. Are you sure you want to enable them?"),
QMessageBox::Question, QMessageBox::Yes | QMessageBox::No)->exec();
auto response = CustomMessageBox::selectable(
this, tr("Development builds"),
tr("Development builds contain experimental features "
"and may be unstable. Are you sure you want to enable them?"),
QMessageBox::Question, QMessageBox::Yes | QMessageBox::No)->exec();
if (response == QMessageBox::Yes)
{
s->set("UseDevBuilds", true);
@ -168,16 +172,16 @@ void SettingsDialog::applySettings(SettingsObject *s)
s->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
s->set("PostExitCommand", ui->postExitCmdTextBox->text());
auto sortMode = (InstSortMode) ui->sortingModeGroup->checkedId();
switch(sortMode)
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;
case Sort_LastLaunch:
s->set("InstSortMode", "LastLaunch");
break;
case Sort_Name:
default:
s->set("InstSortMode", "Name");
break;
}
s->set("PostExitCommand", ui->postExitCmdTextBox->text());
@ -213,7 +217,7 @@ void SettingsDialog::loadSettings(SettingsObject *s)
QString sortMode = s->get("InstSortMode").toString();
if(sortMode == "LastLaunch")
if (sortMode == "LastLaunch")
{
ui->sortLastLaunchedBtn->setChecked(true);
}

View File

@ -3,7 +3,7 @@
* 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
@ -13,46 +13,47 @@
* limitations under the License.
*/
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#pragma once
#include <QDialog>
class SettingsObject;
namespace Ui {
namespace Ui
{
class SettingsDialog;
}
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit SettingsDialog(QWidget *parent = 0);
~SettingsDialog();
void updateCheckboxStuff();
void applySettings(SettingsObject *s);
void loadSettings(SettingsObject* s);
void loadSettings(SettingsObject *s);
protected:
virtual void showEvent ( QShowEvent* );
private slots:
virtual void showEvent(QShowEvent *);
private
slots:
void on_instDirBrowseBtn_clicked();
void on_modsDirBrowseBtn_clicked();
void on_lwjglDirBrowseBtn_clicked();
void on_compatModeCheckBox_clicked(bool checked);
void on_maximizedCheckBox_clicked(bool checked);
void on_buttonBox_accepted();
void on_pushButton_clicked();
void on_btnBrowse_clicked();
@ -60,5 +61,3 @@ private slots:
private:
Ui::SettingsDialog *ui;
};
#endif // SETTINGSDIALOG_H

View File

@ -20,7 +20,7 @@
<string>Settings</string>
</property>
<property name="windowIcon">
<iconset resource="../multimc.qrc">
<iconset resource="../../multimc.qrc">
<normaloff>:/icons/toolbar/settings</normaloff>:/icons/toolbar/settings</iconset>
</property>
<property name="modal">
@ -527,7 +527,7 @@
<tabstop>postExitCmdTextBox</tabstop>
</tabstops>
<resources>
<include location="../multimc.qrc"/>
<include location="../../multimc.qrc"/>
</resources>
<connections>
<connection>

View File

@ -13,24 +13,25 @@
* limitations under the License.
*/
#include "versionselectdialog.h"
#include "ui_versionselectdialog.h"
#include "VersionSelectDialog.h"
#include "ui_VersionSelectDialog.h"
#include <QHeaderView>
#include <QDebug>
#include <gui/ProgressDialog.h>
#include "gui/platform.h"
#include <gui/dialogs/ProgressDialog.h>
#include "gui/Platform.h"
#include <logic/BaseVersion.h>
#include <logic/lists/BaseVersionList.h>
#include <logic/tasks/Task.h>
VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent, bool cancelable)
VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent,
bool cancelable)
: QDialog(parent), ui(new Ui::VersionSelectDialog)
{
MultiMCPlatform::fixWM_CLASS(this);
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
setWindowModality(Qt::WindowModal);
setWindowTitle(title);
@ -44,7 +45,7 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title,
ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch);
if(!cancelable)
if (!cancelable)
{
ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false);
}

View File

@ -3,7 +3,7 @@
* 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
@ -13,12 +13,11 @@
* limitations under the License.
*/
#ifndef VERSIONSELECTDIALOG_H
#define VERSIONSELECTDIALOG_H
#pragma once
#include <QDialog>
#include <QSortFilterProxyModel>
#include "logic/BaseVersion.h"
class BaseVersionList;
@ -31,31 +30,32 @@ class VersionSelectDialog;
class VersionSelectDialog : public QDialog
{
Q_OBJECT
public:
explicit VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent = 0, bool cancelable = true);
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 setFilter(int column, QString filter);
void setResizeOn(int column);
private slots:
private
slots:
void on_refreshButton_clicked();
private:
Ui::VersionSelectDialog *ui;
BaseVersionList *m_vlist;
QSortFilterProxyModel *m_proxyModel;
int resizeOnColumn = 0;
};
#endif // VERSIONSELECTDIALOG_H

View File

@ -1,12 +0,0 @@
#pragma once
#include <QStyledItemDelegate>
class ListViewDelegate : public QStyledItemDelegate
{
public:
explicit ListViewDelegate ( QObject* parent = 0 );
protected:
void paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
};

View File

@ -1,35 +0,0 @@
#ifndef INSTANCESETTINGS_H
#define INSTANCESETTINGS_H
#include <QDialog>
#include "settingsobject.h"
namespace Ui {
class InstanceSettings;
}
class InstanceSettings : public QDialog
{
Q_OBJECT
public:
explicit InstanceSettings(SettingsObject *s, QWidget *parent = 0);
~InstanceSettings();
void updateCheckboxStuff();
void applySettings();
void loadSettings();
protected:
virtual void showEvent ( QShowEvent* );
private slots:
void on_customCommandsGroupBox_toggled(bool arg1);
void on_buttonBox_accepted();
void on_buttonBox_rejected();
private:
Ui::InstanceSettings *ui;
SettingsObject * m_obj;
};
#endif // INSTANCESETTINGS_H

View File

@ -1,159 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>569</width>
<height>420</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="tabsClosable">
<bool>false</bool>
</property>
<widget class="QWidget" name="libraryTab">
<attribute name="title">
<string>Library</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTreeView" name="treeView"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="modTab">
<attribute name="title">
<string>Mods</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QListView" name="listView"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="addModButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeModButton">
<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="viewModButton">
<property name="text">
<string>&amp;View Folder</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="resourcePackTab">
<attribute name="title">
<string>Resource Pack</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QListView" name="listView_2"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<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="pushButton_3">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,4 +1,19 @@
#include "instancedelegate.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 "InstanceDelegate.h"
#include <QPainter>
#include <QTextOption>
#include <QTextLayout>

View File

@ -0,0 +1,27 @@
/* 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 <QStyledItemDelegate>
class ListViewDelegate : public QStyledItemDelegate
{
public:
explicit ListViewDelegate ( QObject* parent = 0 );
protected:
void paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
};

View File

@ -1,3 +1,18 @@
/* 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 <QLabel>
#include <QVBoxLayout>
#include <QResizeEvent>
@ -5,7 +20,6 @@
#include "LabeledToolButton.h"
#include <QApplication>
/*
*
* Tool Button with a label on it, instead of the normal text rendering

View File

@ -0,0 +1,37 @@
/* 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 <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);
};

View File

@ -13,11 +13,13 @@
* limitations under the License.
*/
#include "MCModInfoFrame.h"
#include "ui_MCModInfoFrame.h"
#include "CustomMessageBox.h"
#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)

View File

@ -1,3 +1,18 @@
/* 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 "ModListView.h"
#include <QHeaderView>
#include <QMouseEvent>

27
gui/widgets/ModListView.h Normal file
View File

@ -0,0 +1,27 @@
/* 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 <QTreeView>
class Mod;
class ModListView: public QTreeView
{
Q_OBJECT
public:
explicit ModListView ( QWidget* parent = 0 );
virtual void setModel ( QAbstractItemModel* model );
};