2 * SPDX-FileCopyrightText: 2010 Peter Penz <peter.penz19@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef VIEWMODECONTROLLER_H
8 #define VIEWMODECONTROLLER_H
10 #include "dolphin_export.h"
11 #include "views/dolphinview.h"
17 * @brief Allows the DolphinView to control the view implementations for the
18 * different view modes.
20 * The view implementations (DolphinIconsView, DolphinDetailsView, DolphinColumnView)
21 * connect to signals of the ViewModeController to react on changes. The view
22 * implementations get only read-access to the ViewModeController.
24 class DOLPHIN_EXPORT ViewModeController
: public QObject
29 explicit ViewModeController(QObject
*parent
= nullptr);
30 ~ViewModeController() override
;
33 * @return URL that is shown by the view mode implementation.
38 * Sets the URL to \a url and does nothing else. Called when
39 * a redirection happens. See ViewModeController::setUrl()
41 void redirectToUrl(const QUrl
&url
);
44 * Informs the view mode implementation about a change of the activation
45 * state by emitting the signal activationChanged().
47 void indicateActivationChange(bool active
);
50 * Sets the zoom level to \a level and emits the signal zoomLevelChanged().
51 * It must be assured that the used level is inside the range
52 * ViewModeController::zoomLevelMinimum() and
53 * ViewModeController::zoomLevelMaximum().
55 void setZoomLevel(int level
);
56 int zoomLevel() const;
59 * Sets the name filter to \a and emits the signal nameFilterChanged().
61 void setNameFilter(const QString
&nameFilter
);
62 QString
nameFilter() const;
66 * Sets the URL to \a url and emits the signals cancelPreviews() and
67 * urlChanged() if \a url is different for the current URL.
69 void setUrl(const QUrl
&url
);
73 * Is emitted if the URL has been changed by ViewModeController::setUrl().
75 void urlChanged(const QUrl
&url
);
78 * Is emitted, if ViewModeController::indicateActivationChange() has been
79 * invoked. The view mode implementation may update its visual state
80 * to represent the activation state.
82 void activationChanged(bool active
);
85 * Is emitted if the name filter has been changed by
86 * ViewModeController::setNameFilter().
88 void nameFilterChanged(const QString
&nameFilter
);
91 * Is emitted if the zoom level has been changed by
92 * ViewModeController::setZoomLevel().
94 void zoomLevelChanged(int level
);
97 * Is emitted if pending previews should be canceled (e. g. because of an URL change).
99 void cancelPreviews();
103 QString m_nameFilter
;