aboutsummaryrefslogtreecommitdiff
path: root/src/forms
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-02-23 17:19:32 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-02-23 17:19:32 +0100
commitabd011f7cf8d298b8bbbe30eedb329094d43c0b9 (patch)
tree300909ce22e5c356a4735dbedaf795a594055c9e /src/forms
parentMinor features (diff)
downloadsmolbote-abd011f7cf8d298b8bbbe30eedb329094d43c0b9.tar.xz
Download manager improvements
Added shortcut for download dialog Dialog has proper title Settings replaces ~ with home location Showing download item details
Diffstat (limited to 'src/forms')
-rw-r--r--src/forms/downloaddialog.cpp16
-rw-r--r--src/forms/downloaddialog.h3
-rw-r--r--src/forms/downloaddialog.ui53
3 files changed, 68 insertions, 4 deletions
diff --git a/src/forms/downloaddialog.cpp b/src/forms/downloaddialog.cpp
index 59756bf..7d26c4b 100644
--- a/src/forms/downloaddialog.cpp
+++ b/src/forms/downloaddialog.cpp
@@ -27,12 +27,15 @@
#include <QListWidget>
#include <QLabel>
#include "webengine/downloaditemform.h"
+#include "settings.h"
DownloadDialog::DownloadDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::DownloadDialog)
{
ui->setupUi(this);
+
+ connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(showItemDetails(int)));
}
DownloadDialog::~DownloadDialog()
@@ -42,8 +45,12 @@ DownloadDialog::~DownloadDialog()
void DownloadDialog::addDownload(QWebEngineDownloadItem *item)
{
+ Settings settings;
+
qDebug("download item: %s", qUtf8Printable(item->url().toString()));
- QString filepath = QFileDialog::getSaveFileName(this, tr("Save"));
+ qDebug("download path: %s", qUtf8Printable(settings.value("downloads/path").toString()));
+
+ QString filepath = QFileDialog::getSaveFileName(this, tr("Save"), settings.value("downloads/path").toString());
if(filepath.isEmpty()) {
// user cancelled the save dialog
@@ -64,3 +71,10 @@ void DownloadDialog::addDownload(QWebEngineDownloadItem *item)
item->accept();
this->show();
}
+
+void DownloadDialog::showItemDetails(int index)
+{
+ DownloadItemForm *form = qobject_cast<DownloadItemForm *>(ui->listWidget->itemWidget(ui->listWidget->item(index)));
+ ui->mimeType_label->setText(form->item()->mimeType());
+ ui->path_label->setText(form->item()->path());
+}
diff --git a/src/forms/downloaddialog.h b/src/forms/downloaddialog.h
index a28dd92..9a74cf0 100644
--- a/src/forms/downloaddialog.h
+++ b/src/forms/downloaddialog.h
@@ -39,6 +39,9 @@ public:
public slots:
void addDownload(QWebEngineDownloadItem *item);
+private slots:
+ void showItemDetails(int index);
+
private:
Ui::DownloadDialog *ui;
};
diff --git a/src/forms/downloaddialog.ui b/src/forms/downloaddialog.ui
index 75a6faa..f9bc307 100644
--- a/src/forms/downloaddialog.ui
+++ b/src/forms/downloaddialog.ui
@@ -6,16 +6,63 @@
<rect>
<x>0</x>
<y>0</y>
- <width>640</width>
+ <width>820</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Downloads</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QListWidget" name="listWidget"/>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QListWidget" name="listWidget"/>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Details</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>mime</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="mimeType_label">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>path</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="path_label">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">