diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/FtbListModel.cpp | 35 | ||||
-rw-r--r-- | application/dialogs/NewInstanceDialog.cpp | 7 |
2 files changed, 9 insertions, 33 deletions
diff --git a/application/FtbListModel.cpp b/application/FtbListModel.cpp index 290767ff..68a68794 100644 --- a/application/FtbListModel.cpp +++ b/application/FtbListModel.cpp @@ -2,6 +2,7 @@ #include "MultiMC.h" #include <MMCStrings.h> +#include <Version.h> #include <QtMath> @@ -18,33 +19,9 @@ bool FtbFilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) FtbModpack rightPack = sourceModel()->data(right, Qt::UserRole).value<FtbModpack>(); if(currentSorting == Sorting::ByGameVersion) { - QStringList leftList = leftPack.mcVersion.split("."); - QStringList rightList = rightPack.mcVersion.split("."); - - if(leftList.size() < 1) { - return true; - } else if(rightList.size() < 1) { - return false; - } else { - for(int i = 0; i < qMax(leftList.size(), rightList.size()); i++) { - if(leftList.size() -1 < i) { - return true; - } - - if(rightList.size() -1 < i) { - return false; - } - - int leftV = leftList.at(i).toInt(); - int rightV = rightList.at(i).toInt(); - - if(leftV != rightV) { - return leftV < rightV; - } - - } - return false; - } + Version lv(leftPack.mcVersion); + Version rv(rightPack.mcVersion); + return lv < rv; } else if(currentSorting == Sorting::ByName) { return Strings::naturalCompare(leftPack.name, rightPack.name, Qt::CaseSensitive) >= 0; @@ -93,7 +70,7 @@ int FtbListModel::columnCount(const QModelIndex &parent) const QVariant FtbListModel::data(const QModelIndex &index, int role) const { int pos = index.row(); - if(modpacks.size() < pos || pos < 0) { + if(modpacks.size() <= pos || pos < 0) { return QString("INVALID INDEX %1").arg(pos); } @@ -114,8 +91,10 @@ QVariant FtbListModel::data(const QModelIndex &index, int role) const //TODO: Add pack logos or something... but they have a weird size. This needs some design hacks } else if(role == Qt::TextColorRole) { if(pack.broken) { + //FIXME: Hardcoded color return QColor(255, 0, 50); } else if(pack.bugged) { + //FIXME: Hardcoded color //bugged pack, currently only indicates bugged xml return QColor(244, 229, 66); } diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp index 5faf57ac..eee3991c 100644 --- a/application/dialogs/NewInstanceDialog.cpp +++ b/application/dialogs/NewInstanceDialog.cpp @@ -315,14 +315,11 @@ void NewInstanceDialog::on_btnChooseFtbPack_clicked() { } void NewInstanceDialog::ftbPackDataDownloadSuccessfully() { - ui->packDataDownloadStatus->setText(tr("(Pack data download complete)")); - // ui->labelFtbPack->setText(tr("Disabled for now... not completed!")); - - // Disable for PR + ui->packDataDownloadStatus->setText(tr("(Data download complete)")); ui->ftbBox->setEnabled(true); } void NewInstanceDialog::ftbPackDataDownloadFailed() { - ui->packDataDownloadStatus->setText(tr("(Pack data download failed)")); + ui->packDataDownloadStatus->setText(tr("(Data download failed)")); } |