]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/viewextensionsfactory.h
Use capitalized KDE includes
[dolphin.git] / src / views / viewextensionsfactory.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
3 * *
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. *
8 * *
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. *
13 * *
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 ***************************************************************************/
19
20 #ifndef VIEWEXTENSIONSFACTORY_H
21 #define VIEWEXTENSIONSFACTORY_H
22
23 #include <QObject>
24
25 #include "dolphinview.h"
26
27 class DolphinFileItemDelegate;
28 class DolphinSortFilterProxyModel;
29 class DolphinViewAutoScroller;
30 class KFilePreviewGenerator;
31 class FolderExpander;
32 class QModelIndex;
33 class SelectionManager;
34 class ToolTipManager;
35 class QAbstractItemView;
36 class VersionControlObserver;
37 class ViewModeController;
38
39 /**
40 * @brief Responsible for creating extensions like tooltips and previews
41 * that are available in all view implementations.
42 *
43 * Each view implementation (iconsview, detailsview, columnview) must
44 * instantiate an instance of this class to assure having
45 * a common behavior that is independent from the custom functionality of
46 * a view implementation.
47 */
48 class ViewExtensionsFactory : public QObject
49 {
50 Q_OBJECT
51
52 public:
53 explicit ViewExtensionsFactory(QAbstractItemView* view,
54 DolphinViewController* dolphinViewController,
55 const ViewModeController* viewModeController);
56 virtual ~ViewExtensionsFactory();
57
58 /**
59 * Must be invoked by the item view, when QAbstractItemView::currentChanged()
60 * has been called. Assures that the current item stays visible when it has been
61 * changed by the keyboard.
62 */
63 void handleCurrentIndexChange(const QModelIndex& current, const QModelIndex& previous);
64
65 DolphinFileItemDelegate* fileItemDelegate() const;
66
67 /**
68 * Enables the automatically expanding of a folder when dragging
69 * items above the folder.
70 */
71 void setAutoFolderExpandingEnabled(bool enabled);
72 bool autoFolderExpandingEnabled() const;
73
74 protected:
75 virtual bool eventFilter(QObject* watched, QEvent* event);
76
77 private slots:
78 void slotZoomLevelChanged();
79 void cancelPreviews();
80 void slotShowPreviewChanged();
81 void slotShowHiddenFilesChanged();
82 void slotSortingChanged(DolphinView::Sorting sorting);
83 void slotSortOrderChanged(Qt::SortOrder order);
84 void slotSortFoldersFirstChanged(bool foldersFirst);
85 void slotNameFilterChanged(const QString& nameFilter);
86 void slotRequestVersionControlActions(const KFileItemList& items);
87 void requestActivation();
88
89 private:
90 DolphinSortFilterProxyModel* proxyModel() const;
91
92 private:
93 QAbstractItemView* m_view;
94 DolphinViewController* m_dolphinViewController;
95 ToolTipManager* m_toolTipManager;
96 KFilePreviewGenerator* m_previewGenerator;
97 SelectionManager* m_selectionManager;
98 DolphinViewAutoScroller* m_autoScroller;
99 DolphinFileItemDelegate* m_fileItemDelegate;
100 VersionControlObserver* m_versionControlObserver;
101 FolderExpander* m_folderExpander;
102 };
103
104 #endif
105