summaryrefslogtreecommitdiff
path: root/src/modinfo.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-03-27 20:48:33 +0100
committerTannin <devnull@localhost>2013-03-27 20:48:33 +0100
commite0eb97922d5ef4a1448e76f13374ebfda7fda403 (patch)
tree00f32ad3f680e51a210bee8155624d71f608bb15 /src/modinfo.cpp
parent74c75e60d67b66a63225239c1f6b1403662857aa (diff)
- added hooks for getFileVersion* functions
- automatic donwload retry - support for storing multiple download urls - improved "query info" functionality - some cleanup to download manager code - external fomod installer dialog are now brought to front - added shell... functions to have windows handle problematic situations - added visual clue when filters are active - esps are now automatically activated when installing a mod - added option to never endorse a mod - added "previous" and "next" buttons to mod info dialog - improved the way messagedialog text is shortened - coloring in mod info dialog now visible in other color schemes - plugin list is now saved automatically - vanilla bsas are now enabled even if they are not listed in the ini file - bugfix: setting mod to maximum now doesn't try to place the mod below overwrite
Diffstat (limited to 'src/modinfo.cpp')
-rw-r--r--src/modinfo.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 80f27ccf..aebab059 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -345,7 +345,16 @@ ModInfoRegular::ModInfoRegular(const QDir &path, DirectoryEntry **directoryStruc
m_NexusDescription = metaFile.value("nexusDescription", "").toString();
m_LastNexusQuery = QDateTime::fromString(metaFile.value("lastNexusQuery", "").toString(), Qt::ISODate);
if (metaFile.contains("endorsed")) {
- m_EndorsedState = metaFile.value("endorsed", false).toBool() ? ENDORSED_TRUE : ENDORSED_FALSE;
+ if (metaFile.value("endorsed").canConvert<int>()) {
+ switch (metaFile.value("endorsed").toInt()) {
+ case ENDORSED_FALSE: m_EndorsedState = ENDORSED_FALSE; break;
+ case ENDORSED_TRUE: m_EndorsedState = ENDORSED_TRUE; break;
+ case ENDORSED_NEVER: m_EndorsedState = ENDORSED_NEVER; break;
+ default: m_EndorsedState = ENDORSED_UNKNOWN; break;
+ }
+ } else {
+ m_EndorsedState = metaFile.value("endorsed", false).toBool() ? ENDORSED_TRUE : ENDORSED_FALSE;
+ }
}
int numNexusFiles = metaFile.beginReadArray("nexusFiles");
@@ -411,9 +420,10 @@ void ModInfoRegular::saveMeta()
metaFile.setValue("nexusDescription", m_NexusDescription);
metaFile.setValue("lastNexusQuery", m_LastNexusQuery.toString(Qt::ISODate));
if (m_EndorsedState != ENDORSED_UNKNOWN) {
- metaFile.setValue("endorsed", m_EndorsedState == ENDORSED_TRUE ? true : false);
+ metaFile.setValue("endorsed", m_EndorsedState);
}
+
metaFile.beginWriteArray("nexusFiles");
for (int i = 0; i < m_NexusFileInfos.size(); ++i) {
metaFile.setArrayIndex(i);
@@ -442,7 +452,9 @@ void ModInfoRegular::nxmDescriptionAvailable(int, QVariant, QVariant resultData)
QVariantMap result = resultData.toMap();
m_NewestVersion.parse(result["version"].toString());
m_NexusDescription = result["description"].toString();
- m_EndorsedState = result["voted_by_user"].toBool() ? ENDORSED_TRUE : ENDORSED_FALSE;
+ if (m_EndorsedState != ENDORSED_NEVER) {
+ m_EndorsedState = result["voted_by_user"].toBool() ? ENDORSED_TRUE : ENDORSED_FALSE;
+ }
m_NexusBridge.requestFiles(m_NexusID, QVariant());
}
@@ -593,7 +605,16 @@ void ModInfoRegular::setNexusDescription(const QString &description)
void ModInfoRegular::setIsEndorsed(bool endorsed)
{
- m_EndorsedState = endorsed ? ENDORSED_TRUE : ENDORSED_FALSE;
+ if (m_EndorsedState != ENDORSED_NEVER) {
+ m_EndorsedState = endorsed ? ENDORSED_TRUE : ENDORSED_FALSE;
+ m_MetaInfoChanged = true;
+ }
+}
+
+
+void ModInfoRegular::setNeverEndorse()
+{
+ m_EndorsedState = ENDORSED_NEVER;
m_MetaInfoChanged = true;
}
@@ -601,7 +622,7 @@ void ModInfoRegular::setIsEndorsed(bool endorsed)
bool ModInfoRegular::remove()
{
m_MetaInfoChanged = false;
- return removeDir(absolutePath());
+ return shellDelete(QStringList(absolutePath()), NULL);
}
void ModInfoRegular::endorse(bool doEndorse)