1 /***************************************************************************
2 * Copyright (C) 2010 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef VIEWMODECONTROLLER_H
21 #define VIEWMODECONTROLLER_H
23 #include "dolphin_export.h"
24 #include "views/dolphinview.h"
30 * @brief Allows the DolphinView to control the view implementations for the
31 * different view modes.
33 * The view implementations (DolphinIconsView, DolphinDetailsView, DolphinColumnView)
34 * connect to signals of the ViewModeController to react on changes. The view
35 * implementations get only read-access to the ViewModeController.
37 class DOLPHIN_EXPORT ViewModeController
: public QObject
42 explicit ViewModeController(QObject
* parent
= nullptr);
43 ~ViewModeController() override
;
46 * @return URL that is shown by the view mode implementation.
51 * Sets the URL to \a url and does nothing else. Called when
52 * a redirection happens. See ViewModeController::setUrl()
54 void redirectToUrl(const QUrl
& url
);
57 * Informs the view mode implementation about a change of the activation
58 * state by emitting the signal activationChanged().
60 void indicateActivationChange(bool active
);
63 * Sets the zoom level to \a level and emits the signal zoomLevelChanged().
64 * It must be assured that the used level is inside the range
65 * ViewModeController::zoomLevelMinimum() and
66 * ViewModeController::zoomLevelMaximum().
68 void setZoomLevel(int level
);
69 int zoomLevel() const;
72 * Sets the name filter to \a and emits the signal nameFilterChanged().
74 void setNameFilter(const QString
& nameFilter
);
75 QString
nameFilter() const;
78 * Requests the view mode implementation to hide tooltips.
80 void requestToolTipHiding();
84 * Sets the URL to \a url and emits the signals cancelPreviews() and
85 * urlChanged() if \a url is different for the current URL.
87 void setUrl(const QUrl
& url
);
91 * Is emitted if the URL has been changed by ViewModeController::setUrl().
93 void urlChanged(const QUrl
& url
);
96 * Is emitted, if ViewModeController::indicateActivationChange() has been
97 * invoked. The view mode implementation may update its visual state
98 * to represent the activation state.
100 void activationChanged(bool active
);
103 * Is emitted if the name filter has been changed by
104 * ViewModeController::setNameFilter().
106 void nameFilterChanged(const QString
& nameFilter
);
109 * Is emitted if the zoom level has been changed by
110 * ViewModeController::setZoomLevel().
112 void zoomLevelChanged(int level
);
115 * Is emitted if pending previews should be canceled (e. g. because of an URL change).
117 void cancelPreviews();
121 QString m_nameFilter
;