From 20cb97a35af5097e9d3b2062c0dfcb5f2e5fff5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 6 Sep 2014 18:16:56 +0200 Subject: Sync from quickmods --- gui/MainWindow.cpp | 7 ++++--- gui/MainWindow.ui | 2 +- gui/dialogs/ModEditDialogCommon.cpp | 4 ++-- gui/dialogs/NewInstanceDialog.cpp | 9 --------- gui/dialogs/NewInstanceDialog.h | 1 + gui/groupview/InstanceDelegate.cpp | 16 +++++----------- gui/groupview/InstanceDelegate.h | 2 +- 7 files changed, 14 insertions(+), 27 deletions(-) (limited to 'gui') diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index d3dc8f6e..a5bffcc4 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -65,9 +65,9 @@ #include "gui/pages/global/MultiMCPage.h" #include "gui/pages/global/ExternalToolsPage.h" #include "gui/pages/global/AccountListPage.h" -#include "pages/global/ProxyPage.h" -#include "pages/global/JavaPage.h" -#include "pages/global/MinecraftPage.h" +#include "gui/pages/global/ProxyPage.h" +#include "gui/pages/global/JavaPage.h" +#include "gui/pages/global/MinecraftPage.h" #include "gui/ConsoleWindow.h" #include "pagedialog/PageDialog.h" @@ -91,6 +91,7 @@ #include "logic/net/NetJob.h" #include "logic/BaseInstance.h" +#include "logic/OneSixInstance.h" #include "logic/InstanceFactory.h" #include "logic/MinecraftProcess.h" #include "logic/OneSixUpdate.h" diff --git a/gui/MainWindow.ui b/gui/MainWindow.ui index 03a07ce5..a3edf6bd 100644 --- a/gui/MainWindow.ui +++ b/gui/MainWindow.ui @@ -387,7 +387,7 @@ - Edit Mods + Edit Instance Edit Instance diff --git a/gui/dialogs/ModEditDialogCommon.cpp b/gui/dialogs/ModEditDialogCommon.cpp index 35942374..4a2115d8 100644 --- a/gui/dialogs/ModEditDialogCommon.cpp +++ b/gui/dialogs/ModEditDialogCommon.cpp @@ -4,7 +4,7 @@ bool lastfirst(QModelIndexList &list, int &first, int &last) { - if (!list.size()) + if (list.isEmpty()) return false; first = last = list[0].row(); for (auto item : list) @@ -37,4 +37,4 @@ void showWebsiteForMod(QWidget *parentDlg, Mod &m) QObject::tr("The mod author didn't provide a website link for this mod."), QMessageBox::Warning); } -} \ No newline at end of file +} diff --git a/gui/dialogs/NewInstanceDialog.cpp b/gui/dialogs/NewInstanceDialog.cpp index 41ae329c..80cbbeb2 100644 --- a/gui/dialogs/NewInstanceDialog.cpp +++ b/gui/dialogs/NewInstanceDialog.cpp @@ -38,15 +38,6 @@ NewInstanceDialog::NewInstanceDialog(QWidget *parent) ui->setupUi(this); resize(minimumSizeHint()); layout()->setSizeConstraint(QLayout::SetFixedSize); - /* - if (!MinecraftVersionList::getMainList().isLoaded()) - { - TaskDialog *taskDlg = new TaskDialog(this); - Task *loadTask = MinecraftVersionList::getMainList().getLoadTask(); - loadTask->setParent(taskDlg); - taskDlg->exec(loadTask); - } - */ setSelectedVersion(MMC->minecraftlist()->getLatestStable(), true); InstIconKey = "infinity"; ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); diff --git a/gui/dialogs/NewInstanceDialog.h b/gui/dialogs/NewInstanceDialog.h index 17045ec0..fa9012ea 100644 --- a/gui/dialogs/NewInstanceDialog.h +++ b/gui/dialogs/NewInstanceDialog.h @@ -16,6 +16,7 @@ #pragma once #include + #include "logic/BaseVersion.h" namespace Ui diff --git a/gui/groupview/InstanceDelegate.cpp b/gui/groupview/InstanceDelegate.cpp index 3bd77747..e49e1552 100644 --- a/gui/groupview/InstanceDelegate.cpp +++ b/gui/groupview/InstanceDelegate.cpp @@ -113,16 +113,10 @@ void drawProgressOverlay(QPainter *painter, const QStyleOptionViewItemV4 &option void drawBadges(QPainter *painter, const QStyleOptionViewItemV4 &option, BaseInstance *instance) { QList pixmaps; - for (auto flag : instance->flags()) + const BaseInstance::InstanceFlags flags = instance->flags(); + if (flags & BaseInstance::VersionBrokenFlag) { - switch (flag) - { - case BaseInstance::VersionBrokenFlag: - pixmaps.append("broken"); - break; - default: - break; - } + pixmaps.append("broken"); } // begin easter eggs @@ -160,7 +154,7 @@ void drawBadges(QPainter *painter, const QStyleOptionViewItemV4 &option, BaseIns { return; } - const QPixmap pixmap = ListViewDelegate::requestPixmap(it.next()).scaled( + const QPixmap pixmap = ListViewDelegate::requestBadgePixmap(it.next()).scaled( itemSide, itemSide, Qt::KeepAspectRatio, Qt::FastTransformation); painter->drawPixmap(option.rect.width() - x * itemSide + qMax(x - 1, 0) * spacing - itemSide, y * itemSide + qMax(y - 1, 0) * spacing, itemSide, itemSide, @@ -354,7 +348,7 @@ QSize ListViewDelegate::sizeHint(const QStyleOptionViewItem &option, return sz; } -QPixmap ListViewDelegate::requestPixmap(const QString &key) +QPixmap ListViewDelegate::requestBadgePixmap(const QString &key) { if (!m_pixmapCache.contains(key)) { diff --git a/gui/groupview/InstanceDelegate.h b/gui/groupview/InstanceDelegate.h index 9ab44864..1520cbb8 100644 --- a/gui/groupview/InstanceDelegate.h +++ b/gui/groupview/InstanceDelegate.h @@ -23,7 +23,7 @@ class ListViewDelegate : public QStyledItemDelegate public: explicit ListViewDelegate(QObject *parent = 0); - static QPixmap requestPixmap(const QString &key); + static QPixmap requestBadgePixmap(const QString &key); protected: void paint(QPainter *painter, const QStyleOptionViewItem &option, -- cgit v1.2.3