Browse Source

Refactor and improve StatusBar

adaptive-webui-19844
Vladimir Golovnev (Glassez) 8 years ago
parent
commit
c456b9a42c
  1. 40
      src/gui/mainwindow.cpp
  2. 4
      src/gui/mainwindow.h
  3. 152
      src/gui/statusbar.cpp
  4. 28
      src/gui/statusbar.h

40
src/gui/mainwindow.cpp

@ -264,6 +264,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(m_ui->actionBottomPriority, SIGNAL(triggered()), m_transferListWidget, SLOT(bottomPrioSelectedTorrents())); connect(m_ui->actionBottomPriority, SIGNAL(triggered()), m_transferListWidget, SLOT(bottomPrioSelectedTorrents()));
connect(m_ui->actionToggleVisibility, SIGNAL(triggered()), this, SLOT(toggleVisibility())); connect(m_ui->actionToggleVisibility, SIGNAL(triggered()), this, SLOT(toggleVisibility()));
connect(m_ui->actionMinimize, SIGNAL(triggered()), SLOT(minimizeWindow())); connect(m_ui->actionMinimize, SIGNAL(triggered()), SLOT(minimizeWindow()));
connect(m_ui->actionUseAlternativeSpeedLimits, &QAction::triggered, this, &MainWindow::toggleAlternativeSpeeds);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
m_programUpdateTimer = new QTimer(this); m_programUpdateTimer = new QTimer(this);
@ -289,10 +290,6 @@ MainWindow::MainWindow(QWidget *parent)
// Accept drag 'n drops // Accept drag 'n drops
setAcceptDrops(true); setAcceptDrops(true);
createKeyboardShortcuts(); createKeyboardShortcuts();
// Create status bar
m_statusBar = new StatusBar(QMainWindow::statusBar());
connect(m_statusBar->connectionStatusButton(), SIGNAL(clicked()), SLOT(showConnectionSettings()));
connect(m_ui->actionUseAlternativeSpeedLimits, SIGNAL(triggered()), m_statusBar, SLOT(toggleAlternativeSpeeds()));
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
setUnifiedTitleAndToolBarOnMac(true); setUnifiedTitleAndToolBarOnMac(true);
@ -951,6 +948,8 @@ void MainWindow::notifyOfUpdate(QString)
{ {
// Show restart message // Show restart message
m_statusBar->showRestartRequired(); m_statusBar->showRestartRequired();
Logger::instance()->addMessage(tr("qBittorrent was just updated and needs to be restarted for the changes to be effective.")
, Log::CRITICAL);
// Delete the executable watcher // Delete the executable watcher
delete m_executableWatcher; delete m_executableWatcher;
m_executableWatcher = 0; m_executableWatcher = 0;
@ -1240,7 +1239,21 @@ void MainWindow::optionsSaved()
loadPreferences(); loadPreferences();
} }
// Load program preferences void MainWindow::showStatusBar(bool show)
{
if (show && !m_statusBar) {
// Create status bar
m_statusBar = new StatusBar;
connect(m_statusBar.data(), &StatusBar::connectionButtonClicked, this, &MainWindow::showConnectionSettings);
connect(m_statusBar.data(), &StatusBar::alternativeSpeedsButtonClicked, this, &MainWindow::toggleAlternativeSpeeds);
setStatusBar(m_statusBar);
}
else if (!show && m_statusBar) {
// Remove status bar
setStatusBar(nullptr);
}
}
void MainWindow::loadPreferences(bool configureSession) void MainWindow::loadPreferences(bool configureSession)
{ {
Logger::instance()->addMessage(tr("Options were saved successfully.")); Logger::instance()->addMessage(tr("Options were saved successfully."));
@ -1285,7 +1298,7 @@ void MainWindow::loadPreferences(bool configureSession)
m_ui->toolBar->setVisible(false); m_ui->toolBar->setVisible(false);
} }
m_statusBar->setVisible(pref->isStatusbarDisplayed()); showStatusBar(pref->isStatusbarDisplayed());
if (pref->preventFromSuspend() && !m_preventTimer->isActive()) { if (pref->preventFromSuspend() && !m_preventTimer->isActive()) {
m_preventTimer->start(PREVENT_SUSPEND_INTERVAL); m_preventTimer->start(PREVENT_SUSPEND_INTERVAL);
@ -1541,16 +1554,16 @@ void MainWindow::on_actionOptions_triggered()
void MainWindow::on_actionTopToolBar_triggered() void MainWindow::on_actionTopToolBar_triggered()
{ {
bool isVisible = static_cast<QAction * >(sender())->isChecked(); const bool isVisible = static_cast<QAction*>(sender())->isChecked();
m_ui->toolBar->setVisible(isVisible); m_ui->toolBar->setVisible(isVisible);
Preferences::instance()->setToolbarDisplayed(isVisible); Preferences::instance()->setToolbarDisplayed(isVisible);
} }
void MainWindow::on_actionShowStatusbar_triggered() void MainWindow::on_actionShowStatusbar_triggered()
{ {
bool isVisible = static_cast<QAction*>(sender())->isChecked(); const bool isVisible = static_cast<QAction*>(sender())->isChecked();
m_statusBar->setVisible(isVisible);
Preferences::instance()->setStatusbarDisplayed(isVisible); Preferences::instance()->setStatusbarDisplayed(isVisible);
showStatusBar(isVisible);
} }
void MainWindow::on_actionSpeedInTitleBar_triggered() void MainWindow::on_actionSpeedInTitleBar_triggered()
@ -1681,9 +1694,16 @@ void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVers
if (Preferences::instance()->isUpdateCheckEnabled() && (answer == QMessageBox::Yes)) if (Preferences::instance()->isUpdateCheckEnabled() && (answer == QMessageBox::Yes))
m_programUpdateTimer->start(); m_programUpdateTimer->start();
} }
#endif #endif
void MainWindow::toggleAlternativeSpeeds()
{
BitTorrent::Session *const session = BitTorrent::Session::instance();
if (session->isBandwidthSchedulerEnabled())
m_statusBar->showMessage(tr("Manual change of rate limits mode. The scheduler is disabled."), 5000);
session->setAltGlobalSpeedLimitEnabled(!session->isAltGlobalSpeedLimitEnabled());
}
void MainWindow::on_actionDonateMoney_triggered() void MainWindow::on_actionDonateMoney_triggered()
{ {
QDesktopServices::openUrl(QUrl("http://www.qbittorrent.org/donate")); QDesktopServices::openUrl(QUrl("http://www.qbittorrent.org/donate"));

4
src/gui/mainwindow.h

@ -137,6 +137,7 @@ private slots:
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
void handleUpdateCheckFinished(bool updateAvailable, QString newVersion, bool invokedByUser); void handleUpdateCheckFinished(bool updateAvailable, QString newVersion, bool invokedByUser);
#endif #endif
void toggleAlternativeSpeeds();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
void pythonDownloadSuccess(const QString &url, const QString &filePath); void pythonDownloadSuccess(const QString &url, const QString &filePath);
@ -204,6 +205,7 @@ private:
void displayRSSTab(bool enable); void displayRSSTab(bool enable);
void displaySearchTab(bool enable); void displaySearchTab(bool enable);
void createTorrentTriggered(const QString &path = QString()); void createTorrentTriggered(const QString &path = QString());
void showStatusBar(bool show);
Ui::MainWindow *m_ui; Ui::MainWindow *m_ui;
@ -213,7 +215,7 @@ private:
// GUI related // GUI related
bool m_posInitialized; bool m_posInitialized;
QPointer<QTabWidget> m_tabs; QPointer<QTabWidget> m_tabs;
StatusBar *m_statusBar; QPointer<StatusBar> m_statusBar;
QPointer<OptionsDialog> m_options; QPointer<OptionsDialog> m_options;
QPointer<about> m_aboutDlg; QPointer<about> m_aboutDlg;
QPointer<StatsDialog> m_statsDlg; QPointer<StatsDialog> m_statsDlg;

152
src/gui/statusbar.cpp

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt4 and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2006 Christophe Dumez * Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -24,74 +24,74 @@
* modify file(s), you may extend this exception to your version of the file(s), * modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this * but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version. * exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */
#include "statusbar.h" #include "statusbar.h"
#include <QApplication> #include <QApplication>
#include <QStatusBar> #include <QDebug>
#include <QFrame> #include <QFrame>
#include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QPushButton> #include <QPushButton>
#include <QHBoxLayout> #include <QStyle>
#include <QFontMetrics>
#include <QDebug>
#include "base/bittorrent/session.h" #include "base/bittorrent/session.h"
#include "base/bittorrent/sessionstatus.h" #include "base/bittorrent/sessionstatus.h"
#include "speedlimitdlg.h"
#include "guiiconprovider.h"
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "base/logger.h" #include "guiiconprovider.h"
#include "speedlimitdlg.h"
StatusBar::StatusBar(QStatusBar *bar) StatusBar::StatusBar(QWidget *parent)
: m_bar(bar) : QStatusBar(parent)
{ {
qApp->setStyleSheet("QStatusBar::item { border-width: 0; }"); qApp->setStyleSheet("QStatusBar::item { border-width: 0; }");
BitTorrent::Session *const session = BitTorrent::Session::instance(); BitTorrent::Session *const session = BitTorrent::Session::instance();
connect(session, SIGNAL(speedLimitModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool))); connect(session, &BitTorrent::Session::speedLimitModeChanged, this, &StatusBar::updateAltSpeedsBtn);
m_container = new QWidget(bar); QWidget *container = new QWidget(this);
m_layout = new QHBoxLayout(m_container); QHBoxLayout *layout = new QHBoxLayout(container);
m_layout->setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0);
m_container->setLayout(m_layout); container->setLayout(layout);
m_connecStatusLblIcon = new QPushButton(bar); m_connecStatusLblIcon = new QPushButton(this);
m_connecStatusLblIcon->setFlat(true); m_connecStatusLblIcon->setFlat(true);
m_connecStatusLblIcon->setFocusPolicy(Qt::NoFocus); m_connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor); m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
m_connecStatusLblIcon->setIcon(QIcon(":/icons/skin/firewalled.png")); m_connecStatusLblIcon->setIcon(QIcon(":/icons/skin/firewalled.png"));
m_connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>") + tr("Connection status:") + QString::fromUtf8("</b><br>") + QString::fromUtf8("<i>") + tr("No direct connections. This may indicate network configuration problems.") + QString::fromUtf8("</i>")); m_connecStatusLblIcon->setToolTip(
QString(QLatin1String("<b>%1</b><br><i>%2</i>"))
.arg(tr("Connection status:"))
.arg(tr("No direct connections. This may indicate network configuration problems.")));
connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked);
m_dlSpeedLbl = new QPushButton(bar); m_dlSpeedLbl = new QPushButton(this);
m_dlSpeedLbl->setIcon(QIcon(":/icons/skin/download.png")); m_dlSpeedLbl->setIcon(QIcon(":/icons/skin/download.png"));
connect(m_dlSpeedLbl, SIGNAL(clicked()), this, SLOT(capDownloadSpeed())); connect(m_dlSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capDownloadSpeed);
m_dlSpeedLbl->setFlat(true); m_dlSpeedLbl->setFlat(true);
m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus); m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
m_dlSpeedLbl->setCursor(Qt::PointingHandCursor); m_dlSpeedLbl->setCursor(Qt::PointingHandCursor);
m_dlSpeedLbl->setStyleSheet("text-align:left;"); m_dlSpeedLbl->setStyleSheet("text-align:left;");
m_dlSpeedLbl->setMinimumWidth(200); m_dlSpeedLbl->setMinimumWidth(200);
m_upSpeedLbl = new QPushButton(bar); m_upSpeedLbl = new QPushButton(this);
m_upSpeedLbl->setIcon(QIcon(":/icons/skin/seeding.png")); m_upSpeedLbl->setIcon(QIcon(":/icons/skin/seeding.png"));
connect(m_upSpeedLbl, SIGNAL(clicked()), this, SLOT(capUploadSpeed())); connect(m_upSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capUploadSpeed);
m_upSpeedLbl->setFlat(true); m_upSpeedLbl->setFlat(true);
m_upSpeedLbl->setFocusPolicy(Qt::NoFocus); m_upSpeedLbl->setFocusPolicy(Qt::NoFocus);
m_upSpeedLbl->setCursor(Qt::PointingHandCursor); m_upSpeedLbl->setCursor(Qt::PointingHandCursor);
m_upSpeedLbl->setStyleSheet("text-align:left;"); m_upSpeedLbl->setStyleSheet("text-align:left;");
m_upSpeedLbl->setMinimumWidth(200); m_upSpeedLbl->setMinimumWidth(200);
m_DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), bar); m_DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), this);
m_DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); m_DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
m_altSpeedsBtn = new QPushButton(bar); m_altSpeedsBtn = new QPushButton(this);
m_altSpeedsBtn->setFlat(true); m_altSpeedsBtn->setFlat(true);
m_altSpeedsBtn->setFocusPolicy(Qt::NoFocus); m_altSpeedsBtn->setFocusPolicy(Qt::NoFocus);
m_altSpeedsBtn->setCursor(Qt::PointingHandCursor); m_altSpeedsBtn->setCursor(Qt::PointingHandCursor);
updateAltSpeedsBtn(session->isAltGlobalSpeedLimitEnabled()); updateAltSpeedsBtn(session->isAltGlobalSpeedLimitEnabled());
connect(m_altSpeedsBtn, SIGNAL(clicked()), this, SLOT(toggleAlternativeSpeeds())); connect(m_altSpeedsBtn, &QAbstractButton::clicked, this, &StatusBar::alternativeSpeedsButtonClicked);
// Because on some platforms the default icon size is bigger // Because on some platforms the default icon size is bigger
// and it will result in taller/fatter statusbar, even if the // and it will result in taller/fatter statusbar, even if the
@ -106,37 +106,36 @@ StatusBar::StatusBar(QStatusBar *bar)
m_connecStatusLblIcon->setMaximumWidth(16 + 6); m_connecStatusLblIcon->setMaximumWidth(16 + 6);
m_altSpeedsBtn->setMaximumWidth(28 + 6); m_altSpeedsBtn->setMaximumWidth(28 + 6);
m_statusSep1 = new QFrame(bar); QFrame *statusSep1 = new QFrame(this);
m_statusSep1->setFrameStyle(QFrame::VLine); statusSep1->setFrameStyle(QFrame::VLine);
m_statusSep1->setFrameShadow(QFrame::Raised); statusSep1->setFrameShadow(QFrame::Raised);
m_statusSep2 = new QFrame(bar); QFrame *statusSep2 = new QFrame(this);
m_statusSep2->setFrameStyle(QFrame::VLine); statusSep2->setFrameStyle(QFrame::VLine);
m_statusSep2->setFrameShadow(QFrame::Raised); statusSep2->setFrameShadow(QFrame::Raised);
m_statusSep3 = new QFrame(bar); QFrame *statusSep3 = new QFrame(this);
m_statusSep3->setFrameStyle(QFrame::VLine); statusSep3->setFrameStyle(QFrame::VLine);
m_statusSep3->setFrameShadow(QFrame::Raised); statusSep3->setFrameShadow(QFrame::Raised);
m_statusSep4 = new QFrame(bar); QFrame *statusSep4 = new QFrame(this);
m_statusSep4->setFrameStyle(QFrame::VLine); statusSep4->setFrameStyle(QFrame::VLine);
m_statusSep4->setFrameShadow(QFrame::Raised); statusSep4->setFrameShadow(QFrame::Raised);
m_layout->addWidget(m_DHTLbl); layout->addWidget(m_DHTLbl);
m_layout->addWidget(m_statusSep1); layout->addWidget(statusSep1);
m_layout->addWidget(m_connecStatusLblIcon); layout->addWidget(m_connecStatusLblIcon);
m_layout->addWidget(m_statusSep2); layout->addWidget(statusSep2);
m_layout->addWidget(m_altSpeedsBtn); layout->addWidget(m_altSpeedsBtn);
m_layout->addWidget(m_statusSep4); layout->addWidget(statusSep4);
m_layout->addWidget(m_dlSpeedLbl); layout->addWidget(m_dlSpeedLbl);
m_layout->addWidget(m_statusSep3); layout->addWidget(statusSep3);
m_layout->addWidget(m_upSpeedLbl); layout->addWidget(m_upSpeedLbl);
bar->addPermanentWidget(m_container); addPermanentWidget(container);
bar->setStyleSheet("QWidget {margin: 0;}"); setStyleSheet("QWidget {margin: 0;}");
m_container->adjustSize(); container->adjustSize();
bar->adjustSize(); adjustSize();
// Is DHT enabled // Is DHT enabled
m_DHTLbl->setVisible(session->isDHTEnabled()); m_DHTLbl->setVisible(session->isDHTEnabled());
refreshStatusBar(); refresh();
connect(BitTorrent::Session::instance(), &BitTorrent::Session::statsUpdated connect(session, &BitTorrent::Session::statsUpdated, this, &StatusBar::refresh);
, this, &StatusBar::refreshStatusBar);
} }
StatusBar::~StatusBar() StatusBar::~StatusBar()
@ -144,25 +143,18 @@ StatusBar::~StatusBar()
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
} }
QPushButton* StatusBar::connectionStatusButton() const
{
return m_connecStatusLblIcon;
}
void StatusBar::showRestartRequired() void StatusBar::showRestartRequired()
{ {
// Restart required notification // Restart required notification
const QString restartText = tr("qBittorrent needs to be restarted"); const QString restartText = tr("qBittorrent needs to be restarted!");
QLabel *restartIconLbl = new QLabel(m_bar); QLabel *restartIconLbl = new QLabel(this);
restartIconLbl->setPixmap(QPixmap(":/icons/qbt-theme/dialog-warning.png").scaled(QSize(24,24))); restartIconLbl->setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxWarning));
restartIconLbl->setToolTip(restartText); restartIconLbl->setToolTip(restartText);
m_bar->insertWidget(0, restartIconLbl); insertWidget(0, restartIconLbl);
QLabel *restartLbl = new QLabel(m_bar);
restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); QLabel *restartLbl = new QLabel(this);
m_bar->insertWidget(1, restartLbl); restartLbl->setText(restartText);
QFontMetrics fm(restartLbl->font()); insertWidget(1, restartLbl);
restartLbl->setText(fm.elidedText(restartText, Qt::ElideRight, restartLbl->width()));
Logger::instance()->addMessage(tr("qBittorrent was just updated and needs to be restarted for the changes to be effective."), Log::CRITICAL);
} }
void StatusBar::updateConnectionStatus() void StatusBar::updateConnectionStatus()
@ -216,7 +208,7 @@ void StatusBar::updateSpeedLabels()
m_upSpeedLbl->setText(speedLbl); m_upSpeedLbl->setText(speedLbl);
} }
void StatusBar::refreshStatusBar() void StatusBar::refresh()
{ {
updateConnectionStatus(); updateConnectionStatus();
updateDHTNodesNumber(); updateDHTNodesNumber();
@ -235,15 +227,7 @@ void StatusBar::updateAltSpeedsBtn(bool alternative)
m_altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits")); m_altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits"));
m_altSpeedsBtn->setDown(false); m_altSpeedsBtn->setDown(false);
} }
refreshStatusBar(); refresh();
}
void StatusBar::toggleAlternativeSpeeds()
{
BitTorrent::Session *const session = BitTorrent::Session::instance();
if (session->isBandwidthSchedulerEnabled())
m_bar->showMessage(tr("Manual change of rate limits mode. The scheduler is disabled."), 5000);
session->setAltGlobalSpeedLimitEnabled(!session->isAltGlobalSpeedLimitEnabled());
} }
void StatusBar::capDownloadSpeed() void StatusBar::capDownloadSpeed()
@ -252,11 +236,11 @@ void StatusBar::capDownloadSpeed()
bool ok = false; bool ok = false;
const long newLimit = SpeedLimitDialog::askSpeedLimit( const long newLimit = SpeedLimitDialog::askSpeedLimit(
m_bar->parentWidget(), &ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit()); parentWidget(), &ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit());
if (ok) { if (ok) {
qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.); qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.);
session->setDownloadSpeedLimit(newLimit); session->setDownloadSpeedLimit(newLimit);
refreshStatusBar(); refresh();
} }
} }
@ -266,10 +250,10 @@ void StatusBar::capUploadSpeed()
bool ok = false; bool ok = false;
const long newLimit = SpeedLimitDialog::askSpeedLimit( const long newLimit = SpeedLimitDialog::askSpeedLimit(
m_bar->parentWidget(), &ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit()); parentWidget(), &ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit());
if (ok) { if (ok) {
qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.); qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.);
session->setUploadSpeedLimit(newLimit); session->setUploadSpeedLimit(newLimit);
refreshStatusBar(); refresh();
} }
} }

28
src/gui/statusbar.h

@ -29,34 +29,35 @@
#ifndef STATUSBAR_H #ifndef STATUSBAR_H
#define STATUSBAR_H #define STATUSBAR_H
#include <QObject> #include <QStatusBar>
class QStatusBar;
class QFrame;
class QLabel; class QLabel;
class QPushButton; class QPushButton;
class QHBoxLayout;
namespace BitTorrent namespace BitTorrent
{ {
struct SessionStatus; struct SessionStatus;
} }
class StatusBar: public QObject class StatusBar: public QStatusBar
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(StatusBar)
public: public:
StatusBar(QStatusBar *bar); StatusBar(QWidget *parent = nullptr);
~StatusBar(); ~StatusBar() override;
QPushButton* connectionStatusButton() const; signals:
void alternativeSpeedsButtonClicked();
void connectionButtonClicked();
public slots: public slots:
void showRestartRequired(); void showRestartRequired();
void refreshStatusBar();
private slots:
void refresh();
void updateAltSpeedsBtn(bool alternative); void updateAltSpeedsBtn(bool alternative);
void toggleAlternativeSpeeds();
void capDownloadSpeed(); void capDownloadSpeed();
void capUploadSpeed(); void capUploadSpeed();
@ -65,18 +66,11 @@ private:
void updateDHTNodesNumber(); void updateDHTNodesNumber();
void updateSpeedLabels(); void updateSpeedLabels();
QStatusBar *m_bar;
QPushButton *m_dlSpeedLbl; QPushButton *m_dlSpeedLbl;
QPushButton *m_upSpeedLbl; QPushButton *m_upSpeedLbl;
QLabel *m_DHTLbl; QLabel *m_DHTLbl;
QFrame *m_statusSep1;
QFrame *m_statusSep2;
QFrame *m_statusSep3;
QFrame *m_statusSep4;
QPushButton *m_connecStatusLblIcon; QPushButton *m_connecStatusLblIcon;
QPushButton *m_altSpeedsBtn; QPushButton *m_altSpeedsBtn;
QWidget *m_container;
QHBoxLayout *m_layout;
}; };
#endif // STATUSBAR_H #endif // STATUSBAR_H

Loading…
Cancel
Save