summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/downloadlist.cpp33
-rw-r--r--src/downloadlist.h2
-rw-r--r--src/downloadlistsortproxy.cpp4
-rw-r--r--src/mainwindow.cpp7
-rw-r--r--src/organizer_en.ts38
5 files changed, 53 insertions, 31 deletions
diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp
index 178e4083..d78e97f9 100644
--- a/src/downloadlist.cpp
+++ b/src/downloadlist.cpp
@@ -20,12 +20,14 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "downloadlist.h"
#include "downloadmanager.h"
#include <QEvent>
+#include <QColor>
#include <QSortFilterProxyModel>
DownloadList::DownloadList(DownloadManager *manager, QObject *parent)
: QAbstractTableModel(parent), m_Manager(manager)
+ , m_FontMetrics(QFont())
{
connect(m_Manager, SIGNAL(update(int)), this, SLOT(update(int)));
connect(m_Manager, SIGNAL(aboutToUpdate()), this, SLOT(aboutToUpdate()));
@@ -84,8 +86,6 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const
return tr("Unknown");
case COL_STATUS:
return tr("Pending");
- default:
- return QVariant();
}
} else {
switch (index.column()) {
@@ -119,13 +119,21 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const
return tr("Installed");
case DownloadManager::STATE_UNINSTALLED:
return tr("Uninstalled");
- default:
- return QVariant();
}
- default:
- return QVariant();
}
}
+ } else if (role == Qt::ForegroundRole) {
+ if (pendingDownload) {
+ return QColor(Qt::darkBlue);
+ } else if (index.column() == COL_STATUS) {
+ DownloadManager::DownloadState state = m_Manager->getState(index.row());
+ if (state == DownloadManager::STATE_READY)
+ return QColor(Qt::darkGreen);
+ else if (state == DownloadManager::STATE_UNINSTALLED)
+ return QColor(Qt::darkYellow);
+ else if (state == DownloadManager::STATE_PAUSED)
+ return QColor(Qt::darkRed);
+ }
} else if (role == Qt::ToolTipRole) {
if (pendingDownload) {
return tr("pending download");
@@ -139,9 +147,18 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const
}
return text;
}
- } else {
- return QVariant();
+ } else if (role == Qt::TextAlignmentRole) {
+ if (index.column() == COL_SIZE)
+ return Qt::AlignVCenter | Qt::AlignRight;
+ else
+ return Qt::AlignVCenter | Qt::AlignLeft;
+ } else if (role == Qt::SizeHintRole) {
+ QSize temp = m_FontMetrics.size(Qt::TextSingleLine, data(index, Qt::DisplayRole).toString());
+ temp.rwidth() += 20;
+ temp.rheight() += 12;
+ return temp;
}
+ return QVariant();
}
diff --git a/src/downloadlist.h b/src/downloadlist.h
index 1a5ca0b2..d7764763 100644
--- a/src/downloadlist.h
+++ b/src/downloadlist.h
@@ -21,6 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define DOWNLOADLIST_H
#include <QAbstractTableModel>
+#include <QFontMetrics>
class DownloadManager;
@@ -90,6 +91,7 @@ public slots:
private:
DownloadManager *m_Manager;
+ QFontMetrics m_FontMetrics;
QString sizeFormat(quint64 size) const;
};
diff --git a/src/downloadlistsortproxy.cpp b/src/downloadlistsortproxy.cpp
index 5e455529..1df3a9f1 100644
--- a/src/downloadlistsortproxy.cpp
+++ b/src/downloadlistsortproxy.cpp
@@ -47,9 +47,9 @@ bool DownloadListSortProxy::lessThan(const QModelIndex &left,
DownloadManager::DownloadState leftState = m_Manager->getState(left.row());
DownloadManager::DownloadState rightState = m_Manager->getState(right.row());
if (leftState == rightState)
- return m_Manager->getFileTime(left.row()) > m_Manager->getFileTime(right.row());
+ return m_Manager->getFileTime(left.row()) < m_Manager->getFileTime(right.row());
else
- return leftState < rightState;
+ return leftState > rightState;
} else if(left.column() == DownloadList::COL_SIZE){
return m_Manager->getFileSize(left.row()) < m_Manager->getFileSize(right.row());
} else {
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 9ae7e2de..b2876e33 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -5154,8 +5154,11 @@ void MainWindow::initDownloadList()
ui->downloadView->setModel(sortProxy);
ui->downloadView->setManager(m_OrganizerCore.downloadManager());
- //ui->downloadView->sortByColumn(1, Qt::DescendingOrder);
- ui->downloadView->header()->resizeSections(QHeaderView::Stretch);
+ ui->downloadView->setUniformRowHeights(true);
+ ui->downloadView->header()->setStretchLastSection(false);
+ ui->downloadView->header()->setSectionResizeMode(QHeaderView::Interactive);
+ ui->downloadView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
+ ui->downloadView->sortByColumn(1, Qt::DescendingOrder);
connect(ui->downloadView, SIGNAL(installDownload(int)), &m_OrganizerCore, SLOT(installDownload(int)));
connect(ui->downloadView, SIGNAL(queryInfo(int)), m_OrganizerCore.downloadManager(), SLOT(queryInfo(int)));
diff --git a/src/organizer_en.ts b/src/organizer_en.ts
index 71a438cb..6c1488eb 100644
--- a/src/organizer_en.ts
+++ b/src/organizer_en.ts
@@ -292,97 +292,97 @@ p, li { white-space: pre-wrap; }
<context>
<name>DownloadList</name>
<message>
- <location filename="downloadlist.cpp" line="64"/>
+ <location filename="downloadlist.cpp" line="65"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="65"/>
+ <location filename="downloadlist.cpp" line="66"/>
<source>Size</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="66"/>
+ <location filename="downloadlist.cpp" line="67"/>
<source>Status</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="82"/>
+ <location filename="downloadlist.cpp" line="83"/>
<source>&lt; game %1 mod %2 file %3 &gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="84"/>
+ <location filename="downloadlist.cpp" line="85"/>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="86"/>
+ <location filename="downloadlist.cpp" line="87"/>
<source>Pending</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="99"/>
+ <location filename="downloadlist.cpp" line="100"/>
<source>Started</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="103"/>
+ <location filename="downloadlist.cpp" line="104"/>
<source>Canceling</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="105"/>
+ <location filename="downloadlist.cpp" line="106"/>
<source>Pausing</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="107"/>
+ <location filename="downloadlist.cpp" line="108"/>
<source>Canceled</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="109"/>
+ <location filename="downloadlist.cpp" line="110"/>
<source>Paused</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="111"/>
+ <location filename="downloadlist.cpp" line="112"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="113"/>
+ <location filename="downloadlist.cpp" line="114"/>
<source>Fetching Info 1</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="115"/>
+ <location filename="downloadlist.cpp" line="116"/>
<source>Fetching Info 2</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="117"/>
+ <location filename="downloadlist.cpp" line="118"/>
<source>Downloaded</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="119"/>
+ <location filename="downloadlist.cpp" line="120"/>
<source>Installed</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="121"/>
+ <location filename="downloadlist.cpp" line="122"/>
<source>Uninstalled</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="131"/>
+ <location filename="downloadlist.cpp" line="145"/>
<source>pending download</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="downloadlist.cpp" line="135"/>
+ <location filename="downloadlist.cpp" line="149"/>
<source>Information missing, please select &quot;Query Info&quot; from the context menu to re-retrieve.</source>
<translation type="unfinished"></translation>
</message>