1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
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 VIEWEXTENSIONSFACTORY_H
21 #define VIEWEXTENSIONSFACTORY_H
25 #include "dolphinview.h"
27 class DolphinController
;
28 class DolphinFileItemDelegate
;
29 class DolphinSortFilterProxyModel
;
30 class DolphinViewAutoScroller
;
31 class KFilePreviewGenerator
;
33 class SelectionManager
;
35 class QAbstractItemView
;
38 * @brief Responsible for creating extensions like tooltips and previews
39 * that are available in all view implementations.
41 * Each view implementation (iconsview, detailsview, columnview) must
42 * instantiate an instance of this class to assure having
43 * a common behavior that is independent from the custom functionality of
44 * a view implementation.
46 class ViewExtensionsFactory
: public QObject
51 explicit ViewExtensionsFactory(QAbstractItemView
* view
,
52 DolphinController
* controller
);
53 virtual ~ViewExtensionsFactory();
56 * Must be invoked by the item view, when QAbstractItemView::currentChanged()
57 * has been called. Assures that the current item stays visible when it has been
58 * changed by the keyboard.
60 void handleCurrentIndexChange(const QModelIndex
& current
, const QModelIndex
& previous
);
62 DolphinFileItemDelegate
* fileItemDelegate() const;
65 virtual bool eventFilter(QObject
* watched
, QEvent
* event
);
68 void slotZoomLevelChanged();
69 void cancelPreviews();
70 void slotShowPreviewChanged();
71 void slotShowHiddenFilesChanged();
72 void slotSortingChanged(DolphinView::Sorting sorting
);
73 void slotSortOrderChanged(Qt::SortOrder order
);
74 void slotSortFoldersFirstChanged(bool foldersFirst
);
75 void requestActivation();
78 DolphinSortFilterProxyModel
* proxyModel() const;
81 QAbstractItemView
* m_view
;
82 DolphinController
* m_controller
;
83 ToolTipManager
* m_toolTipManager
;
84 KFilePreviewGenerator
* m_previewGenerator
;
85 SelectionManager
* m_selectionManager
;
86 DolphinViewAutoScroller
* m_autoScroller
;
87 DolphinFileItemDelegate
* m_fileItemDelegate
;