Changed statusbar hashing label to ElidedLabel

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7823 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-01-07 11:47:10 +00:00
parent f9439f2bac
commit 7cf4ef4f8b
3 changed files with 6 additions and 29 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;
};