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
25 #include "dolphin_export.h"
26 #include <views/dolphinview.h>
29 * @brief Allows the DolphinView to control the view implementations for the
30 * different view modes.
32 * The view implementations (DolphinIconsView, DolphinDetailsView, DolphinColumnView)
33 * connect to signals of the ViewModeController to react on changes. The view
34 * implementations get only read-access to the ViewModeController.
36 class DOLPHIN_EXPORT ViewModeController
: public QObject
41 explicit ViewModeController(QObject
* parent
= 0);
42 ~ViewModeController() override
;
45 * @return URL that is shown by the view mode implementation.
50 * Sets the URL to \a url and does nothing else. Called when
51 * a redirection happens. See ViewModeController::setUrl()
53 void redirectToUrl(const QUrl
& url
);
56 * Informs the view mode implementation about a change of the activation
57 * state by emitting the signal activationChanged().
59 void indicateActivationChange(bool active
);
62 * Sets the zoom level to \a level and emits the signal zoomLevelChanged().
63 * It must be assured that the used level is inside the range
64 * ViewModeController::zoomLevelMinimum() and
65 * ViewModeController::zoomLevelMaximum().
67 void setZoomLevel(int level
);
68 int zoomLevel() const;
71 * Sets the name filter to \a and emits the signal nameFilterChanged().
73 void setNameFilter(const QString
& nameFilter
);
74 QString
nameFilter() const;
77 * Requests the view mode implementation to hide tooltips.
79 void requestToolTipHiding();
83 * Sets the URL to \a url and emits the signals cancelPreviews() and
84 * urlChanged() if \a url is different for the current URL.
86 void setUrl(const QUrl
& url
);
90 * Is emitted if the URL has been changed by ViewModeController::setUrl().
92 void urlChanged(const QUrl
& url
);
95 * Is emitted, if ViewModeController::indicateActivationChange() has been
96 * invoked. The view mode implementation may update its visual state
97 * to represent the activation state.
99 void activationChanged(bool active
);
102 * Is emitted if the name filter has been changed by
103 * ViewModeController::setNameFilter().
105 void nameFilterChanged(const QString
& nameFilter
);
108 * Is emitted if the zoom level has been changed by
109 * ViewModeController::setZoomLevel().
111 void zoomLevelChanged(int level
);
114 * Is emitted if pending previews should be canceled (e. g. because of an URL change).
116 void cancelPreviews();
120 QString m_nameFilter
;