From 7cf4ef4f8b58eb203378cc80057db6d4ef664ed6 Mon Sep 17 00:00:00 2001
From: thunder2 <retroshare.project@gmail.com>
Date: Wed, 7 Jan 2015 11:47:10 +0000
Subject: [PATCH] Changed statusbar hashing label to ElidedLabel

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7823 b45a01b8-16f6-495d-af2f-9b41ad6348cc
---
 retroshare-gui/src/gui/MainWindow.cpp         |  2 +-
 .../src/gui/statusbar/hashingstatus.cpp       | 29 ++-----------------
 .../src/gui/statusbar/hashingstatus.h         |  4 ++-
 3 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp
index 4d8eefc63..27b95136c 100644
--- a/retroshare-gui/src/gui/MainWindow.cpp
+++ b/retroshare-gui/src/gui/MainWindow.cpp
@@ -260,7 +260,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
     statusBar()->addWidget(dhtstatus);
 
     hashingstatus = new HashingStatus();
-    statusBar()->addPermanentWidget(hashingstatus);
+    statusBar()->addPermanentWidget(hashingstatus, 1);
 
     discstatus = new DiscStatus();
     statusBar()->addPermanentWidget(discstatus);
diff --git a/retroshare-gui/src/gui/statusbar/hashingstatus.cpp b/retroshare-gui/src/gui/statusbar/hashingstatus.cpp
index 536be0460..d24a264ff 100644
--- a/retroshare-gui/src/gui/statusbar/hashingstatus.cpp
+++ b/retroshare-gui/src/gui/statusbar/hashingstatus.cpp
@@ -24,31 +24,9 @@
 #include <QMovie>
 
 #include "hashingstatus.h"
-
+#include "gui/common/ElidedLabel.h"
 #include "gui/notifyqt.h"
 
-class StatusLabel : public QLabel
-{
-public:
-    StatusLabel(QLayout *layout, int diffWidth, QWidget *parent = NULL, Qt::WindowFlags f = 0) : QLabel(parent, f)
-    {
-        m_layout = layout;
-        m_diffWidth = diffWidth;
-    }
-
-    virtual QSize minimumSizeHint() const
-    {
-        const QSize sizeHint = QLabel::minimumSizeHint();
-
-        // do not resize the layout
-        return QSize(qMin(sizeHint.width(), m_layout->geometry().width() - m_diffWidth), sizeHint.height());
-    }
-
-private:
-    QLayout *m_layout;
-    int m_diffWidth;
-};
-
 HashingStatus::HashingStatus(QWidget *parent)
  : QWidget(parent)
 {
@@ -63,12 +41,9 @@ HashingStatus::HashingStatus(QWidget *parent)
     hbox->addWidget(hashloader);
 
     movie->jumpToNextFrame(); // to calculate the real width
-    statusHashing = new StatusLabel(hbox, movie->frameRect().width() + hbox->spacing(), this);
+    statusHashing = new ElidedLabel(this);
     hbox->addWidget(statusHashing);
 
-    QSpacerItem *horizontalSpacer = new QSpacerItem(3000, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
-    hbox->addItem(horizontalSpacer);
-
     _compactMode = false;
 
     setLayout(hbox);
diff --git a/retroshare-gui/src/gui/statusbar/hashingstatus.h b/retroshare-gui/src/gui/statusbar/hashingstatus.h
index e21c1dafe..c26cbfc9a 100644
--- a/retroshare-gui/src/gui/statusbar/hashingstatus.h
+++ b/retroshare-gui/src/gui/statusbar/hashingstatus.h
@@ -24,6 +24,7 @@
 #include <QWidget>
 
 class QLabel;
+class ElidedLabel;
 
 class HashingStatus : public QWidget
 {
@@ -39,7 +40,8 @@ public slots:
     void updateHashingInfo(const QString&) ;
 
 private:
-    QLabel *statusHashing, *hashloader;
+    ElidedLabel *statusHashing;
+    QLabel *hashloader;
     QMovie *movie;
     bool _compactMode;
 };