source: SMSSender/frontend/gui/ui/models/grouptablemodel.h @ 316:16f8e7f93ca4

separation-frontend-backend
Last change on this file since 316:16f8e7f93ca4 was 316:16f8e7f93ca4, checked in by Sämy Zehnder <saemy.zehnder@…>, 8 years ago
  • Adds the copyright header to each file and updates the development period.
File size: 2.0 KB
Line 
1/*
2 smssender - A frontend for fast and easy SMS sending over different gateways.
3 Copyright (C) 2007-2014, gorrión. See http://smssender.gorrion.ch
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 3 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, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef UI_GROUPTABLEMODEL_H
19#define UI_GROUPTABLEMODEL_H
20
21#include <QAbstractTableModel>
22
23#include "common/domain/sgroup.h"
24#include "frontend/business/groupmanager.h"
25
26namespace UI {
27
28class GroupTableModel: public QAbstractTableModel {
29    Q_OBJECT
30
31public:
32    enum Columns {
33        ColImage   = 0,
34        ColName    = 1,
35        ColMembers = 2,
36
37        MaxCol     = ColMembers
38    };
39
40public:
41    GroupTableModel(QObject *parent, GroupManager *groupManager);
42
43    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
44    QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
45    int      columnCount(const QModelIndex& parent = QModelIndex()) const;
46    int      rowCount(const QModelIndex& parent = QModelIndex()) const;
47    bool     removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
48
49    SGroup *dataObject(const QModelIndex &index) const;
50
51private:
52    QString getMembersStr(const SGroup& group) const;
53    void setGroups(const QSet<SGroup*> &groups);
54
55public slots:
56    void groupAddRemove(SGroup *group);
57    void groupUpdated(SGroup *contact);
58
59private:
60    GroupManager * const m_groupManager;
61
62    QList<SGroup*> m_groups;
63};
64
65} // namespace UI
66
67#endif // UI_GROUPTABLEMODEL_H
Note: See TracBrowser for help on using the repository browser.