~ubuntu-branches/ubuntu/utopic/kdebase/utopic

« back to all changes in this revision

Viewing changes to dolphin/src/views/dolphincolumnviewcontainer.h

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers, José Manuel Santamaría Lema, Modestas Vainius
  • Date: 2011-05-26 02:53:50 UTC
  • mfrom: (0.7.7 upstream) (0.4.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 296.
  • Revision ID: james.westby@ubuntu.com-20110526025350-7o10g65yegec2rnq
Tags: 4:4.6.3-1
* New upstream release.

[ José Manuel Santamaría Lema ]
* Bump kde-sc-dev-latest build dependency to 4:4.6.3.
* Bump Standards-Version to 3.9.2; no changes needed.

[ Modestas Vainius ]
* Enable DLRestrictions for libraries in this package. Requires
  libdlrestrictions-dev 0.14 and kdelibs5-dev 4:4.6.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2007-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 DOLPHINCOLUMNVIEWCONTAINER_H
 
21
#define DOLPHINCOLUMNVIEWCONTAINER_H
 
22
 
 
23
#include "dolphinview.h"
 
24
 
 
25
#include <kurl.h>
 
26
 
 
27
#include <QList>
 
28
#include <QScrollArea>
 
29
#include <QString>
 
30
 
 
31
class DolphinColumnView;
 
32
class DolphinViewController;
 
33
class QFrame;
 
34
class QTimeLine;
 
35
class QTimer;
 
36
 
 
37
/**
 
38
 * @brief Represents a container for columns represented as instances
 
39
 *        of DolphinColumnView.
 
40
 *
 
41
 * @see DolphinColumnView
 
42
 */
 
43
class DolphinColumnViewContainer : public QScrollArea
 
44
{
 
45
    Q_OBJECT
 
46
 
 
47
public:
 
48
    /**
 
49
     * @param parent                Parent widget.
 
50
     * @param dolphinViewController Allows the DolphinColumnView to control the
 
51
     *                              DolphinView in a limited way.
 
52
     * @param viewModeController    Controller that is used by the DolphinView
 
53
     *                              to control the DolphinColumnView. The DolphinColumnView
 
54
     *                              only has read access to the controller.
 
55
     * @param model                 Directory that is shown.
 
56
     */
 
57
    explicit DolphinColumnViewContainer(QWidget* parent,
 
58
                                        DolphinViewController* dolphinViewController,
 
59
                                        const ViewModeController* viewModeController);
 
60
    virtual ~DolphinColumnViewContainer();
 
61
 
 
62
    KUrl rootUrl() const;
 
63
 
 
64
    QAbstractItemView* activeColumn() const;
 
65
 
 
66
    /**
 
67
     * Shows the column which represents the URL \a url. If the column
 
68
     * is already shown, it gets activated, otherwise it will be created.
 
69
     */
 
70
    void showColumn(const KUrl& url);
 
71
 
 
72
protected:
 
73
    virtual void mousePressEvent(QMouseEvent* event);
 
74
    virtual void keyPressEvent(QKeyEvent* event);
 
75
    virtual void resizeEvent(QResizeEvent* event);
 
76
    virtual void wheelEvent(QWheelEvent* event);
 
77
 
 
78
private slots:
 
79
    /**
 
80
     * Moves the content of the columns view to represent
 
81
     * the scrollbar position \a x.
 
82
     */
 
83
    void moveContentHorizontally(int x);
 
84
 
 
85
    /**
 
86
     * Updates the background color of the columns to respect
 
87
     * the current activation state \a active.
 
88
     */
 
89
    void updateColumnsBackground(bool active);
 
90
 
 
91
    /**
 
92
     * Tells the Dolphin controller to update the active URL
 
93
     * to m_activeUrl. The slot is called asynchronously with a
 
94
     * small delay, as this prevents a flickering when a directory
 
95
     * from an inactive column gets selected.
 
96
     */
 
97
    void updateActiveUrl();
 
98
 
 
99
    /**
 
100
     * Invoked when m_assureVisibleActiveColumnTimer has been exceeded.
 
101
     * Assures that the currently active column is fully visible
 
102
     * by adjusting the horizontal position of the content.
 
103
     */
 
104
    void slotAssureVisibleActiveColumn();
 
105
 
 
106
private:
 
107
    /**
 
108
     * Assures that the currently active column is fully visible
 
109
     * by adjusting the horizontal position of the content. The
 
110
     * adjustment is done with a small delay (see
 
111
     * slotAssureVisibleActiveColumn();
 
112
     */
 
113
    void assureVisibleActiveColumn();
 
114
 
 
115
    void layoutColumns();
 
116
 
 
117
    /**
 
118
     * Request the activation for the column \a column. It is assured
 
119
     * that the columns gets fully visible by adjusting the horizontal
 
120
     * position of the content.
 
121
     */
 
122
    void requestActivation(DolphinColumnView* column);
 
123
 
 
124
    /** Removes all columns except of the root column. */
 
125
    void removeAllColumns();
 
126
 
 
127
    /**
 
128
     * Deletes the column. If the itemview of the controller is set to the column,
 
129
     * the controllers itemview is set to 0.
 
130
     */
 
131
    void deleteColumn(DolphinColumnView* column);
 
132
 
 
133
private:
 
134
    DolphinViewController* m_dolphinViewController;
 
135
    const ViewModeController* m_viewModeController;
 
136
    bool m_active;
 
137
    int m_index;
 
138
    int m_contentX;
 
139
    QList<DolphinColumnView*> m_columns;
 
140
    QFrame* m_emptyViewport;
 
141
    QTimeLine* m_animation;
 
142
    QAbstractItemView* m_dragSource;
 
143
 
 
144
    QTimer* m_activeUrlTimer;
 
145
    QTimer* m_assureVisibleActiveColumnTimer;
 
146
 
 
147
    friend class DolphinColumnView;
 
148
};
 
149
 
 
150
#endif