New lang, download manager tweaks.
This commit is contained in:
parent
cbf16f6233
commit
41eb010c12
@ -69,7 +69,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>Error: %1</source>
|
||||
<translation type="unfinished">Chyba: %1. {1?}</translation>
|
||||
<translation>Chyba: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cannot open folder</source>
|
||||
@ -138,6 +138,14 @@
|
||||
<source>GB</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Downloading %n file(s)...</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FeedMessageViewer</name>
|
||||
|
@ -136,6 +136,13 @@
|
||||
<source>GB</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Downloading %n file(s)...</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FeedMessageViewer</name>
|
||||
|
@ -136,6 +136,13 @@
|
||||
<source>GB</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Downloading %n file(s)...</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FeedMessageViewer</name>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<context>
|
||||
<name>Application</name>
|
||||
<message>
|
||||
<location filename="../src/miscellaneous/application.cpp" line="109"/>
|
||||
<location filename="../src/miscellaneous/application.cpp" line="122"/>
|
||||
<source>Application is already running.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -132,7 +132,15 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="668"/>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="563"/>
|
||||
<source>Downloading %n file(s)...</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="701"/>
|
||||
<source>%n minutes remaining</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
@ -140,7 +148,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="672"/>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="705"/>
|
||||
<source>%n seconds remaining</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
@ -148,22 +156,22 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="684"/>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="717"/>
|
||||
<source>bytes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="688"/>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="721"/>
|
||||
<source>kB</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="692"/>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="725"/>
|
||||
<source>MB</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="696"/>
|
||||
<location filename="../src/network-web/downloadmanager.cpp" line="729"/>
|
||||
<source>GB</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -3119,12 +3127,12 @@ currently installed one.</source>
|
||||
<context>
|
||||
<name>StatusBar</name>
|
||||
<message>
|
||||
<location filename="../src/gui/statusbar.cpp" line="36"/>
|
||||
<location filename="../src/gui/statusbar.cpp" line="37"/>
|
||||
<source>Fullscreen mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui/statusbar.cpp" line="37"/>
|
||||
<location filename="../src/gui/statusbar.cpp" line="38"/>
|
||||
<source>Switch application between fulscreen/normal states right from this status bar icon.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -136,6 +136,13 @@
|
||||
<source>GB</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Downloading %n file(s)...</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FeedMessageViewer</name>
|
||||
|
@ -136,6 +136,13 @@
|
||||
<source>GB</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Downloading %n file(s)...</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FeedMessageViewer</name>
|
||||
|
@ -136,6 +136,13 @@
|
||||
<source>GB</source>
|
||||
<translation>GB</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Downloading %n file(s)...</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FeedMessageViewer</name>
|
||||
|
@ -136,6 +136,13 @@
|
||||
<source>GB</source>
|
||||
<translation>GB</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Downloading %n file(s)...</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FeedMessageViewer</name>
|
||||
|
@ -164,20 +164,20 @@ void FeedMessageViewer::updateTrayIconStatus(int unread_messages, int total_mess
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesStarted() {
|
||||
//: Text display in status bar when feed update is started.
|
||||
qApp->mainForm()->statusBar()->showProgress(0, tr("Feed update started"));
|
||||
qApp->mainForm()->statusBar()->showProgressFeeds(0, tr("Feed update started"));
|
||||
}
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed, int current, int total) {
|
||||
// Some feed got updated.
|
||||
m_feedsView->updateCountsOfParticularFeed(feed, true);
|
||||
qApp->mainForm()->statusBar()->showProgress((current * 100.0) / total,
|
||||
qApp->mainForm()->statusBar()->showProgressFeeds((current * 100.0) / total,
|
||||
//: Text display in status bar when particular feed is updated.
|
||||
tr("Updated feed '%1'").arg(feed->title()));
|
||||
}
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesFinished() {
|
||||
qApp->closeLock()->unlock();
|
||||
qApp->mainForm()->statusBar()->clearProgress();
|
||||
qApp->mainForm()->statusBar()->clearProgressFeeds();
|
||||
m_messagesView->reloadSelections(1);
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,14 @@
|
||||
|
||||
#include "gui/statusbar.h"
|
||||
|
||||
#include "gui/formmain.h"
|
||||
#include "gui/tabwidget.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QLabel>
|
||||
#include <QProgressBar>
|
||||
#include <QThread>
|
||||
|
||||
|
||||
StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
|
||||
@ -36,18 +39,33 @@ StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
|
||||
m_fullscreenSwitcher->setText(tr("Fullscreen mode"));
|
||||
m_fullscreenSwitcher->setToolTip(tr("Switch application between fulscreen/normal states right from this status bar icon."));
|
||||
|
||||
m_progressBar = new QProgressBar(this);
|
||||
m_progressBar->setTextVisible(false);
|
||||
m_progressBar->setFixedWidth(100);
|
||||
m_progressBar->setVisible(false);
|
||||
m_barProgressFeeds = new QProgressBar(this);
|
||||
m_barProgressFeeds->setTextVisible(false);
|
||||
m_barProgressFeeds->setFixedWidth(100);
|
||||
m_barProgressFeeds->setVisible(false);
|
||||
|
||||
m_progressLabel = new QLabel(this);
|
||||
m_progressLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
m_progressLabel->setVisible(false);
|
||||
m_lblProgressFeeds = new QLabel(this);
|
||||
m_lblProgressFeeds->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
m_lblProgressFeeds->setVisible(false);
|
||||
|
||||
m_barProgressDownload = new QProgressBar(this);
|
||||
m_barProgressDownload->setTextVisible(true);
|
||||
m_barProgressDownload->setFixedWidth(100);
|
||||
m_barProgressDownload->setVisible(false);
|
||||
|
||||
m_lblProgressDownload = new QLabel(this);
|
||||
m_lblProgressDownload->setText("Downloading files in background");
|
||||
m_lblProgressDownload->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
m_lblProgressDownload->setVisible(false);
|
||||
|
||||
// TODO: nastavit event filter na label a progress aby se po kliku
|
||||
// otevřel download manager
|
||||
|
||||
// Add widgets.
|
||||
addWidget(m_progressBar);
|
||||
addWidget(m_progressLabel);
|
||||
addPermanentWidget(m_lblProgressFeeds);
|
||||
addPermanentWidget(m_barProgressFeeds);
|
||||
addPermanentWidget(m_lblProgressDownload);
|
||||
addPermanentWidget(m_barProgressDownload);
|
||||
addPermanentWidget(m_fullscreenSwitcher);
|
||||
}
|
||||
|
||||
@ -55,15 +73,33 @@ StatusBar::~StatusBar() {
|
||||
qDebug("Destroying StatusBar instance.");
|
||||
}
|
||||
|
||||
void StatusBar::showProgress(int progress, const QString &label) {
|
||||
m_progressLabel->setVisible(true);
|
||||
m_progressBar->setVisible(true);
|
||||
|
||||
m_progressLabel->setText(label);
|
||||
m_progressBar->setValue(progress);
|
||||
void StatusBar::displayDownloadManager() {
|
||||
qApp->mainForm()->tabWidget()->showDownloadManager();
|
||||
}
|
||||
|
||||
void StatusBar::clearProgress() {
|
||||
m_progressLabel->setVisible(false);
|
||||
m_progressBar->setVisible(false);
|
||||
void StatusBar::showProgressFeeds(int progress, const QString &label) {
|
||||
m_lblProgressFeeds->setVisible(true);
|
||||
m_barProgressFeeds->setVisible(true);
|
||||
|
||||
m_lblProgressFeeds->setText(label);
|
||||
m_barProgressFeeds->setValue(progress);
|
||||
}
|
||||
|
||||
void StatusBar::clearProgressFeeds() {
|
||||
m_lblProgressFeeds->setVisible(false);
|
||||
m_barProgressFeeds->setVisible(false);
|
||||
}
|
||||
|
||||
void StatusBar::showProgressDownload(int progress, const QString &tooltip) {
|
||||
m_lblProgressDownload->setVisible(true);
|
||||
m_barProgressDownload->setVisible(true);
|
||||
m_barProgressDownload->setValue(progress);
|
||||
m_barProgressDownload->setToolTip(tooltip);
|
||||
m_lblProgressDownload->setToolTip(tooltip);
|
||||
}
|
||||
|
||||
void StatusBar::clearProgressDownload() {
|
||||
m_lblProgressDownload->setVisible(false);
|
||||
m_barProgressDownload->setVisible(false);
|
||||
m_barProgressDownload->setValue(0);
|
||||
}
|
||||
|
@ -37,13 +37,19 @@ class StatusBar : public QStatusBar {
|
||||
return m_fullscreenSwitcher;
|
||||
}
|
||||
|
||||
public slots:
|
||||
// Progress bar operations
|
||||
void showProgress(int progress, const QString &label);
|
||||
void clearProgress();
|
||||
void showProgressFeeds(int progress, const QString &label);
|
||||
void clearProgressFeeds();
|
||||
|
||||
void showProgressDownload(int progress, const QString &tooltip);
|
||||
void clearProgressDownload();
|
||||
|
||||
private:
|
||||
QProgressBar *m_progressBar;
|
||||
QLabel *m_progressLabel;
|
||||
QProgressBar *m_barProgressFeeds;
|
||||
QLabel *m_lblProgressFeeds;
|
||||
QProgressBar *m_barProgressDownload;
|
||||
QLabel *m_lblProgressDownload;
|
||||
QToolButton *m_fullscreenSwitcher;
|
||||
|
||||
};
|
||||
|
@ -118,9 +118,7 @@ class TabWidget : public QTabWidget {
|
||||
int addLinkedBrowser(const QString &initial_url);
|
||||
|
||||
// General method for adding WebBrowsers.
|
||||
int addBrowser(bool move_after_current,
|
||||
bool make_active,
|
||||
const QUrl &initial_url = QUrl());
|
||||
int addBrowser(bool move_after_current, bool make_active, const QUrl &initial_url = QUrl());
|
||||
|
||||
private:
|
||||
PlainToolButton *m_btnAddTab;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "gui/feedmessageviewer.h"
|
||||
#include "gui/messagebox.h"
|
||||
#include "gui/formmain.h"
|
||||
#include "gui/statusbar.h"
|
||||
|
||||
#include <QSessionManager>
|
||||
#include <QThread>
|
||||
@ -59,6 +60,18 @@ IconFactory *Application::icons() {
|
||||
return m_icons;
|
||||
}
|
||||
|
||||
DownloadManager *Application::downloadManager() {
|
||||
if (m_downloadManager == NULL) {
|
||||
m_downloadManager = new DownloadManager();
|
||||
|
||||
connect(m_downloadManager, SIGNAL(downloadFinished()), mainForm()->statusBar(), SLOT(clearProgressDownload()));
|
||||
connect(m_downloadManager, SIGNAL(downloadProgress(int,QString)),
|
||||
mainForm()->statusBar(), SLOT(showProgressDownload(int,QString)));
|
||||
}
|
||||
|
||||
return m_downloadManager;
|
||||
}
|
||||
|
||||
bool Application::backupDatabaseSettings(bool backup_database, bool backup_settings,
|
||||
const QString &target_path, const QString &backup_name) {
|
||||
if (!QFileInfo(target_path).isWritable()) {
|
||||
|
@ -88,14 +88,7 @@ class Application : public QtSingleApplication {
|
||||
}
|
||||
|
||||
IconFactory *icons();
|
||||
|
||||
inline DownloadManager *downloadManager() {
|
||||
if (m_downloadManager == NULL) {
|
||||
m_downloadManager = new DownloadManager();
|
||||
}
|
||||
|
||||
return m_downloadManager;
|
||||
}
|
||||
DownloadManager *downloadManager();
|
||||
|
||||
inline Settings *settings() {
|
||||
if (m_settings == NULL) {
|
||||
|
@ -452,13 +452,15 @@ DownloadManager::~DownloadManager() {
|
||||
}
|
||||
|
||||
delete m_ui;
|
||||
|
||||
qDebug("Destroying DownloadManager instance.");
|
||||
}
|
||||
|
||||
int DownloadManager::activeDownloads() const {
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < m_downloads.count(); i++) {
|
||||
if (m_downloads.at(i)->m_ui->m_btnStopDownload->isEnabled()) {
|
||||
foreach (DownloadItem *download, m_downloads) {
|
||||
if (download->downloading()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -466,6 +468,25 @@ int DownloadManager::activeDownloads() const {
|
||||
return count;
|
||||
}
|
||||
|
||||
int DownloadManager::downloadProgress() const {
|
||||
qint64 bytes_total = 0;
|
||||
qint64 bytes_received = 0;
|
||||
|
||||
foreach (DownloadItem *download, m_downloads) {
|
||||
if (download->downloading()) {
|
||||
bytes_total += download->bytesTotal();
|
||||
bytes_received += download->bytesReceived();
|
||||
}
|
||||
}
|
||||
|
||||
if (bytes_total <= 0) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return (bytes_received * 100.0) / bytes_total;
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadManager::download(const QNetworkRequest &request) {
|
||||
if (!request.url().isEmpty()) {
|
||||
handleUnsupportedContent(m_networkManager->get(request));
|
||||
@ -501,7 +522,8 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) {
|
||||
|
||||
void DownloadManager::addItem(DownloadItem *item) {
|
||||
connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow()));
|
||||
connect(item, SIGNAL(downloadFinished()), this, SLOT(finished()));
|
||||
connect(item, SIGNAL(progress(qint64,qint64)), this, SLOT(itemProgress()));
|
||||
connect(item, SIGNAL(downloadFinished()), this, SLOT(itemFinished()));
|
||||
|
||||
int row = m_downloads.count();
|
||||
m_model->beginInsertRows(QModelIndex(), row, row);
|
||||
@ -521,8 +543,8 @@ QNetworkAccessManager *DownloadManager::networkManager() const {
|
||||
return m_networkManager;
|
||||
}
|
||||
|
||||
void DownloadManager::finished() {
|
||||
// NOTE: Download has finished.
|
||||
void DownloadManager::itemFinished() {
|
||||
emit downloadFinished();
|
||||
}
|
||||
|
||||
void DownloadManager::updateRow() {
|
||||
@ -531,6 +553,17 @@ void DownloadManager::updateRow() {
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadManager::itemProgress() {
|
||||
int progress = downloadProgress();
|
||||
|
||||
if (progress < 0) {
|
||||
emit downloadFinished();
|
||||
}
|
||||
else {
|
||||
emit downloadProgress(progress, tr("Downloading %n file(s)...", "", activeDownloads()));
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadManager::updateRow(DownloadItem *item) {
|
||||
int row = m_downloads.indexOf(item);
|
||||
|
||||
|
@ -109,16 +109,17 @@ class DownloadManager : public TabContent {
|
||||
QNetworkAccessManager *networkManager() const;
|
||||
|
||||
int activeDownloads() const;
|
||||
int downloadProgress() const;
|
||||
|
||||
RemovePolicy removePolicy() const;
|
||||
void setRemovePolicy(RemovePolicy policy);
|
||||
|
||||
static QString timeString(double time_remaining);
|
||||
static QString dataString(qint64 size);
|
||||
|
||||
void setDownloadDirectory(const QString &directory);
|
||||
QString downloadDirectory();
|
||||
|
||||
static QString timeString(double time_remaining);
|
||||
static QString dataString(qint64 size);
|
||||
|
||||
public slots:
|
||||
void download(const QNetworkRequest &request);
|
||||
void download(const QUrl &url);
|
||||
@ -131,7 +132,12 @@ class DownloadManager : public TabContent {
|
||||
|
||||
void updateRow(DownloadItem *item);
|
||||
void updateRow();
|
||||
void finished();
|
||||
void itemProgress();
|
||||
void itemFinished();
|
||||
|
||||
signals:
|
||||
void downloadProgress(int progress, const QString &description);
|
||||
void downloadFinished();
|
||||
|
||||
private:
|
||||
void addItem(DownloadItem *item);
|
||||
|
Loading…
x
Reference in New Issue
Block a user