]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/selectionmode/bottombar.cpp
Merge branch 'master' into kf6
[dolphin.git] / src / selectionmode / bottombar.cpp
index 4ca184a6dfade54033355b3d150743b59f085af3..b40fc95db4f301d80612b4a3ea24499ba3e8a6bb 100644 (file)
@@ -1,27 +1,25 @@
 /*
     This file is part of the KDE project
-    SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@zohomail.eu>
+    SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@kde.org>
 
     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
 */
 
 #include "bottombar.h"
 
-#include "bottombarcontentscontainer.h"
 #include "backgroundcolorhelper.h"
-#include "global.h"
+#include "bottombarcontentscontainer.h"
 
 #include <QGridLayout>
 #include <QResizeEvent>
 #include <QScrollArea>
 #include <QStyle>
-#include <QtGlobal>
 #include <QTimer>
 
 using namespace SelectionMode;
 
-BottomBar::BottomBar(KActionCollection *actionCollection, QWidget *parent) :
-    QWidget{parent}
+BottomBar::BottomBar(KActionCollection *actionCollection, QWidget *parent)
+    QWidget{parent}
 {
     // Showing of this widget is normally animated. We hide it for now and make it small.
     hide();
@@ -46,13 +44,13 @@ BottomBar::BottomBar(KActionCollection *actionCollection, QWidget *parent) :
     m_scrollArea->setWidget(m_contentsContainer);
     m_contentsContainer->installEventFilter(this); // Adjusts the height of this bar to the height of the contentsContainer
     connect(m_contentsContainer, &BottomBarContentsContainer::error, this, &BottomBar::error);
-    connect(m_contentsContainer, &BottomBarContentsContainer::barVisibilityChangeRequested, this, [this](bool visible){
+    connect(m_contentsContainer, &BottomBarContentsContainer::barVisibilityChangeRequested, this, [this](bool visible) {
         if (!m_allowedToBeVisible && visible) {
             return;
         }
         setVisibleInternal(visible, WithAnimation);
     });
-    connect(m_contentsContainer, &BottomBarContentsContainer::leaveSelectionModeRequested, this, &BottomBar::leaveSelectionModeRequested);
+    connect(m_contentsContainer, &BottomBarContentsContainer::selectionModeLeavingRequested, this, &BottomBar::selectionModeLeavingRequested);
 
     BackgroundColorHelper::instance()->controlBackgroundColor(this);
 }
@@ -79,20 +77,18 @@ void BottomBar::setVisibleInternal(bool visible, Animated animated)
         m_heightAnimation->stop(); // deletes because of QAbstractAnimation::DeleteWhenStopped.
     }
     m_heightAnimation = new QPropertyAnimation(this, "maximumHeight");
-    m_heightAnimation->setDuration(2 *
-            style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, this) *
-            GlobalConfig::animationDurationFactor());
+    m_heightAnimation->setDuration(2 * style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, this) * GlobalConfig::animationDurationFactor());
     m_heightAnimation->setStartValue(height());
     m_heightAnimation->setEasingCurve(QEasingCurve::OutCubic);
     if (visible) {
         show();
         m_heightAnimation->setEndValue(sizeHint().height());
-        connect(m_heightAnimation, &QAbstractAnimation::finished,
-                this, [this](){ setMaximumHeight(sizeHint().height()); });
+        connect(m_heightAnimation, &QAbstractAnimation::finished, this, [this]() {
+            setMaximumHeight(sizeHint().height());
+        });
     } else {
         m_heightAnimation->setEndValue(0);
-        connect(m_heightAnimation, &QAbstractAnimation::finished,
-                this, &QWidget::hide);
+        connect(m_heightAnimation, &QAbstractAnimation::finished, this, &QWidget::hide);
     }
 
     m_heightAnimation->start(QAbstractAnimation::DeleteWhenStopped);
@@ -114,7 +110,7 @@ void BottomBar::slotSplitTabDisabled()
     switch (contents()) {
     case CopyToOtherViewContents:
     case MoveToOtherViewContents:
-        Q_EMIT leaveSelectionModeRequested();
+        Q_EMIT selectionModeLeavingRequested();
     default:
         return;
     }
@@ -164,3 +160,5 @@ void BottomBar::resizeEvent(QResizeEvent *resizeEvent)
 
     return QWidget::resizeEvent(resizeEvent);
 }
+
+#include "moc_bottombar.cpp"