mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
layout cleanups for the statusbar
svn path=/trunk/KDE/kdebase/apps/; revision=726013
This commit is contained in:
parent
dc1966aec3
commit
d67de9dfef
|
@ -51,18 +51,20 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent, const KUrl& url) :
|
|||
m_progressBar = new QProgressBar(this);
|
||||
m_progressBar->hide();
|
||||
|
||||
const QSize size(m_progressBar->sizeHint());
|
||||
const int barHeight = size.height();
|
||||
const int contentHeight = QFontMetrics(m_messageLabel->font()).height();
|
||||
const int barHeight = contentHeight + 8;
|
||||
|
||||
m_progressBar->setMaximumWidth(200);
|
||||
setMinimumHeight(barHeight);
|
||||
m_messageLabel->setMinimumTextHeight(barHeight);
|
||||
m_spaceInfo->setFixedHeight(barHeight);
|
||||
m_spaceInfo->setFixedHeight(contentHeight);
|
||||
m_progressBar->setFixedHeight(contentHeight);
|
||||
m_progressBar->setMaximumWidth(200);
|
||||
}
|
||||
|
||||
|
||||
DolphinStatusBar::~DolphinStatusBar()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void DolphinStatusBar::setMessage(const QString& msg,
|
||||
Type type)
|
||||
|
|
|
@ -59,7 +59,8 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget* parent) :
|
|||
}
|
||||
|
||||
StatusBarMessageLabel::~StatusBarMessageLabel()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void StatusBarMessageLabel::setMessage(const QString& text,
|
||||
DolphinStatusBar::Type type)
|
||||
|
@ -122,7 +123,9 @@ void StatusBarMessageLabel::setMinimumTextHeight(int min)
|
|||
if (min != m_minTextHeight) {
|
||||
m_minTextHeight = min;
|
||||
setMinimumHeight(min);
|
||||
m_closeButton->setFixedHeight(min - borderGap() * 2);
|
||||
if (m_closeButton->height() > min) {
|
||||
m_closeButton->setFixedHeight(min);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,12 +155,12 @@ void StatusBarMessageLabel::paintEvent(QPaintEvent* /* event */)
|
|||
painter.drawRect(QRect(0, 0, width(), height()));
|
||||
|
||||
// draw pixmap
|
||||
int x = borderGap();
|
||||
int x = BorderGap;
|
||||
int y = (m_minTextHeight - m_pixmap.height()) / 2;
|
||||
|
||||
if (!m_pixmap.isNull()) {
|
||||
painter.drawPixmap(x, y, m_pixmap);
|
||||
x += m_pixmap.width() + borderGap();
|
||||
x += m_pixmap.width() + BorderGap;
|
||||
}
|
||||
|
||||
// draw text
|
||||
|
@ -265,14 +268,14 @@ void StatusBarMessageLabel::assureVisibleText()
|
|||
int StatusBarMessageLabel::availableTextWidth() const
|
||||
{
|
||||
const int buttonWidth = (m_type == DolphinStatusBar::Error) ?
|
||||
m_closeButton->width() + borderGap() : 0;
|
||||
return width() - m_pixmap.width() - (borderGap() * 4) - buttonWidth;
|
||||
m_closeButton->width() + BorderGap : 0;
|
||||
return width() - m_pixmap.width() - (BorderGap * 4) - buttonWidth;
|
||||
}
|
||||
|
||||
void StatusBarMessageLabel::updateCloseButtonPosition()
|
||||
{
|
||||
const int x = width() - m_closeButton->width() - borderGap();
|
||||
const int y = height() - m_closeButton->height() - borderGap();
|
||||
const int x = width() - m_closeButton->width() - BorderGap;
|
||||
const int y = (height() - m_closeButton->height()) / 2;
|
||||
m_closeButton->move(x, y);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,10 +125,8 @@ private:
|
|||
Desaturate
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GeometryTimeout = 100
|
||||
};
|
||||
enum { GeometryTimeout = 100 };
|
||||
enum { BorderGap = 2 };
|
||||
|
||||
DolphinStatusBar::Type m_type;
|
||||
State m_state;
|
||||
|
@ -140,11 +138,6 @@ private:
|
|||
QList<QString> m_pendingMessages;
|
||||
QPixmap m_pixmap;
|
||||
QPushButton* m_closeButton;
|
||||
|
||||
int borderGap() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
inline DolphinStatusBar::Type StatusBarMessageLabel::type() const
|
||||
|
|
Loading…
Reference in a new issue