]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphindetailsview.h
681a5e1f98ffb8058416d8002f52dfd2bd962952
[dolphin.git] / src / dolphindetailsview.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
3 * peter.penz@gmx.at *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
20
21 #ifndef DOLPHINDETAILSVIEW_H
22 #define DOLPHINDETAILSVIEW_H
23
24 #include <dolphinview.h>
25 #include <QStyleOptionViewItem>
26 #include <QTreeView>
27 #include <libdolphin_export.h>
28
29 class DolphinController;
30
31 /**
32 * @brief Represents the details view which shows the name, size,
33 * date, permissions, owner and group of an item.
34 *
35 * The width of the columns is automatically adjusted in a way
36 * that full available width of the view is used by stretching the width
37 * of the name column.
38 */
39 class LIBDOLPHINPRIVATE_EXPORT DolphinDetailsView : public QTreeView
40 {
41 Q_OBJECT
42
43 public:
44 explicit DolphinDetailsView(QWidget* parent, DolphinController* controller);
45 virtual ~DolphinDetailsView();
46
47 protected:
48 virtual bool event(QEvent* event);
49 virtual QStyleOptionViewItem viewOptions() const;
50 virtual void contextMenuEvent(QContextMenuEvent* event);
51 virtual void mouseReleaseEvent(QMouseEvent* event);
52 virtual void dragEnterEvent(QDragEnterEvent* event);
53 virtual void dropEvent(QDropEvent* event);
54
55 private slots:
56 /**
57 * Sets the sort indicator section of the header view
58 * corresponding to \a sorting.
59 */
60 void setSortIndicatorSection(DolphinView::Sorting sorting);
61
62 /**
63 * Sets the sort indicator order of the header view
64 * corresponding to \a sortOrder.
65 */
66 void setSortIndicatorOrder(Qt::SortOrder sortOrder);
67
68 /**
69 * Synchronizes the sorting state of the Dolphin menu 'View -> Sort'
70 * with the current state of the details view.
71 * @param column Index of the current sorting column.
72 */
73 void synchronizeSortingState(int column);
74
75 void zoomIn();
76 void zoomOut();
77
78 private:
79 bool isZoomInPossible() const;
80 bool isZoomOutPossible() const;
81
82 /**
83 * Updates the size of the decoration dependent on the
84 * icon size of the DetailsModeSettings. The controller
85 * will get informed about possible zoom in/zoom out
86 * operations.
87 */
88 void updateDecorationSize();
89
90 private:
91 DolphinController* m_controller;
92 QStyleOptionViewItem m_viewOptions;
93 };
94
95 #endif