- Started to improved the status bar style

This commit is contained in:
Christophe Dumez 2009-11-18 14:54:33 +00:00
parent 0cb5993f66
commit 5da2e6a9ee
4 changed files with 48 additions and 10 deletions

View file

@ -33,6 +33,7 @@
- COSMETIC: Added a "torrent status" column to transfer list
- COSMETIC: Display Seeds and Peers in two separate columns
- COSMETIC: New deletion confirmation dialog (Merged delete/delete permanently actions)
- COSMETIC: Improved status bar layout spacing
* Thu Sep 3 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.0
- FEATURE: Added Magnet URI support

View file

@ -196,14 +196,14 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
// Accept drag 'n drops
setAcceptDrops(true);
createKeyboardShortcuts();
// Create status bar
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
show();
// Load Window state and sizes
readSettings();
properties->readSettings();
// Create status bar
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
if(Preferences::startMinimized()) {
setWindowState(Qt::WindowMinimized);

View file

@ -17,7 +17,11 @@
<string/>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout"/>
<layout class="QVBoxLayout">
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">

View file

@ -35,6 +35,8 @@
#include <QFrame>
#include <QLabel>
#include <QTimer>
#include <QGridLayout>
#include <QHBoxLayout>
#include "bittorrent.h"
#include "misc.h"
@ -52,17 +54,29 @@ private:
QFrame *statusSep4;
QLabel *connecStatusLblIcon;
QTimer *refreshTimer;
QWidget *container;
QGridLayout *layout;
bittorrent *BTSession;
public:
StatusBar(QStatusBar *bar, bittorrent *BTSession): bar(bar), BTSession(BTSession) {
container = new QWidget();
layout = new QGridLayout(bar);
layout->setVerticalSpacing(0);
layout->setContentsMargins(0,0,0,0);
container->setLayout(layout);
connecStatusLblIcon = new QLabel();
connecStatusLblIcon->setFixedWidth(22);
connecStatusLblIcon->setFrameShape(QFrame::NoFrame);
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/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>"));
dlSpeedLbl = new QLabel(tr("D: %1 KiB/s - T: %2", "Download speed: x KiB/s - Transferred: xMiB").arg("0.0").arg(misc::friendlyUnit(0)));
dlSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
upSpeedLbl = new QLabel(tr("U: %1 KiB/s - T: %2", "Upload speed: x KiB/s - Transferred: xMiB").arg("0.0").arg(misc::friendlyUnit(0)));
upSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0));
DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
statusSep1 = new QFrame();
statusSep1->setFixedWidth(1);
statusSep1->setFrameStyle(QFrame::Box);
@ -73,14 +87,31 @@ public:
statusSep3->setFixedWidth(1);
statusSep3->setFrameStyle(QFrame::Box);
statusSep4 = new QFrame();
bar->addPermanentWidget(DHTLbl);
bar->addPermanentWidget(statusSep1);
bar->addPermanentWidget(connecStatusLblIcon);
bar->addPermanentWidget(statusSep2);
bar->addPermanentWidget(dlSpeedLbl);
bar->addPermanentWidget(statusSep3);
bar->addPermanentWidget(upSpeedLbl);
layout->addWidget(DHTLbl, 0, 0);
layout->setColumnStretch(0, 1);
layout->addWidget(statusSep1, 0, 1);
layout->setColumnStretch(1, 0);
layout->addWidget(connecStatusLblIcon, 0, 2);
layout->setColumnStretch(2, 0);
layout->addWidget(statusSep2, 0, 3);
layout->setColumnStretch(3, 0);
layout->addWidget(dlSpeedLbl, 0, 4);
layout->setColumnStretch(4, 1);
layout->addWidget(statusSep3, 0, 5);
layout->setColumnStretch(5, 0);
layout->addWidget(upSpeedLbl, 0, 6);
layout->setColumnStretch(6, 1);
bar->addPermanentWidget(container);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
//container->setBaseSize(bar->width()-24, 24);
//container->setFixedWidth(bar->width()-24);
bar->setStyleSheet("QWidget {padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0;};");
container->setContentsMargins(0, 0, 0, 1);
bar->setContentsMargins(0, 0, 0, 0);
container->setFixedHeight(24);
bar->setContentsMargins(12, 0, 12, 0);
bar->setFixedHeight(26);
refreshTimer = new QTimer(bar);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refreshStatusBar()));
refreshTimer->start(1500);
@ -95,6 +126,8 @@ public:
delete statusSep2;
delete statusSep3;
delete connecStatusLblIcon;
delete layout;
delete container;
}
public slots: