]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/statusbar/dolphinstatusbar.cpp
[Status Bar] Don't mess with status bar visibility in extensions
[dolphin.git] / src / statusbar / dolphinstatusbar.cpp
index 9bb050d052441434fd224c02abc56a712a0b0f60..87dce7e0a873ff9b62f87b5aaaed91084d9fffe7 100644 (file)
@@ -1,21 +1,8 @@
-/***************************************************************************
- *   Copyright (C) 2006-2012 by Peter Penz <peter.penz19@gmail.com>        *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2006-2012 Peter Penz <peter.penz19@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #include "dolphinstatusbar.h"
 
@@ -47,6 +34,7 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) :
     m_text(),
     m_defaultText(),
     m_label(nullptr),
+    m_zoomLabel(nullptr),
     m_spaceInfo(nullptr),
     m_zoomSlider(nullptr),
     m_progressBar(nullptr),
@@ -61,6 +49,9 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) :
     m_label->setWordWrap(true);
     m_label->setTextFormat(Qt::PlainText);
 
+    // Initialize zoom slider's explanatory label
+    m_zoomLabel = new QLabel(i18nc("Used as a noun, i.e. 'Here is the zoom level:'","Zoom:"), this);
+
     // Initialize zoom widget
     m_zoomSlider = new QSlider(Qt::Horizontal, this);
     m_zoomSlider->setAccessibleName(i18n("Zoom"));
@@ -113,25 +104,27 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) :
     m_label->setFixedHeight(contentHeight);
     m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 
-    m_zoomSlider->setMaximumWidth(fontMetrics.averageCharWidth() * 25);
+    m_zoomSlider->setMaximumWidth(fontMetrics.averageCharWidth() * 15);
 
-    m_spaceInfo->setFixedHeight(zoomSliderHeight);
+    m_spaceInfo->setFixedHeight(contentHeight);
     m_spaceInfo->setMaximumWidth(fontMetrics.averageCharWidth() * 25);
     m_spaceInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 
     m_progressBar->setFixedHeight(zoomSliderHeight);
-    m_progressBar->setMaximumWidth(fontMetrics.averageCharWidth() * 25);
+    m_progressBar->setMaximumWidth(fontMetrics.averageCharWidth() * 20);
 
     QHBoxLayout* topLayout = new QHBoxLayout(this);
     topLayout->setContentsMargins(2, 0, 2, 0);
     topLayout->setSpacing(4);
     topLayout->addWidget(m_label, 1);
+    topLayout->addWidget(m_zoomLabel);
     topLayout->addWidget(m_zoomSlider, 1);
     topLayout->addWidget(m_spaceInfo, 1);
     topLayout->addWidget(m_stopButton);
     topLayout->addWidget(m_progressTextLabel);
     topLayout->addWidget(m_progressBar);
 
+    setVisible(GeneralSettings::showStatusBar());
     setExtensionsVisible(true);
     setWhatsThis(xi18nc("@info:whatsthis Statusbar", "<para>This is "
         "the <emphasis>Statusbar</emphasis>. It contains three elements "
@@ -229,7 +222,9 @@ QString DolphinStatusBar::defaultText() const
 
 void DolphinStatusBar::setUrl(const QUrl& url)
 {
-    m_spaceInfo->setUrl(url);
+    if (GeneralSettings::showSpaceInfo()) {
+        m_spaceInfo->setUrl(url);
+    }
 }
 
 QUrl DolphinStatusBar::url() const
@@ -251,6 +246,7 @@ int DolphinStatusBar::zoomLevel() const
 
 void DolphinStatusBar::readSettings()
 {
+    setVisible(GeneralSettings::showStatusBar());
     setExtensionsVisible(true);
 }
 
@@ -261,7 +257,7 @@ void DolphinStatusBar::updateSpaceInfo()
 
 void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event)
 {
-    Q_UNUSED(event);
+    Q_UNUSED(event)
 
     QMenu menu(this);
 
@@ -278,6 +274,7 @@ void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event)
         const bool visible = showZoomSliderAction->isChecked();
         GeneralSettings::setShowZoomSlider(visible);
         m_zoomSlider->setVisible(visible);
+        m_zoomLabel->setVisible(visible);
     } else if (action == showSpaceInfoAction) {
         const bool visible = showSpaceInfoAction->isChecked();
         GeneralSettings::setShowSpaceInfo(visible);
@@ -332,7 +329,10 @@ void DolphinStatusBar::setExtensionsVisible(bool visible)
         showSpaceInfo = GeneralSettings::showSpaceInfo();
         showZoomSlider = GeneralSettings::showZoomSlider();
     }
+
+    m_spaceInfo->setShown(showSpaceInfo);
     m_spaceInfo->setVisible(showSpaceInfo);
     m_zoomSlider->setVisible(showZoomSlider);
+    m_zoomLabel->setVisible(showZoomSlider);
 }