diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2019-05-03 21:32:33 -0500 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2019-05-03 21:32:33 -0500 |
| commit | 179a73857125ee604f42b0d5c2d765183c86d2c7 (patch) | |
| tree | b9b3f9d62bd5640de839d150a53ab8ef119dab9c /src/downloadlistwidget.h | |
| parent | e2b799bd6b5cfd51969fefd1dab5e5b1b7e5f81c (diff) | |
| parent | 907c5468424b48774f5da2a6b5f96f26590987b0 (diff) | |
Merge pull request #695 from ModOrganizer2/Develop
Stage for Release 2.2.0
Diffstat (limited to 'src/downloadlistwidget.h')
| -rw-r--r-- | src/downloadlistwidget.h | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h index fe7f3b22..ad07b0f1 100644 --- a/src/downloadlistwidget.h +++ b/src/downloadlistwidget.h @@ -21,51 +21,64 @@ 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 <QHeaderView>
+#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 DownloadListHeader : public QHeaderView
{
-
Q_OBJECT
public:
+ explicit DownloadListHeader(Qt::Orientation orientation, QWidget *parent = nullptr) : QHeaderView(orientation, parent) {}
+ void customResizeSections();
+
+private:
+ void mouseReleaseEvent(QMouseEvent *event) override;
+};
- DownloadListWidgetDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent = 0);
- ~DownloadListWidgetDelegate();
+class DownloadListWidget : public QTreeView
+{
+ Q_OBJECT
- virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+public:
+ explicit DownloadListWidget(QWidget *parent = 0);
+ ~DownloadListWidget();
- 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 queryInfoMd5(int index);
void removeDownload(int index, bool deleteFile);
void restoreDownload(int index);
void cancelDownload(int index);
@@ -75,19 +88,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();
@@ -106,26 +110,14 @@ private slots: void issueRemoveFromViewCompleted();
void issueRemoveFromViewUninstalled();
void issueQueryInfo();
-
- void stateChanged(int row, DownloadManager::DownloadState);
- void resetCache(int);
+ void issueQueryInfoMd5();
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;
+ void resizeEvent(QResizeEvent *event);
};
#endif // DOWNLOADLISTWIDGET_H
|
