]> cloud.milkyroute.net Git - dolphin.git/blob - src/viewextensionsfactory.h
move the DolphinFileItemDelegate creation into ViewExtensionsFactory
[dolphin.git] / src / 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 class DolphinController;
26 class DolphinFileItemDelegate;
27 class DolphinViewAutoScroller;
28 class KFilePreviewGenerator;
29 class QModelIndex;
30 class SelectionManager;
31 class ToolTipManager;
32 class QAbstractItemView;
33
34 /**
35 * @brief Responsible for creating extensions like tooltips and previews
36 * that are available in all view implementations.
37 *
38 * Each view implementation (iconsview, detailsview, columnview) must
39 * instantiate an instance of this class to assure having
40 * a common behavior that is independent from the custom functionality of
41 * a view implementation.
42 */
43 class ViewExtensionsFactory : public QObject
44 {
45 Q_OBJECT
46
47 public:
48 explicit ViewExtensionsFactory(QAbstractItemView* view,
49 DolphinController* controller);
50 virtual ~ViewExtensionsFactory();
51
52 /**
53 * Must be invoked by the item view, when QAbstractItemView::currentChanged()
54 * has been called. Assures that the current item stays visible when it has been
55 * changed by the keyboard.
56 */
57 void handleCurrentIndexChange(const QModelIndex& current, const QModelIndex& previous);
58
59 DolphinFileItemDelegate* fileItemDelegate() const;
60
61 protected:
62 virtual bool eventFilter(QObject* watched, QEvent* event);
63
64 private slots:
65 void slotZoomLevelChanged();
66 void cancelPreviews();
67 void slotShowPreviewChanged();
68 void requestActivation();
69
70 private:
71 DolphinController* m_controller;
72 ToolTipManager* m_toolTipManager;
73 KFilePreviewGenerator* m_previewGenerator;
74 SelectionManager* m_selectionManager;
75 DolphinViewAutoScroller* m_autoScroller;
76 DolphinFileItemDelegate* m_fileItemDelegate;
77 };
78
79 #endif
80