From 5920dc2cd14ef5dc6e3802939cbe6256ea13848b Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Sun, 30 Dec 2018 12:07:40 +0100 Subject: Disable downloadlist widget delegates, port partial functionality to QTreeView --- src/mainwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 27ffc71e..5ca60ef1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5152,6 +5152,7 @@ void MainWindow::on_actionEndorseMO_triggered() void MainWindow::updateDownloadListDelegate() { + /* if (m_OrganizerCore.settings().compactDownloads()) { ui->downloadView->setItemDelegate( new DownloadListWidgetCompactDelegate(m_OrganizerCore.downloadManager(), @@ -5165,6 +5166,7 @@ void MainWindow::updateDownloadListDelegate() ui->downloadView, ui->downloadView)); } + */ DownloadListSortProxy *sortProxy = new DownloadListSortProxy(m_OrganizerCore.downloadManager(), ui->downloadView); sortProxy->setSourceModel(new DownloadList(m_OrganizerCore.downloadManager(), ui->downloadView)); @@ -5175,6 +5177,9 @@ void MainWindow::updateDownloadListDelegate() //ui->downloadView->sortByColumn(1, Qt::DescendingOrder); ui->downloadView->header()->resizeSections(QHeaderView::Stretch); + connect(ui->downloadView, SIGNAL(resumeDownload(int)), m_OrganizerCore.downloadManager(), SLOT(resumeDownload(int))); + + /* connect(ui->downloadView->itemDelegate(), SIGNAL(installDownload(int)), &m_OrganizerCore, SLOT(installDownload(int))); connect(ui->downloadView->itemDelegate(), SIGNAL(queryInfo(int)), m_OrganizerCore.downloadManager(), SLOT(queryInfo(int))); connect(ui->downloadView->itemDelegate(), SIGNAL(visitOnNexus(int)), m_OrganizerCore.downloadManager(), SLOT(visitOnNexus(int))); @@ -5185,6 +5190,7 @@ void MainWindow::updateDownloadListDelegate() connect(ui->downloadView->itemDelegate(), SIGNAL(cancelDownload(int)), m_OrganizerCore.downloadManager(), SLOT(cancelDownload(int))); connect(ui->downloadView->itemDelegate(), SIGNAL(pauseDownload(int)), m_OrganizerCore.downloadManager(), SLOT(pauseDownload(int))); connect(ui->downloadView->itemDelegate(), SIGNAL(resumeDownload(int)), this, SLOT(resumeDownload(int))); + */ } -- cgit v1.3.1 From ec8dbcbf280bf6b542e9087d562e51757d205299 Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Sun, 30 Dec 2018 14:54:28 +0100 Subject: Port context menus to new downloadlist --- src/downloadlist.cpp | 2 + src/downloadlistwidget.cpp | 359 +++++++++----------------------------- src/downloadlistwidget.h | 58 +------ src/downloadmanager.cpp | 2 +- src/mainwindow.cpp | 41 ++--- src/mainwindow.ui | 2 +- src/organizer_en.ts | 417 +++++++++++++++++++++------------------------ 7 files changed, 291 insertions(+), 590 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp index 503274e6..a44850cb 100644 --- a/src/downloadlist.cpp +++ b/src/downloadlist.cpp @@ -82,8 +82,10 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const DownloadManager::DownloadState state = m_Manager->getState(index.row()); switch (state) { case DownloadManager::STATE_INSTALLED : return tr("Installed"); + case DownloadManager::STATE_UNINSTALLED : return tr("Uninstalled"); case DownloadManager::STATE_READY : return tr("Downloaded"); case DownloadManager::STATE_DOWNLOADING : return m_Manager->getProgress(index.row()).second; + case DownloadManager::STATE_PAUSED : return tr("Paused"); default : return state; } } else { diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index b3d9b083..915ddda5 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -30,224 +30,101 @@ DownloadListWidget::DownloadListWidget(QWidget *parent) : QTreeView(parent) { connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onDoubleClick(QModelIndex))); + connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenu(QPoint))); } - DownloadListWidget::~DownloadListWidget() { } -void DownloadListWidget::onDoubleClick(const QModelIndex &index) -{ - emit(resumeDownload(dynamic_cast(model())->mapToSource(index).row())); -} - - -DownloadListWidgetDelegate::DownloadListWidgetDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent) - : QItemDelegate(parent) - , m_Manager(manager) - , m_MetaDisplay(metaDisplay) - , m_ItemWidget(new DownloadListWidget) - , m_ContextRow(0) - , m_View(view) -{ - m_NameLabel = m_ItemWidget->findChild("nameLabel"); - m_SizeLabel = m_ItemWidget->findChild("sizeLabel"); - m_Progress = m_ItemWidget->findChild("downloadProgress"); - m_InstallLabel = m_ItemWidget->findChild("installLabel"); - - m_InstallLabel->setVisible(false); - m_Progress->setTextVisible(true); - - connect(manager, SIGNAL(stateChanged(int,DownloadManager::DownloadState)), this, SLOT(stateChanged(int,DownloadManager::DownloadState))); - connect(manager, SIGNAL(downloadRemoved(int)), this, SLOT(resetCache(int))); -} - - -DownloadListWidgetDelegate::~DownloadListWidgetDelegate() -{ - delete m_ItemWidget; -} - - -void DownloadListWidgetDelegate::stateChanged(int row,DownloadManager::DownloadState) +void DownloadListWidget::setManager(DownloadManager *manager) { - m_Cache.remove(row); + m_Manager = manager; } - -void DownloadListWidgetDelegate::resetCache(int) +void DownloadListWidget::onDoubleClick(const QModelIndex &index) { - m_Cache.clear(); + QModelIndex sourceIndex = qobject_cast(model())->mapToSource(index); + if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) { + emit installDownload(sourceIndex.row()); + } else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) { + emit resumeDownload(sourceIndex.row()); + } } - -void DownloadListWidgetDelegate::drawCache(QPainter *painter, const QStyleOptionViewItem &option, const QPixmap &cache) const +void DownloadListWidget::onCustomContextMenu(const QPoint &point) { - QRect rect = option.rect; - rect.setLeft(0); - rect.setWidth(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2) + m_View->columnWidth(3)); - painter->drawPixmap(rect, cache); -} - - -QString DownloadListWidgetDelegate::sizeFormat(quint64 size) const -{ - qreal calc = size; - QStringList list; - list << "KB" << "MB" << "GB" << "TB"; - - QStringListIterator i(list); - QString unit("byte(s)"); - - while (calc >= 1024.0 && i.hasNext()) - { - unit = i.next(); - calc /= 1024.0; - } - - return QString().setNum(calc, 'f', 2) + " " + unit; -} - + QMenu menu(this); + QModelIndex index = indexAt(point); + bool hidden = false; + if (index.row() >= 0) { + m_ContextRow = qobject_cast(model())->mapToSource(index).row(); + DownloadManager::DownloadState state = m_Manager->getState(m_ContextRow); + hidden = m_Manager->isHidden(m_ContextRow); + if (state >= DownloadManager::STATE_READY) { + menu.addAction(tr("Install"), this, SLOT(issueInstall())); + if (m_Manager->isInfoIncomplete(m_ContextRow)) { + menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo())); + } + else { + menu.addAction(tr("Visit on Nexus"), this, SLOT(issueVisitOnNexus())); + } -void DownloadListWidgetDelegate::paintPendingDownload(int downloadIndex) const -{ - std::tuple nexusids = m_Manager->getPendingDownload(downloadIndex); - m_NameLabel->setText(tr("< game %1 mod %2 file %3 >").arg(std::get<0>(nexusids)).arg(std::get<1>(nexusids)).arg(std::get<2>(nexusids))); - m_SizeLabel->setText("???"); - m_InstallLabel->setVisible(true); - m_InstallLabel->setText(tr("Pending")); - m_Progress->setVisible(false); -} + menu.addAction(tr("Open File"), this, SLOT(issueOpenFile())); + menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); + menu.addSeparator(); -void DownloadListWidgetDelegate::paintRegularDownload(int downloadIndex) const -{ - QString name = m_MetaDisplay ? m_Manager->getDisplayName(downloadIndex) : m_Manager->getFileName(downloadIndex); - if (name.length() > 120) { - name.truncate(120); - name.append("..."); - } - m_NameLabel->setText(name); - m_SizeLabel->setText(sizeFormat(m_Manager->getFileSize(downloadIndex) )); - DownloadManager::DownloadState state = m_Manager->getState(downloadIndex); - if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) { - QPalette labelPalette; - m_InstallLabel->setVisible(true); - m_Progress->setVisible(false); -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) - m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Paused - Double Click to resume", 0)); -#else - m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Paused - Double Click to resume", 0, QApplication::UnicodeUTF8)); -#endif - labelPalette.setColor(QPalette::WindowText, Qt::darkRed); - m_InstallLabel->setPalette(labelPalette); - } else if (state == DownloadManager::STATE_FETCHINGMODINFO) { - m_InstallLabel->setText(tr("Fetching Info 1")); - m_Progress->setVisible(false); - } else if (state == DownloadManager::STATE_FETCHINGFILEINFO) { - m_InstallLabel->setText(tr("Fetching Info 2")); - m_Progress->setVisible(false); - } else if (state >= DownloadManager::STATE_READY) { - QPalette labelPalette; - m_InstallLabel->setVisible(true); - m_Progress->setVisible(false); - if (state == DownloadManager::STATE_INSTALLED) { - // the tr-macro doesn't work here, maybe because the translation is actually associated with DownloadListWidget instead - // of DownloadListWidgetDelegate? -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) - m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Installed - Double Click to re-install", 0)); -#else - m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Installed - Double Click to re-install", 0, QApplication::UnicodeUTF8)); -#endif - labelPalette.setColor(QPalette::WindowText, Qt::darkGray); - } else if (state == DownloadManager::STATE_UNINSTALLED) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) - m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Uninstalled - Double Click to re-install", 0)); -#else - m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Uninstalled - Double Click to re-install", 0, QApplication::UnicodeUTF8)); -#endif - labelPalette.setColor(QPalette::WindowText, Qt::lightGray); - } else { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) - m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Done - Double Click to install", 0)); -#else - m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Done - Double Click to install", 0, QApplication::UnicodeUTF8)); -#endif - labelPalette.setColor(QPalette::WindowText, Qt::darkGreen); + menu.addAction(tr("Delete"), this, SLOT(issueDelete())); + if (hidden) { + menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView())); + } + else { + menu.addAction(tr("Hide"), this, SLOT(issueRemoveFromView())); + } } - m_InstallLabel->setPalette(labelPalette); - if (m_Manager->isInfoIncomplete(downloadIndex)) { - m_NameLabel->setText(" " + m_NameLabel->text()); + else if (state == DownloadManager::STATE_DOWNLOADING) { + menu.addAction(tr("Cancel"), this, SLOT(issueCancel())); + menu.addAction(tr("Pause"), this, SLOT(issuePause())); + menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); } - } else { - m_InstallLabel->setVisible(false); - m_Progress->setVisible(true); - m_Progress->setValue(m_Manager->getProgress(downloadIndex).first); - m_Progress->setFormat(m_Manager->getProgress(downloadIndex).second); - } -} - -void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - try { - auto iter = m_Cache.find(index.row()); - if (iter != m_Cache.end()) { - drawCache(painter, option, *iter); - return; + else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) { + menu.addAction(tr("Delete"), this, SLOT(issueDelete())); + menu.addAction(tr("Resume"), this, SLOT(issueResume())); + menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); } - m_ItemWidget->resize(QSize(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2) + m_View->columnWidth(3), option.rect.height())); - - int downloadIndex = index.data().toInt(); - - if (downloadIndex >= m_Manager->numTotalDownloads()) { - paintPendingDownload(downloadIndex - m_Manager->numTotalDownloads()); - } else { - paintRegularDownload(downloadIndex); - } - -#pragma message("caching disabled because changes in the list (including resorting) doesn't work correctly") -// if (state >= DownloadManager::STATE_READY) { - if (false) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) - QPixmap cache = m_ItemWidget->grab(); -#else - QPixmap cache = QPixmap::grabWidget(m_ItemWidget); -#endif - m_Cache[index.row()] = cache; - drawCache(painter, option, cache); - } else { - painter->save(); - painter->translate(QPoint(0, option.rect.topLeft().y())); - - m_ItemWidget->render(painter); - painter->restore(); - } - } catch (const std::exception &e) { - qCritical("failed to paint download list: %s", e.what()); + menu.addSeparator(); + } + menu.addAction(tr("Delete Installed..."), this, SLOT(issueDeleteCompleted())); + menu.addAction(tr("Delete Uninstalled..."), this, SLOT(issueDeleteUninstalled())); + menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll())); + + if (!hidden) { + menu.addSeparator(); + menu.addAction(tr("Hide Installed..."), this, SLOT(issueRemoveFromViewCompleted())); + menu.addAction(tr("Hide Uninstalled..."), this, SLOT(issueRemoveFromViewUninstalled())); + menu.addAction(tr("Hide All..."), this, SLOT(issueRemoveFromViewAll())); + } + if (hidden) { + menu.addSeparator(); + menu.addAction(tr("Un-Hide All..."), this, SLOT(issueRestoreToViewAll())); } -} -QSize DownloadListWidgetDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex&) const -{ - const int width = m_ItemWidget->minimumWidth(); - const int height = m_ItemWidget->height(); - return QSize(width, height); + menu.exec(viewport()->mapToGlobal(point)); } - -void DownloadListWidgetDelegate::issueInstall() +void DownloadListWidget::issueInstall() { emit installDownload(m_ContextRow); } -void DownloadListWidgetDelegate::issueQueryInfo() +void DownloadListWidget::issueQueryInfo() { emit queryInfo(m_ContextRow); } -void DownloadListWidgetDelegate::issueDelete() +void DownloadListWidget::issueDelete() { if (QMessageBox::question(nullptr, tr("Delete Files?"), tr("This will permanently delete the selected download."), @@ -256,52 +133,53 @@ void DownloadListWidgetDelegate::issueDelete() } } -void DownloadListWidgetDelegate::issueRemoveFromView() +void DownloadListWidget::issueRemoveFromView() { + qDebug() << "removing from view: " << m_ContextRow; emit removeDownload(m_ContextRow, false); } -void DownloadListWidgetDelegate::issueRestoreToView() +void DownloadListWidget::issueRestoreToView() { emit restoreDownload(m_ContextRow); } -void DownloadListWidgetDelegate::issueRestoreToViewAll() +void DownloadListWidget::issueRestoreToViewAll() { emit restoreDownload(-1); } -void DownloadListWidgetDelegate::issueVisitOnNexus() +void DownloadListWidget::issueVisitOnNexus() { emit visitOnNexus(m_ContextRow); } -void DownloadListWidgetDelegate::issueOpenFile() +void DownloadListWidget::issueOpenFile() { emit openFile(m_ContextRow); } -void DownloadListWidgetDelegate::issueOpenInDownloadsFolder() +void DownloadListWidget::issueOpenInDownloadsFolder() { emit openInDownloadsFolder(m_ContextRow); } -void DownloadListWidgetDelegate::issueCancel() +void DownloadListWidget::issueCancel() { emit cancelDownload(m_ContextRow); } -void DownloadListWidgetDelegate::issuePause() +void DownloadListWidget::issuePause() { emit pauseDownload(m_ContextRow); } -void DownloadListWidgetDelegate::issueResume() +void DownloadListWidget::issueResume() { emit resumeDownload(m_ContextRow); } -void DownloadListWidgetDelegate::issueDeleteAll() +void DownloadListWidget::issueDeleteAll() { if (QMessageBox::question(nullptr, tr("Delete Files?"), tr("This will remove all finished downloads from this list and from disk."), @@ -310,7 +188,7 @@ void DownloadListWidgetDelegate::issueDeleteAll() } } -void DownloadListWidgetDelegate::issueDeleteCompleted() +void DownloadListWidget::issueDeleteCompleted() { if (QMessageBox::question(nullptr, tr("Delete Files?"), tr("This will remove all installed downloads from this list and from disk."), @@ -319,7 +197,7 @@ void DownloadListWidgetDelegate::issueDeleteCompleted() } } -void DownloadListWidgetDelegate::issueDeleteUninstalled() +void DownloadListWidget::issueDeleteUninstalled() { if (QMessageBox::question(nullptr, tr("Delete Files?"), tr("This will remove all uninstalled downloads from this list and from disk."), @@ -328,7 +206,7 @@ void DownloadListWidgetDelegate::issueDeleteUninstalled() } } -void DownloadListWidgetDelegate::issueRemoveFromViewAll() +void DownloadListWidget::issueRemoveFromViewAll() { if (QMessageBox::question(nullptr, tr("Are you sure?"), tr("This will remove all finished downloads from this list (but NOT from disk)."), @@ -337,7 +215,7 @@ void DownloadListWidgetDelegate::issueRemoveFromViewAll() } } -void DownloadListWidgetDelegate::issueRemoveFromViewCompleted() +void DownloadListWidget::issueRemoveFromViewCompleted() { if (QMessageBox::question(nullptr, tr("Are you sure?"), tr("This will remove all installed downloads from this list (but NOT from disk)."), @@ -346,7 +224,7 @@ void DownloadListWidgetDelegate::issueRemoveFromViewCompleted() } } -void DownloadListWidgetDelegate::issueRemoveFromViewUninstalled() +void DownloadListWidget::issueRemoveFromViewUninstalled() { if (QMessageBox::question(nullptr, tr("Are you sure?"), tr("This will remove all uninstalled downloads from this list (but NOT from disk)."), @@ -354,82 +232,3 @@ void DownloadListWidgetDelegate::issueRemoveFromViewUninstalled() emit removeDownload(-3, false); } } - -bool DownloadListWidgetDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, - const QStyleOptionViewItem &option, const QModelIndex &index) -{ - try { - if (event->type() == QEvent::MouseButtonDblClick) { - QModelIndex sourceIndex = qobject_cast(model)->mapToSource(index); - if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) { - emit installDownload(sourceIndex.row()); - } else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) { - emit resumeDownload(sourceIndex.row()); - } - return true; - } else if (event->type() == QEvent::MouseButtonRelease) { - QMouseEvent *mouseEvent = static_cast(event); - if (mouseEvent->button() == Qt::RightButton) { - QMenu menu(m_View); - bool hidden = false; - m_ContextRow = qobject_cast(model)->mapToSource(index).row(); - if (m_ContextRow < m_Manager->numTotalDownloads()) { - DownloadManager::DownloadState state = m_Manager->getState(m_ContextRow); - hidden = m_Manager->isHidden(m_ContextRow); - if (state >= DownloadManager::STATE_READY) { - menu.addAction(tr("Install"), this, SLOT(issueInstall())); - if (m_Manager->isInfoIncomplete(m_ContextRow)) { - menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo())); - }else { - menu.addAction(tr("Visit on Nexus"), this,SLOT(issueVisitOnNexus())); - } - - menu.addAction(tr("Open File"), this, SLOT(issueOpenFile())); - menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); - - menu.addSeparator(); - - menu.addAction(tr("Delete"), this, SLOT(issueDelete())); - if (hidden) { - menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView())); - } else { - menu.addAction(tr("Hide"), this, SLOT(issueRemoveFromView())); - } - } else if (state == DownloadManager::STATE_DOWNLOADING){ - menu.addAction(tr("Cancel"), this, SLOT(issueCancel())); - menu.addAction(tr("Pause"), this, SLOT(issuePause())); - menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); - } else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) { - menu.addAction(tr("Delete"), this, SLOT(issueDelete())); - menu.addAction(tr("Resume"), this, SLOT(issueResume())); - menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); - } - - menu.addSeparator(); - } - menu.addAction(tr("Delete Installed..."), this, SLOT(issueDeleteCompleted())); - menu.addAction(tr("Delete Uninstalled..."), this, SLOT(issueDeleteUninstalled())); - menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll())); - - if (!hidden) { - menu.addSeparator(); - menu.addAction(tr("Hide Installed..."), this, SLOT(issueRemoveFromViewCompleted())); - menu.addAction(tr("Hide Uninstalled..."), this, SLOT(issueRemoveFromViewUninstalled())); - menu.addAction(tr("Hide All..."), this, SLOT(issueRemoveFromViewAll())); - } - if (hidden) { - menu.addSeparator(); - menu.addAction(tr("Un-Hide All..."), this, SLOT(issueRestoreToViewAll())); - } - - menu.exec(mouseEvent->globalPos()); - - event->accept(); - return true; - } - } - } catch (const std::exception &e) { - qCritical("failed to handle editor event: %s", e.what()); - } - return QItemDelegate::editorEvent(event, model, option, index); -} diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h index 7a7a25f7..0c17de87 100644 --- a/src/downloadlistwidget.h +++ b/src/downloadlistwidget.h @@ -31,6 +31,8 @@ namespace Ui { class DownloadListWidget; } +class DownloadManager; + class DownloadListWidget : public QTreeView { Q_OBJECT @@ -39,33 +41,9 @@ public: explicit DownloadListWidget(QWidget *parent = 0); ~DownloadListWidget(); -signals: - void resumeDownload(int index); - -private slots: - void onDoubleClick(const QModelIndex &index); -}; - -class DownloadManager; - -class DownloadListWidgetDelegate : public QItemDelegate -{ - - Q_OBJECT - -public: - - DownloadListWidgetDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent = 0); - ~DownloadListWidgetDelegate(); - - virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; - - void paintPendingDownload(int downloadIndex) const; - void paintRegularDownload(int downloadIndex) const; + void setManager(DownloadManager *manager); signals: - void installDownload(int index); void queryInfo(int index); void removeDownload(int index, bool deleteFile); @@ -77,19 +55,9 @@ signals: void openFile(int index); void openInDownloadsFolder(int index); -protected: - - QString sizeFormat(quint64 size) const; - bool editorEvent(QEvent *event, QAbstractItemModel *model, - const QStyleOptionViewItem &option, const QModelIndex &index); - -private: - - - void drawCache(QPainter *painter, const QStyleOptionViewItem &option, const QPixmap &cache) const; - private slots: - + void onDoubleClick(const QModelIndex &index); + void onCustomContextMenu(const QPoint &point); void issueInstall(); void issueDelete(); void issueRemoveFromView(); @@ -109,25 +77,9 @@ private slots: void issueRemoveFromViewUninstalled(); void issueQueryInfo(); - void stateChanged(int row, DownloadManager::DownloadState); - void resetCache(int); - private: - - DownloadListWidget *m_ItemWidget; DownloadManager *m_Manager; - - bool m_MetaDisplay; - - QLabel *m_NameLabel; - QLabel *m_SizeLabel; - QProgressBar *m_Progress; - QLabel *m_InstallLabel; int m_ContextRow; - - QTreeView *m_View; - - mutable QMap m_Cache; }; #endif // DOWNLOADLISTWIDGET_H diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index f1cbf109..9f07b030 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1853,4 +1853,4 @@ void DownloadManager::writeData(DownloadInfo *info) "Canceling download \"%2\"...").arg(ret).arg(fileName)); } } -} \ No newline at end of file +} diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5ca60ef1..80ddf093 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5152,45 +5152,26 @@ void MainWindow::on_actionEndorseMO_triggered() void MainWindow::updateDownloadListDelegate() { - /* - if (m_OrganizerCore.settings().compactDownloads()) { - ui->downloadView->setItemDelegate( - new DownloadListWidgetCompactDelegate(m_OrganizerCore.downloadManager(), - m_OrganizerCore.settings().metaDownloads(), - ui->downloadView, - ui->downloadView)); - } else { - ui->downloadView->setItemDelegate( - new DownloadListWidgetDelegate(m_OrganizerCore.downloadManager(), - m_OrganizerCore.settings().metaDownloads(), - ui->downloadView, - ui->downloadView)); - } - */ - DownloadListSortProxy *sortProxy = new DownloadListSortProxy(m_OrganizerCore.downloadManager(), ui->downloadView); sortProxy->setSourceModel(new DownloadList(m_OrganizerCore.downloadManager(), ui->downloadView)); connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), sortProxy, SLOT(updateFilter(QString))); connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(downloadFilterChanged(QString))); ui->downloadView->setModel(sortProxy); + ui->downloadView->setManager(m_OrganizerCore.downloadManager()); //ui->downloadView->sortByColumn(1, Qt::DescendingOrder); ui->downloadView->header()->resizeSections(QHeaderView::Stretch); - connect(ui->downloadView, SIGNAL(resumeDownload(int)), m_OrganizerCore.downloadManager(), SLOT(resumeDownload(int))); - - /* - connect(ui->downloadView->itemDelegate(), SIGNAL(installDownload(int)), &m_OrganizerCore, SLOT(installDownload(int))); - connect(ui->downloadView->itemDelegate(), SIGNAL(queryInfo(int)), m_OrganizerCore.downloadManager(), SLOT(queryInfo(int))); - connect(ui->downloadView->itemDelegate(), SIGNAL(visitOnNexus(int)), m_OrganizerCore.downloadManager(), SLOT(visitOnNexus(int))); - connect(ui->downloadView->itemDelegate(), SIGNAL(openFile(int)), m_OrganizerCore.downloadManager(), SLOT(openFile(int))); - connect(ui->downloadView->itemDelegate(), SIGNAL(openInDownloadsFolder(int)), m_OrganizerCore.downloadManager(), SLOT(openInDownloadsFolder(int))); - connect(ui->downloadView->itemDelegate(), SIGNAL(removeDownload(int, bool)), m_OrganizerCore.downloadManager(), SLOT(removeDownload(int, bool))); - connect(ui->downloadView->itemDelegate(), SIGNAL(restoreDownload(int)), m_OrganizerCore.downloadManager(), SLOT(restoreDownload(int))); - connect(ui->downloadView->itemDelegate(), SIGNAL(cancelDownload(int)), m_OrganizerCore.downloadManager(), SLOT(cancelDownload(int))); - connect(ui->downloadView->itemDelegate(), SIGNAL(pauseDownload(int)), m_OrganizerCore.downloadManager(), SLOT(pauseDownload(int))); - connect(ui->downloadView->itemDelegate(), SIGNAL(resumeDownload(int)), this, SLOT(resumeDownload(int))); - */ + connect(ui->downloadView, SIGNAL(installDownload(int)), &m_OrganizerCore, SLOT(installDownload(int))); + connect(ui->downloadView, SIGNAL(queryInfo(int)), m_OrganizerCore.downloadManager(), SLOT(queryInfo(int))); + connect(ui->downloadView, SIGNAL(visitOnNexus(int)), m_OrganizerCore.downloadManager(), SLOT(visitOnNexus(int))); + connect(ui->downloadView, SIGNAL(openFile(int)), m_OrganizerCore.downloadManager(), SLOT(openFile(int))); + connect(ui->downloadView, SIGNAL(openInDownloadsFolder(int)), m_OrganizerCore.downloadManager(), SLOT(openInDownloadsFolder(int))); + connect(ui->downloadView, SIGNAL(removeDownload(int, bool)), m_OrganizerCore.downloadManager(), SLOT(removeDownload(int, bool))); + connect(ui->downloadView, SIGNAL(restoreDownload(int)), m_OrganizerCore.downloadManager(), SLOT(restoreDownload(int))); + connect(ui->downloadView, SIGNAL(cancelDownload(int)), m_OrganizerCore.downloadManager(), SLOT(cancelDownload(int))); + connect(ui->downloadView, SIGNAL(pauseDownload(int)), m_OrganizerCore.downloadManager(), SLOT(pauseDownload(int))); + connect(ui->downloadView, SIGNAL(resumeDownload(int)), this, SLOT(resumeDownload(int))); } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 5dfd075b..771832fd 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1311,7 +1311,7 @@ p, li { white-space: pre-wrap; } - Qt::PreventContextMenu + Qt::CustomContextMenu true diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 9b61eafc..e958c116 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -313,16 +313,26 @@ p, li { white-space: pre-wrap; } + Uninstalled + + + + Downloaded - + + Paused + + + + Information missing, please select "Query Info" from the context menu to re-retrieve. - + pending download @@ -337,392 +347,349 @@ p, li { white-space: pre-wrap; } - - Done - Double Click to install - - - Paused - Double Click to resume - - - - - - Installed - Double Click to re-install - - - - - - Uninstalled - Double Click to re-install - - - - - DownloadListWidgetCompact - - - - Placeholder - - - - - Done - - - - - DownloadListWidgetCompactDelegate - - - < game %1 mod %2 file %3 > - - - - - Pending - - - - - Paused + + Install - - Fetching Info 1 + + Query Info - - Fetching Info 2 + + Visit on Nexus - - Installed + + Open File - - Uninstalled + + + + Show in Folder - - Done + + + Delete - - - - - - - - Are you sure? + + Un-Hide - - This will permanently delete the selected download. + + Hide - - This will remove all finished downloads from this list and from disk. + + Cancel - - This will remove all installed downloads from this list and from disk. + + Pause - - This will remove all uninstalled downloads from this list and from disk. + + Resume - - This will permanently remove all finished downloads from this list (but NOT from disk). + + Delete Installed... - - This will permanently remove all installed downloads from this list (but NOT from disk). + + Delete Uninstalled... - - This will permanently remove all uninstalled downloads from this list (but NOT from disk). + + Delete All... - - Install + + Hide Installed... - - Query Info + + Hide Uninstalled... - - Visit on Nexus + + Hide All... - - Open File + + Un-Hide All... - - - - Show in Folder + + + + + Delete Files? - - Delete + + This will permanently delete the selected download. - - Un-Hide + + This will remove all finished downloads from this list and from disk. - - Hide + + This will remove all installed downloads from this list and from disk. - - Cancel + + This will remove all uninstalled downloads from this list and from disk. - - Pause + + + + Are you sure? - - Remove + + This will remove all finished downloads from this list (but NOT from disk). - - Resume + + This will remove all installed downloads from this list (but NOT from disk). - - Delete Installed... + + This will remove all uninstalled downloads from this list (but NOT from disk). + + + DownloadListWidgetCompact - - Delete Uninstalled... + + + Placeholder - - Delete All... + + Done + + + DownloadListWidgetCompactDelegate - - Hide Installed... + + < game %1 mod %2 file %3 > - - Hide Uninstalled... + + Pending - - Hide All... + + Paused - - Un-Hide All... + + Fetching Info 1 - - - DownloadListWidgetDelegate - - < game %1 mod %2 file %3 > + + Fetching Info 2 - - Pending + + Installed - - Fetching Info 1 + + Uninstalled - - Fetching Info 2 + + Done - - - - - Delete Files? + + + + + + + + Are you sure? - + This will permanently delete the selected download. - + This will remove all finished downloads from this list and from disk. - + This will remove all installed downloads from this list and from disk. - + This will remove all uninstalled downloads from this list and from disk. - - - - Are you sure? - - - - - This will remove all finished downloads from this list (but NOT from disk). + + This will permanently remove all finished downloads from this list (but NOT from disk). - - This will remove all installed downloads from this list (but NOT from disk). + + This will permanently remove all installed downloads from this list (but NOT from disk). - - This will remove all uninstalled downloads from this list (but NOT from disk). + + This will permanently remove all uninstalled downloads from this list (but NOT from disk). - + Install - + Query Info - + Visit on Nexus - + Open File - - - + + + Show in Folder - - + Delete - + Un-Hide - + Hide - + Cancel - + Pause - + + Remove + + + + Resume - + Delete Installed... - + Delete Uninstalled... - + Delete All... - + Hide Installed... - + Hide Uninstalled... - + Hide All... - + Un-Hide All... @@ -2470,7 +2437,7 @@ Please enter a name: - + Are you sure? @@ -2797,13 +2764,13 @@ You can also use online editors and converters instead. - + Enable selected - + Disable selected @@ -2864,13 +2831,13 @@ You can also use online editors and converters instead. - + Exception: - + Unknown exception @@ -3008,7 +2975,7 @@ Click OK to restart MO now. - + Set Priority @@ -3073,196 +3040,196 @@ Click OK to restart MO now. - + Thank you! - + Thank you for your endorsement! - + Request to Nexus failed: %1 - - + + failed to read %1: %2 - - + + Error - + failed to extract %1 (errorcode %2) - + Extract BSA - + This archive contains invalid hashes. Some files may be broken. - + Extract... - + This will restart MO, continue? - + Edit Categories... - + Deselect filter - + Remove - + Enable all - + Disable all - + Unlock load order - + Lock load order - + Open Origin in Explorer - + Open Origin Info... - + depends on missing "%1" - + incompatible with "%1" - + Please wait while LOOT is running - + loot failed. Exit code was: %1 - + failed to start loot - + failed to run loot: %1 - + Errors occured - + Backup of load order created - + Choose backup to restore - + No Backups - + There are no backups to restore - - + + Restore failed - - + + Failed to restore the backup. Errorcode: %1 - + Backup of modlist created - + A file with the same name has already been downloaded. What would you like to do? - + Overwrite - + Rename new file - + Ignore file - + Set the priority of the selected mods -- cgit v1.3.1 From 7a71a9eb9e1f1c8e0681038105a6bb8ba888077b Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Sun, 30 Dec 2018 15:16:06 +0100 Subject: Fix a bug where downloadlist context actions run multiple times --- src/mainwindow.cpp | 8 ++------ src/mainwindow.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 80ddf093..b618a661 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -341,7 +341,7 @@ MainWindow::MainWindow(QSettings &initSettings ui->openFolderMenu->setMenu(openFolderMenu()); - updateDownloadListDelegate(); + initDownloadList(); ui->savegameList->installEventFilter(this); ui->savegameList->setMouseTracking(true); @@ -4657,8 +4657,6 @@ void MainWindow::on_actionSettings_triggered() NexusInterface::instance(&m_PluginContainer)->setNMMVersion(settings.getNMMVersion()); - updateDownloadListDelegate(); - m_OrganizerCore.updateVFSParams(settings.logLevel(), settings.crashDumpsType(), settings.executablesBlacklist()); m_OrganizerCore.cycleDiagnostics(); } @@ -4713,13 +4711,11 @@ void MainWindow::languageChange(const QString &newLanguage) createHelpWidget(); - updateDownloadListDelegate(); updateProblemsButton(); ui->listOptionsBtn->setMenu(modListContextMenu()); ui->openFolderMenu->setMenu(openFolderMenu()); - } void MainWindow::writeDataToFile(QFile &file, const QString &directory, const DirectoryEntry &directoryEntry) @@ -5150,7 +5146,7 @@ void MainWindow::on_actionEndorseMO_triggered() } -void MainWindow::updateDownloadListDelegate() +void MainWindow::initDownloadList() { DownloadListSortProxy *sortProxy = new DownloadListSortProxy(m_OrganizerCore.downloadManager(), ui->downloadView); sortProxy->setSourceModel(new DownloadList(m_OrganizerCore.downloadManager(), ui->downloadView)); diff --git a/src/mainwindow.h b/src/mainwindow.h index d19cd6a4..93f2ed5f 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -246,7 +246,7 @@ private: bool populateMenuCategories(QMenu *menu, int targetID); - void updateDownloadListDelegate(); + void initDownloadList(); // remove invalid category-references from mods void fixCategories(); -- cgit v1.3.1 From 463abedee7d63542bce7b0e71cdd52e318d9a8e5 Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Sun, 30 Dec 2018 16:35:39 +0100 Subject: Remove old downloads tab code leftovers --- src/CMakeLists.txt | 4 - src/downloadlistwidget.cpp | 1 - src/downloadlistwidget.ui | 140 ------ src/downloadlistwidgetcompact.cpp | 412 ----------------- src/downloadlistwidgetcompact.h | 131 ------ src/downloadlistwidgetcompact.ui | 168 ------- src/mainwindow.cpp | 1 - src/organizer.pro | 4 - src/organizer_en.ts | 905 ++++++++++++++++---------------------- 9 files changed, 372 insertions(+), 1394 deletions(-) delete mode 100644 src/downloadlistwidget.ui delete mode 100644 src/downloadlistwidgetcompact.cpp delete mode 100644 src/downloadlistwidgetcompact.h delete mode 100644 src/downloadlistwidgetcompact.ui (limited to 'src/mainwindow.cpp') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a084bae0..4c883cf5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,7 +54,6 @@ SET(organizer_SRCS executableslist.cpp editexecutablesdialog.cpp downloadmanager.cpp - downloadlistwidgetcompact.cpp downloadlistwidget.cpp downloadlistsortproxy.cpp downloadlist.cpp @@ -147,7 +146,6 @@ SET(organizer_HDRS executableslist.h editexecutablesdialog.h downloadmanager.h - downloadlistwidgetcompact.h downloadlistwidget.h downloadlistsortproxy.h downloadlist.h @@ -218,8 +216,6 @@ SET(organizer_UIS installdialog.ui finddialog.ui editexecutablesdialog.ui - downloadlistwidgetcompact.ui - downloadlistwidget.ui credentialsdialog.ui categoriesdialog.ui activatemodsdialog.ui diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index 915ddda5..9cf8e097 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -18,7 +18,6 @@ along with Mod Organizer. If not, see . */ #include "downloadlistwidget.h" -#include "ui_downloadlistwidget.h" #include #include #include diff --git a/src/downloadlistwidget.ui b/src/downloadlistwidget.ui deleted file mode 100644 index 112ca231..00000000 --- a/src/downloadlistwidget.ui +++ /dev/null @@ -1,140 +0,0 @@ - - - DownloadListWidget - - - - 0 - 0 - 315 - 81 - - - - Qt::CustomContextMenu - - - Placeholder - - - false - - - - 0 - - - 1 - - - 0 - - - 1 - - - - - QFrame::Box - - - QFrame::Raised - - - - - - - - - 1 - 0 - - - - - 16777215 - 16777215 - - - - Placeholder - - - - - - - Qt::Horizontal - - - - 10 - 20 - - - - - - - - 0 - - - - - - - false - - - KB - - - - - - - - - - - Done - Double Click to install - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - 0 - - - - - - - - - - - - - diff --git a/src/downloadlistwidgetcompact.cpp b/src/downloadlistwidgetcompact.cpp deleted file mode 100644 index e033c202..00000000 --- a/src/downloadlistwidgetcompact.cpp +++ /dev/null @@ -1,412 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "downloadlistwidgetcompact.h" -#include "ui_downloadlistwidgetcompact.h" -#include -#include -#include -#include -#include - - -DownloadListWidgetCompact::DownloadListWidgetCompact(QWidget *parent) : - QWidget(parent), - ui(new Ui::DownloadListWidgetCompact) -{ - ui->setupUi(this); -} - -DownloadListWidgetCompact::~DownloadListWidgetCompact() -{ - delete ui; -} - - -DownloadListWidgetCompactDelegate::DownloadListWidgetCompactDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent) - : QItemDelegate(parent) - , m_Manager(manager) - , m_MetaDisplay(metaDisplay) - , m_ItemWidget(new DownloadListWidgetCompact) - , m_View(view) -{ - m_NameLabel = m_ItemWidget->findChild("nameLabel"); - m_SizeLabel = m_ItemWidget->findChild("sizeLabel"); - m_Progress = m_ItemWidget->findChild("downloadProgress"); - m_DoneLabel = m_ItemWidget->findChild("doneLabel"); - - m_DoneLabel->setVisible(false); - - connect(manager, SIGNAL(stateChanged(int,DownloadManager::DownloadState)), - this, SLOT(stateChanged(int,DownloadManager::DownloadState))); - connect(manager, SIGNAL(downloadRemoved(int)), this, SLOT(resetCache(int))); -} - - -DownloadListWidgetCompactDelegate::~DownloadListWidgetCompactDelegate() -{ - delete m_ItemWidget; -} - - -void DownloadListWidgetCompactDelegate::stateChanged(int row,DownloadManager::DownloadState) -{ - m_Cache.remove(row); -} - - -void DownloadListWidgetCompactDelegate::resetCache(int) -{ - m_Cache.clear(); -} - - -void DownloadListWidgetCompactDelegate::drawCache(QPainter *painter, const QStyleOptionViewItem &option, const QPixmap &cache) const -{ - QRect rect = option.rect; - rect.setLeft(0); - rect.setWidth(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2) + m_View->columnWidth(3)); - painter->drawPixmap(rect, cache); -} - -QString DownloadListWidgetCompactDelegate::sizeFormat(quint64 size) const -{ - qreal calc = size; - QStringList list; - list << "KB" << "MB" << "GB" << "TB"; - - QStringListIterator i(list); - QString unit("byte(s)"); - - while (calc >= 1024.0 && i.hasNext()) - { - unit = i.next(); - calc /= 1024.0; - } - - return QString().setNum(calc, 'f', 2) + " " + unit; -} - -void DownloadListWidgetCompactDelegate::paintPendingDownload(int downloadIndex) const -{ - std::tuple nexusids = m_Manager->getPendingDownload(downloadIndex); - m_NameLabel->setText(tr("< game %1 mod %2 file %3 >").arg(std::get<0>(nexusids)).arg(std::get<1>(nexusids)).arg(std::get<2>(nexusids))); - //if (m_SizeLabel != nullptr) { - // m_SizeLabel->setText("???"); - //} - m_DoneLabel->setVisible(true); - m_DoneLabel->setText(tr("Pending")); - m_Progress->setVisible(false); -} - - -void DownloadListWidgetCompactDelegate::paintRegularDownload(int downloadIndex) const -{ - QString name = m_MetaDisplay ? m_Manager->getDisplayName(downloadIndex) : m_Manager->getFileName(downloadIndex); - if (name.length() > 60) { - name.truncate(60); - name.append("..."); - } - m_NameLabel->setText(name); - DownloadManager::DownloadState state = m_Manager->getState(downloadIndex); - - if (m_SizeLabel != nullptr) { - m_SizeLabel->setText(sizeFormat(m_Manager->getFileSize(downloadIndex)) + " "); - m_SizeLabel->setVisible(true); - } - //else { - // m_SizeLabel->setVisible(false); - //} - - if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) { - m_DoneLabel->setVisible(true); - m_Progress->setVisible(false); - m_DoneLabel->setText(QString("%1").arg(tr("Paused"))); - } else if (state == DownloadManager::STATE_FETCHINGMODINFO) { - m_DoneLabel->setText(QString("%1").arg(tr("Fetching Info 1"))); - } else if (state == DownloadManager::STATE_FETCHINGFILEINFO) { - m_DoneLabel->setText(QString("%1").arg(tr("Fetching Info 2"))); - } else if (state >= DownloadManager::STATE_READY) { - m_DoneLabel->setVisible(true); - m_Progress->setVisible(false); - if (state == DownloadManager::STATE_INSTALLED) { - m_DoneLabel->setText(QString("%1").arg(tr("Installed"))); - } else if (state == DownloadManager::STATE_UNINSTALLED) { - m_DoneLabel->setText(QString("%1").arg(tr("Uninstalled"))); - } else { - m_DoneLabel->setText(QString("%1").arg(tr("Done"))); - } - if (m_Manager->isInfoIncomplete(downloadIndex)) { - m_NameLabel->setText(" " + m_NameLabel->text()); - } - } else { - m_DoneLabel->setVisible(false); - m_Progress->setVisible(true); - m_Progress->setValue(m_Manager->getProgress(downloadIndex).first); - m_Progress->setFormat(m_Manager->getProgress(downloadIndex).second); - } -} - -void DownloadListWidgetCompactDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const -{ -#pragma message("This is quite costy - room for optimization?") - try { - auto iter = m_Cache.find(index.row()); - if (iter != m_Cache.end()) { - drawCache(painter, option, *iter); - return; - } - - m_ItemWidget->resize(QSize(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2) + m_View->columnWidth(3), option.rect.height())); - if (index.row() % 2 == 1) { - m_ItemWidget->setBackgroundRole(QPalette::AlternateBase); - } else { - m_ItemWidget->setBackgroundRole(QPalette::Base); - } - - int downloadIndex = index.data().toInt(); - if (downloadIndex >= m_Manager->numTotalDownloads()) { - paintPendingDownload(downloadIndex - m_Manager->numTotalDownloads()); - } else { - paintRegularDownload(downloadIndex); - } - -#pragma message("caching disabled because changes in the list (including resorting) doesn't work correctly") - if (false) { -// if (state >= DownloadManager::STATE_READY) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) - QPixmap cache = m_ItemWidget->grab(); -#else - QPixmap cache = QPixmap::grabWidget(m_ItemWidget); -#endif - m_Cache[index.row()] = cache; - drawCache(painter, option, cache); - } else { - painter->save(); - painter->translate(QPoint(0, option.rect.topLeft().y())); - - m_ItemWidget->render(painter); - painter->restore(); - } - } catch (const std::exception &e) { - qCritical("failed to paint download list item %d: %s", index.row(), e.what()); - } -} - -QSize DownloadListWidgetCompactDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex&) const -{ - const int width = m_ItemWidget->minimumWidth(); - const int height = m_ItemWidget->height(); - return QSize(width, height); -} - - -void DownloadListWidgetCompactDelegate::issueInstall() -{ - emit installDownload(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issueQueryInfo() -{ - emit queryInfo(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issueDelete() -{ - if (QMessageBox::question(nullptr, tr("Are you sure?"), - tr("This will permanently delete the selected download."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - emit removeDownload(m_ContextIndex.row(), true); - } -} - -void DownloadListWidgetCompactDelegate::issueRemoveFromView() -{ - emit removeDownload(m_ContextIndex.row(), false); -} - -void DownloadListWidgetCompactDelegate::issueVisitOnNexus() -{ - emit visitOnNexus(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issueOpenFile() -{ - emit openFile(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issueOpenInDownloadsFolder() -{ - emit openInDownloadsFolder(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issueRestoreToView() -{ - emit restoreDownload(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issueRestoreToViewAll() -{ - emit restoreDownload(-1); -} - - -void DownloadListWidgetCompactDelegate::issueCancel() -{ - emit cancelDownload(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issuePause() -{ - emit pauseDownload(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issueResume() -{ - emit resumeDownload(m_ContextIndex.row()); -} - -void DownloadListWidgetCompactDelegate::issueDeleteAll() -{ - if (QMessageBox::question(nullptr, tr("Are you sure?"), - tr("This will remove all finished downloads from this list and from disk."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - emit removeDownload(-1, true); - } -} - -void DownloadListWidgetCompactDelegate::issueDeleteCompleted() -{ - if (QMessageBox::question(nullptr, tr("Are you sure?"), - tr("This will remove all installed downloads from this list and from disk."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - emit removeDownload(-2, true); - } -} - -void DownloadListWidgetCompactDelegate::issueDeleteUninstalled() -{ - if (QMessageBox::question(nullptr, tr("Are you sure?"), - tr("This will remove all uninstalled downloads from this list and from disk."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - emit removeDownload(-3, true); - } -} - -void DownloadListWidgetCompactDelegate::issueRemoveFromViewAll() -{ - if (QMessageBox::question(nullptr, tr("Are you sure?"), - tr("This will permanently remove all finished downloads from this list (but NOT from disk)."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - emit removeDownload(-1, false); - } -} - -void DownloadListWidgetCompactDelegate::issueRemoveFromViewCompleted() -{ - if (QMessageBox::question(nullptr, tr("Are you sure?"), - tr("This will permanently remove all installed downloads from this list (but NOT from disk)."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - emit removeDownload(-2, false); - } -} - -void DownloadListWidgetCompactDelegate::issueRemoveFromViewUninstalled() -{ - if (QMessageBox::question(nullptr, tr("Are you sure?"), - tr("This will permanently remove all uninstalled downloads from this list (but NOT from disk)."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - emit removeDownload(-3, false); - } -} - - -bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, - const QStyleOptionViewItem &option, const QModelIndex &index) -{ - try { - if (event->type() == QEvent::MouseButtonDblClick) { - QModelIndex sourceIndex = qobject_cast(model)->mapToSource(index); - if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) { - emit installDownload(sourceIndex.row()); - } else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) { - emit resumeDownload(sourceIndex.row()); - } - return true; - } else if (event->type() == QEvent::MouseButtonRelease) { - QMouseEvent *mouseEvent = static_cast(event); - if (mouseEvent->button() == Qt::RightButton) { - QMenu menu; - bool hidden = false; - m_ContextIndex = qobject_cast(model)->mapToSource(index); - if (m_ContextIndex.row() < m_Manager->numTotalDownloads()) { - DownloadManager::DownloadState state = m_Manager->getState(m_ContextIndex.row()); - hidden = m_Manager->isHidden(m_ContextIndex.row()); - if (state >= DownloadManager::STATE_READY) { - menu.addAction(tr("Install"), this, SLOT(issueInstall())); - if (m_Manager->isInfoIncomplete(m_ContextIndex.row())) { - menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo())); - }else { - menu.addAction(tr("Visit on Nexus"), this, SLOT(issueVisitOnNexus())); - } - menu.addAction(tr("Open File"), this, SLOT(issueOpenFile())); - menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); - menu.addSeparator(); - menu.addAction(tr("Delete"), this, SLOT(issueDelete())); - if (hidden) { - menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView())); - } else { - menu.addAction(tr("Hide"), this, SLOT(issueRemoveFromView())); - } - } else if (state == DownloadManager::STATE_DOWNLOADING){ - menu.addAction(tr("Cancel"), this, SLOT(issueCancel())); - menu.addAction(tr("Pause"), this, SLOT(issuePause())); - menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); - } else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) { - menu.addAction(tr("Remove"), this, SLOT(issueDelete())); - menu.addAction(tr("Resume"), this, SLOT(issueResume())); - menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); - } - menu.addSeparator(); - } - menu.addAction(tr("Delete Installed..."), this, SLOT(issueDeleteCompleted())); - menu.addAction(tr("Delete Uninstalled..."), this, SLOT(issueDeleteUninstalled())); - menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll())); - if (!hidden) { - menu.addSeparator(); - menu.addAction(tr("Hide Installed..."), this, SLOT(issueRemoveFromViewCompleted())); - menu.addAction(tr("Hide Uninstalled..."), this, SLOT(issueRemoveFromViewUninstalled())); - menu.addAction(tr("Hide All..."), this, SLOT(issueRemoveFromViewAll())); - } - if (hidden) { - menu.addSeparator(); - menu.addAction(tr("Un-Hide All..."), this, SLOT(issueRestoreToViewAll())); - } - menu.exec(mouseEvent->globalPos()); - - event->accept(); - return false; - } - } - } catch (const std::exception &e) { - qCritical("failed to handle editor event: %s", e.what()); - } - - return QItemDelegate::editorEvent(event, model, option, index); -} diff --git a/src/downloadlistwidgetcompact.h b/src/downloadlistwidgetcompact.h deleted file mode 100644 index eb109f29..00000000 --- a/src/downloadlistwidgetcompact.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef DOWNLOADLISTWIDGETCOMPACT_H -#define DOWNLOADLISTWIDGETCOMPACT_H - -#include -#include -#include -#include -#include -#include "downloadmanager.h" - - -namespace Ui { -class DownloadListWidgetCompact; -} - -class DownloadListWidgetCompact : public QWidget -{ - Q_OBJECT - -public: - explicit DownloadListWidgetCompact(QWidget *parent = 0); - ~DownloadListWidgetCompact(); - -private: - Ui::DownloadListWidgetCompact *ui; - int m_ContextRow; -}; - -class DownloadManager; - -class DownloadListWidgetCompactDelegate : public QItemDelegate -{ - - Q_OBJECT - -public: - - DownloadListWidgetCompactDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent = 0); - ~DownloadListWidgetCompactDelegate(); - - virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; - -signals: - - void installDownload(int index); - void queryInfo(int index); - void removeDownload(int index, bool deleteFile); - void restoreDownload(int index); - void cancelDownload(int index); - void pauseDownload(int index); - void resumeDownload(int index); - void visitOnNexus(int index); - void openFile(int index); - void openInDownloadsFolder(int index); - -protected: - - QString sizeFormat(quint64 size) const; - bool editorEvent(QEvent *event, QAbstractItemModel *model, - const QStyleOptionViewItem &option, const QModelIndex &index); - -private: - - void drawCache(QPainter *painter, const QStyleOptionViewItem &option, const QPixmap &cache) const; - void paintPendingDownload(int downloadIndex) const; - void paintRegularDownload(int downloadIndex) const; - -private slots: - - void issueInstall(); - void issueDelete(); - void issueRemoveFromView(); - void issueRestoreToView(); - void issueRestoreToViewAll(); - void issueVisitOnNexus(); - void issueOpenFile(); - void issueOpenInDownloadsFolder(); - void issueCancel(); - void issuePause(); - void issueResume(); - void issueDeleteAll(); - void issueDeleteCompleted(); - void issueDeleteUninstalled(); - void issueRemoveFromViewAll(); - void issueRemoveFromViewCompleted(); - void issueRemoveFromViewUninstalled(); - void issueQueryInfo(); - - void stateChanged(int row, DownloadManager::DownloadState); - void resetCache(int); -private: - - DownloadListWidgetCompact *m_ItemWidget; - DownloadManager *m_Manager; - - bool m_MetaDisplay; - - QLabel *m_NameLabel; - QLabel *m_SizeLabel; - QProgressBar *m_Progress; - QLabel *m_DoneLabel; - - QModelIndex m_ContextIndex; - - QTreeView *m_View; - - mutable QMap m_Cache; - -}; - -#endif // DOWNLOADLISTWIDGETCOMPACT_H diff --git a/src/downloadlistwidgetcompact.ui b/src/downloadlistwidgetcompact.ui deleted file mode 100644 index ab634fb5..00000000 --- a/src/downloadlistwidgetcompact.ui +++ /dev/null @@ -1,168 +0,0 @@ - - - DownloadListWidgetCompact - - - - 0 - 0 - 315 - 24 - - - - Qt::CustomContextMenu - - - Placeholder - - - true - - - - 2 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Qt::NoContextMenu - - - Placeholder - - - - - - - Qt::Horizontal - - - - 10 - 20 - - - - - - - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 118 - 0 - - - - - - - - - 0 - 118 - 0 - - - - - - - - - 120 - 120 - 120 - - - - - - - - Qt::NoContextMenu - - - Done - - - false - - - - - - - - 1 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16 - - - - Qt::NoContextMenu - - - 0 - - - - - - - - diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b618a661..9ae7e2de 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -55,7 +55,6 @@ along with Mod Organizer. If not, see . #include "activatemodsdialog.h" #include "downloadlist.h" #include "downloadlistwidget.h" -#include "downloadlistwidgetcompact.h" #include "messagedialog.h" #include "installationmanager.h" #include "lockeddialog.h" diff --git a/src/organizer.pro b/src/organizer.pro index df42db40..b8e79e0c 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -53,7 +53,6 @@ SOURCES += \ executableslist.cpp \ editexecutablesdialog.cpp \ downloadmanager.cpp \ - downloadlistwidgetcompact.cpp \ downloadlistwidget.cpp \ downloadlistsortproxy.cpp \ downloadlist.cpp \ @@ -130,7 +129,6 @@ HEADERS += \ executableslist.h \ editexecutablesdialog.h \ downloadmanager.h \ - downloadlistwidgetcompact.h \ downloadlistwidget.h \ downloadlistsortproxy.h \ downloadlist.h \ @@ -190,8 +188,6 @@ FORMS += \ installdialog.ui \ finddialog.ui \ editexecutablesdialog.ui \ - downloadlistwidgetcompact.ui \ - downloadlistwidget.ui \ credentialsdialog.ui \ categoriesdialog.ui \ activatemodsdialog.ui \ diff --git a/src/organizer_en.ts b/src/organizer_en.ts index e958c116..71a438cb 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -307,390 +307,229 @@ p, li { white-space: pre-wrap; } - - Installed + + < game %1 mod %2 file %3 > - - Uninstalled + + Unknown - Downloaded + Pending - - Paused + + Started - - Information missing, please select "Query Info" from the context menu to re-retrieve. + + Canceling - pending download - - - - - DownloadListWidget - - - - Placeholder - - - - - Done - Double Click to install + Pausing - - Install - - - - - Query Info - - - - - Visit on Nexus - - - - - Open File - - - - - - - Show in Folder - - - - - - Delete - - - - - Un-Hide - - - - - Hide - - - - - Cancel - - - - - Pause + + Canceled - - Resume + + Paused - - Delete Installed... + + Error - - Delete Uninstalled... + + Fetching Info 1 - - Delete All... + + Fetching Info 2 - - Hide Installed... + + Downloaded - - Hide Uninstalled... + + Installed - - Hide All... + + Uninstalled - - Un-Hide All... + + pending download - - - - - Delete Files? + + Information missing, please select "Query Info" from the context menu to re-retrieve. + + + DownloadListWidget - - This will permanently delete the selected download. + + Install - - This will remove all finished downloads from this list and from disk. + + Query Info - - This will remove all installed downloads from this list and from disk. + + Visit on Nexus - - This will remove all uninstalled downloads from this list and from disk. + + Open File - - - - Are you sure? + + + + Show in Folder - - This will remove all finished downloads from this list (but NOT from disk). + + + Delete - - This will remove all installed downloads from this list (but NOT from disk). + + Un-Hide - - This will remove all uninstalled downloads from this list (but NOT from disk). + + Hide - - - DownloadListWidgetCompact - - - Placeholder + + Cancel - - Done + + Pause - - - DownloadListWidgetCompactDelegate - - < game %1 mod %2 file %3 > + + Resume - - Pending + + Delete Installed... - - Paused + + Delete Uninstalled... - - Fetching Info 1 + + Delete All... - - Fetching Info 2 + + Hide Installed... - - Installed + + Hide Uninstalled... - - Uninstalled + + Hide All... - - Done + + Un-Hide All... - - - - - - - - Are you sure? + + + + + Delete Files? - + This will permanently delete the selected download. - + This will remove all finished downloads from this list and from disk. - + This will remove all installed downloads from this list and from disk. - + This will remove all uninstalled downloads from this list and from disk. - - This will permanently remove all finished downloads from this list (but NOT from disk). - - - - - This will permanently remove all installed downloads from this list (but NOT from disk). - - - - - This will permanently remove all uninstalled downloads from this list (but NOT from disk). - - - - - Install - - - - - Query Info - - - - - Visit on Nexus - - - - - Open File - - - - - - - Show in Folder - - - - - Delete - - - - - Un-Hide - - - - - Hide - - - - - Cancel - - - - - Pause - - - - - Remove - - - - - Resume - - - - - Delete Installed... - - - - - Delete Uninstalled... - - - - - Delete All... - - - - - Hide Installed... + + + + Are you sure? - - Hide Uninstalled... + + This will remove all finished downloads from this list (but NOT from disk). - - Hide All... + + This will remove all installed downloads from this list (but NOT from disk). - - Un-Hide All... + + This will remove all uninstalled downloads from this list (but NOT from disk). @@ -1592,7 +1431,7 @@ p, li { white-space: pre-wrap; } - + Create Backup @@ -1768,8 +1607,8 @@ p, li { white-space: pre-wrap; } - - + + Refresh @@ -1953,7 +1792,7 @@ p, li { white-space: pre-wrap; } - + Update @@ -1964,7 +1803,7 @@ p, li { white-space: pre-wrap; } - + No Problems @@ -1994,7 +1833,7 @@ Right now this has very limited functionality - + Endorse Mod Organizer @@ -2014,850 +1853,850 @@ Right now this has very limited functionality - + Toolbar - + Desktop - + Start Menu - + There is no supported sort mechanism for this game. You will probably have to use a third-party tool. - + Crash on exit - + MO crashed while exiting. Some settings may not be saved. Error: %1 - + Problems - + There are potential problems with your setup - + Everything seems to be in order - - - + + + Endorse - + Won't Endorse - + Help on UI - + Documentation Wiki - + Report Issue - + Tutorials - + About - + About Qt - + Name - + Please enter a name for the new profile - + failed to create profile: %1 - + Show tutorial? - + You are starting Mod Organizer for the first time. Do you want to show a tutorial of its basic features? If you choose no you can always start the tutorial from the "Help"-menu. - + Downloads in progress - + There are still downloads in progress, do you really want to quit? - + Plugin "%1" failed: %2 - + Plugin "%1" failed - + Browse Mod Page - + Also in: <br> - + No conflict - + <Edit...> - + This bsa is enabled in the ini file so it may be required! - + Activating Network Proxy - + Notice: Your current MO version (%1) is lower than the previous version (%2).<br>The GUI may not downgrade gracefully, so you may experience oddities.<br>However, there should be no serious issues. - + Choose Mod - + Mod Archive - + Start Tutorial? - + You're about to start a tutorial. For technical reasons it's not possible to end the tutorial early. Continue? - + failed to spawn notepad.exe: %1 - + failed to change origin name: %1 - + failed to move "%1" from mod "%2" to "%3": %4 - + <Contains %1> - + <Checked> - + <Unchecked> - + <Update> - + <Mod Backup> - + <Managed by MO> - + <Managed outside MO> - + <No category> - + <Conflicted> - + <Not Endorsed> - + failed to rename mod: %1 - + Overwrite? - + This will replace the existing mod "%1". Continue? - + failed to remove mod "%1" - - - + + + failed to rename "%1" to "%2" - - - - + + + + Confirm - + Remove the following mods?<br><ul>%1</ul> - + failed to remove mod: %1 - - - + + + Failed - + Installation file no longer exists - + Mods installed with old versions of MO can't be reinstalled in this way. - + Failed to create backup. - + You need to be logged in with Nexus to resume a download - - - - + + + + You need to be logged in with Nexus to endorse - - + + Endorsing multiple mods will take a while. Please wait... - - + + Unendorsing multiple mods will take a while. Please wait... - + Failed to display overwrite dialog: %1 - + Opening Nexus Links - + You are trying to open %1 links to Nexus Mods. Are you sure you want to do this? - + Nexus ID for this Mod is unknown - + Web page for this mod is unknown - + <table cellspacing="5"><tr><th>Type</th><th>All</th><th>Visible</th><tr><td>Enabled mods:&emsp;</td><td align=right>%1 / %2</td><td align=right>%3 / %4</td></tr><tr><td>Unmanaged/DLCs:&emsp;</td><td align=right>%5</td><td align=right>%6</td></tr><tr><td>Mod backups:&emsp;</td><td align=right>%7</td><td align=right>%8</td></tr><tr><td>Separators:&emsp;</td><td align=right>%9</td><td align=right>%10</td></tr></table> - + <table cellspacing="4"><tr><th>Type</th><th>Active</th><th>Total</th></tr><tr><td>Active plugins:</td><td align=right>%1</td><td align=right>%2</td></tr><tr><td>Active ESMs:</td><td align=right>%3</td><td align=right>%4</td></tr><tr><td>Active ESPs:</td><td align=right>%7</td><td align=right>%8</td></tr><tr><td>Active ESMs+ESPs:</td><td align=right>%9</td><td align=right>%10</td></tr><tr><td>Active ESLs:</td><td align=right>%5</td><td align=right>%6</td></tr></table> - - - + + + Create Mod... - + This will create an empty mod. Please enter a name: - - + + A mod with this name already exists - + Create Separator... - + This will create a new separator. Please enter a name: - + A separator with this name already exists - + This will move all files from overwrite into a new, regular mod. Please enter a name: - - + + Are you sure? - + About to recursively delete: - + Not logged in, endorsement information will be wrong - + Continue? - + The versioning scheme decides which version is considered newer than another. This function will guess the versioning scheme under the assumption that the installed version is outdated. - - + + Sorry - + I don't know a versioning scheme where %1 is newer than %2. - + Really enable all visible mods? - + Really disable all visible mods? - + Export to csv - + CSV (Comma Separated Values) is a format that can be imported in programs like Excel to create a spreadsheet. You can also use online editors and converters instead. - + Select what mods you want export: - + All installed mods - + Only active (checked) mods from your current profile - + All currently visible mods in the mod list - + Choose what Columns to export: - + Mod_Priority - + Mod_Name - + Mod_Status - + Primary_Category - + Nexus_ID - + Mod_Nexus_URL - + Mod_Version - + Install_Date - + Download_File_Name - + export failed: %1 - + Open Game folder - + Open MyGames folder - + Open INIs folder - + Open Instance folder - + Open Mods folder - + Open Profile folder - + Open Downloads folder - + Open MO2 Install folder - + Open MO2 Plugins folder - + Open MO2 Logs folder - + Install Mod... - + Create empty mod - + Create Separator - + Enable all visible - + Disable all visible - + Check all for update - + Export to csv... - - + + Send to - - + + Top - - + + Bottom - - + + Priority... - + Separator... - + All Mods - + Sync to Mods... - + Clear Overwrite... - - + + Open in Explorer - + Restore Backup - + Remove Backup... - - + + Change Categories - - + + Primary Category - + Rename Separator... - + Remove Separator... - + Select Color... - + Reset Color - + Change versioning scheme - + Un-ignore update - + Ignore update - - + + Enable selected - - + + Disable selected - + Rename Mod... - + Reinstall Mod - + Remove Mod... - + Un-Endorse - + Won't endorse - + Endorsement state unknown - + Ignore missing data - + Mark as converted/working - + Visit on Nexus - + Visit web page - + Information... - - + + Exception: - - + + Unknown exception - + <All> - + <Multiple> - + %1 more - + Are you sure you want to remove the following %n save(s)?<br><ul>%1</ul><br>Removed saves will be sent to the Recycle Bin. @@ -2865,12 +2704,12 @@ You can also use online editors and converters instead. - + Enable Mods... - + Delete %n save(s) @@ -2878,22 +2717,22 @@ You can also use online editors and converters instead. - + failed to remove %1 - + failed to create %1 - + Restarting MO - + Changing the managed game directory requires restarting MO. Any pending downloads will be paused. @@ -2901,335 +2740,335 @@ Click OK to restart MO now. - + Can't change download directory while downloads are in progress! - + failed to write to file %1 - + %1 written - + Select binary - + Binary - + Enter Name - + Please enter a name for the executable - + Not an executable - + This is not a recognized executable. - - + + Replace file? - + There already is a hidden version of this file. Replace it? - - + + File operation failed - - + + Failed to remove "%1". Maybe you lack the required file permissions? - + There already is a visible version of this file. Replace it? - - + + Set Priority - + Set the priority of the selected plugins - + file not found: %1 - + failed to generate preview for %1 - + Sorry, can't preview anything. This function currently does not support extracting from bsas. - + Update available - + Open/Execute - + Add as Executable - + Preview - + Un-Hide - + Hide - + Write To File... - + Do you want to endorse Mod Organizer on %1 now? - + Thank you! - + Thank you for your endorsement! - + Request to Nexus failed: %1 - - + + failed to read %1: %2 - - + + Error - + failed to extract %1 (errorcode %2) - + Extract BSA - + This archive contains invalid hashes. Some files may be broken. - + Extract... - + This will restart MO, continue? - + Edit Categories... - + Deselect filter - + Remove - + Enable all - + Disable all - + Unlock load order - + Lock load order - + Open Origin in Explorer - + Open Origin Info... - + depends on missing "%1" - + incompatible with "%1" - + Please wait while LOOT is running - + loot failed. Exit code was: %1 - + failed to start loot - + failed to run loot: %1 - + Errors occured - + Backup of load order created - + Choose backup to restore - + No Backups - + There are no backups to restore - - + + Restore failed - - + + Failed to restore the backup. Errorcode: %1 - + Backup of modlist created - + A file with the same name has already been downloaded. What would you like to do? - + Overwrite - + Rename new file - + Ignore file - + Set the priority of the selected mods @@ -5586,18 +5425,18 @@ If the folder was still in use, restart MO and try again. - + Please use "Help" from the toolbar to get usage instructions to all elements - - + + <Manage...> - + failed to parse profile %1: %2 -- cgit v1.3.1 From cfb941082e27925279535cade18d2b3c912c8930 Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Sun, 30 Dec 2018 19:41:05 +0100 Subject: Add downloadlist styling tweaks --- src/downloadlist.cpp | 33 +++++++++++++++++++++++++-------- src/downloadlist.h | 2 ++ src/downloadlistsortproxy.cpp | 4 ++-- src/mainwindow.cpp | 7 +++++-- src/organizer_en.ts | 38 +++++++++++++++++++------------------- 5 files changed, 53 insertions(+), 31 deletions(-) (limited to 'src/mainwindow.cpp') 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 . #include "downloadlist.h" #include "downloadmanager.h" #include +#include #include 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 . #define DOWNLOADLIST_H #include +#include 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; } DownloadList - + Name - + Size - + Status - + < game %1 mod %2 file %3 > - + Unknown - + Pending - + Started - + Canceling - + Pausing - + Canceled - + Paused - + Error - + Fetching Info 1 - + Fetching Info 2 - + Downloaded - + Installed - + Uninstalled - + pending download - + Information missing, please select "Query Info" from the context menu to re-retrieve. -- cgit v1.3.1 From c11ff7e2db09514304cef35a650aa3fbef27dd16 Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Sun, 30 Dec 2018 22:13:15 +0100 Subject: Add icon for incomplete download info, add download progress delegate --- src/downloadlist.cpp | 5 +++++ src/downloadlist.h | 1 - src/downloadlistwidget.cpp | 26 ++++++++++++++++++++++++++ src/downloadlistwidget.h | 18 ++++++++++++++++++ src/downloadmanager.cpp | 6 +++--- src/mainwindow.cpp | 7 ++++--- src/mainwindow.h | 2 +- 7 files changed, 57 insertions(+), 8 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp index d78e97f9..09f6968c 100644 --- a/src/downloadlist.cpp +++ b/src/downloadlist.cpp @@ -21,6 +21,7 @@ along with Mod Organizer. If not, see . #include "downloadmanager.h" #include #include +#include #include @@ -147,6 +148,10 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const } return text; } + } else if (role == Qt::DecorationRole && index.column() == COL_NAME) { + if (!pendingDownload && m_Manager->getState(index.row()) >= DownloadManager::STATE_READY + && m_Manager->isInfoIncomplete(index.row())) + return QIcon(":/MO/gui/warning_16"); } else if (role == Qt::TextAlignmentRole) { if (index.column() == COL_SIZE) return Qt::AlignVCenter | Qt::AlignRight; diff --git a/src/downloadlist.h b/src/downloadlist.h index d7764763..3b33fc40 100644 --- a/src/downloadlist.h +++ b/src/downloadlist.h @@ -23,7 +23,6 @@ along with Mod Organizer. If not, see . #include #include - class DownloadManager; diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index 9cf8e097..6a85c317 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -17,13 +17,39 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ +#include "downloadlist.h" #include "downloadlistwidget.h" #include #include #include #include #include +#include +void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + QModelIndex sourceIndex = m_SortProxy->mapToSource(index); + if (sourceIndex.column() == DownloadList::COL_STATUS && sourceIndex.row() < m_Manager->numTotalDownloads() + && m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_DOWNLOADING) { + bool pendingDownload = sourceIndex.row() >= m_Manager->numTotalDownloads(); + QStyleOptionProgressBar progressBarOption; + progressBarOption.state = QStyle::State_Enabled; + progressBarOption.direction = QApplication::layoutDirection(); + progressBarOption.rect = option.rect; + progressBarOption.fontMetrics = QApplication::fontMetrics(); + progressBarOption.minimum = 0; + progressBarOption.maximum = 100; + progressBarOption.textAlignment = Qt::AlignCenter; + progressBarOption.textVisible = true; + progressBarOption.progress = m_Manager->getProgress(sourceIndex.row()).first; + progressBarOption.text = m_Manager->getProgress(sourceIndex.row()).second; + + QApplication::style()->drawControl(QStyle::CE_ProgressBar, + &progressBarOption, painter); + } else { + QStyledItemDelegate::paint(painter, option, index); + } +} DownloadListWidget::DownloadListWidget(QWidget *parent) : QTreeView(parent) diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h index 0c17de87..c19e4473 100644 --- a/src/downloadlistwidget.h +++ b/src/downloadlistwidget.h @@ -21,11 +21,14 @@ along with Mod Organizer. If not, see . #define DOWNLOADLISTWIDGET_H #include "downloadmanager.h" +#include "downloadlistsortproxy.h" #include #include #include #include #include +#include + namespace Ui { class DownloadListWidget; @@ -33,6 +36,21 @@ namespace Ui { class DownloadManager; +class DownloadProgressDelegate : public QStyledItemDelegate +{ + Q_OBJECT + +public: + DownloadProgressDelegate(DownloadManager *manager, DownloadListSortProxy *sortProxy, QWidget *parent = 0) : QStyledItemDelegate(parent), m_Manager(manager), m_SortProxy(sortProxy) {} + + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const override; + +private: + DownloadManager *m_Manager; + DownloadListSortProxy *m_SortProxy; +}; + class DownloadListWidget : public QTreeView { Q_OBJECT diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 9f07b030..b94b5864 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -64,7 +64,7 @@ DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createNew(const Mo info->m_DownloadID = s_NextDownloadID++; info->m_StartTime.start(); info->m_PreResumeSize = 0LL; - info->m_Progress = std::make_pair(0, " 0.0 Bytes/s "); + info->m_Progress = std::make_pair(0, "0.0 B/s "); info->m_ResumePos = 0; info->m_FileInfo = new ModRepositoryFileInfo(*fileInfo); info->m_Urls = URLs; @@ -1338,7 +1338,7 @@ void DownloadManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) QString unit; if (speed < 1000) { - unit = "Bytes/s"; + unit = "B/s"; } else if (speed < 1000*1024) { speed /= 1024; @@ -1349,7 +1349,7 @@ void DownloadManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) unit = "MB/s"; } - info->m_Progress.second = QString::fromLatin1("%1% - %2 %3").arg(info->m_Progress.first).arg(speed, 8, 'f', 1,' ').arg(unit, -8, ' '); + info->m_Progress.second = QString::fromLatin1("%1% - %2 %3").arg(info->m_Progress.first).arg(QString::number(speed, 'f', 1)).arg(unit); TaskProgressManager::instance().updateProgress(info->m_TaskProgressId, bytesReceived, bytesTotal); emit update(index); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b2876e33..4f60ae16 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -319,6 +319,7 @@ MainWindow::MainWindow(QSettings &initSettings //ui->bsaList->setLocalMoveOnly(true); + initDownloadView(); bool pluginListAdjusted = registerWidgetState(ui->espList->objectName(), ui->espList->header(), "plugin_list_state"); registerWidgetState(ui->dataTree->objectName(), ui->dataTree->header()); registerWidgetState(ui->downloadView->objectName(), @@ -340,8 +341,6 @@ MainWindow::MainWindow(QSettings &initSettings ui->openFolderMenu->setMenu(openFolderMenu()); - initDownloadList(); - ui->savegameList->installEventFilter(this); ui->savegameList->setMouseTracking(true); @@ -5145,15 +5144,17 @@ void MainWindow::on_actionEndorseMO_triggered() } -void MainWindow::initDownloadList() +void MainWindow::initDownloadView() { DownloadListSortProxy *sortProxy = new DownloadListSortProxy(m_OrganizerCore.downloadManager(), ui->downloadView); sortProxy->setSourceModel(new DownloadList(m_OrganizerCore.downloadManager(), ui->downloadView)); connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), sortProxy, SLOT(updateFilter(QString))); connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(downloadFilterChanged(QString))); + ui->downloadView->setObjectName("downloadView"); ui->downloadView->setModel(sortProxy); ui->downloadView->setManager(m_OrganizerCore.downloadManager()); + ui->downloadView->setItemDelegate(new DownloadProgressDelegate(m_OrganizerCore.downloadManager(), sortProxy, ui->downloadView)); ui->downloadView->setUniformRowHeights(true); ui->downloadView->header()->setStretchLastSection(false); ui->downloadView->header()->setSectionResizeMode(QHeaderView::Interactive); diff --git a/src/mainwindow.h b/src/mainwindow.h index 93f2ed5f..13a66a8e 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -246,7 +246,7 @@ private: bool populateMenuCategories(QMenu *menu, int targetID); - void initDownloadList(); + void initDownloadView(); // remove invalid category-references from mods void fixCategories(); -- cgit v1.3.1 From 03823a433a27bb5f9a94973c47e1408dd83cc5c0 Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Mon, 31 Dec 2018 02:15:47 +0100 Subject: Add qss styling options for progress bar and compact mode widgets --- src/downloadlist.cpp | 13 +++---------- src/downloadlistwidget.cpp | 30 ++++++++++++++++-------------- src/mainwindow.cpp | 13 +++++++++++++ src/mainwindow.h | 1 + 4 files changed, 33 insertions(+), 24 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp index 09f6968c..6d79b0f5 100644 --- a/src/downloadlist.cpp +++ b/src/downloadlist.cpp @@ -98,8 +98,6 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const switch (m_Manager->getState(index.row())) { case DownloadManager::STATE_STARTED: return tr("Started"); - case DownloadManager::STATE_DOWNLOADING: - return m_Manager->getProgress(index.row()).second; case DownloadManager::STATE_CANCELING: return tr("Canceling"); case DownloadManager::STATE_PAUSING: @@ -153,15 +151,10 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const && m_Manager->isInfoIncomplete(index.row())) return QIcon(":/MO/gui/warning_16"); } else if (role == Qt::TextAlignmentRole) { - if (index.column() == COL_SIZE) - return Qt::AlignVCenter | Qt::AlignRight; - else + if (index.column() == COL_NAME) 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; + else + return Qt::AlignVCenter | Qt::AlignRight; } return QVariant(); } diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index 6a85c317..e908faf3 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -32,20 +32,22 @@ void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewIt if (sourceIndex.column() == DownloadList::COL_STATUS && sourceIndex.row() < m_Manager->numTotalDownloads() && m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_DOWNLOADING) { bool pendingDownload = sourceIndex.row() >= m_Manager->numTotalDownloads(); - QStyleOptionProgressBar progressBarOption; - progressBarOption.state = QStyle::State_Enabled; - progressBarOption.direction = QApplication::layoutDirection(); - progressBarOption.rect = option.rect; - progressBarOption.fontMetrics = QApplication::fontMetrics(); - progressBarOption.minimum = 0; - progressBarOption.maximum = 100; - progressBarOption.textAlignment = Qt::AlignCenter; - progressBarOption.textVisible = true; - progressBarOption.progress = m_Manager->getProgress(sourceIndex.row()).first; - progressBarOption.text = m_Manager->getProgress(sourceIndex.row()).second; - - QApplication::style()->drawControl(QStyle::CE_ProgressBar, - &progressBarOption, painter); + QProgressBar progressBarOption; + progressBarOption.setProperty("compact", option.widget->property("compact")); + progressBarOption.setMinimum(0); + progressBarOption.setMaximum(100); + progressBarOption.setAlignment(Qt::AlignCenter); + progressBarOption.resize(option.rect.width(), option.rect.height()); + progressBarOption.setValue(m_Manager->getProgress(sourceIndex.row()).first); + progressBarOption.setFormat(m_Manager->getProgress(sourceIndex.row()).second); + + // paint the background with default delegate first to preserve table cell styling + QStyledItemDelegate::paint(painter, option, index); + + painter->save(); + painter->translate(option.rect.topLeft()); + progressBarOption.render(painter); + painter->restore(); } else { QStyledItemDelegate::paint(painter, option, index); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4f60ae16..328c0b2d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4655,6 +4655,8 @@ void MainWindow::on_actionSettings_triggered() NexusInterface::instance(&m_PluginContainer)->setNMMVersion(settings.getNMMVersion()); + updateDownloadView(); + m_OrganizerCore.updateVFSParams(settings.logLevel(), settings.crashDumpsType(), settings.executablesBlacklist()); m_OrganizerCore.cycleDiagnostics(); } @@ -4709,6 +4711,7 @@ void MainWindow::languageChange(const QString &newLanguage) createHelpWidget(); + updateDownloadView(); updateProblemsButton(); ui->listOptionsBtn->setMenu(modListContextMenu()); @@ -5160,6 +5163,7 @@ void MainWindow::initDownloadView() ui->downloadView->header()->setSectionResizeMode(QHeaderView::Interactive); ui->downloadView->header()->setSectionResizeMode(0, QHeaderView::Stretch); ui->downloadView->sortByColumn(1, Qt::DescendingOrder); + updateDownloadView(); connect(ui->downloadView, SIGNAL(installDownload(int)), &m_OrganizerCore, SLOT(installDownload(int))); connect(ui->downloadView, SIGNAL(queryInfo(int)), m_OrganizerCore.downloadManager(), SLOT(queryInfo(int))); @@ -5173,6 +5177,15 @@ void MainWindow::initDownloadView() connect(ui->downloadView, SIGNAL(resumeDownload(int)), this, SLOT(resumeDownload(int))); } +void MainWindow::updateDownloadView() +{ + if (m_OrganizerCore.settings().compactDownloads()) + ui->downloadView->setProperty("compact", true); + else + ui->downloadView->setProperty("compact", false); + ui->downloadView->style()->unpolish(ui->downloadView); + ui->downloadView->style()->polish(ui->downloadView); +} void MainWindow::modDetailsUpdated(bool) { diff --git a/src/mainwindow.h b/src/mainwindow.h index 13a66a8e..a419b797 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -247,6 +247,7 @@ private: bool populateMenuCategories(QMenu *menu, int targetID); void initDownloadView(); + void updateDownloadView(); // remove invalid category-references from mods void fixCategories(); -- cgit v1.3.1 From 412a0620820d26294ddbc306b137692c65e8e980 Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Mon, 31 Dec 2018 16:08:47 +0100 Subject: Tweak styling options for downloads tab, port Paper Light theme for reference --- src/downloadlistwidget.cpp | 28 +++++++++++++++-------- src/mainwindow.cpp | 7 +++--- src/stylesheets/Paper Light by 6788.qss | 39 +++++++++++++++++++-------------- 3 files changed, 44 insertions(+), 30 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index e908faf3..ac327f7b 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -32,21 +32,31 @@ void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewIt if (sourceIndex.column() == DownloadList::COL_STATUS && sourceIndex.row() < m_Manager->numTotalDownloads() && m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_DOWNLOADING) { bool pendingDownload = sourceIndex.row() >= m_Manager->numTotalDownloads(); - QProgressBar progressBarOption; - progressBarOption.setProperty("compact", option.widget->property("compact")); - progressBarOption.setMinimum(0); - progressBarOption.setMaximum(100); - progressBarOption.setAlignment(Qt::AlignCenter); - progressBarOption.resize(option.rect.width(), option.rect.height()); - progressBarOption.setValue(m_Manager->getProgress(sourceIndex.row()).first); - progressBarOption.setFormat(m_Manager->getProgress(sourceIndex.row()).second); + QProgressBar progressBar; + progressBar.setProperty("downloadView", option.widget->property("downloadView")); + progressBar.resize(option.rect.width(), option.rect.height()); + progressBar.setTextVisible(false); + progressBar.setMinimum(0); + progressBar.setMaximum(100); + progressBar.setValue(m_Manager->getProgress(sourceIndex.row()).first); + progressBar.setStyle(QApplication::style()); + + QLabel progressText; + progressText.setProperty("downloadView", option.widget->property("downloadView")); + progressText.setProperty("downloadProgress", true); + progressText.resize(option.rect.width(), option.rect.height()); + progressText.setAttribute(Qt::WA_TranslucentBackground); + progressText.setAlignment(Qt::AlignCenter); + progressText.setText(m_Manager->getProgress(sourceIndex.row()).second); + progressText.setStyle(QApplication::style()); // paint the background with default delegate first to preserve table cell styling QStyledItemDelegate::paint(painter, option, index); painter->save(); painter->translate(option.rect.topLeft()); - progressBarOption.render(painter); + progressBar.render(painter); + progressText.render(painter); painter->restore(); } else { QStyledItemDelegate::paint(painter, option, index); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 328c0b2d..b4d77085 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5154,8 +5154,7 @@ void MainWindow::initDownloadView() connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), sortProxy, SLOT(updateFilter(QString))); connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(downloadFilterChanged(QString))); - ui->downloadView->setObjectName("downloadView"); - ui->downloadView->setModel(sortProxy); + ui->downloadView->setModel(sortProxy); ui->downloadView->setManager(m_OrganizerCore.downloadManager()); ui->downloadView->setItemDelegate(new DownloadProgressDelegate(m_OrganizerCore.downloadManager(), sortProxy, ui->downloadView)); ui->downloadView->setUniformRowHeights(true); @@ -5180,9 +5179,9 @@ void MainWindow::initDownloadView() void MainWindow::updateDownloadView() { if (m_OrganizerCore.settings().compactDownloads()) - ui->downloadView->setProperty("compact", true); + ui->downloadView->setProperty("downloadView", "compact"); else - ui->downloadView->setProperty("compact", false); + ui->downloadView->setProperty("downloadView", "standard"); ui->downloadView->style()->unpolish(ui->downloadView); ui->downloadView->style()->polish(ui->downloadView); } diff --git a/src/stylesheets/Paper Light by 6788.qss b/src/stylesheets/Paper Light by 6788.qss index 36585291..3193b817 100644 --- a/src/stylesheets/Paper Light by 6788.qss +++ b/src/stylesheets/Paper Light by 6788.qss @@ -680,10 +680,9 @@ QToolTip { border-radius: 6px; } -/* Progress Bars (Downloads) */ +/* Progress Bars */ QProgressBar { - /* progress bars when downloading */ background: #FFFFFF; text-align: center; border: 0px; @@ -929,29 +928,35 @@ QSlider::handle:hover { background: #EBEBEB; } -DownloadListWidget QFrame, -DownloadListWidgetCompact, -DownloadListWidgetCompact QLabel { - /* an entry on the Downloads tab */ - background: #FFFFFF; +DownloadListWidget[downloadView=standard]::item { + padding: 15px; + border-bottom: 2px solid #BBBBBB; } -DownloadListWidget #frame { - /* outer box of an entry on the Downloads tab */ - border: none; +QProgressBar[downloadView=standard] { + background: transparent; + border: 2px solid gray; + border-radius: 8px; + margin: 4px 0px 6px 0px; } -#installLabel { - /* installed/done label */ - color: none; +QLabel[downloadProgress] { + qproperty-alignment: AlignCenter; + padding-bottom: 3px; } /* Compact Downloads View */ -DownloadListWidgetCompact, -DownloadListWidgetCompact QLabel { - /* an entry on the Downloads tab */ - background: #FFFFFF; +DownloadListWidget[downloadView=compact]::item { + padding: 3px; + border-bottom: 2px solid #BBBBBB; +} + +QProgressBar[downloadView=compact] { + background: transparent; + border: 2px solid gray; + border-radius: 8px; + margin: 1px 0px 3px 0px; } /* Categories Filter */ -- cgit v1.3.1 From b8babae78a452071c3a707347d21a06fef759bab Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Mon, 31 Dec 2018 18:48:53 +0100 Subject: Fix download layout bug, port most of remaining themes --- src/downloadlist.cpp | 66 ++++++++++++--------------------- src/downloadlist.h | 1 - src/downloadlistwidget.cpp | 63 ++++++++++++++++--------------- src/downloadlistwidget.h | 2 - src/mainwindow.cpp | 1 + src/stylesheets/Paper Automata.qss | 27 +++++++------- src/stylesheets/Paper Dark by 6788.qss | 35 ++++++++--------- src/stylesheets/Paper Light by 6788.qss | 5 --- src/stylesheets/dark.qss | 9 ++++- src/stylesheets/dracula.qss | 22 ++++++++++- src/stylesheets/skyrim.qss | 10 ++++- src/stylesheets/vs15 Dark-Green.qss | 14 +++++-- src/stylesheets/vs15 Dark-Orange.qss | 14 +++++-- src/stylesheets/vs15 Dark-Purple.qss | 14 +++++-- src/stylesheets/vs15 Dark-Red.qss | 14 +++++-- src/stylesheets/vs15 Dark-Yellow.qss | 14 +++++-- src/stylesheets/vs15 Dark.qss | 14 +++++-- 17 files changed, 191 insertions(+), 134 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp index 6d79b0f5..fa2cc077 100644 --- a/src/downloadlist.cpp +++ b/src/downloadlist.cpp @@ -28,7 +28,6 @@ along with Mod Organizer. If not, see . 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())); @@ -81,50 +80,35 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const if (pendingDownload) { std::tuple nexusids = m_Manager->getPendingDownload(index.row() - m_Manager->numTotalDownloads()); switch (index.column()) { - case COL_NAME: - return tr("< game %1 mod %2 file %3 >").arg(std::get<0>(nexusids)).arg(std::get<1>(nexusids)).arg(std::get<2>(nexusids)); - case COL_SIZE: - return tr("Unknown"); - case COL_STATUS: - return tr("Pending"); + case COL_NAME: return tr("< game %1 mod %2 file %3 >").arg(std::get<0>(nexusids)).arg(std::get<1>(nexusids)).arg(std::get<2>(nexusids)); + case COL_SIZE: return tr("Unknown"); + case COL_STATUS: return tr("Pending"); } } else { switch (index.column()) { - case COL_NAME: - return m_Manager->getFileName(index.row()); - case COL_SIZE: - return sizeFormat(m_Manager->getFileSize(index.row())); + case COL_NAME: return m_Manager->getFileName(index.row()); + case COL_SIZE: return sizeFormat(m_Manager->getFileSize(index.row())); case COL_STATUS: switch (m_Manager->getState(index.row())) { - case DownloadManager::STATE_STARTED: - return tr("Started"); - case DownloadManager::STATE_CANCELING: - return tr("Canceling"); - case DownloadManager::STATE_PAUSING: - return tr("Pausing"); - case DownloadManager::STATE_CANCELED: - return tr("Canceled"); - case DownloadManager::STATE_PAUSED: - return tr("Paused"); - case DownloadManager::STATE_ERROR: - return tr("Error"); - case DownloadManager::STATE_FETCHINGMODINFO: - return tr("Fetching Info 1"); - case DownloadManager::STATE_FETCHINGFILEINFO: - return tr("Fetching Info 2"); - case DownloadManager::STATE_READY: - return tr("Downloaded"); - case DownloadManager::STATE_INSTALLED: - return tr("Installed"); - case DownloadManager::STATE_UNINSTALLED: - return tr("Uninstalled"); + // STATE_DOWNLOADING handled by DownloadProgressDelegate + case DownloadManager::STATE_STARTED: return tr("Started"); + case DownloadManager::STATE_CANCELING: return tr("Canceling"); + case DownloadManager::STATE_PAUSING: return tr("Pausing"); + case DownloadManager::STATE_CANCELED: return tr("Canceled"); + case DownloadManager::STATE_PAUSED: return tr("Paused"); + case DownloadManager::STATE_ERROR: return tr("Error"); + case DownloadManager::STATE_FETCHINGMODINFO: return tr("Fetching Info 1"); + case DownloadManager::STATE_FETCHINGFILEINFO: return tr("Fetching Info 2"); + case DownloadManager::STATE_READY: return tr("Downloaded"); + case DownloadManager::STATE_INSTALLED: return tr("Installed"); + case DownloadManager::STATE_UNINSTALLED: return tr("Uninstalled"); } } } - } else if (role == Qt::ForegroundRole) { + } else if (role == Qt::ForegroundRole && index.column() == COL_STATUS) { if (pendingDownload) { return QColor(Qt::darkBlue); - } else if (index.column() == COL_STATUS) { + } else { DownloadManager::DownloadState state = m_Manager->getState(index.row()); if (state == DownloadManager::STATE_READY) return QColor(Qt::darkGreen); @@ -135,7 +119,7 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const } } else if (role == Qt::ToolTipRole) { if (pendingDownload) { - return tr("pending download"); + return tr("Pending download"); } else { QString text = m_Manager->getFileName(index.row()) + "\n"; if (m_Manager->isInfoIncomplete(index.row())) { @@ -168,13 +152,12 @@ void DownloadList::aboutToUpdate() void DownloadList::update(int row) { - if (row < 0) { + if (row < 0) emit endResetModel(); - } else if (row < this->rowCount()) { + else if (row < this->rowCount()) emit dataChanged(this->index(row, 0, QModelIndex()), this->index(row, this->columnCount(QModelIndex())-1, QModelIndex())); - } else { + else qCritical("invalid row %d in download list, update failed", row); - } } QString DownloadList::sizeFormat(quint64 size) const @@ -187,8 +170,7 @@ QString DownloadList::sizeFormat(quint64 size) const QString unit("KB"); calc /= 1024.0; - while (calc >= 1024.0 && i.hasNext()) - { + while (calc >= 1024.0 && i.hasNext()) { unit = i.next(); calc /= 1024.0; } diff --git a/src/downloadlist.h b/src/downloadlist.h index 3b33fc40..4e0b5ef4 100644 --- a/src/downloadlist.h +++ b/src/downloadlist.h @@ -90,7 +90,6 @@ public slots: private: DownloadManager *m_Manager; - QFontMetrics m_FontMetrics; QString sizeFormat(quint64 size) const; }; diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index ac327f7b..f69f9e9f 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -34,13 +34,17 @@ void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewIt bool pendingDownload = sourceIndex.row() >= m_Manager->numTotalDownloads(); QProgressBar progressBar; progressBar.setProperty("downloadView", option.widget->property("downloadView")); + progressBar.setProperty("downloadProgress", true); progressBar.resize(option.rect.width(), option.rect.height()); - progressBar.setTextVisible(false); + progressBar.setTextVisible(true); + progressBar.setAlignment(Qt::AlignCenter); progressBar.setMinimum(0); progressBar.setMaximum(100); progressBar.setValue(m_Manager->getProgress(sourceIndex.row()).first); + progressBar.setFormat(m_Manager->getProgress(sourceIndex.row()).second); progressBar.setStyle(QApplication::style()); + /* QLabel progressText; progressText.setProperty("downloadView", option.widget->property("downloadView")); progressText.setProperty("downloadProgress", true); @@ -49,6 +53,7 @@ void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewIt progressText.setAlignment(Qt::AlignCenter); progressText.setText(m_Manager->getProgress(sourceIndex.row()).second); progressText.setStyle(QApplication::style()); + */ // paint the background with default delegate first to preserve table cell styling QStyledItemDelegate::paint(painter, option, index); @@ -56,7 +61,7 @@ void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewIt painter->save(); painter->translate(option.rect.topLeft()); progressBar.render(painter); - progressText.render(painter); + //progressText.render(painter); painter->restore(); } else { QStyledItemDelegate::paint(painter, option, index); @@ -82,11 +87,11 @@ void DownloadListWidget::setManager(DownloadManager *manager) void DownloadListWidget::onDoubleClick(const QModelIndex &index) { QModelIndex sourceIndex = qobject_cast(model())->mapToSource(index); - if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) { + if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) emit installDownload(sourceIndex.row()); - } else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) { + else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) + || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) emit resumeDownload(sourceIndex.row()); - } } void DownloadListWidget::onCustomContextMenu(const QPoint &point) @@ -94,38 +99,34 @@ void DownloadListWidget::onCustomContextMenu(const QPoint &point) QMenu menu(this); QModelIndex index = indexAt(point); bool hidden = false; + if (index.row() >= 0) { m_ContextRow = qobject_cast(model())->mapToSource(index).row(); DownloadManager::DownloadState state = m_Manager->getState(m_ContextRow); hidden = m_Manager->isHidden(m_ContextRow); + if (state >= DownloadManager::STATE_READY) { menu.addAction(tr("Install"), this, SLOT(issueInstall())); - if (m_Manager->isInfoIncomplete(m_ContextRow)) { + if (m_Manager->isInfoIncomplete(m_ContextRow)) menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo())); - } - else { + else menu.addAction(tr("Visit on Nexus"), this, SLOT(issueVisitOnNexus())); - } - menu.addAction(tr("Open File"), this, SLOT(issueOpenFile())); menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); menu.addSeparator(); menu.addAction(tr("Delete"), this, SLOT(issueDelete())); - if (hidden) { + if (hidden) menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView())); - } - else { + else menu.addAction(tr("Hide"), this, SLOT(issueRemoveFromView())); - } - } - else if (state == DownloadManager::STATE_DOWNLOADING) { + } else if (state == DownloadManager::STATE_DOWNLOADING) { menu.addAction(tr("Cancel"), this, SLOT(issueCancel())); menu.addAction(tr("Pause"), this, SLOT(issuePause())); menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); - } - else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) { + } else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) + || (state == DownloadManager::STATE_PAUSING)) { menu.addAction(tr("Delete"), this, SLOT(issueDelete())); menu.addAction(tr("Resume"), this, SLOT(issueResume())); menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder())); @@ -137,14 +138,12 @@ void DownloadListWidget::onCustomContextMenu(const QPoint &point) menu.addAction(tr("Delete Uninstalled..."), this, SLOT(issueDeleteUninstalled())); menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll())); + menu.addSeparator(); if (!hidden) { - menu.addSeparator(); menu.addAction(tr("Hide Installed..."), this, SLOT(issueRemoveFromViewCompleted())); menu.addAction(tr("Hide Uninstalled..."), this, SLOT(issueRemoveFromViewUninstalled())); menu.addAction(tr("Hide All..."), this, SLOT(issueRemoveFromViewAll())); - } - if (hidden) { - menu.addSeparator(); + } else { menu.addAction(tr("Un-Hide All..."), this, SLOT(issueRestoreToViewAll())); } @@ -163,11 +162,11 @@ void DownloadListWidget::issueQueryInfo() void DownloadListWidget::issueDelete() { - if (QMessageBox::question(nullptr, tr("Delete Files?"), - tr("This will permanently delete the selected download."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - emit removeDownload(m_ContextRow, true); - } + if (QMessageBox::question(nullptr, tr("Delete Files?"), + tr("This will permanently delete the selected download."), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + emit removeDownload(m_ContextRow, true); + } } void DownloadListWidget::issueRemoveFromView() @@ -178,7 +177,7 @@ void DownloadListWidget::issueRemoveFromView() void DownloadListWidget::issueRestoreToView() { - emit restoreDownload(m_ContextRow); + emit restoreDownload(m_ContextRow); } void DownloadListWidget::issueRestoreToViewAll() @@ -237,8 +236,8 @@ void DownloadListWidget::issueDeleteCompleted() void DownloadListWidget::issueDeleteUninstalled() { if (QMessageBox::question(nullptr, tr("Delete Files?"), - tr("This will remove all uninstalled downloads from this list and from disk."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + tr("This will remove all uninstalled downloads from this list and from disk."), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { emit removeDownload(-3, true); } } @@ -264,8 +263,8 @@ void DownloadListWidget::issueRemoveFromViewCompleted() void DownloadListWidget::issueRemoveFromViewUninstalled() { if (QMessageBox::question(nullptr, tr("Are you sure?"), - tr("This will remove all uninstalled downloads from this list (but NOT from disk)."), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + tr("This will remove all uninstalled downloads from this list (but NOT from disk)."), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { emit removeDownload(-3, false); } } diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h index c19e4473..93ece07a 100644 --- a/src/downloadlistwidget.h +++ b/src/downloadlistwidget.h @@ -34,8 +34,6 @@ namespace Ui { class DownloadListWidget; } -class DownloadManager; - class DownloadProgressDelegate : public QStyledItemDelegate { Q_OBJECT diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b4d77085..f20665eb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5184,6 +5184,7 @@ void MainWindow::updateDownloadView() ui->downloadView->setProperty("downloadView", "standard"); ui->downloadView->style()->unpolish(ui->downloadView); ui->downloadView->style()->polish(ui->downloadView); + m_OrganizerCore.downloadManager()->refreshList(); } void MainWindow::modDetailsUpdated(bool) diff --git a/src/stylesheets/Paper Automata.qss b/src/stylesheets/Paper Automata.qss index 748e589e..572d3313 100644 --- a/src/stylesheets/Paper Automata.qss +++ b/src/stylesheets/Paper Automata.qss @@ -893,29 +893,28 @@ DownloadListWidget { background: transparent; } -DownloadListWidget QFrame, -DownloadListWidgetCompact, -DownloadListWidgetCompact QLabel { - /* an entry on the Downloads tab */ +DownloadListWidget::item:!selected { background: #DAD4BB; } -DownloadListWidget QFrame#frame { - /* outer box of an entry on the Downloads tab */ - border: 2px solid #DAD4BB; +DownloadListWidget[downloadView=standard]::item { + padding: 15px; + margin-bottom: 2px; } -DownloadListWidget QLabel#installLabel { - /* installed/done label */ - color: none; +QProgressBar[downloadView=standard] { + margin: 4px 0px 6px 0px; } /* Compact Downloads View */ -DownloadListWidgetCompact, -DownloadListWidgetCompact QLabel { - /* an entry on the Downloads tab */ - background: #DAD4BB; +DownloadListWidget[downloadView=compact]::item { + padding: 4px 4px 6px 4px; + margin-bottom: 2px; +} + +QProgressBar[downloadView=compact] { + margin: 1px 0px 3px 0px; } /* Categories Filter */ diff --git a/src/stylesheets/Paper Dark by 6788.qss b/src/stylesheets/Paper Dark by 6788.qss index 9f4db66f..ae6ea77b 100644 --- a/src/stylesheets/Paper Dark by 6788.qss +++ b/src/stylesheets/Paper Dark by 6788.qss @@ -919,29 +919,30 @@ QSlider::handle:hover { background: #242424; } -DownloadListWidget QFrame, -DownloadListWidgetCompact, -DownloadListWidgetCompact QLabel { - /* an entry on the Downloads tab */ - background: #141414; +DownloadListWidget[downloadView=standard]::item { + padding: 15px; + border-bottom: 2px solid #666666; } -DownloadListWidget#frame { - /* outer box of an entry on the Downloads tab */ - border: none; -} - -#installLabel { - /* installed/done label */ - color: none; +QProgressBar[downloadView=standard] { + background: transparent; + border: 2px solid #666666; + border-radius: 8px; + margin: 4px 0px 6px 0px; } /* Compact Downloads View */ -DownloadListWidgetCompact, -DownloadListWidgetCompact QLabel { - /* an entry on the Downloads tab */ - background: #141414; +DownloadListWidget[downloadView=compact]::item { + padding: 3px; + border-bottom: 2px solid #666666; +} + +QProgressBar[downloadView=compact] { + background: transparent; + border: 2px solid gray; + border-radius: 8px; + margin: 1px 0px 3px 0px; } /* Categories Filter */ diff --git a/src/stylesheets/Paper Light by 6788.qss b/src/stylesheets/Paper Light by 6788.qss index 3193b817..5e69b79d 100644 --- a/src/stylesheets/Paper Light by 6788.qss +++ b/src/stylesheets/Paper Light by 6788.qss @@ -940,11 +940,6 @@ QProgressBar[downloadView=standard] { margin: 4px 0px 6px 0px; } -QLabel[downloadProgress] { - qproperty-alignment: AlignCenter; - padding-bottom: 3px; -} - /* Compact Downloads View */ DownloadListWidget[downloadView=compact]::item { diff --git a/src/stylesheets/dark.qss b/src/stylesheets/dark.qss index d5a7aedf..5bbb0f0c 100644 --- a/src/stylesheets/dark.qss +++ b/src/stylesheets/dark.qss @@ -257,7 +257,6 @@ QProgressBar QProgressBar::chunk { background-color: #427683; - width: 20px; } QTabBar::tab @@ -366,4 +365,12 @@ QTreeView::branch:open:has-children:has-siblings DownloadListWidget QLabel#installLabel { color: none; +} + +DownloadListWidget[downloadView=standard]::item { + padding: 16px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; } \ No newline at end of file diff --git a/src/stylesheets/dracula.qss b/src/stylesheets/dracula.qss index 99cf918d..33ce5f66 100644 --- a/src/stylesheets/dracula.qss +++ b/src/stylesheets/dracula.qss @@ -394,4 +394,24 @@ SaveGameInfoWidget { DownloadListWidget QLabel#installLabel { color: none; -} \ No newline at end of file +} + +DownloadListWidget[downloadView=standard]::item { + padding: 16px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; +} + +QProgressBar +{ + border: 2px solid grey; + border-radius: 5px; + text-align: center; +} + +QProgressBar::chunk +{ + background-color: #427683; +} diff --git a/src/stylesheets/skyrim.qss b/src/stylesheets/skyrim.qss index e4d87499..d36eac57 100644 --- a/src/stylesheets/skyrim.qss +++ b/src/stylesheets/skyrim.qss @@ -534,7 +534,7 @@ QProgressBar { background-color: transparent; color: transparent; height: 14px; - margin: 0 10px; + margin: 0 0px; border-width: 4px 21px; border-style: solid; border-color: transparent; @@ -542,6 +542,14 @@ QProgressBar { QProgressBar::chunk { background: url(./skyrim/progress-bar-chunk.png) center center repeat-x qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #95BED9, stop:0.78781 #6EB9CE); } +DownloadListWidget[downloadView=standard]::item { + padding: 15px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; +} + /* Right Pane and Tab Bars #QTabWidget, #QTabBar */ QTabWidget::pane { border: none; diff --git a/src/stylesheets/vs15 Dark-Green.qss b/src/stylesheets/vs15 Dark-Green.qss index 5427b38a..10f923cb 100644 --- a/src/stylesheets/vs15 Dark-Green.qss +++ b/src/stylesheets/vs15 Dark-Green.qss @@ -532,8 +532,8 @@ QHeaderView::up-arrow { image: url(./vs15/sort-asc.png); margin-bottom: -37px; } -QTreeView#downloadView QHeaderView::up-arrow { - margin-bottom: -32px; } +DownloadListWidget QHeaderView::up-arrow { + margin-bottom: -47px; } QHeaderView::down-arrow { image: url(./vs15/sort-desc.png); @@ -599,11 +599,19 @@ QProgressBar { text-align: center; border-style: solid; border-width: 1px; - margin: 0 10px; } + margin: 0 0px; } QProgressBar::chunk { background: #06B025; } +DownloadListWidget[downloadView=standard]::item { + padding: 16px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; +} + /* Right Pane and Tab Bars #QTabWidget, #QTabBar */ QTabWidget::pane { border-color: #3F3F46; diff --git a/src/stylesheets/vs15 Dark-Orange.qss b/src/stylesheets/vs15 Dark-Orange.qss index fe65ece0..bbde1f82 100644 --- a/src/stylesheets/vs15 Dark-Orange.qss +++ b/src/stylesheets/vs15 Dark-Orange.qss @@ -533,8 +533,8 @@ QHeaderView::up-arrow { image: url(./vs15/sort-asc.png); margin-bottom: -37px; } -QTreeView#downloadView QHeaderView::up-arrow { - margin-bottom: -32px; } +DownloadListWidget QHeaderView::up-arrow { + margin-bottom: -47px; } QHeaderView::down-arrow { image: url(./vs15/sort-desc.png); @@ -600,11 +600,19 @@ QProgressBar { text-align: center; border-style: solid; border-width: 1px; - margin: 0 10px; } + margin: 0 0px; } QProgressBar::chunk { background: #06B025; } +DownloadListWidget[downloadView=standard]::item { + padding: 16px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; +} + /* Right Pane and Tab Bars #QTabWidget, #QTabBar */ QTabWidget::pane { border-color: #3F3F46; diff --git a/src/stylesheets/vs15 Dark-Purple.qss b/src/stylesheets/vs15 Dark-Purple.qss index eb2e8b82..faad7297 100644 --- a/src/stylesheets/vs15 Dark-Purple.qss +++ b/src/stylesheets/vs15 Dark-Purple.qss @@ -533,8 +533,8 @@ QHeaderView::up-arrow { image: url(./vs15/sort-asc.png); margin-bottom: -37px; } -QTreeView#downloadView QHeaderView::up-arrow { - margin-bottom: -32px; } +DownloadListWidget QHeaderView::up-arrow { + margin-bottom: -47px; } QHeaderView::down-arrow { image: url(./vs15/sort-desc.png); @@ -600,11 +600,19 @@ QProgressBar { text-align: center; border-style: solid; border-width: 1px; - margin: 0 10px; } + margin: 0px 0px; } QProgressBar::chunk { background: #06B025; } +DownloadListWidget[downloadView=standard]::item { + padding: 16px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; +} + /* Right Pane and Tab Bars #QTabWidget, #QTabBar */ QTabWidget::pane { border-color: #3F3F46; diff --git a/src/stylesheets/vs15 Dark-Red.qss b/src/stylesheets/vs15 Dark-Red.qss index ee363e0b..2ffcff68 100644 --- a/src/stylesheets/vs15 Dark-Red.qss +++ b/src/stylesheets/vs15 Dark-Red.qss @@ -533,8 +533,8 @@ QHeaderView::up-arrow { image: url(./vs15/sort-asc.png); margin-bottom: -37px; } -QTreeView#downloadView QHeaderView::up-arrow { - margin-bottom: -32px; } +DownloadListWidget QHeaderView::up-arrow { + margin-bottom: -47px; } QHeaderView::down-arrow { image: url(./vs15/sort-desc.png); @@ -600,11 +600,19 @@ QProgressBar { text-align: center; border-style: solid; border-width: 1px; - margin: 0 10px; } + margin: 0 0px; } QProgressBar::chunk { background: #06B025; } +DownloadListWidget[downloadView=standard]::item { + padding: 16px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; +} + /* Right Pane and Tab Bars #QTabWidget, #QTabBar */ QTabWidget::pane { border-color: #3F3F46; diff --git a/src/stylesheets/vs15 Dark-Yellow.qss b/src/stylesheets/vs15 Dark-Yellow.qss index 08dbe758..24afe005 100644 --- a/src/stylesheets/vs15 Dark-Yellow.qss +++ b/src/stylesheets/vs15 Dark-Yellow.qss @@ -533,8 +533,8 @@ QHeaderView::up-arrow { image: url(./vs15/sort-asc.png); margin-bottom: -37px; } -QTreeView#downloadView QHeaderView::up-arrow { - margin-bottom: -32px; } +DownloadListWidget QHeaderView::up-arrow { + margin-bottom: -47px; } QHeaderView::down-arrow { image: url(./vs15/sort-desc.png); @@ -600,11 +600,19 @@ QProgressBar { text-align: center; border-style: solid; border-width: 1px; - margin: 0 10px; } + margin: 0 0px; } QProgressBar::chunk { background: #06B025; } +DownloadListWidget[downloadView=standard]::item { + padding: 16px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; +} + /* Right Pane and Tab Bars #QTabWidget, #QTabBar */ QTabWidget::pane { border-color: #3F3F46; diff --git a/src/stylesheets/vs15 Dark.qss b/src/stylesheets/vs15 Dark.qss index 8c4d354e..6a551775 100644 --- a/src/stylesheets/vs15 Dark.qss +++ b/src/stylesheets/vs15 Dark.qss @@ -532,8 +532,8 @@ QHeaderView::up-arrow { image: url(./vs15/sort-asc.png); margin-bottom: -37px; } -QTreeView#downloadView QHeaderView::up-arrow { - margin-bottom: -32px; } +DownloadListWidget QHeaderView::up-arrow { + margin-bottom: -47px; } QHeaderView::down-arrow { image: url(./vs15/sort-desc.png); @@ -599,11 +599,19 @@ QProgressBar { text-align: center; border-style: solid; border-width: 1px; - margin: 0 10px; } + margin: 0 0px; } QProgressBar::chunk { background: #06B025; } +DownloadListWidget[downloadView=standard]::item { + padding: 16px; +} + +DownloadListWidget[downloadView=compact]::item { + padding: 4px; +} + /* Right Pane and Tab Bars #QTabWidget, #QTabBar */ QTabWidget::pane { border-color: #3F3F46; -- cgit v1.3.1 From fd6345cd4e49a135dd833e8567cb5bbe6887ebb9 Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Mon, 31 Dec 2018 20:29:03 +0100 Subject: Add 'download meta information' support to download tab --- src/downloadlist.cpp | 7 +- src/downloadlist.h | 3 + src/downloadlistwidget.cpp | 10 + src/downloadlistwidget.h | 4 + src/mainwindow.cpp | 7 +- src/organizer_en.ts | 502 ++++++++++++++++++++++----------------------- 6 files changed, 279 insertions(+), 254 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp index fa2cc077..a0286aef 100644 --- a/src/downloadlist.cpp +++ b/src/downloadlist.cpp @@ -33,6 +33,11 @@ DownloadList::DownloadList(DownloadManager *manager, QObject *parent) connect(m_Manager, SIGNAL(aboutToUpdate()), this, SLOT(aboutToUpdate())); } +void DownloadList::setMetaDisplay(bool metaDisplay) +{ + m_MetaDisplay = metaDisplay; +} + int DownloadList::rowCount(const QModelIndex&) const { @@ -86,7 +91,7 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const } } else { switch (index.column()) { - case COL_NAME: return m_Manager->getFileName(index.row()); + case COL_NAME: return m_MetaDisplay ? m_Manager->getDisplayName(index.row()) : m_Manager->getFileName(index.row()); case COL_SIZE: return sizeFormat(m_Manager->getFileSize(index.row())); case COL_STATUS: switch (m_Manager->getState(index.row())) { diff --git a/src/downloadlist.h b/src/downloadlist.h index 4e0b5ef4..a504f209 100644 --- a/src/downloadlist.h +++ b/src/downloadlist.h @@ -52,6 +52,8 @@ public: **/ explicit DownloadList(DownloadManager *manager, QObject *parent = 0); + void setMetaDisplay(bool metaDisplay); + /** * @brief retrieve the number of rows to display. Invoked by Qt * @@ -90,6 +92,7 @@ public slots: private: DownloadManager *m_Manager; + bool m_MetaDisplay; QString sizeFormat(quint64 size) const; }; diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index f69f9e9f..6c7447c8 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -84,6 +84,16 @@ void DownloadListWidget::setManager(DownloadManager *manager) m_Manager = manager; } +void DownloadListWidget::setSourceModel(DownloadList *sourceModel) +{ + m_SourceModel = sourceModel; +} + +void DownloadListWidget::setMetaDisplay(bool metaDisplay) +{ + m_SourceModel->setMetaDisplay(metaDisplay); +} + void DownloadListWidget::onDoubleClick(const QModelIndex &index) { QModelIndex sourceIndex = qobject_cast(model())->mapToSource(index); diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h index 93ece07a..c8d4fe6e 100644 --- a/src/downloadlistwidget.h +++ b/src/downloadlistwidget.h @@ -21,6 +21,7 @@ along with Mod Organizer. If not, see . #define DOWNLOADLISTWIDGET_H #include "downloadmanager.h" +#include "downloadlist.h" #include "downloadlistsortproxy.h" #include #include @@ -58,6 +59,8 @@ public: ~DownloadListWidget(); void setManager(DownloadManager *manager); + void setSourceModel(DownloadList *sourceModel); + void setMetaDisplay(bool metaDisplay); signals: void installDownload(int index); @@ -95,6 +98,7 @@ private slots: private: DownloadManager *m_Manager; + DownloadList *m_SourceModel; int m_ContextRow; }; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2fcec086..63606833 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5150,12 +5150,14 @@ void MainWindow::on_actionEndorseMO_triggered() void MainWindow::initDownloadView() { + DownloadList *sourceModel = new DownloadList(m_OrganizerCore.downloadManager(), ui->downloadView); DownloadListSortProxy *sortProxy = new DownloadListSortProxy(m_OrganizerCore.downloadManager(), ui->downloadView); - sortProxy->setSourceModel(new DownloadList(m_OrganizerCore.downloadManager(), ui->downloadView)); + sortProxy->setSourceModel(sourceModel); connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), sortProxy, SLOT(updateFilter(QString))); connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(downloadFilterChanged(QString))); - ui->downloadView->setModel(sortProxy); + ui->downloadView->setSourceModel(sourceModel); + ui->downloadView->setModel(sortProxy); ui->downloadView->setManager(m_OrganizerCore.downloadManager()); ui->downloadView->setItemDelegate(new DownloadProgressDelegate(m_OrganizerCore.downloadManager(), sortProxy, ui->downloadView)); ui->downloadView->setUniformRowHeights(true); @@ -5183,6 +5185,7 @@ void MainWindow::updateDownloadView() ui->downloadView->setProperty("downloadView", "compact"); else ui->downloadView->setProperty("downloadView", "standard"); + ui->downloadView->setMetaDisplay(m_OrganizerCore.settings().metaDownloads()); ui->downloadView->style()->unpolish(ui->downloadView); ui->downloadView->style()->polish(ui->downloadView); m_OrganizerCore.downloadManager()->refreshList(); diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 6c1488eb..48936ca9 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -292,97 +292,97 @@ p, li { white-space: pre-wrap; } DownloadList - + Name - + Size - + Status - + < game %1 mod %2 file %3 > - + Unknown - + Pending - + Started - + Canceling - + Pausing - + Canceled - + Paused - + Error - + Fetching Info 1 - + Fetching Info 2 - + Downloaded - + Installed - + Uninstalled - - pending download + + Pending download - + Information missing, please select "Query Info" from the context menu to re-retrieve. @@ -390,145 +390,145 @@ p, li { white-space: pre-wrap; } DownloadListWidget - + Install - + Query Info - + Visit on Nexus - + Open File - - - + + + Show in Folder - - + + Delete - + Un-Hide - + Hide - + Cancel - + Pause - + Resume - + Delete Installed... - + Delete Uninstalled... - + Delete All... - + Hide Installed... - + Hide Uninstalled... - + Hide All... - + Un-Hide All... - - - - + + + + Delete Files? - + This will permanently delete the selected download. - + This will remove all finished downloads from this list and from disk. - + This will remove all installed downloads from this list and from disk. - + This will remove all uninstalled downloads from this list and from disk. - - - + + + Are you sure? - + This will remove all finished downloads from this list (but NOT from disk). - + This will remove all installed downloads from this list (but NOT from disk). - + This will remove all uninstalled downloads from this list (but NOT from disk). @@ -1608,7 +1608,7 @@ p, li { white-space: pre-wrap; } - + Refresh @@ -1792,7 +1792,7 @@ p, li { white-space: pre-wrap; } - + Update @@ -1803,7 +1803,7 @@ p, li { white-space: pre-wrap; } - + No Problems @@ -1833,7 +1833,7 @@ Right now this has very limited functionality - + Endorse Mod Organizer @@ -1853,288 +1853,288 @@ Right now this has very limited functionality - + Toolbar - + Desktop - + Start Menu - + There is no supported sort mechanism for this game. You will probably have to use a third-party tool. - + Crash on exit - + MO crashed while exiting. Some settings may not be saved. Error: %1 - + Problems - + There are potential problems with your setup - + Everything seems to be in order - + Endorse - + Won't Endorse - + Help on UI - + Documentation Wiki - + Report Issue - + Tutorials - + About - + About Qt - + Name - + Please enter a name for the new profile - + failed to create profile: %1 - + Show tutorial? - + You are starting Mod Organizer for the first time. Do you want to show a tutorial of its basic features? If you choose no you can always start the tutorial from the "Help"-menu. - + Downloads in progress - + There are still downloads in progress, do you really want to quit? - + Plugin "%1" failed: %2 - + Plugin "%1" failed - + Browse Mod Page - + Also in: <br> - + No conflict - + <Edit...> - + This bsa is enabled in the ini file so it may be required! - + Activating Network Proxy - + Notice: Your current MO version (%1) is lower than the previous version (%2).<br>The GUI may not downgrade gracefully, so you may experience oddities.<br>However, there should be no serious issues. - + Choose Mod - + Mod Archive - + Start Tutorial? - + You're about to start a tutorial. For technical reasons it's not possible to end the tutorial early. Continue? - + failed to spawn notepad.exe: %1 - + failed to change origin name: %1 - + failed to move "%1" from mod "%2" to "%3": %4 - + <Contains %1> - + <Checked> - + <Unchecked> - + <Update> - + <Mod Backup> - + <Managed by MO> - + <Managed outside MO> - + <No category> - + <Conflicted> - + <Not Endorsed> - + failed to rename mod: %1 - + Overwrite? - + This will replace the existing mod "%1". Continue? - + failed to remove mod "%1" - - - + + + failed to rename "%1" to "%2" - + @@ -2142,129 +2142,129 @@ Error: %1 - + Remove the following mods?<br><ul>%1</ul> - + failed to remove mod: %1 - - - + + + Failed - + Installation file no longer exists - + Mods installed with old versions of MO can't be reinstalled in this way. - + Failed to create backup. - + You need to be logged in with Nexus to resume a download - - - - + + + + You need to be logged in with Nexus to endorse - - + + Endorsing multiple mods will take a while. Please wait... - - + + Unendorsing multiple mods will take a while. Please wait... - + Failed to display overwrite dialog: %1 - + Opening Nexus Links - + You are trying to open %1 links to Nexus Mods. Are you sure you want to do this? - + Nexus ID for this Mod is unknown - + Web page for this mod is unknown - + <table cellspacing="5"><tr><th>Type</th><th>All</th><th>Visible</th><tr><td>Enabled mods:&emsp;</td><td align=right>%1 / %2</td><td align=right>%3 / %4</td></tr><tr><td>Unmanaged/DLCs:&emsp;</td><td align=right>%5</td><td align=right>%6</td></tr><tr><td>Mod backups:&emsp;</td><td align=right>%7</td><td align=right>%8</td></tr><tr><td>Separators:&emsp;</td><td align=right>%9</td><td align=right>%10</td></tr></table> - + <table cellspacing="4"><tr><th>Type</th><th>Active</th><th>Total</th></tr><tr><td>Active plugins:</td><td align=right>%1</td><td align=right>%2</td></tr><tr><td>Active ESMs:</td><td align=right>%3</td><td align=right>%4</td></tr><tr><td>Active ESPs:</td><td align=right>%7</td><td align=right>%8</td></tr><tr><td>Active ESMs+ESPs:</td><td align=right>%9</td><td align=right>%10</td></tr><tr><td>Active ESLs:</td><td align=right>%5</td><td align=right>%6</td></tr></table> - + Create Mod... - + This will create an empty mod. Please enter a name: - + A mod with this name already exists - + Create Separator... - + This will create a new separator. Please enter a name: - + A separator with this name already exists @@ -2276,7 +2276,7 @@ Please enter a name: - + Are you sure? @@ -2304,7 +2304,7 @@ This function will guess the versioning scheme under the assumption that the ins - + Sorry @@ -2603,13 +2603,13 @@ You can also use online editors and converters instead. - + Enable selected - + Disable selected @@ -2670,13 +2670,13 @@ You can also use online editors and converters instead. - + Exception: - + Unknown exception @@ -2745,330 +2745,330 @@ Click OK to restart MO now. - + failed to write to file %1 - + %1 written - + Select binary - + Binary - + Enter Name - + Please enter a name for the executable - + Not an executable - + This is not a recognized executable. - - + + Replace file? - + There already is a hidden version of this file. Replace it? - - + + File operation failed - - + + Failed to remove "%1". Maybe you lack the required file permissions? - + There already is a visible version of this file. Replace it? - - + + Set Priority - + Set the priority of the selected plugins - + file not found: %1 - + failed to generate preview for %1 - + Sorry, can't preview anything. This function currently does not support extracting from bsas. - + Update available - + Open/Execute - + Add as Executable - + Preview - + Un-Hide - + Hide - + Write To File... - + Do you want to endorse Mod Organizer on %1 now? - + Thank you! - + Thank you for your endorsement! - + Request to Nexus failed: %1 - - + + failed to read %1: %2 - - + + Error - + failed to extract %1 (errorcode %2) - + Extract BSA - + This archive contains invalid hashes. Some files may be broken. - + Extract... - + This will restart MO, continue? - + Edit Categories... - + Deselect filter - + Remove - + Enable all - + Disable all - + Unlock load order - + Lock load order - + Open Origin in Explorer - + Open Origin Info... - + depends on missing "%1" - + incompatible with "%1" - + Please wait while LOOT is running - + loot failed. Exit code was: %1 - + failed to start loot - + failed to run loot: %1 - + Errors occured - + Backup of load order created - + Choose backup to restore - + No Backups - + There are no backups to restore - - + + Restore failed - - + + Failed to restore the backup. Errorcode: %1 - + Backup of modlist created - + A file with the same name has already been downloaded. What would you like to do? - + Overwrite - + Rename new file - + Ignore file - + Set the priority of the selected mods @@ -5410,7 +5410,7 @@ If the folder was still in use, restart MO and try again. - + Mod Organizer @@ -5425,18 +5425,18 @@ If the folder was still in use, restart MO and try again. - + Please use "Help" from the toolbar to get usage instructions to all elements - - + + <Manage...> - + failed to parse profile %1: %2 @@ -5487,12 +5487,12 @@ If the folder was still in use, restart MO and try again. - + Script Extender - + Proxy DLL @@ -5708,28 +5708,28 @@ Select Show Details option to see the full change-log. - - + + attempt to store setting for unknown plugin "%1" - + Error - + Failed to create "%1", you may not have the necessary permission. path remains unchanged. - + Restart Mod Organizer? - + In order to reset the window geometries, MO must be restarted. Restart it now? @@ -6410,22 +6410,22 @@ programs you are intentionally running. - + Confirm - + Changing the mod directory affects all your profiles! Mods not present (or named differently) in the new location will be disabled in all profiles. There is no way to undo this unless you backed up your profiles manually. Proceed? - + Executables Blacklist - + Enter one executable per line to be blacklisted from the virtual file system. Mods and other virtualized files will not be visible to these executables and any executables launched by them. @@ -6436,47 +6436,47 @@ Example: - + Select base directory - + Select download directory - + Select mod directory - + Select cache directory - + Select profiles directory - + Select overwrite directory - + Select game executable - + Confirm? - + This will make all dialogs show up again where you checked the "Remember selection"-box. Continue? -- cgit v1.3.1 From 895556f257c2625ac53371089835aab0d01979be Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Mon, 31 Dec 2018 20:53:35 +0100 Subject: Add filetime column to download tab --- src/downloadlist.cpp | 12 +++++++----- src/downloadlist.h | 3 ++- src/downloadlistsortproxy.cpp | 4 +++- src/mainwindow.cpp | 2 +- src/mainwindow.ui | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp index a0286aef..b21a5306 100644 --- a/src/downloadlist.cpp +++ b/src/downloadlist.cpp @@ -47,7 +47,7 @@ int DownloadList::rowCount(const QModelIndex&) const int DownloadList::columnCount(const QModelIndex&) const { - return 3; + return 4; } @@ -68,10 +68,11 @@ QVariant DownloadList::headerData(int section, Qt::Orientation orientation, int if ((role == Qt::DisplayRole) && (orientation == Qt::Horizontal)) { switch (section) { - case COL_NAME : return tr("Name"); - case COL_SIZE : return tr("Size"); - case COL_STATUS : return tr("Status"); - default : return QVariant(); + case COL_NAME: return tr("Name"); + case COL_SIZE: return tr("Size"); + case COL_STATUS: return tr("Status"); + case COL_FILETIME: return tr("Filetime"); + default: return QVariant(); } } else { return QAbstractItemModel::headerData(section, orientation, role); @@ -93,6 +94,7 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const switch (index.column()) { case COL_NAME: return m_MetaDisplay ? m_Manager->getDisplayName(index.row()) : m_Manager->getFileName(index.row()); case COL_SIZE: return sizeFormat(m_Manager->getFileSize(index.row())); + case COL_FILETIME: return m_Manager->getFileTime(index.row()); case COL_STATUS: switch (m_Manager->getState(index.row())) { // STATE_DOWNLOADING handled by DownloadProgressDelegate diff --git a/src/downloadlist.h b/src/downloadlist.h index a504f209..2c32a397 100644 --- a/src/downloadlist.h +++ b/src/downloadlist.h @@ -39,7 +39,8 @@ public: enum EColumn { COL_NAME = 0, COL_STATUS, - COL_SIZE + COL_SIZE, + COL_FILETIME }; public: diff --git a/src/downloadlistsortproxy.cpp b/src/downloadlistsortproxy.cpp index 1df3a9f1..dc97dc3e 100644 --- a/src/downloadlistsortproxy.cpp +++ b/src/downloadlistsortproxy.cpp @@ -50,8 +50,10 @@ bool DownloadListSortProxy::lessThan(const QModelIndex &left, return m_Manager->getFileTime(left.row()) < m_Manager->getFileTime(right.row()); else return leftState > rightState; - } else if(left.column() == DownloadList::COL_SIZE){ + } else if (left.column() == DownloadList::COL_SIZE) { 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 { return leftIndex < rightIndex; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 63606833..f913ad0a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5160,7 +5160,7 @@ void MainWindow::initDownloadView() ui->downloadView->setModel(sortProxy); ui->downloadView->setManager(m_OrganizerCore.downloadManager()); ui->downloadView->setItemDelegate(new DownloadProgressDelegate(m_OrganizerCore.downloadManager(), sortProxy, ui->downloadView)); - ui->downloadView->setUniformRowHeights(true); + ui->downloadView->setUniformRowHeights(false); ui->downloadView->header()->setStretchLastSection(false); ui->downloadView->header()->setSectionResizeMode(QHeaderView::Interactive); ui->downloadView->header()->setSectionResizeMode(0, QHeaderView::Stretch); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 771832fd..ba4b8d63 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1365,7 +1365,7 @@ p, li { white-space: pre-wrap; } 15 - true + false -- cgit v1.3.1 From 79ccbccb1bc6e7794ec92d3da7ef762bd7d252bf Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Tue, 1 Jan 2019 14:22:31 +0100 Subject: Fix toolbar buttons not setting their icons on startup --- src/mainwindow.cpp | 6 +- src/organizer_en.ts | 624 ++++++++++++++++++++++++++-------------------------- 2 files changed, 317 insertions(+), 313 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f913ad0a..80db447c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -457,8 +457,12 @@ MainWindow::MainWindow(QSettings &initSettings for (QAction *action : ui->toolBar->actions()) { // set the name of the widget to the name of the action to allow styling - ui->toolBar->widgetForAction(action)->setObjectName(action->objectName()); + QWidget *actionWidget = ui->toolBar->widgetForAction(action); + actionWidget->setObjectName(action->objectName()); + actionWidget->style()->unpolish(actionWidget); + actionWidget->style()->polish(actionWidget); } + emit updatePluginCount(); emit updateModCount(); } diff --git a/src/organizer_en.ts b/src/organizer_en.ts index ace06361..de09d513 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -395,145 +395,145 @@ p, li { white-space: pre-wrap; } DownloadListWidget - + Install - + Query Info - + Visit on Nexus - + Open File - - - + + + Show in Folder - - + + Delete - + Un-Hide - + Hide - + Cancel - + Pause - + Resume - + Delete Installed... - + Delete Uninstalled... - + Delete All... - + Hide Installed... - + Hide Uninstalled... - + Hide All... - + Un-Hide All... - - - - + + + + Delete Files? - + This will permanently delete the selected download. - + This will remove all finished downloads from this list and from disk. - + This will remove all installed downloads from this list and from disk. - + This will remove all uninstalled downloads from this list and from disk. - - - + + + Are you sure? - + This will remove all finished downloads from this list (but NOT from disk). - + This will remove all installed downloads from this list (but NOT from disk). - + This will remove all uninstalled downloads from this list (but NOT from disk). @@ -562,7 +562,7 @@ p, li { white-space: pre-wrap; } - A file with the same name has already been downloaded. Do you want to download it again? The new file will receive a different name. + A file with the same name "%1" has already been downloaded. Do you want to download it again? The new file will receive a different name. @@ -1436,7 +1436,7 @@ p, li { white-space: pre-wrap; } - + Create Backup @@ -1612,8 +1612,8 @@ p, li { white-space: pre-wrap; } - - + + Refresh @@ -1797,7 +1797,7 @@ p, li { white-space: pre-wrap; } - + Update @@ -1808,7 +1808,7 @@ p, li { white-space: pre-wrap; } - + No Problems @@ -1838,7 +1838,7 @@ Right now this has very limited functionality - + Endorse Mod Organizer @@ -1878,830 +1878,830 @@ Right now this has very limited functionality - + Crash on exit - + MO crashed while exiting. Some settings may not be saved. Error: %1 - + Problems - + There are potential problems with your setup - + Everything seems to be in order - - + + Endorse - + Won't Endorse - + Help on UI - + Documentation Wiki - + Report Issue - + Tutorials - + About - + About Qt - + Name - + Please enter a name for the new profile - + failed to create profile: %1 - + Show tutorial? - + You are starting Mod Organizer for the first time. Do you want to show a tutorial of its basic features? If you choose no you can always start the tutorial from the "Help"-menu. - + Downloads in progress - + There are still downloads in progress, do you really want to quit? - + Plugin "%1" failed: %2 - + Plugin "%1" failed - + Browse Mod Page - + Also in: <br> - + No conflict - + <Edit...> - + This bsa is enabled in the ini file so it may be required! - + Activating Network Proxy - + Notice: Your current MO version (%1) is lower than the previous version (%2).<br>The GUI may not downgrade gracefully, so you may experience oddities.<br>However, there should be no serious issues. - + Choose Mod - + Mod Archive - + Start Tutorial? - + You're about to start a tutorial. For technical reasons it's not possible to end the tutorial early. Continue? - + failed to spawn notepad.exe: %1 - + failed to change origin name: %1 - + failed to move "%1" from mod "%2" to "%3": %4 - + <Contains %1> - + <Checked> - + <Unchecked> - + <Update> - + <Mod Backup> - + <Managed by MO> - + <Managed outside MO> - + <No category> - + <Conflicted> - + <Not Endorsed> - + failed to rename mod: %1 - + Overwrite? - + This will replace the existing mod "%1". Continue? - + failed to remove mod "%1" - - - + + + failed to rename "%1" to "%2" - - - - + + + + Confirm - + Remove the following mods?<br><ul>%1</ul> - + failed to remove mod: %1 - - - + + + Failed - + Installation file no longer exists - + Mods installed with old versions of MO can't be reinstalled in this way. - + Failed to create backup. - + You need to be logged in with Nexus to resume a download - - - - + + + + You need to be logged in with Nexus to endorse - - + + Endorsing multiple mods will take a while. Please wait... - - + + Unendorsing multiple mods will take a while. Please wait... - + Failed to display overwrite dialog: %1 - + Opening Nexus Links - + You are trying to open %1 links to Nexus Mods. Are you sure you want to do this? - + Nexus ID for this Mod is unknown - + Web page for this mod is unknown - + <table cellspacing="5"><tr><th>Type</th><th>All</th><th>Visible</th><tr><td>Enabled mods:&emsp;</td><td align=right>%1 / %2</td><td align=right>%3 / %4</td></tr><tr><td>Unmanaged/DLCs:&emsp;</td><td align=right>%5</td><td align=right>%6</td></tr><tr><td>Mod backups:&emsp;</td><td align=right>%7</td><td align=right>%8</td></tr><tr><td>Separators:&emsp;</td><td align=right>%9</td><td align=right>%10</td></tr></table> - + <table cellspacing="4"><tr><th>Type</th><th>Active</th><th>Total</th></tr><tr><td>Active plugins:</td><td align=right>%1</td><td align=right>%2</td></tr><tr><td>Active ESMs:</td><td align=right>%3</td><td align=right>%4</td></tr><tr><td>Active ESPs:</td><td align=right>%7</td><td align=right>%8</td></tr><tr><td>Active ESMs+ESPs:</td><td align=right>%9</td><td align=right>%10</td></tr><tr><td>Active ESLs:</td><td align=right>%5</td><td align=right>%6</td></tr></table> - - - + + + Create Mod... - + This will create an empty mod. Please enter a name: - - + + A mod with this name already exists - + Create Separator... - + This will create a new separator. Please enter a name: - + A separator with this name already exists - + This will move all files from overwrite into a new, regular mod. Please enter a name: - - + + Are you sure? - + About to recursively delete: - + Not logged in, endorsement information will be wrong - + Continue? - + The versioning scheme decides which version is considered newer than another. This function will guess the versioning scheme under the assumption that the installed version is outdated. - - + + Sorry - + I don't know a versioning scheme where %1 is newer than %2. - + Really enable all visible mods? - + Really disable all visible mods? - + Export to csv - + CSV (Comma Separated Values) is a format that can be imported in programs like Excel to create a spreadsheet. You can also use online editors and converters instead. - + Select what mods you want export: - + All installed mods - + Only active (checked) mods from your current profile - + All currently visible mods in the mod list - + Choose what Columns to export: - + Mod_Priority - + Mod_Name - + Mod_Status - + Primary_Category - + Nexus_ID - + Mod_Nexus_URL - + Mod_Version - + Install_Date - + Download_File_Name - + export failed: %1 - + Open Game folder - + Open MyGames folder - + Open INIs folder - + Open Instance folder - + Open Mods folder - + Open Profile folder - + Open Downloads folder - + Open MO2 Install folder - + Open MO2 Plugins folder - + Open MO2 Logs folder - + Install Mod... - + Create empty mod - + Create Separator - + Enable all visible - + Disable all visible - + Check all for update - + Export to csv... - - + + Send to - - + + Top - - + + Bottom - - + + Priority... - + Separator... - + All Mods - + Sync to Mods... - + Clear Overwrite... - - + + Open in Explorer - + Restore Backup - + Remove Backup... - - + + Change Categories - - + + Primary Category - + Rename Separator... - + Remove Separator... - + Select Color... - + Reset Color - + Change versioning scheme - + Un-ignore update - + Ignore update - - + + Enable selected - - + + Disable selected - + Rename Mod... - + Reinstall Mod - + Remove Mod... - + Un-Endorse - + Won't endorse - + Endorsement state unknown - + Ignore missing data - + Mark as converted/working - + Visit on Nexus - + Visit web page - + Information... - - + + Exception: - - + + Unknown exception - + <All> - + <Multiple> - + %1 more - + Are you sure you want to remove the following %n save(s)?<br><ul>%1</ul><br>Removed saves will be sent to the Recycle Bin. @@ -2709,12 +2709,12 @@ You can also use online editors and converters instead. - + Enable Mods... - + Delete %n save(s) @@ -2722,22 +2722,22 @@ You can also use online editors and converters instead. - + failed to remove %1 - + failed to create %1 - + Restarting MO - + Changing the managed game directory requires restarting MO. Any pending downloads will be paused. @@ -2745,335 +2745,335 @@ Click OK to restart MO now. - + Can't change download directory while downloads are in progress! - + failed to write to file %1 - + %1 written - + Select binary - + Binary - + Enter Name - + Please enter a name for the executable - + Not an executable - + This is not a recognized executable. - - + + Replace file? - + There already is a hidden version of this file. Replace it? - - + + File operation failed - - + + Failed to remove "%1". Maybe you lack the required file permissions? - + There already is a visible version of this file. Replace it? - - + + Set Priority - + Set the priority of the selected plugins - + file not found: %1 - + failed to generate preview for %1 - + Sorry, can't preview anything. This function currently does not support extracting from bsas. - + Update available - + Open/Execute - + Add as Executable - + Preview - + Un-Hide - + Hide - + Write To File... - + Do you want to endorse Mod Organizer on %1 now? - + Thank you! - + Thank you for your endorsement! - + Request to Nexus failed: %1 - - + + failed to read %1: %2 - - + + Error - + failed to extract %1 (errorcode %2) - + Extract BSA - + This archive contains invalid hashes. Some files may be broken. - + Extract... - + This will restart MO, continue? - + Edit Categories... - + Deselect filter - + Remove - + Enable all - + Disable all - + Unlock load order - + Lock load order - + Open Origin in Explorer - + Open Origin Info... - + depends on missing "%1" - + incompatible with "%1" - + Please wait while LOOT is running - + loot failed. Exit code was: %1 - + failed to start loot - + failed to run loot: %1 - + Errors occured - + Backup of load order created - + Choose backup to restore - + No Backups - + There are no backups to restore - - + + Restore failed - - + + Failed to restore the backup. Errorcode: %1 - + Backup of modlist created - + A file with the same name has already been downloaded. What would you like to do? - + Overwrite - + Rename new file - + Ignore file - + Set the priority of the selected mods @@ -5430,18 +5430,18 @@ If the folder was still in use, restart MO and try again. - + Please use "Help" from the toolbar to get usage instructions to all elements - - + + <Manage...> - + failed to parse profile %1: %2 -- cgit v1.3.1 From 6fa416fc52f21ddb3eebcd1568baf8394e89ef6b Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Tue, 1 Jan 2019 21:47:59 +0100 Subject: Add default download row sizes for generic styles, sanitize mainwindow.ui --- src/mainwindow.cpp | 12 +++- src/mainwindow.ui | 47 ++++---------- src/organizer_en.ts | 172 ++++++++++++++++++++++++++-------------------------- 3 files changed, 107 insertions(+), 124 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 80db447c..224ce0a9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5185,10 +5185,18 @@ void MainWindow::initDownloadView() void MainWindow::updateDownloadView() { - if (m_OrganizerCore.settings().compactDownloads()) + // set the view attribute and default row sizes + if (m_OrganizerCore.settings().compactDownloads()) { ui->downloadView->setProperty("downloadView", "compact"); - else + setStyleSheet("DownloadListWidget::item { padding: 4px; }"); + } else { ui->downloadView->setProperty("downloadView", "standard"); + setStyleSheet("DownloadListWidget::item { padding: 16px; }"); + } + + // reapply global stylesheet on the widget level (!) to override the defaults + ui->downloadView->setStyleSheet(styleSheet()); + ui->downloadView->setMetaDisplay(m_OrganizerCore.settings().metaDownloads()); ui->downloadView->style()->unpolish(ui->downloadView); ui->downloadView->style()->polish(ui->downloadView); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index ba4b8d63..547faaa9 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1303,7 +1303,7 @@ p, li { white-space: pre-wrap; } - + 320 @@ -1322,51 +1322,21 @@ p, li { white-space: pre-wrap; } This is a list of mods you downloaded from Nexus. Double click one to install it. You can also drag an archive into here. - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAsNeeded - - + true - - QAbstractItemView::DragDrop - - - Qt::MoveAction - - + true - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - QAbstractItemView::ScrollPerPixel - - + 0 - + false - + true - - 50 - - - 15 - - - false - @@ -1683,6 +1653,11 @@ Right now this has very limited functionality QLCDNumber
lcdnumber.h
+ + DownloadListWidget + QWidget +
downloadlistwidget.h
+
diff --git a/src/organizer_en.ts b/src/organizer_en.ts index de09d513..4c6eb51b 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -1465,7 +1465,7 @@ p, li { white-space: pre-wrap; } - + Filter @@ -1675,145 +1675,145 @@ p, li { white-space: pre-wrap; } - + Show Hidden - + Tool Bar - + Install Mod - + Install &Mod - + Install a new mod from an archive - + Ctrl+M - + Profiles - + &Profiles - + Configure Profiles - + Ctrl+P - + Executables - + &Executables - + Configure the executables that can be started through Mod Organizer - + Ctrl+E - - + + Tools - + &Tools - + Ctrl+I - + Settings - + &Settings - + Configure settings and workarounds - + Ctrl+S - + Nexus - + Search nexus network for more mods - + Ctrl+N - + Update - + Mod Organizer is up-to-date - + No Problems - + This button will be highlighted if MO discovered potential problems in your setup and provide tips on how to fix them. !Work in progress! @@ -1821,39 +1821,39 @@ Right now this has very limited functionality - - + + Help - + Ctrl+H - + Endorse MO - + Endorse Mod Organizer - + Copy Log to Clipboard - + Change Game - + Open the Instance selection dialog to manage a different Game @@ -2281,7 +2281,7 @@ Please enter a name: - + Are you sure? @@ -2608,13 +2608,13 @@ You can also use online editors and converters instead. - + Enable selected - + Disable selected @@ -2675,13 +2675,13 @@ You can also use online editors and converters instead. - + Exception: - + Unknown exception @@ -2819,7 +2819,7 @@ Click OK to restart MO now. - + Set Priority @@ -2884,196 +2884,196 @@ Click OK to restart MO now. - + Thank you! - + Thank you for your endorsement! - + Request to Nexus failed: %1 - - + + failed to read %1: %2 - - + + Error - + failed to extract %1 (errorcode %2) - + Extract BSA - + This archive contains invalid hashes. Some files may be broken. - + Extract... - + This will restart MO, continue? - + Edit Categories... - + Deselect filter - + Remove - + Enable all - + Disable all - + Unlock load order - + Lock load order - + Open Origin in Explorer - + Open Origin Info... - + depends on missing "%1" - + incompatible with "%1" - + Please wait while LOOT is running - + loot failed. Exit code was: %1 - + failed to start loot - + failed to run loot: %1 - + Errors occured - + Backup of load order created - + Choose backup to restore - + No Backups - + There are no backups to restore - - + + Restore failed - - + + Failed to restore the backup. Errorcode: %1 - + Backup of modlist created - + A file with the same name has already been downloaded. What would you like to do? - + Overwrite - + Rename new file - + Ignore file - + Set the priority of the selected mods -- cgit v1.3.1