mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Code clean up
This commit is contained in:
parent
4e79411d9f
commit
3b898c52d3
6 changed files with 18 additions and 30 deletions
Binary file not shown.
Before Width: | Height: | Size: 722 B |
BIN
src/Icons/oxygen/arrow-down.png
Normal file
BIN
src/Icons/oxygen/arrow-down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,006 B |
BIN
src/Icons/oxygen/arrow-up.png
Normal file
BIN
src/Icons/oxygen/arrow-up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 927 B |
Binary file not shown.
Before Width: | Height: | Size: 787 B |
|
@ -3,9 +3,7 @@
|
||||||
<file>Icons/url.png</file>
|
<file>Icons/url.png</file>
|
||||||
<file>Icons/loading.png</file>
|
<file>Icons/loading.png</file>
|
||||||
<file>Icons/3-state-checkbox.gif</file>
|
<file>Icons/3-state-checkbox.gif</file>
|
||||||
<file>Icons/uparrow.png</file>
|
|
||||||
<file>Icons/sphere.png</file>
|
<file>Icons/sphere.png</file>
|
||||||
<file>Icons/downarrow.png</file>
|
|
||||||
<file>Icons/slow_off.png</file>
|
<file>Icons/slow_off.png</file>
|
||||||
<file>Icons/sphere2.png</file>
|
<file>Icons/sphere2.png</file>
|
||||||
<file>Icons/magnet.png</file>
|
<file>Icons/magnet.png</file>
|
||||||
|
@ -305,10 +303,12 @@
|
||||||
<file>Icons/oxygen/user-group-delete.png</file>
|
<file>Icons/oxygen/user-group-delete.png</file>
|
||||||
<file>Icons/oxygen/edit-find-user.png</file>
|
<file>Icons/oxygen/edit-find-user.png</file>
|
||||||
<file>Icons/oxygen/media-playback-pause.png</file>
|
<file>Icons/oxygen/media-playback-pause.png</file>
|
||||||
|
<file>Icons/oxygen/arrow-down.png</file>
|
||||||
<file>Icons/oxygen/tab-close.png</file>
|
<file>Icons/oxygen/tab-close.png</file>
|
||||||
<file>Icons/oxygen/inode-directory.png</file>
|
<file>Icons/oxygen/inode-directory.png</file>
|
||||||
<file>Icons/oxygen/tools-report-bug.png</file>
|
<file>Icons/oxygen/tools-report-bug.png</file>
|
||||||
<file>Icons/oxygen/view-filter.png</file>
|
<file>Icons/oxygen/view-filter.png</file>
|
||||||
|
<file>Icons/oxygen/arrow-up.png</file>
|
||||||
<file>Icons/oxygen/services.png</file>
|
<file>Icons/oxygen/services.png</file>
|
||||||
<file>Icons/oxygen/view-preview.png</file>
|
<file>Icons/oxygen/view-preview.png</file>
|
||||||
<file>Icons/oxygen/view-refresh.png</file>
|
<file>Icons/oxygen/view-refresh.png</file>
|
||||||
|
|
|
@ -48,30 +48,30 @@ class StatusBar: public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StatusBar(QStatusBar *bar): bar(bar) {
|
StatusBar(QStatusBar *bar): m_bar(bar) {
|
||||||
Preferences pref;
|
Preferences pref;
|
||||||
connect(QBtSession::instance(), SIGNAL(alternativeSpeedsModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool)));
|
connect(QBtSession::instance(), SIGNAL(alternativeSpeedsModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool)));
|
||||||
container = new QWidget();
|
container = new QWidget(bar);
|
||||||
layout = new QGridLayout(container);
|
layout = new QGridLayout(container);
|
||||||
layout->setVerticalSpacing(0);
|
layout->setVerticalSpacing(0);
|
||||||
layout->setContentsMargins(0,0,0,0);
|
layout->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
container->setLayout(layout);
|
container->setLayout(layout);
|
||||||
connecStatusLblIcon = new QPushButton();
|
connecStatusLblIcon = new QPushButton(bar);
|
||||||
connecStatusLblIcon->setFlat(true);
|
connecStatusLblIcon->setFlat(true);
|
||||||
connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
|
connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
|
||||||
connecStatusLblIcon->setFixedWidth(22);
|
connecStatusLblIcon->setFixedWidth(22);
|
||||||
connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
|
connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
|
||||||
connecStatusLblIcon->setIcon(QIcon(":/Icons/skin/firewalled.png"));
|
connecStatusLblIcon->setIcon(QIcon(":/Icons/skin/firewalled.png"));
|
||||||
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>"));
|
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>"));
|
||||||
dlSpeedLbl = new QPushButton(tr("D: %1 B/s - T: %2", "Download speed: x B/s - Transferred: x MiB").arg("0.0").arg(misc::friendlyUnit(0)));
|
dlSpeedLbl = new QPushButton(tr("D: %1 B/s - T: %2", "Download speed: x B/s - Transferred: x MiB").arg("0.0").arg(misc::friendlyUnit(0)), bar);
|
||||||
//dlSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
//dlSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
connect(dlSpeedLbl, SIGNAL(clicked()), this, SLOT(capDownloadSpeed()));
|
connect(dlSpeedLbl, SIGNAL(clicked()), this, SLOT(capDownloadSpeed()));
|
||||||
dlSpeedLbl->setFlat(true);
|
dlSpeedLbl->setFlat(true);
|
||||||
dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
|
dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
|
||||||
dlSpeedLbl->setCursor(Qt::PointingHandCursor);
|
dlSpeedLbl->setCursor(Qt::PointingHandCursor);
|
||||||
|
|
||||||
altSpeedsBtn = new QPushButton();
|
altSpeedsBtn = new QPushButton(bar);
|
||||||
altSpeedsBtn->setFixedWidth(32);
|
altSpeedsBtn->setFixedWidth(32);
|
||||||
altSpeedsBtn->setIconSize(QSize(32,32));
|
altSpeedsBtn->setIconSize(QSize(32,32));
|
||||||
altSpeedsBtn->setFlat(true);
|
altSpeedsBtn->setFlat(true);
|
||||||
|
@ -81,27 +81,27 @@ public:
|
||||||
|
|
||||||
connect(altSpeedsBtn, SIGNAL(clicked()), this, SLOT(toggleAlternativeSpeeds()));
|
connect(altSpeedsBtn, SIGNAL(clicked()), this, SLOT(toggleAlternativeSpeeds()));
|
||||||
|
|
||||||
upSpeedLbl = new QPushButton(tr("U: %1 B/s - T: %2", "Upload speed: x B/s - Transferred: x MiB").arg("0.0").arg(misc::friendlyUnit(0)));
|
upSpeedLbl = new QPushButton(tr("U: %1 B/s - T: %2", "Upload speed: x B/s - Transferred: x MiB").arg("0.0").arg(misc::friendlyUnit(0)), bar);
|
||||||
//upSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
//upSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
connect(upSpeedLbl, SIGNAL(clicked()), this, SLOT(capUploadSpeed()));
|
connect(upSpeedLbl, SIGNAL(clicked()), this, SLOT(capUploadSpeed()));
|
||||||
upSpeedLbl->setFlat(true);
|
upSpeedLbl->setFlat(true);
|
||||||
upSpeedLbl->setFocusPolicy(Qt::NoFocus);
|
upSpeedLbl->setFocusPolicy(Qt::NoFocus);
|
||||||
upSpeedLbl->setCursor(Qt::PointingHandCursor);
|
upSpeedLbl->setCursor(Qt::PointingHandCursor);
|
||||||
DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0));
|
DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), bar);
|
||||||
DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
statusSep1 = new QFrame();
|
statusSep1 = new QFrame(bar);
|
||||||
statusSep1->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
|
statusSep1->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
|
||||||
statusSep1->setFrameStyle(QFrame::VLine);
|
statusSep1->setFrameStyle(QFrame::VLine);
|
||||||
statusSep1->setFrameShadow(QFrame::Raised);
|
statusSep1->setFrameShadow(QFrame::Raised);
|
||||||
statusSep2 = new QFrame();
|
statusSep2 = new QFrame(bar);
|
||||||
statusSep2->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
|
statusSep2->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
|
||||||
statusSep2->setFrameStyle(QFrame::VLine);
|
statusSep2->setFrameStyle(QFrame::VLine);
|
||||||
statusSep2->setFrameShadow(QFrame::Raised);
|
statusSep2->setFrameShadow(QFrame::Raised);
|
||||||
statusSep3 = new QFrame();
|
statusSep3 = new QFrame(bar);
|
||||||
statusSep3->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
|
statusSep3->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
|
||||||
statusSep3->setFrameStyle(QFrame::VLine);
|
statusSep3->setFrameStyle(QFrame::VLine);
|
||||||
statusSep3->setFrameShadow(QFrame::Raised);
|
statusSep3->setFrameShadow(QFrame::Raised);
|
||||||
statusSep4 = new QFrame();
|
statusSep4 = new QFrame(bar);
|
||||||
statusSep4->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
|
statusSep4->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
|
||||||
statusSep4->setFrameStyle(QFrame::VLine);
|
statusSep4->setFrameStyle(QFrame::VLine);
|
||||||
statusSep4->setFrameShadow(QFrame::Raised);
|
statusSep4->setFrameShadow(QFrame::Raised);
|
||||||
|
@ -138,18 +138,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
~StatusBar() {
|
~StatusBar() {
|
||||||
delete refreshTimer;
|
|
||||||
delete dlSpeedLbl;
|
|
||||||
delete upSpeedLbl;
|
|
||||||
delete DHTLbl;
|
|
||||||
delete statusSep1;
|
|
||||||
delete statusSep2;
|
|
||||||
delete statusSep3;
|
|
||||||
delete statusSep4;
|
|
||||||
delete connecStatusLblIcon;
|
|
||||||
delete altSpeedsBtn;
|
|
||||||
delete layout;
|
|
||||||
delete container;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPushButton* connectionStatusButton() const {
|
QPushButton* connectionStatusButton() const {
|
||||||
|
@ -160,13 +148,13 @@ public slots:
|
||||||
void showRestartRequired() {
|
void showRestartRequired() {
|
||||||
// Restart required notification
|
// Restart required notification
|
||||||
const QString restart_text = tr("qBittorrent needs to be restarted");
|
const QString restart_text = tr("qBittorrent needs to be restarted");
|
||||||
QLabel *restartIconLbl = new QLabel();
|
QLabel *restartIconLbl = new QLabel(m_bar);
|
||||||
restartIconLbl->setPixmap(QPixmap(":/Icons/oxygen/dialog-warning.png").scaled(QSize(24,24)));
|
restartIconLbl->setPixmap(QPixmap(":/Icons/oxygen/dialog-warning.png").scaled(QSize(24,24)));
|
||||||
restartIconLbl->setToolTip(restart_text);
|
restartIconLbl->setToolTip(restart_text);
|
||||||
bar->insertWidget(0,restartIconLbl);
|
m_bar->insertWidget(0,restartIconLbl);
|
||||||
QLabel *restartLbl = new QLabel();
|
QLabel *restartLbl = new QLabel(m_bar);
|
||||||
restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||||
bar->insertWidget(1, restartLbl);
|
m_bar->insertWidget(1, restartLbl);
|
||||||
QFontMetrics fm(restartLbl->font());
|
QFontMetrics fm(restartLbl->font());
|
||||||
restartLbl->setText(fm.elidedText(restart_text, Qt::ElideRight, restartLbl->width()));
|
restartLbl->setText(fm.elidedText(restart_text, Qt::ElideRight, restartLbl->width()));
|
||||||
QBtSession::instance()->addConsoleMessage(tr("qBittorrent was just updated and needs to be restarted for the changes to be effective."), "red");
|
QBtSession::instance()->addConsoleMessage(tr("qBittorrent was just updated and needs to be restarted for the changes to be effective."), "red");
|
||||||
|
@ -259,7 +247,7 @@ public slots:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStatusBar *bar;
|
QStatusBar *m_bar;
|
||||||
QPushButton *dlSpeedLbl;
|
QPushButton *dlSpeedLbl;
|
||||||
QPushButton *upSpeedLbl;
|
QPushButton *upSpeedLbl;
|
||||||
QLabel *DHTLbl;
|
QLabel *DHTLbl;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue