diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-02-23 20:40:47 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-02-23 20:40:47 +0100 |
commit | 8c37e1ade4ab4a32e97711f037bbf0fd396ec40c (patch) | |
tree | 1da35ba85a71fb6db2ff7573c7f40dfbc89072e2 /src/forms/downloaddialog.cpp | |
parent | Download manager improvements (diff) | |
download | smolbote-8c37e1ade4ab4a32e97711f037bbf0fd396ec40c.tar.xz |
Download manager
Added total size to widget
Added default file name
Diffstat (limited to 'src/forms/downloaddialog.cpp')
-rw-r--r-- | src/forms/downloaddialog.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/forms/downloaddialog.cpp b/src/forms/downloaddialog.cpp index 7d26c4b..950fa96 100644 --- a/src/forms/downloaddialog.cpp +++ b/src/forms/downloaddialog.cpp @@ -34,6 +34,7 @@ DownloadDialog::DownloadDialog(QWidget *parent) : ui(new Ui::DownloadDialog) { ui->setupUi(this); + ui->filePath->setWordWrap(true); connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(showItemDetails(int))); } @@ -47,10 +48,7 @@ void DownloadDialog::addDownload(QWebEngineDownloadItem *item) { Settings settings; - qDebug("download item: %s", qUtf8Printable(item->url().toString())); - qDebug("download path: %s", qUtf8Printable(settings.value("downloads/path").toString())); - - QString filepath = QFileDialog::getSaveFileName(this, tr("Save"), settings.value("downloads/path").toString()); + QString filepath = QFileDialog::getSaveFileName(this, tr("Save"), settings.value("downloads/path").toString() + "/" + QFileInfo(item->path()).fileName()); if(filepath.isEmpty()) { // user cancelled the save dialog @@ -76,5 +74,6 @@ 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()); + ui->filePath_label->setText(form->item()->path()); + ui->fileSize_label->setText(QString("%1 bytes").arg(form->item()->totalBytes())); } |