diff options
| author | Tannin <devnull@localhost> | 2013-06-20 21:55:37 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-06-20 21:55:37 +0200 |
| commit | f8c683f700a3fff30540ff343df2bfba15080e86 (patch) | |
| tree | 248b6dcea1f45449675c05d4e64ed4b76e976919 /src/downloadlist.cpp | |
| parent | 49cbe0349184419530d22782cc670946b61c9f01 (diff) | |
- some fixes for qt5 compatibility
- hook.dll no longer creates a dump and uninstalls it if an exception is reported that doesn't originate from it
- NCC used read-only transactions again because otherwise solid archives become unusably slow.
- removed the integrated nexus browser
- the mod description and motd are now rendered in QTextBrowser. This (and the above) eliminates the dependency on qtwebkit
- removed the direct file download for mod files
- reduced CPU usage during downloads by invalidating only one column of the download list. This widget still needs to be replaced
- added the complete filename as an option for the modname
- applications that require elevation can now be started by invoking an elevated secondary ModOrganizer instance
- MO will now register nexus file servers and provides a settings dialog to pick preferred servers. (This preference is not used yet)
- worked around 1-2 bugs in QSortFilterProxy
- handling of nxm links is now done by an external application. This allows the registration of different applications depending on the game
- integrated fomod installer now displays the screenshot in a scalable view
- bugfix: integrated fomod installer didn't name output files correctly if the name differs from the source name
- bugfix: a successful login to nexus was (sometimes?) not correctly detected as a success
- bugfix: top-level entries in QtGroupingProxy were sometimes incorrectly displayed as groups
- bugfix: GetPrivateProfile... optimization could cause null-pointer indirection
- bugfix: GetCurrentWorkingDirectory caused buffer overflow in case of pre-flighting (buffer size 0)
- bugfix: configurator plugin now also uses qt5 (it's currently broken though)
Diffstat (limited to 'src/downloadlist.cpp')
| -rw-r--r-- | src/downloadlist.cpp | 175 |
1 files changed, 88 insertions, 87 deletions
diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp index a7f0869f..305aee91 100644 --- a/src/downloadlist.cpp +++ b/src/downloadlist.cpp @@ -17,90 +17,91 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. */ -#include "downloadlist.h"
-#include "downloadmanager.h"
-#include <QEvent>
-
-#include <QSortFilterProxyModel>
-
-
-DownloadList::DownloadList(DownloadManager *manager, QObject *parent)
- : QAbstractTableModel(parent), m_Manager(manager)
-{
- connect(m_Manager, SIGNAL(update(int)), this, SLOT(update(int)));
- connect(m_Manager, SIGNAL(aboutToUpdate()), this, SLOT(aboutToUpdate()));
-}
-
-
-int DownloadList::rowCount(const QModelIndex&) const
-{
- return m_Manager->numTotalDownloads();
-}
-
-int DownloadList::columnCount(const QModelIndex&) const
-{
- return 3;
-}
-
-
-QModelIndex DownloadList::index(int row, int column, const QModelIndex&) const
-{
- return createIndex(row, column, row);
-}
-
-
-QModelIndex DownloadList::parent(const QModelIndex&) const
-{
- return QModelIndex();
-}
-
-
-QVariant DownloadList::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if ((role == Qt::DisplayRole) &&
- (orientation == Qt::Horizontal)) {
- switch (section) {
- case 0: return tr("Name");
- case 1: return tr("Filetime");
- default: return tr("Done");
- }
- } else {
- return QAbstractItemModel::headerData(section, orientation, role);
- }
-}
-
-
-QVariant DownloadList::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- return index.row();
- } else if (role == Qt::ToolTipRole) {
- if (m_Manager->isInfoIncomplete(index.row())) {
- return 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);
- }
- } else {
- return QVariant();
- }
-}
-
-
-void DownloadList::aboutToUpdate()
-{
- emit beginResetModel();
-}
-
-
-void DownloadList::update(int row)
-{
- if (row < 0) {
- emit endResetModel();
- } else if (row < this->rowCount()) {
- emit dataChanged(this->index(row, 0, QModelIndex()), this->index(row, 1, QModelIndex()));
- } else {
- qCritical("invalid row %d in download list, update failed", row);
- }
-}
-
+#include "downloadlist.h" +#include "downloadmanager.h" +#include <QEvent> + +#include <QSortFilterProxyModel> + + +DownloadList::DownloadList(DownloadManager *manager, QObject *parent) + : QAbstractTableModel(parent), m_Manager(manager) +{ + connect(m_Manager, SIGNAL(update(int)), this, SLOT(update(int))); + connect(m_Manager, SIGNAL(aboutToUpdate()), this, SLOT(aboutToUpdate())); +} + + +int DownloadList::rowCount(const QModelIndex&) const +{ + return m_Manager->numTotalDownloads(); +} + +int DownloadList::columnCount(const QModelIndex&) const +{ + return 3; +} + + +QModelIndex DownloadList::index(int row, int column, const QModelIndex&) const +{ + return createIndex(row, column, row); +} + + +QModelIndex DownloadList::parent(const QModelIndex&) const +{ + return QModelIndex(); +} + + +QVariant DownloadList::headerData(int section, Qt::Orientation orientation, int role) const +{ + if ((role == Qt::DisplayRole) && + (orientation == Qt::Horizontal)) { + switch (section) { + case 0: return tr("Name"); + case 1: return tr("Filetime"); + default: return tr("Done"); + } + } else { + return QAbstractItemModel::headerData(section, orientation, role); + } +} + + +QVariant DownloadList::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + return index.row(); + } else if (role == Qt::ToolTipRole) { + if (m_Manager->isInfoIncomplete(index.row())) { + return 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); + } + } else { + return QVariant(); + } +} + + +void DownloadList::aboutToUpdate() +{ + emit beginResetModel(); +} + + +void DownloadList::update(int row) +{ + if (row < 0) { + emit endResetModel(); + } else if (row < this->rowCount()) { +#pragma message("updating only the one column is a hack") + emit dataChanged(this->index(row, 2, QModelIndex()), this->index(row, 2, QModelIndex())); + } else { + qCritical("invalid row %d in download list, update failed", row); + } +} + |
