Reworked status bar.

This commit is contained in:
Martin Rotter 2014-01-07 08:57:10 +01:00
parent 3303167fcf
commit c210055fed
3 changed files with 29 additions and 7 deletions

View File

@ -10,6 +10,7 @@
#include "gui/iconthemefactory.h"
#include "gui/messagesview.h"
#include "gui/feedsview.h"
#include "gui/statusbar.h"
#include <QVBoxLayout>
#include <QSplitter>
@ -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() {

View File

@ -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);
}

View File

@ -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;