+ m_zoomLabel->setVisible(showZoomSlider);
+ updateContentsMargins();
+}
+
+void DolphinStatusBar::updateContentsMargins()
+{
+ if (GeneralSettings::showStatusBar() == GeneralSettings::EnumShowStatusBar::FullWidth) {
+ // We reduce the outside margin for the flat button so it visually has the same margin as the status bar text label on the other end of the bar.
+ m_topLayout->setContentsMargins(6, 0, 2, 0);
+ } else {
+ // Add extra margins to toplayout to avoid clipping too early.
+ m_topLayout->setContentsMargins(clippingAmount() * 2, 0, clippingAmount(), 0);
+ }
+ setContentsMargins(0, 0, 0, 0);
+}
+
+void DolphinStatusBar::paintEvent(QPaintEvent *paintEvent)
+{
+ Q_UNUSED(paintEvent)
+ QPainter p(this);
+ QStyleOption opt;
+ opt.initFrom(this);
+ // Draw statusbar only if there is text.
+ if (GeneralSettings::showStatusBar() == GeneralSettings::EnumShowStatusBar::Small) {
+ if (m_label && !m_label->fullText().isEmpty()) {
+ opt.state = QStyle::State_Sunken;
+ QPainterPath path;
+ // Adjust the rectangle to be a bit larger, then clip the left and bottom border off.
+ QRect clipRect;
+ if (layoutDirection() == Qt::RightToLeft) {
+ opt.rect = rect().adjusted(0, 0, clippingAmount(), clippingAmount());
+ clipRect = QRect(opt.rect.topLeft(), opt.rect.bottomRight()).adjusted(0, 0, -clippingAmount(), -clippingAmount());
+ } else {
+ opt.rect = rect().adjusted(-clippingAmount(), 0, 0, clippingAmount());
+ clipRect = QRect(opt.rect.topLeft(), opt.rect.bottomRight()).adjusted(clippingAmount(), 0, 0, -clippingAmount());
+ }
+ path.addRect(clipRect);
+ p.setClipPath(path);
+ opt.palette.setColor(QPalette::Base, palette().window().color());
+ p.setBrush(palette().window().color());
+ p.setPen(Qt::transparent);
+ p.drawRoundedRect(opt.rect, 5, 5); // Radius is from Breeze style.
+ style()->drawPrimitive(QStyle::PE_Frame, &opt, &p, this);
+ }
+ }
+ // Draw regular statusbar.
+ else {
+ style()->drawPrimitive(QStyle::PE_PanelStatusBar, &opt, &p, this);
+ }
+}
+
+int DolphinStatusBar::preferredHeight() const
+{
+ return m_spaceInfo->height();