summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/downloadlist.cpp9
-rw-r--r--src/downloadlist.h1
-rw-r--r--src/downloadlistsortproxy.cpp2
-rw-r--r--src/downloadlistwidget.cpp1
-rw-r--r--src/downloadmanager.cpp13
-rw-r--r--src/downloadmanager.h8
6 files changed, 33 insertions, 1 deletions
diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp
index 6957f270..99347a79 100644
--- a/src/downloadlist.cpp
+++ b/src/downloadlist.cpp
@@ -77,6 +77,7 @@ QVariant DownloadList::headerData(int section, Qt::Orientation orientation, int
case COL_SIZE: return tr("Size");
case COL_STATUS: return tr("Status");
case COL_FILETIME: return tr("Filetime");
+ case COL_SOURCEGAME: return tr("Source Game");
default: return QVariant();
}
} else {
@@ -118,10 +119,16 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const
if (m_Manager->isInfoIncomplete(index.row())) {
return {};
} else {
- const MOBase::ModRepositoryFileInfo *info = m_Manager->getFileInfo(index.row());
return QString("%1").arg(m_Manager->getModID(index.row()));
}
}
+ case COL_SOURCEGAME: {
+ if (m_Manager->isInfoIncomplete(index.row())) {
+ return {};
+ } else {
+ return QString("%1").arg(m_Manager->getDisplayGameName(index.row()));
+ }
+ }
case COL_SIZE: return MOBase::localizedByteSize(m_Manager->getFileSize(index.row()));
case COL_FILETIME: return m_Manager->getFileTime(index.row());
case COL_STATUS:
diff --git a/src/downloadlist.h b/src/downloadlist.h
index 51ab4541..eb2bbc55 100644
--- a/src/downloadlist.h
+++ b/src/downloadlist.h
@@ -43,6 +43,7 @@ public:
COL_MODNAME,
COL_VERSION,
COL_ID,
+ COL_SOURCEGAME,
// number of columns
COL_COUNT
diff --git a/src/downloadlistsortproxy.cpp b/src/downloadlistsortproxy.cpp
index a69993c0..6209a721 100644
--- a/src/downloadlistsortproxy.cpp
+++ b/src/downloadlistsortproxy.cpp
@@ -96,6 +96,8 @@ bool DownloadListSortProxy::lessThan(const QModelIndex &left,
return m_Manager->getFileSize(left.row()) < m_Manager->getFileSize(right.row());
} else if (left.column() == DownloadList::COL_FILETIME) {
return m_Manager->getFileTime(left.row()) < m_Manager->getFileTime(right.row());
+ } else if (left.column() == DownloadList::COL_SOURCEGAME) {
+ return m_Manager->getDisplayGameName(left.row()) < m_Manager->getDisplayGameName(right.row());
} else {
return leftIndex < rightIndex;
}
diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp
index 85d27831..ac37b0ee 100644
--- a/src/downloadlistwidget.cpp
+++ b/src/downloadlistwidget.cpp
@@ -135,6 +135,7 @@ void DownloadListWidget::setManager(DownloadManager *manager)
header()->hideSection(DownloadList::COL_MODNAME);
header()->hideSection(DownloadList::COL_VERSION);
header()->hideSection(DownloadList::COL_ID);
+ header()->hideSection(DownloadList::COL_SOURCEGAME);
}
void DownloadListWidget::setSourceModel(DownloadList *sourceModel)
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 361e7164..adfbc84d 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -1239,6 +1239,19 @@ int DownloadManager::getModID(int index) const
return m_ActiveDownloads.at(index)->m_FileInfo->modID;
}
+QString DownloadManager::getDisplayGameName(int index) const
+{
+ if ((index < 0) || (index >= m_ActiveDownloads.size())) {
+ throw MyException(tr("mod id: invalid download index %1").arg(index));
+ }
+ QString gameName = m_ActiveDownloads.at(index)->m_FileInfo->gameName;
+ IPluginGame* gamePlugin = m_OrganizerCore->getGame(gameName);
+ if (gamePlugin) {
+ gameName = gamePlugin->gameName();
+ }
+ return gameName;
+}
+
QString DownloadManager::getGameName(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
diff --git a/src/downloadmanager.h b/src/downloadmanager.h
index f2ad15f4..4fc61cad 100644
--- a/src/downloadmanager.h
+++ b/src/downloadmanager.h
@@ -313,6 +313,14 @@ public:
int getModID(int index) const;
/**
+ * @brief retrieve the displayable game name of the download specified by the index
+ *
+ * @param index index of the file to look up
+ * @return the displayable game name
+ **/
+ QString getDisplayGameName(int index) const;
+
+ /**
* @brief retrieve the game name of the downlaod specified by the index
*
* @param index index of the file to look up