first release
[groupsms] / sms / contactwidgetitem.h
1 #ifndef CONTACTWIDGETITEM_H
2 #define CONTACTWIDGETITEM_H
3
4 #include <QToolButton>
5 #include <QLabel>
6 #include "item.h"
7
8
9 const int ICON_SIZE = 38;
10 const int MARGE_HEIGH = 4;
11 const int CONTACT_ITEM_MARGE_WIDTH = 50;
12 const int BTN_SELECTED_OFFSET_X = 10;
13 const int BTN_SELECTED_OFFSET_Y = 5;
14 const int USER_PIC_OFFSET_X = BTN_SELECTED_OFFSET_X + 80;
15 const int USER_PIC_OFFSET_Y = BTN_SELECTED_OFFSET_Y + 20;
16 const int FULL_NAME_OFFSET_X = USER_PIC_OFFSET_X + 50;
17 const int FULL_NAME_OFFSET_Y = 5;
18 const int MOBILE_NUMBER_OFFSET_X = FULL_NAME_OFFSET_X;
19 const int MOBILE_NUMBER_OFFSET_Y = FULL_NAME_OFFSET_Y + 30;
20
21 const int BTN_SELECTED_MARGE_WIDTH = 130;
22
23 // GroupWidgetItem
24 const int BTN_OPEN_GROUP_OFFSET_X = 10;
25 const int BTN_OPEN_GROUP_OFFSET_Y = 5;
26 const int BTN_GROUP_SELECTED_OFFSET_X = BTN_OPEN_GROUP_OFFSET_X + 60;
27 const int BTN_GROUP_SELECTED_OFFSET_Y = 5;
28 const int GROUP_USER_PIC_OFFSET_X = BTN_GROUP_SELECTED_OFFSET_X + 80;
29 const int GROUP_USER_PIC_OFFSET_Y = BTN_OPEN_GROUP_OFFSET_Y + 25;
30 const int GROUP_NAME_OFFSET_X = GROUP_USER_PIC_OFFSET_X + 50;
31 const int GROUP_NAME_OFFSET_Y = 20;
32
33 const int ITEM_HEIGHT = 60;
34
35 const int BTN_TOOL_WIDTH = 60;
36 const int BTN_TOOL_HEIGHT = 60;
37
38 class ContactWidgetItem : public QObject
39 {
40     Q_OBJECT
41 public:
42     ContactWidgetItem(QObject *parent = 0);
43     ~ContactWidgetItem();
44
45     void loadUserPic();
46     int move(int x, int y, QWidget *parent = 0);
47     void showAll();
48     void hideAll();
49     void reSet();
50     void setData( Item &item );
51     void setSelected(bool selected);
52
53     QToolButton *btn_selected;
54     QLabel *label_fullname;
55     QLabel *label_mobile_number;
56     QLabel *label_user_pic;
57     QString user_pic_uri;
58
59     QString full_name;
60     QString mobile_number;
61     QString group_owner;
62     QString uid;
63
64     int m_x;
65     int m_height;
66     bool m_isSelected;
67     bool m_isGroup;
68     QColor m_color;
69
70 Q_SIGNALS:
71     void itemUpdate();
72     void itemSelected( ContactWidgetItem *item, bool selected );
73
74 public Q_SLOTS:
75     void btn_selected_clicked();
76 };
77
78 #endif // CONTACTWIDGETITEM_H