summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-10-18 23:35:38 +0200
committerTannin <devnull@localhost>2013-10-18 23:35:38 +0200
commit9a03783f491505940a20d006055a5427bf364807 (patch)
tree7569f788f2d2e2b0033f274466d38c1ae7098183 /src
parentd73b1e38c8c4dd817fc833fee44216244c87da43 (diff)
- tooltip on download list now contains the file name
- bugfix: when refreshing the directory tree conflict information wasn't immediately refreshed (including on start) - bugfix: dataChanged events wasn't emitted when user changed the modlist - bugfix: file patterns in checkfnis plugin weren't completely correct
Diffstat (limited to 'src')
-rw-r--r--src/downloadlist.cpp6
-rw-r--r--src/mainwindow.cpp7
-rw-r--r--src/modinfo.cpp8
-rw-r--r--src/modinfo.h10
-rw-r--r--src/modlist.cpp21
5 files changed, 40 insertions, 12 deletions
diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp
index 9ab48013..fe021a27 100644
--- a/src/downloadlist.cpp
+++ b/src/downloadlist.cpp
@@ -75,12 +75,14 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole) {
return index.row();
} else if (role == Qt::ToolTipRole) {
+ QString text = m_Manager->getFileName(index.row()) + "\n";
if (m_Manager->isInfoIncomplete(index.row())) {
- return tr("Information missing, please select \"Query Info\" from the context menu to re-retrieve.");
+ text += tr("Information missing, please select \"Query Info\" from the context menu to re-retrieve.");
} else {
NexusInfo info = m_Manager->getNexusInfo(index.row());
- return QString("%1 (ID %2) %3").arg(info.m_ModName).arg(m_Manager->getModID(index.row())).arg(info.m_Version);
+ text += QString("%1 (ID %2) %3").arg(info.m_ModName).arg(m_Manager->getModID(index.row())).arg(info.m_Version);
}
+ return text;
} else {
return QVariant();
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index de6f20cf..4c72ada3 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2080,7 +2080,7 @@ QStringList MainWindow::findFiles(const QString &path, const std::function<bool(
if (dir != NULL) {
std::vector<FileEntry::Ptr> files = dir->getFiles();
foreach (FileEntry::Ptr file, files) {
- if (filter(ToQString(file->getName()))) {
+ if (filter(ToQString(file->getFullPath()))) {
result.append(ToQString(file->getFullPath()));
}
}
@@ -2498,6 +2498,11 @@ void MainWindow::directory_refreshed()
// some problem-reports may rely on the virtual directory tree so they need to be updated
// now
updateProblemsButton();
+
+ for (int i = 0; i < m_ModList.rowCount(); ++i) {
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(i);
+ modInfo->clearCaches();
+ }
}
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 9bc013f1..8d672675 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -324,6 +324,7 @@ ModInfoRegular::ModInfoRegular(const QDir &path, DirectoryEntry **directoryStruc
}
}
+
QString categoriesString = metaFile.value("category", "").toString();
QStringList categories = categoriesString.split(',', QString::SkipEmptyParts);
@@ -589,6 +590,11 @@ void ModInfoRegular::endorse(bool doEndorse)
}
}
+void ModInfoRegular::clearCaches()
+{
+ m_LastConflictCheck = QTime();
+}
+
QString ModInfoRegular::absolutePath() const
{
@@ -690,7 +696,7 @@ ModInfoRegular::EConflictType ModInfoRegular::isConflicted() const
{
// this is costy so cache the result
QTime now = QTime::currentTime();
- if (abs(m_LastConflictCheck.secsTo(now)) > 10) {
+ if (m_LastConflictCheck.isNull() || (m_LastConflictCheck.secsTo(now) > 10)) {
bool overwrite = false;
bool overwritten = false;
bool regular = false;
diff --git a/src/modinfo.h b/src/modinfo.h
index 59030350..71c8de55 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -283,6 +283,11 @@ public:
virtual void endorse(bool doEndorse) = 0;
/**
+ * @brief clear all caches held for this mod
+ */
+ virtual void clearCaches() {}
+
+ /**
* @brief getter for the mod name
*
* @return the mod name
@@ -634,6 +639,11 @@ public:
virtual void endorse(bool doEndorse);
/**
+ * @brief clear all caches held for this mod
+ */
+ virtual void clearCaches();
+
+ /**
* @brief getter for the mod name
*
* @return the mod name
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 786f6f17..18bbfd5a 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -373,9 +373,10 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role)
}
return true;
} else if (role == Qt::EditRole) {
+ bool res = false;
switch (index.column()) {
case COL_NAME: {
- return renameMod(modID, value.toString());
+ res = renameMod(modID, value.toString());
} break;
case COL_PRIORITY: {
bool ok = false;
@@ -384,9 +385,9 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role)
m_Profile->setModPriority(modID, newPriority);
emit modlist_changed(index, role);
- return true;
+ res = true;
} else {
- return false;
+ res = false;
}
} break;
case COL_MODID: {
@@ -396,9 +397,9 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role)
if (ok) {
info->setNexusID(newID);
emit modlist_changed(index, role);
- return true;
+ res = true;
} else {
- return false;
+ res = false;
}
} break;
case COL_VERSION: {
@@ -407,17 +408,21 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role)
VersionInfo version(value.toString(), scheme);
if (version.isValid()) {
info->setVersion(version);
- return true;
+ res = true;
} else {
- return false;
+ res = false;
}
} break;
default: {
qWarning("edit on column \"%s\" not supported",
getColumnName(index.column()).toUtf8().constData());
- return false;
+ res = false;
} break;
}
+ if (res) {
+ emit dataChanged(index, index);
+ }
+ return res;
} else {
return false;
}