summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-10-05 14:20:48 +0200
committerTannin <devnull@localhost>2013-10-05 14:20:48 +0200
commitcffd9eb4e21f0ddcddca68d8eb0f1c80c8ac6ae1 (patch)
treee6ee4888366aa0412296df6118f8d563a4bf9d50 /src/modlist.cpp
parent640b14ef257aa3b681e9c1ba72a88707dfdc7632 (diff)
- hook.dll now doesn't inject to certain applications (currently steam, chrome and firefox)
- versioning system improved. Will now report "downgrades" for mods and support a different versioning system (requires manual switch) - updates can now be ignored until a new version is uploaded - new splash screen - bugfix: a few memory leaks (shouldn't account for much) - bugfix: result of GetModuleHandle wasn't zero-terminated in some cases
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index b5a7182e..7367b2ae 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -143,13 +143,16 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
} else if (column == COL_NAME) {
return modInfo->name();
} else if (column == COL_VERSION) {
- QString version = modInfo->getVersion().canonicalString();
- if (version.isEmpty() && modInfo->canBeUpdated()) {
- version = "?";
- } else if (version[0] == 'd') {
- version.remove(0, 1);
+ VersionInfo verInfo = modInfo->getVersion();
+ if (role == Qt::EditRole) {
+ return verInfo.canonicalString();
+ } else {
+ QString version = verInfo.displayString();
+ if (version.isEmpty() && modInfo->canBeUpdated()) {
+ version = "?";
+ }
+ return version;
}
- return version;
} else if (column == COL_PRIORITY) {
int priority = modInfo->getFixedPriority();
if (priority != INT_MIN) {
@@ -241,17 +244,18 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
result.setItalic(true);
}
} else if (column == COL_VERSION) {
- if (modInfo->updateAvailable()) {
+ if (modInfo->updateAvailable() || modInfo->downgradeAvailable()) {
result.setWeight(QFont::Bold);
}
}
return result;
} else if (role == Qt::DecorationRole) {
if (column == COL_VERSION) {
- if (modInfo->updateAvailable() &&
- modInfo->getNewestVersion().isValid()) {
+ if (modInfo->updateAvailable()) {
return QIcon(":/MO/gui/update_available");
- } else if (modInfo->getVersion().isVersionDate()) {
+ } else if (modInfo->downgradeAvailable()) {
+ return QIcon(":/MO/gui/warning");
+ } else if (modInfo->getVersion().scheme() == VersionInfo::SCHEME_DATE) {
return QIcon(":/MO/gui/version_date");
}
}
@@ -264,7 +268,7 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
} else if (column == COL_VERSION) {
if (!modInfo->getNewestVersion().isValid()) {
return QVariant();
- } else if (modInfo->updateAvailable()) {
+ } else if (modInfo->updateAvailable() || modInfo->downgradeAvailable()) {
return QBrush(Qt::red);
} else {
return QBrush(Qt::darkGreen);
@@ -291,7 +295,13 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
return QString();
}
} else if (column == COL_VERSION) {
- return tr("installed version: %1, newest version: %2").arg(modInfo->getVersion().canonicalString()).arg(modInfo->getNewestVersion().canonicalString());
+ QString text = tr("installed version: %1, newest version: %2").arg(modInfo->getVersion().displayString()).arg(modInfo->getNewestVersion().displayString());
+ if (modInfo->downgradeAvailable()) {
+ text += "<br>" + tr("The newest version on Nexus seems to be older than the one you have installed. This could either mean the version you have has been withdrawn "
+ "(i.e. due to a bug) or the author uses a non-standard versioning scheme and that newest version is actually newer. "
+ "Either way you may want to \"upgrade\".");
+ }
+ return text;
} else if (column == COL_CATEGORY) {
const std::set<int> &categories = modInfo->getCategories();
std::wostringstream categoryString;