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
;
34 class SelectionManager
;
36 class QAbstractItemView
;
37 class VersionControlObserver
;
40 * @brief Responsible for creating extensions like tooltips and previews
41 * that are available in all view implementations.
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.
48 class ViewExtensionsFactory
: public QObject
53 explicit ViewExtensionsFactory(QAbstractItemView
* view
,
54 DolphinController
* controller
);
55 virtual ~ViewExtensionsFactory();
58 * Must be invoked by the item view, when QAbstractItemView::currentChanged()
59 * has been called. Assures that the current item stays visible when it has been
60 * changed by the keyboard.
62 void handleCurrentIndexChange(const QModelIndex
& current
, const QModelIndex
& previous
);
64 DolphinFileItemDelegate
* fileItemDelegate() const;
67 * Enables the automatically expanding of a folder when dragging
68 * items above the folder.
70 void setAutoFolderExpandingEnabled(bool enabled
);
71 bool autoFolderExpandingEnabled() const;
74 virtual bool eventFilter(QObject
* watched
, QEvent
* event
);
77 void slotZoomLevelChanged();
78 void cancelPreviews();
79 void slotShowPreviewChanged();
80 void slotShowHiddenFilesChanged();
81 void slotSortingChanged(DolphinView::Sorting sorting
);
82 void slotSortOrderChanged(Qt::SortOrder order
);
83 void slotSortFoldersFirstChanged(bool foldersFirst
);
84 void slotNameFilterChanged(const QString
& nameFilter
);
85 void slotRequestVersionControlActions(const KFileItemList
& items
);
86 void requestActivation();
89 DolphinSortFilterProxyModel
* proxyModel() const;
92 QAbstractItemView
* m_view
;
93 DolphinController
* m_controller
;
94 ToolTipManager
* m_toolTipManager
;
95 KFilePreviewGenerator
* m_previewGenerator
;
96 SelectionManager
* m_selectionManager
;
97 DolphinViewAutoScroller
* m_autoScroller
;
98 DolphinFileItemDelegate
* m_fileItemDelegate
;
99 VersionControlObserver
* m_versionControlObserver
;
100 FolderExpander
* m_folderExpander
;