Browse Source

- Started to improved the status bar style

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
5da2e6a9ee
  1. 1
      Changelog
  2. 4
      src/GUI.cpp
  3. 6
      src/MainWindow.ui
  4. 47
      src/statusbar.h

1
Changelog

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

4
src/GUI.cpp

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

6
src/MainWindow.ui

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

47
src/statusbar.h

@ -35,6 +35,8 @@
#include <QFrame> #include <QFrame>
#include <QLabel> #include <QLabel>
#include <QTimer> #include <QTimer>
#include <QGridLayout>
#include <QHBoxLayout>
#include "bittorrent.h" #include "bittorrent.h"
#include "misc.h" #include "misc.h"
@ -52,17 +54,29 @@ private:
QFrame *statusSep4; QFrame *statusSep4;
QLabel *connecStatusLblIcon; QLabel *connecStatusLblIcon;
QTimer *refreshTimer; QTimer *refreshTimer;
QWidget *container;
QGridLayout *layout;
bittorrent *BTSession; bittorrent *BTSession;
public: public:
StatusBar(QStatusBar *bar, bittorrent *BTSession): bar(bar), BTSession(BTSession) { 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 = new QLabel();
connecStatusLblIcon->setFixedWidth(22);
connecStatusLblIcon->setFrameShape(QFrame::NoFrame); connecStatusLblIcon->setFrameShape(QFrame::NoFrame);
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/firewalled.png"))); 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>")); 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 = 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 = 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 = new QLabel(tr("DHT: %1 nodes").arg(0));
DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
statusSep1 = new QFrame(); statusSep1 = new QFrame();
statusSep1->setFixedWidth(1); statusSep1->setFixedWidth(1);
statusSep1->setFrameStyle(QFrame::Box); statusSep1->setFrameStyle(QFrame::Box);
@ -73,14 +87,31 @@ public:
statusSep3->setFixedWidth(1); statusSep3->setFixedWidth(1);
statusSep3->setFrameStyle(QFrame::Box); statusSep3->setFrameStyle(QFrame::Box);
statusSep4 = new QFrame(); statusSep4 = new QFrame();
bar->addPermanentWidget(DHTLbl); layout->addWidget(DHTLbl, 0, 0);
bar->addPermanentWidget(statusSep1); layout->setColumnStretch(0, 1);
bar->addPermanentWidget(connecStatusLblIcon); layout->addWidget(statusSep1, 0, 1);
bar->addPermanentWidget(statusSep2); layout->setColumnStretch(1, 0);
bar->addPermanentWidget(dlSpeedLbl); layout->addWidget(connecStatusLblIcon, 0, 2);
bar->addPermanentWidget(statusSep3); layout->setColumnStretch(2, 0);
bar->addPermanentWidget(upSpeedLbl); 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); refreshTimer = new QTimer(bar);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refreshStatusBar())); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refreshStatusBar()));
refreshTimer->start(1500); refreshTimer->start(1500);
@ -95,6 +126,8 @@ public:
delete statusSep2; delete statusSep2;
delete statusSep3; delete statusSep3;
delete connecStatusLblIcon; delete connecStatusLblIcon;
delete layout;
delete container;
} }
public slots: public slots:

Loading…
Cancel
Save