Some fixes and additions.

This commit is contained in:
Martin Rotter 2015-07-02 07:12:33 +02:00
parent 38c6c6b448
commit cb887e5e7e
5 changed files with 58 additions and 24 deletions

View File

@ -2,14 +2,15 @@
<center><h2>2.5.0</h2></center>
Added:
<ul>
<li>Fancy & modern popup notifications (turned on by default).</li>
<li><b>Fancy & modern popup notifications</b> (turned on by default).</li>
<li>Enhanced information in download manager.</li>
</ul>
<hr/>
<center><h2>2.4.2</h2></center>
Fixed:
<ul>
<li>Browse button in 'Downloads' section of settings is now correctly disabled when needed.</li>
<li>Icon cache is now automatically cleared after most of application is loaded. This should save some memory.</li>
</ul>

View File

@ -88,7 +88,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex">
<number>3</number>
<number>7</number>
</property>
<widget class="QWidget" name="m_pageGeneral">
<layout class="QFormLayout" name="formLayout_5">
@ -465,7 +465,7 @@ MySQL backend will automatically use database with name &quot;rssguard&quot;. Do
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="m_tabIconSkin">
<attribute name="title">
@ -497,8 +497,8 @@ MySQL backend will automatically use database with name &quot;rssguard&quot;. Do
<rect>
<x>0</x>
<y>0</y>
<width>208</width>
<height>238</height>
<width>776</width>
<height>425</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -1728,5 +1728,21 @@ MySQL backend will automatically use database with name &quot;rssguard&quot;. Do
</hint>
</hints>
</connection>
<connection>
<sender>m_rbDownloadsAskEachFile</sender>
<signal>toggled(bool)</signal>
<receiver>m_btnDownloadsTargetDirectory</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>348</x>
<y>77</y>
</hint>
<hint type="destinationlabel">
<x>968</x>
<y>50</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>404</width>
<height>45</height>
<width>413</width>
<height>206</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
@ -46,7 +46,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="SqueezeLabel" name="m_lblFilename" native="true">
<widget class="SqueezeLabel" name="m_lblRemoteFilename" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -58,6 +58,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_lblLocalFilename">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="SqueezeLabel" name="m_lblInfoDownload" native="true">
<property name="sizePolicy">

View File

@ -113,7 +113,7 @@ void DownloadItem::getFileName() {
stop();
m_ui->m_progressDownload->setVisible(false);
m_ui->m_lblFilename->setText(tr("Cancelled"));
m_ui->m_lblLocalFilename->setText(tr("Selection if local file cancelled."));
m_canceledFileSelect = true;
return;
}
@ -123,7 +123,9 @@ void DownloadItem::getFileName() {
qApp->settings()->setValue(GROUP(Downloads), Downloads::TargetExplicitDirectory,
QDir::toNativeSeparators(QFileInfo(chosen_filename).absolutePath()));
qApp->downloadManager()->setDownloadDirectory(file_info.absoluteDir().absolutePath());
m_ui->m_lblFilename->setText(file_info.fileName());
// TODO: Probably not needed.
//m_ui->m_lblFilename->setText(file_info.fileName());
}
m_output.setFileName(chosen_filename);
@ -139,7 +141,7 @@ void DownloadItem::getFileName() {
return;
}
m_ui->m_lblFilename->setText(QFileInfo(m_output.fileName()).fileName());
updateInfoAndUrlLabel();
if (m_requestFileName) {
downloadReadyRead();
@ -336,7 +338,7 @@ void DownloadItem::downloadProgress(qint64 bytes_received, qint64 bytes_total) {
m_ui->m_progressDownload->setMaximum(totalValue);
emit progress(currentValue, totalValue);
updateInfoLabel();
updateDownloadInfoLabel();
}
qint64 DownloadItem::bytesTotal() const {
@ -371,7 +373,7 @@ double DownloadItem::currentSpeed() const {
}
}
void DownloadItem::updateInfoLabel() {
void DownloadItem::updateDownloadInfoLabel() {
if (m_reply->error() != QNetworkReply::NoError) {
return;
}
@ -429,14 +431,21 @@ void DownloadItem::finished() {
m_ui->m_btnOpenFile->setEnabled(true);
m_ui->m_btnOpenFolder->setEnabled(true);
m_output.close();
updateInfoLabel();
updateDownloadInfoLabel();
emit statusChanged();
emit downloadFinished();
if (downloadedSuccessfully()) {
qApp->showGuiMessage(tr("Download finished"),
tr("File '%1' is downloaded.\nClick here to open parent directory.").arg(QDir::toNativeSeparators(m_output.fileName())),
QSystemTrayIcon::Information, 0, false, QIcon(), this, SLOT(openFolder()));
}
}
void DownloadItem::updateInfoAndUrlLabel() {
m_ui->m_lblRemoteFilename->setText(tr("URL: %1").arg(m_url.toString()));
m_ui->m_lblLocalFilename->setText(tr("Local file: %1").arg(QDir::toNativeSeparators(m_output.fileName())));
}
DownloadManager::DownloadManager(QWidget *parent) : TabContent(parent), m_ui(new Ui::DownloadManager),
@ -525,11 +534,9 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) {
DownloadItem *item = new DownloadItem(reply, this);
addItem(item);
if (item->m_canceledFileSelect) {
return;
}
if (!item->m_canceledFileSelect) {
qApp->mainForm()->tabWidget()->showDownloadManager();
}
}
void DownloadManager::addItem(DownloadItem *item) {
@ -669,8 +676,10 @@ void DownloadManager::load() {
if (!url.isEmpty() && !file_name.isEmpty()) {
DownloadItem *item = new DownloadItem(0, this);
item->m_output.setFileName(file_name);
item->m_ui->m_lblFilename->setText(QFileInfo(item->m_output.fileName()).fileName());
item->m_url = url;
item->updateInfoAndUrlLabel();
item->m_ui->m_btnStopDownload->setVisible(false);
item->m_ui->m_btnStopDownload->setEnabled(false);
item->m_ui->m_btnTryAgain->setVisible(!done);

View File

@ -71,9 +71,10 @@ class DownloadItem : public QWidget {
void downloadFinished();
private:
void updateInfoAndUrlLabel();
void getFileName();
void init();
void updateInfoLabel();
void updateDownloadInfoLabel();
QString saveFileName(const QString &directory) const;
Ui::DownloadItem *m_ui;