Changeset View
Changeset View
Standalone View
Standalone View
tabbox/clientmodel.h
Show All 23 Lines | |||||
24 | 24 | | |||
25 | #include <QModelIndex> | 25 | #include <QModelIndex> | ||
26 | /** | 26 | /** | ||
27 | * @file | 27 | * @file | ||
28 | * This file defines the class ClientModel, the model for TabBoxClients. | 28 | * This file defines the class ClientModel, the model for TabBoxClients. | ||
29 | * | 29 | * | ||
30 | * @author Martin Gräßlin <mgraesslin@kde.org> | 30 | * @author Martin Gräßlin <mgraesslin@kde.org> | ||
31 | * @since 4.4 | 31 | * @since 4.4 | ||
32 | */ | 32 | **/ | ||
33 | 33 | | |||
34 | namespace KWin | 34 | namespace KWin | ||
35 | { | 35 | { | ||
36 | namespace TabBox | 36 | namespace TabBox | ||
37 | { | 37 | { | ||
38 | 38 | | |||
39 | 39 | | |||
40 | /** | 40 | /** | ||
41 | * The model for TabBoxClients used in TabBox. | 41 | * The model for TabBoxClients used in TabBox. | ||
42 | * | 42 | * | ||
43 | * @author Martin Gräßlin <mgraesslin@kde.org> | 43 | * @author Martin Gräßlin <mgraesslin@kde.org> | ||
44 | * @since 4.4 | 44 | * @since 4.4 | ||
45 | */ | 45 | **/ | ||
46 | class ClientModel | 46 | class ClientModel | ||
47 | : public QAbstractItemModel | 47 | : public QAbstractItemModel | ||
48 | { | 48 | { | ||
49 | Q_OBJECT | 49 | Q_OBJECT | ||
50 | public: | 50 | public: | ||
51 | enum { | 51 | enum { | ||
52 | ClientRole = Qt::UserRole, ///< The TabBoxClient | 52 | ClientRole = Qt::UserRole, ///< The TabBoxClient | ||
53 | CaptionRole = Qt::UserRole + 1, ///< The caption of TabBoxClient | 53 | CaptionRole = Qt::UserRole + 1, ///< The caption of TabBoxClient | ||
Show All 11 Lines | |||||
65 | virtual QModelIndex parent(const QModelIndex& child) const; | 65 | virtual QModelIndex parent(const QModelIndex& child) const; | ||
66 | virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const; | 66 | virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const; | ||
67 | Q_INVOKABLE QString longestCaption() const; | 67 | Q_INVOKABLE QString longestCaption() const; | ||
68 | 68 | | |||
69 | /** | 69 | /** | ||
70 | * @param client The TabBoxClient whose index should be returned | 70 | * @param client The TabBoxClient whose index should be returned | ||
71 | * @return Returns the ModelIndex of given TabBoxClient or an invalid ModelIndex | 71 | * @return Returns the ModelIndex of given TabBoxClient or an invalid ModelIndex | ||
72 | * if the model does not contain the given TabBoxClient. | 72 | * if the model does not contain the given TabBoxClient. | ||
73 | */ | 73 | **/ | ||
74 | QModelIndex index(QWeakPointer<TabBoxClient> client) const; | 74 | QModelIndex index(QWeakPointer<TabBoxClient> client) const; | ||
75 | 75 | | |||
76 | /** | 76 | /** | ||
77 | * Generates a new list of TabBoxClients based on the current config. | 77 | * Generates a new list of TabBoxClients based on the current config. | ||
78 | * Calling this method will reset the model. If partialReset is true | 78 | * Calling this method will reset the model. If partialReset is true | ||
79 | * the top of the list is kept as a starting point. If not the | 79 | * the top of the list is kept as a starting point. If not the | ||
80 | * current active client is used as the starting point to generate the | 80 | * current active client is used as the starting point to generate the | ||
81 | * list. | 81 | * list. | ||
82 | * @param desktop The desktop for which the list should be created | 82 | * @param desktop The desktop for which the list should be created | ||
83 | * @param partialReset Keep the currently selected client or regenerate everything | 83 | * @param partialReset Keep the currently selected client or regenerate everything | ||
84 | */ | 84 | **/ | ||
85 | void createClientList(int desktop, bool partialReset = false); | 85 | void createClientList(int desktop, bool partialReset = false); | ||
86 | /** | 86 | /** | ||
87 | * This method is provided as a overload for current desktop | 87 | * This method is provided as a overload for current desktop | ||
88 | * @see createClientList | 88 | * @see createClientList | ||
89 | */ | 89 | **/ | ||
90 | void createClientList(bool partialReset = false); | 90 | void createClientList(bool partialReset = false); | ||
91 | /** | 91 | /** | ||
92 | * @return Returns the current list of TabBoxClients. | 92 | * @return Returns the current list of TabBoxClients. | ||
93 | */ | 93 | **/ | ||
94 | TabBoxClientList clientList() const { | 94 | TabBoxClientList clientList() const { | ||
95 | return m_clientList; | 95 | return m_clientList; | ||
96 | } | 96 | } | ||
97 | 97 | | |||
98 | public Q_SLOTS: | 98 | public Q_SLOTS: | ||
99 | void close(int index); | 99 | void close(int index); | ||
100 | /** | 100 | /** | ||
101 | * Activates the client at @p index and closes the TabBox. | 101 | * Activates the client at @p index and closes the TabBox. | ||
Show All 12 Lines |