blob: 41786d7437da255893a53c6b85ab19d38cfcfe11 [file] [log] [blame]
Olivier SOLDANO5d4a1ff2017-05-08 13:12:47 -04001/**************************************************************************
2* Copyright (C) 2015-2017 by Savoir-faire Linux *
3* Author: Olivier Soldano <olivier.soldano@savoirfairelinux.com> *
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
19
20#ifndef BANNEDCONTACTSWIDGET_H
21#define BANNEDCONTACTSWIDGET_H
22
23#include <QWidget>
24#include <QAbstractItemModel>
25#include <QObject>
26#include <QItemDelegate>
27
28// LRC
29#include "account.h"
30#include "contactmethod.h"
31
32/* item delegate */
33
34class BannedContactItemDelegate : public QItemDelegate
35{
36public:
37 BannedContactItemDelegate(QObject* parent = 0);
38
39protected:
40 void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
41 QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
42
43private:
44 constexpr static int cellHeight_ = 60;
45 constexpr static int sizeImage_ = 48;
46 constexpr static int dxImage_ = 16;
47 constexpr static int dyImage_ = 6;
48
49 constexpr static int dxText_ = dxImage_;
50 constexpr static int dyText_ = cellHeight_/2;
51
52 constexpr static int separatorYPadding_ = 20;
53};
54
55/* widget */
56namespace Ui {
57class BannedContactsWidget;
58}
59
60class BannedContactsWidget : public QWidget
61{
62 Q_OBJECT
63
64public:
65 explicit BannedContactsWidget(QWidget *parent = 0);
66 ~BannedContactsWidget();
67 void setAccount(Account *ac);
68
69private slots:
70 void setCurrentContact(const QModelIndex index);
71 void debanContact();
72
73private:
74 Account* account_ {};
75 BannedContactItemDelegate* bannedItemDelegate_;
76 ContactMethod* bannedContact_;
77 Ui::BannedContactsWidget *ui;
78};
79#endif // BANNEDCONTACTSWIDGET_H