X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/78cffd2979a6ed87e044fcb024cf4fdfc5c7cb3d..5233d129fca917f806f19d2df8263e93c4edec4d:/src/selectionmode/bottombar.h diff --git a/src/selectionmode/bottombar.h b/src/selectionmode/bottombar.h index ab29a85a5..73515b0bd 100644 --- a/src/selectionmode/bottombar.h +++ b/src/selectionmode/bottombar.h @@ -1,6 +1,6 @@ /* This file is part of the KDE project - SPDX-FileCopyrightText: 2022 Felix Ernst + SPDX-FileCopyrightText: 2022 Felix Ernst SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ @@ -8,24 +8,21 @@ #ifndef BOTTOMBAR_H #define BOTTOMBAR_H +#include "animatedheightwidget.h" #include "global.h" #include #include -#include -#include class KActionCollection; class KFileItemList; -class QAction; class QPushButton; class QResizeEvent; -class QScrollArea; class QUrl; namespace SelectionMode { - class BottomBarContentsContainer; +class BottomBarContentsContainer; /** * @brief A bar used in selection mode that serves various purposes depending on what the user is currently trying to do. @@ -35,7 +32,7 @@ namespace SelectionMode * * The visible contents of the bar are managed in BottomBarContentsContainer. This class serves as a wrapper around it. */ -class BottomBar : public QWidget +class BottomBar : public AnimatedHeightWidget { Q_OBJECT @@ -74,6 +71,7 @@ public: * @param visible Whether this bar is supposed to be visible long term * @param animated Whether this should be animated. The animation is skipped if the users' settings are configured that way. * + * @see AnimatedHeightWidget::setVisible() * @see QWidget::setVisible() */ void setVisible(bool visible, Animated animated); @@ -84,9 +82,6 @@ public: void resetContents(Contents contents); Contents contents() const; - /** @returns a width of 1 to make sure that this bar never causes side panels to shrink. */ - QSize sizeHint() const override; - public Q_SLOTS: /** Adapts the contents based on the selection in the related view. */ void slotSelectionChanged(const KFileItemList &selection, const QUrl &baseUrl); @@ -100,7 +95,7 @@ Q_SIGNALS: */ void error(const QString &errorMessage); - void leaveSelectionModeRequested(); + void selectionModeLeavingRequested(); protected: /** Is installed on an internal widget to make sure that the height of the bar is adjusted to its contents. */ @@ -110,8 +105,6 @@ protected: void resizeEvent(QResizeEvent *resizeEvent) override; private: - using QWidget::setVisible; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget so we can still use it privately. - /** * Identical to SelectionModeBottomBar::setVisible() but doesn't change m_allowedToBeVisible. * @see SelectionModeBottomBar::setVisible() @@ -119,9 +112,10 @@ private: */ void setVisibleInternal(bool visible, Animated animated); + /** @see AnimatedHeightWidget::preferredHeight() */ + int preferredHeight() const override; + private: - /** The only direct child widget of this bar. */ - QScrollArea *m_scrollArea; /** The only direct grandchild of this bar. */ BottomBarContentsContainer *m_contentsContainer; @@ -129,8 +123,6 @@ private: * This is necessary because this bar might have been setVisible(true) but there is no reason to show the bar currently so it was kept hidden. * @see SelectionModeBottomBar::setVisible() */ bool m_allowedToBeVisible = false; - /** @see SelectionModeBottomBar::setVisible() */ - QPointer m_heightAnimation; }; }