summaryrefslogtreecommitdiff
path: root/src/downloadlistwidget.h
diff options
context:
space:
mode:
authorLostDragonist <lost.dragonist@gmail.com>2019-01-01 17:07:52 -0600
committerLostDragonist <lost.dragonist@gmail.com>2019-01-01 17:07:52 -0600
commit15e47114175d7dd86cd6e774aff1d7872e87a647 (patch)
tree6bb64a158b56717ba4b5aaccc64108bffce00102 /src/downloadlistwidget.h
parentd8396bfa2cde422c7522b0e6a78b0d5ab2e218ac (diff)
parent5ad411cd47fc3193c6c87a745e41bd6c09b687ab (diff)
Merge remote-tracking branch 'remotes/origin/Develop' into archive_conflicts_2
Diffstat (limited to 'src/downloadlistwidget.h')
-rw-r--r--src/downloadlistwidget.h69
1 files changed, 22 insertions, 47 deletions
diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h
index fe7f3b22..0002e2b4 100644
--- a/src/downloadlistwidget.h
+++ b/src/downloadlistwidget.h
@@ -21,49 +21,48 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define DOWNLOADLISTWIDGET_H
#include "downloadmanager.h"
+#include "downloadlist.h"
+#include "downloadlistsortproxy.h"
#include <QWidget>
#include <QItemDelegate>
#include <QLabel>
#include <QProgressBar>
#include <QTreeView>
+#include <QStyledItemDelegate>
+
namespace Ui {
- class DownloadListWidget;
+ class DownloadListWidget;
}
-class DownloadListWidget : public QWidget
+class DownloadProgressDelegate : public QStyledItemDelegate
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit DownloadListWidget(QWidget *parent = 0);
- ~DownloadListWidget();
+ 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:
- Ui::DownloadListWidget *ui;
+ DownloadManager *m_Manager;
+ DownloadListSortProxy *m_SortProxy;
};
-class DownloadManager;
-
-class DownloadListWidgetDelegate : public QItemDelegate
+class DownloadListWidget : public QTreeView
{
-
Q_OBJECT
public:
+ explicit DownloadListWidget(QWidget *parent = 0);
+ ~DownloadListWidget();
- 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);
+ void setSourceModel(DownloadList *sourceModel);
+ void setMetaDisplay(bool metaDisplay);
signals:
-
void installDownload(int index);
void queryInfo(int index);
void removeDownload(int index, bool deleteFile);
@@ -75,19 +74,10 @@ 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 onHeaderCustomContextMenu(const QPoint &point);
void issueInstall();
void issueDelete();
void issueRemoveFromView();
@@ -107,25 +97,10 @@ 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;
+ DownloadList *m_SourceModel = 0;
int m_ContextRow;
-
- QTreeView *m_View;
-
- mutable QMap<int, QPixmap> m_Cache;
};
#endif // DOWNLOADLISTWIDGET_H