Browse Source

Adjust the size of the elements in the statusbar

Use the same height for all the elements and try to prevent
variations of the speed labels.
adaptive-webui-19844
Gabriele 10 years ago
parent
commit
f46e660679
  1. 33
      src/statusbar.cpp

33
src/statusbar.cpp

@ -55,12 +55,10 @@ StatusBar::StatusBar(QStatusBar *bar) @@ -55,12 +55,10 @@ StatusBar::StatusBar(QStatusBar *bar)
connecStatusLblIcon = new QPushButton(bar);
connecStatusLblIcon->setFlat(true);
connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
connecStatusLblIcon->setFixedWidth(32);
connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
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>"));
dlSpeedLbl = new QPushButton(bar);
dlSpeedLbl->setIconSize(QSize(16,16));
dlSpeedLbl->setIcon(QIcon(":/Icons/skin/download.png"));
//dlSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
connect(dlSpeedLbl, SIGNAL(clicked()), this, SLOT(capDownloadSpeed()));
@ -69,8 +67,6 @@ StatusBar::StatusBar(QStatusBar *bar) @@ -69,8 +67,6 @@ StatusBar::StatusBar(QStatusBar *bar)
dlSpeedLbl->setCursor(Qt::PointingHandCursor);
altSpeedsBtn = new QPushButton(bar);
altSpeedsBtn->setFixedWidth(36);
altSpeedsBtn->setIconSize(QSize(32,32));
altSpeedsBtn->setFlat(true);
altSpeedsBtn->setFocusPolicy(Qt::NoFocus);
altSpeedsBtn->setCursor(Qt::PointingHandCursor);
@ -79,7 +75,6 @@ StatusBar::StatusBar(QStatusBar *bar) @@ -79,7 +75,6 @@ StatusBar::StatusBar(QStatusBar *bar)
connect(altSpeedsBtn, SIGNAL(clicked()), this, SLOT(toggleAlternativeSpeeds()));
upSpeedLbl = new QPushButton(bar);
upSpeedLbl->setIconSize(QSize(16,16));
upSpeedLbl->setIcon(QIcon(":/Icons/skin/seeding.png"));
//upSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
connect(upSpeedLbl, SIGNAL(clicked()), this, SLOT(capUploadSpeed()));
@ -88,20 +83,32 @@ StatusBar::StatusBar(QStatusBar *bar) @@ -88,20 +83,32 @@ StatusBar::StatusBar(QStatusBar *bar)
upSpeedLbl->setCursor(Qt::PointingHandCursor);
DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), bar);
DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
QRect labelRect = dlSpeedLbl->fontMetrics().boundingRect(" XX 0.000,00 XiX/s (000,0 XiX) ");
if (labelRect.height() < 26)
labelRect.setHeight(26);
dlSpeedLbl->setIconSize(QSize(16,16));
upSpeedLbl->setIconSize(QSize(16,16));
connecStatusLblIcon->setFixedHeight(labelRect.height());
altSpeedsBtn->setIconSize(QSize(30,30)); // cut out blank parts
altSpeedsBtn->setFixedHeight(labelRect.height());
dlSpeedLbl->setMinimumSize(labelRect.width(), labelRect.height());
upSpeedLbl->setMinimumSize(labelRect.width(), labelRect.height());
statusSep1 = new QFrame(bar);
statusSep1->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
statusSep1->setFixedSize(3, labelRect.height());
statusSep1->setFrameStyle(QFrame::VLine);
statusSep1->setFrameShadow(QFrame::Raised);
statusSep2 = new QFrame(bar);
statusSep2->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
statusSep2->setFixedSize(3, labelRect.height());
statusSep2->setFrameStyle(QFrame::VLine);
statusSep2->setFrameShadow(QFrame::Raised);
statusSep3 = new QFrame(bar);
statusSep3->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
statusSep3->setFixedSize(3, labelRect.height());
statusSep3->setFrameStyle(QFrame::VLine);
statusSep3->setFrameShadow(QFrame::Raised);
statusSep4 = new QFrame(bar);
statusSep4->setFixedSize(3, dlSpeedLbl->fontMetrics().height());
statusSep4->setFixedSize(3, labelRect.height());
statusSep4->setFrameStyle(QFrame::VLine);
statusSep4->setFrameShadow(QFrame::Raised);
layout->addWidget(DHTLbl);
@ -116,11 +123,9 @@ StatusBar::StatusBar(QStatusBar *bar) @@ -116,11 +123,9 @@ StatusBar::StatusBar(QStatusBar *bar)
bar->addPermanentWidget(container);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
//bar->setStyleSheet("QWidget {padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0;}\n");
container->setContentsMargins(0, 0, 0, 1);
bar->setContentsMargins(0, 0, 0, 0);
container->setFixedHeight(dlSpeedLbl->fontMetrics().height()+7);
bar->setFixedHeight(dlSpeedLbl->fontMetrics().height()+9);
bar->setStyleSheet("QWidget {padding: 0; margin: 0;}\n QPushButton {padding: 3px;}\n");
container->adjustSize();
bar->adjustSize();
// Is DHT enabled
DHTLbl->setVisible(pref->isDHTEnabled());
refreshTimer = new QTimer(bar);

Loading…
Cancel
Save