]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/dolphinitemlistview.h
DolphinView: Conform to global scroll speed
[dolphin.git] / src / views / dolphinitemlistview.h
1 /*
2 * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef DOLPHINITEMLISTVIEW_H
8 #define DOLPHINITEMLISTVIEW_H
9
10 #include "dolphin_export.h"
11 #include "kitemviews/kfileitemlistview.h"
12
13 class KFileItemListView;
14
15 /**
16 * @brief Dolphin specific view-implementation.
17 *
18 * Offers zoom-level support and takes care for translating
19 * the view-properties into the corresponding KItemListView
20 * properties.
21 */
22 class DOLPHIN_EXPORT DolphinItemListView : public KFileItemListView
23 {
24 Q_OBJECT
25
26 public:
27 explicit DolphinItemListView(QGraphicsWidget *parent = nullptr);
28 ~DolphinItemListView() override;
29
30 void setZoomLevel(int level);
31 int zoomLevel() const;
32
33 enum SelectionTogglesEnabled { True, False, FollowSetting };
34 /**
35 * Sets whether the items in this view should show a small selection toggle area on mouse hover.
36 * The default for this view is to follow the "showSelectionToggle" setting but this method can
37 * be used to ignore that setting and force a different value.
38 */
39 void setEnabledSelectionToggles(SelectionTogglesEnabled selectionTogglesEnabled);
40
41 void readSettings();
42 void writeSettings();
43
44 protected:
45 KItemListWidgetCreatorBase *defaultWidgetCreator() const override;
46 /** Overwriting in the Dolphin-specific class because we want this to be user-configurable.
47 * @see KStandardItemListView::itemLayoutHighlightEntireRow */
48 bool itemLayoutHighlightEntireRow(ItemLayout layout) const override;
49 bool itemLayoutSupportsItemExpanding(ItemLayout layout) const override;
50 void onItemLayoutChanged(ItemLayout current, ItemLayout previous) override;
51 void onPreviewsShownChanged(bool shown) override;
52 void onVisibleRolesChanged(const QList<QByteArray> &current, const QList<QByteArray> &previous) override;
53
54 void updateFont() override;
55
56 private:
57 void updateGridSize();
58
59 using KItemListView::setEnabledSelectionToggles; // Makes sure that the setEnabledSelectionToggles() declaration above doesn't hide
60 // the one from the base class so we can still use it privately.
61 SelectionTogglesEnabled m_selectionTogglesEnabled = FollowSetting;
62
63 private:
64 int m_zoomLevel;
65 };
66
67 #endif