| 1 | // -*- c-basic-offset: 2 -*- |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of Licq, an instant messaging client for UNIX. |
|---|
| 4 | * Copyright (C) 1999-2006 Licq developers |
|---|
| 5 | * |
|---|
| 6 | * Licq is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * Licq is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with Licq; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef USERVIEW_H |
|---|
| 22 | #define USERVIEW_H |
|---|
| 23 | |
|---|
| 24 | #include "contactlist/contactlist.h" |
|---|
| 25 | |
|---|
| 26 | #include "userviewbase.h" |
|---|
| 27 | |
|---|
| 28 | namespace LicqQtGui |
|---|
| 29 | { |
|---|
| 30 | |
|---|
| 31 | /** |
|---|
| 32 | * Contact list view that can show either single groups or a threaded view |
|---|
| 33 | */ |
|---|
| 34 | class UserView : public UserViewBase |
|---|
| 35 | { |
|---|
| 36 | Q_OBJECT |
|---|
| 37 | |
|---|
| 38 | public: |
|---|
| 39 | /** |
|---|
| 40 | * Constructor |
|---|
| 41 | * |
|---|
| 42 | * @param contactList The contact list instance |
|---|
| 43 | * @param parent Parent object |
|---|
| 44 | */ |
|---|
| 45 | UserView(ContactListModel* contactList, QWidget* parent = 0); |
|---|
| 46 | |
|---|
| 47 | /** |
|---|
| 48 | * Destructor |
|---|
| 49 | */ |
|---|
| 50 | virtual ~UserView(); |
|---|
| 51 | |
|---|
| 52 | /** |
|---|
| 53 | * Get the currently selected user |
|---|
| 54 | * |
|---|
| 55 | * @param id Return parameter for user id |
|---|
| 56 | * @param ppid Return parameter for protocol id |
|---|
| 57 | * @return True if a user is currently selected |
|---|
| 58 | */ |
|---|
| 59 | bool MainWindowSelectedItemUser(QString& id, unsigned long& ppid) const; |
|---|
| 60 | |
|---|
| 61 | /** |
|---|
| 62 | * Set skin colors |
|---|
| 63 | * |
|---|
| 64 | * @param back Background color |
|---|
| 65 | */ |
|---|
| 66 | virtual void setColors(QColor back); |
|---|
| 67 | |
|---|
| 68 | public slots: |
|---|
| 69 | /** |
|---|
| 70 | * Set current view to display |
|---|
| 71 | */ |
|---|
| 72 | void updateRootIndex(); |
|---|
| 73 | |
|---|
| 74 | /** |
|---|
| 75 | * Update expanded status of all groups (only relevant for threaded view mode) |
|---|
| 76 | */ |
|---|
| 77 | void expandGroups(); |
|---|
| 78 | |
|---|
| 79 | protected slots: |
|---|
| 80 | /** |
|---|
| 81 | * Apply new skin |
|---|
| 82 | */ |
|---|
| 83 | virtual void applySkin(); |
|---|
| 84 | |
|---|
| 85 | /** |
|---|
| 86 | * Overload the base class so we can analyze the rows |
|---|
| 87 | * which were inserted and act accordingly |
|---|
| 88 | * |
|---|
| 89 | * @param parent The view index which was populated |
|---|
| 90 | * @param start The number of the first inserted row |
|---|
| 91 | * @param end The number of the last inserted row |
|---|
| 92 | */ |
|---|
| 93 | virtual void rowsInserted(const QModelIndex& parent, int start, int end); |
|---|
| 94 | |
|---|
| 95 | private: |
|---|
| 96 | /** |
|---|
| 97 | * Mouse button was pressed |
|---|
| 98 | * |
|---|
| 99 | * @param event Mouse event |
|---|
| 100 | */ |
|---|
| 101 | virtual void mousePressEvent(QMouseEvent* event); |
|---|
| 102 | |
|---|
| 103 | /** |
|---|
| 104 | * Key was pressed |
|---|
| 105 | * |
|---|
| 106 | * @param event Key event |
|---|
| 107 | */ |
|---|
| 108 | virtual void keyPressEvent(QKeyEvent* event); |
|---|
| 109 | |
|---|
| 110 | /** |
|---|
| 111 | * Mouse was moved |
|---|
| 112 | * |
|---|
| 113 | * @param event Mouse event |
|---|
| 114 | */ |
|---|
| 115 | virtual void mouseMoveEvent(QMouseEvent* event); |
|---|
| 116 | |
|---|
| 117 | /** |
|---|
| 118 | * Sets row spanning for particular rows in the given group |
|---|
| 119 | * |
|---|
| 120 | * @param parent The view index to analyze |
|---|
| 121 | * @param start The count of the first row |
|---|
| 122 | * @param end The count of the last row |
|---|
| 123 | */ |
|---|
| 124 | void spanRowRange(const QModelIndex& parent, int start, int end); |
|---|
| 125 | |
|---|
| 126 | private slots: |
|---|
| 127 | /** |
|---|
| 128 | * Tell proxy to resort list according to current settings |
|---|
| 129 | */ |
|---|
| 130 | void resort(); |
|---|
| 131 | |
|---|
| 132 | /** |
|---|
| 133 | * A group has been expanded |
|---|
| 134 | * |
|---|
| 135 | * @param index Model index of the expanded group |
|---|
| 136 | */ |
|---|
| 137 | void slotExpanded(const QModelIndex& index); |
|---|
| 138 | |
|---|
| 139 | /** |
|---|
| 140 | * A group has been collapsed |
|---|
| 141 | * |
|---|
| 142 | * @param index Model index of the expanded group |
|---|
| 143 | */ |
|---|
| 144 | void slotCollapsed(const QModelIndex& index); |
|---|
| 145 | |
|---|
| 146 | /** |
|---|
| 147 | * A header has been clicked and the list should be resorted |
|---|
| 148 | * |
|---|
| 149 | * @param column Number of the column to sort by |
|---|
| 150 | */ |
|---|
| 151 | void slotHeaderClicked(int column); |
|---|
| 152 | |
|---|
| 153 | /** |
|---|
| 154 | * Reload config settings |
|---|
| 155 | */ |
|---|
| 156 | void configUpdated(); |
|---|
| 157 | }; |
|---|
| 158 | |
|---|
| 159 | } // namespace LicqQtGui |
|---|
| 160 | |
|---|
| 161 | #endif |
|---|