diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index eb253f8d3..8e1ad109c 100644 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -10,6 +10,7 @@ #include "gui/iconthemefactory.h" #include "gui/messagesview.h" #include "gui/feedsview.h" +#include "gui/statusbar.h" #include #include @@ -118,7 +119,7 @@ void FeedMessageViewer::updateAllFeeds() { } void FeedMessageViewer::onFeedUpdatesStarted() { - + FormMain::getInstance()->statusBar()->showProgress(0, tr("Feed update started")); } void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed, @@ -126,13 +127,14 @@ void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed, int total) { // Some feed got updated. m_feedsView->updateCountsOfParticularFeed(feed, true); - - + FormMain::getInstance()->statusBar()->showProgress((current * 100.0) / total, + tr("Updated feed '%1'").arg(feed->title())); } void FeedMessageViewer::onFeedUpdatesFinished() { // Updates of some feeds finished, unlock the lock. SystemFactory::getInstance()->applicationCloseLock()->unlock(); + FormMain::getInstance()->statusBar()->clearProgress(); } void FeedMessageViewer::createConnections() { diff --git a/src/gui/statusbar.cpp b/src/gui/statusbar.cpp index 8878dcf19..dea639bef 100644 --- a/src/gui/statusbar.cpp +++ b/src/gui/statusbar.cpp @@ -17,22 +17,38 @@ StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) { 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_progressLabel = new QLabel(this); + m_progressLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_progressLabel->setText("aaa"); + m_progressLabel->setVisible(false); // Add widgets. + addPermanentWidget(m_progressLabel); + addPermanentWidget(m_progressBar); addPermanentWidget(m_fullscreenSwitcher); - addWidget(m_progressBar, 0); - addWidget(m_progressLabel, 1); } StatusBar::~StatusBar() { qDebug("Destroying StatusBar instance."); } -QToolButton *StatusBar::fullscreenSwitcher() const -{ +QToolButton *StatusBar::fullscreenSwitcher() const { return m_fullscreenSwitcher; } + +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::clearProgress() { + m_progressLabel->setVisible(false); + m_progressBar->setVisible(false); +} diff --git a/src/gui/statusbar.h b/src/gui/statusbar.h index 23175e141..470b7dc36 100644 --- a/src/gui/statusbar.h +++ b/src/gui/statusbar.h @@ -18,6 +18,10 @@ class StatusBar : public QStatusBar { QToolButton *fullscreenSwitcher() const; + // Progress bar operations + void showProgress(int progress, const QString &label); + void clearProgress(); + private: QProgressBar *m_progressBar; QLabel *m_progressLabel;