diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-12-27 17:06:33 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-12-27 17:06:33 +0100 |
commit | bdc239d1f827308c0fc1e4c202ed0e3f5c71da0b (patch) | |
tree | e743885fcdfc92a85eb46b075cf65e6b7c0c8a8e /src/lib/downloads/widgets | |
parent | UrlRequestInterceptor fixes (diff) | |
download | smolbote-bdc239d1f827308c0fc1e4c202ed0e3f5c71da0b.tar.xz |
Download manager fixes
DownloadsWidget
- Download widget now in landscape
- Download widget no longer docks in the main window, but is a dialog
DownloadItemWidget
- Download item widget looks more compact
- Download details are now a part of the item widgets instead
- Download details: save path
Diffstat (limited to 'src/lib/downloads/widgets')
-rw-r--r-- | src/lib/downloads/widgets/downloaditemform.ui | 28 | ||||
-rw-r--r-- | src/lib/downloads/widgets/downloaditemwidget.cpp | 19 | ||||
-rw-r--r-- | src/lib/downloads/widgets/downloaditemwidget.h | 3 |
3 files changed, 44 insertions, 6 deletions
diff --git a/src/lib/downloads/widgets/downloaditemform.ui b/src/lib/downloads/widgets/downloaditemform.ui index 8a8d148..7e63211 100644 --- a/src/lib/downloads/widgets/downloaditemform.ui +++ b/src/lib/downloads/widgets/downloaditemform.ui @@ -7,13 +7,22 @@ <x>0</x> <y>0</y> <width>500</width> - <height>70</height> + <height>100</height> </rect> </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> <item> <widget class="QLabel" name="url_label"> <property name="text"> @@ -26,14 +35,14 @@ <item> <widget class="QLabel" name="status_label"> <property name="text"> - <string>Unknown</string> + <string>Un&known</string> </property> </widget> </item> <item> <widget class="QLabel" name="filesize_label"> <property name="text"> - <string>x MiB / y MiB</string> + <string>&x MiB / y MiB</string> </property> </widget> </item> @@ -46,6 +55,19 @@ </item> </layout> </item> + <item> + <widget class="QWidget" name="detailsWidget" native="true"> + <layout class="QVBoxLayout" name="detailsLayout"> + <item> + <widget class="QLabel" name="path_label"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> <resources/> diff --git a/src/lib/downloads/widgets/downloaditemwidget.cpp b/src/lib/downloads/widgets/downloaditemwidget.cpp index df0b6fc..6145a6e 100644 --- a/src/lib/downloads/widgets/downloaditemwidget.cpp +++ b/src/lib/downloads/widgets/downloaditemwidget.cpp @@ -20,10 +20,13 @@ DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *pa ui->setupUi(this); ui->url_label->setText(item->url().toString()); + ui->detailsWidget->hide(); - connect(item, SIGNAL(stateChanged(QWebEngineDownloadItem::DownloadState)), this, SLOT(updateState(QWebEngineDownloadItem::DownloadState))); - connect(item, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateProgress(qint64,qint64))); - connect(item, SIGNAL(finished()), this, SLOT(updateFinished())); + ui->path_label->setText(item->path()); + + connect(item, &QWebEngineDownloadItem::stateChanged, this, &DownloadItemWidget::updateState); + connect(item, &QWebEngineDownloadItem::downloadProgress, this, &DownloadItemWidget::updateProgress); + connect(item, &QWebEngineDownloadItem::finished, this, &DownloadItemWidget::updateFinished); } DownloadItemWidget::~DownloadItemWidget() @@ -31,6 +34,16 @@ DownloadItemWidget::~DownloadItemWidget() delete ui; } +void DownloadItemWidget::showDetails() +{ + ui->detailsWidget->show(); +} + +void DownloadItemWidget::hideDetails() +{ + ui->detailsWidget->hide(); +} + QWebEngineDownloadItem *DownloadItemWidget::item() const { return m_item; diff --git a/src/lib/downloads/widgets/downloaditemwidget.h b/src/lib/downloads/widgets/downloaditemwidget.h index cffa32a..c6246da 100644 --- a/src/lib/downloads/widgets/downloaditemwidget.h +++ b/src/lib/downloads/widgets/downloaditemwidget.h @@ -24,6 +24,9 @@ public: explicit DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *parent = 0); ~DownloadItemWidget(); + void showDetails(); + void hideDetails(); + QWebEngineDownloadItem *item() const; QString sizeString(int size) const; |