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> <center><h2>2.5.0</h2></center>
Added: Added:
<ul> <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> </ul>
<hr/> <hr/>
<center><h2>2.4.2</h2></center> <center><h2>2.4.2</h2></center>
Fixed: Fixed:
<ul> <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> <li>Icon cache is now automatically cleared after most of application is loaded. This should save some memory.</li>
</ul> </ul>

View File

@ -88,7 +88,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings"> <widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>7</number>
</property> </property>
<widget class="QWidget" name="m_pageGeneral"> <widget class="QWidget" name="m_pageGeneral">
<layout class="QFormLayout" name="formLayout_5"> <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> <enum>QTabWidget::North</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="m_tabIconSkin"> <widget class="QWidget" name="m_tabIconSkin">
<attribute name="title"> <attribute name="title">
@ -497,8 +497,8 @@ MySQL backend will automatically use database with name &quot;rssguard&quot;. Do
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>208</width> <width>776</width>
<height>238</height> <height>425</height>
</rect> </rect>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
@ -1728,5 +1728,21 @@ MySQL backend will automatically use database with name &quot;rssguard&quot;. Do
</hint> </hint>
</hints> </hints>
</connection> </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> </connections>
</ui> </ui>

View File

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

View File

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

View File

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