From 27f257ba03f3491094d0070bf32469ebad2f242f Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 26 Oct 2010 17:57:07 +0000 Subject: [PATCH] BUGFIX: Elide status bar text if it is too wide --- Changelog | 1 + src/statusbar.h | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Changelog b/Changelog index 71bb1a47e..356048606 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ * Unreleased - Christophe Dumez - v2.4.9 - BUGFIX: Fix crash when pressing enter in save path field in torrent addition dialog + - BUGFIX: Elide status bar text if it is too wide * Sun Oct 24 2010 - Christophe Dumez - v2.4.8 - BUGFIX: Fix possible crash on manual peer ban diff --git a/src/statusbar.h b/src/statusbar.h index b7b5d796c..5b2a12489 100644 --- a/src/statusbar.h +++ b/src/statusbar.h @@ -38,6 +38,7 @@ #include #include #include +#include #include "bittorrent.h" #include "speedlimitdlg.h" #include "preferences.h" @@ -163,11 +164,16 @@ public: public slots: void showRestartRequired() { // Restart required notification - QLabel *restartLbl = new QLabel(tr("qBittorrent needs to be restarted")); - restartLbl->setPixmap(QPixmap(":/Icons/oxygen/dialog-warning.png").scaled(QSize(24,24))); - restartLbl->setToolTip(tr("qBittorrent needs to be restarted")); - bar->insertWidget(0,restartLbl); - bar->insertWidget(1, new QLabel(tr("qBittorrent needs to be restarted"))); + const QString restart_text = tr("qBittorrent needs to be restarted"); + QLabel *restartIconLbl = new QLabel(); + restartIconLbl->setPixmap(QPixmap(":/Icons/oxygen/dialog-warning.png").scaled(QSize(24,24))); + restartIconLbl->setToolTip(restart_text); + bar->insertWidget(0,restartIconLbl); + QLabel *restartLbl = new QLabel(); + restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + bar->insertWidget(1, restartLbl); + QFontMetrics fm(restartLbl->font()); + restartLbl->setText(fm.elidedText(restart_text, Qt::ElideRight, restartLbl->width())); } void stopTimer() {