summaryrefslogtreecommitdiff
path: root/src/downloadstab.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-12-26 20:58:06 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-12-26 20:58:06 -0500
commit106ed49baecc60dbdf4844ed684df750e5caf3aa (patch)
treef7485c0d4e995263b313ed08856869c9e8c8b6a1 /src/downloadstab.cpp
parent3eb64c32e8643a34ce2de07bdb0f2fae2869b69a (diff)
removed setUpdateDelay(false) calls, it's the default
FilterWidget for downloads tab
Diffstat (limited to 'src/downloadstab.cpp')
-rw-r--r--src/downloadstab.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/downloadstab.cpp b/src/downloadstab.cpp
index a1a5a474..f5258724 100644
--- a/src/downloadstab.cpp
+++ b/src/downloadstab.cpp
@@ -1,6 +1,5 @@
#include "downloadstab.h"
#include "downloadlist.h"
-#include "downloadlistsortproxy.h"
#include "downloadlistwidget.h"
#include "organizercore.h"
#include "ui_mainwindow.h"
@@ -13,20 +12,19 @@ DownloadsTab::DownloadsTab(OrganizerCore& core, Ui::MainWindow* mwui)
DownloadList *sourceModel = new DownloadList(
m_core.downloadManager(), ui.list);
- DownloadListSortProxy *sortProxy = new DownloadListSortProxy(
- m_core.downloadManager(), ui.list);
-
- sortProxy->setSourceModel(sourceModel);
- connect(ui.filter, SIGNAL(textChanged(QString)), sortProxy, SLOT(updateFilter(QString)));
- connect(ui.filter, SIGNAL(textChanged(QString)), this, SLOT(downloadFilterChanged(QString)));
-
- ui.list->setSourceModel(sourceModel);
- ui.list->setModel(sortProxy);
+ ui.list->setModel(sourceModel);
ui.list->setManager(m_core.downloadManager());
ui.list->setItemDelegate(new DownloadProgressDelegate(
- m_core.downloadManager(), sortProxy, ui.list));
+ m_core.downloadManager(), ui.list));
+
update();
+ m_filter.setEdit(ui.filter);
+ m_filter.setList(ui.list);
+ m_filter.setSortPredicate([sourceModel](auto&& left, auto&& right) {
+ return sourceModel->lessThan(left, right);
+ });
+
connect(ui.refresh, &QPushButton::clicked, [&]{ refresh(); });
connect(ui.list, SIGNAL(installDownload(int)), &m_core, SLOT(installDownload(int)));
connect(ui.list, SIGNAL(queryInfo(int)), m_core.downloadManager(), SLOT(queryInfo(int)));
@@ -39,7 +37,7 @@ DownloadsTab::DownloadsTab(OrganizerCore& core, Ui::MainWindow* mwui)
connect(ui.list, SIGNAL(restoreDownload(int)), m_core.downloadManager(), SLOT(restoreDownload(int)));
connect(ui.list, SIGNAL(cancelDownload(int)), m_core.downloadManager(), SLOT(cancelDownload(int)));
connect(ui.list, SIGNAL(pauseDownload(int)), m_core.downloadManager(), SLOT(pauseDownload(int)));
- connect(ui.list, SIGNAL(resumeDownload(int)), this, SLOT(resumeDownload(int)));
+ connect(ui.list, &DownloadListWidget::resumeDownload, [&](int i){ resumeDownload(i); });
}
void DownloadsTab::update()
@@ -77,12 +75,3 @@ void DownloadsTab::resumeDownload(int downloadIndex)
m_core.downloadManager()->resumeDownload(downloadIndex);
});
}
-
-void DownloadsTab::downloadFilterChanged(const QString &filter)
-{
- if (!filter.isEmpty()) {
- ui.list->setStyleSheet("QTreeView { border: 2px ridge #f00; }");
- } else {
- ui.list->setStyleSheet("");
- }
-}