first release
[groupsms] / sms / contactwidgetitem.h
diff --git a/sms/contactwidgetitem.h b/sms/contactwidgetitem.h
new file mode 100644 (file)
index 0000000..f589413
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef CONTACTWIDGETITEM_H
+#define CONTACTWIDGETITEM_H
+
+#include <QToolButton>
+#include <QLabel>
+#include "item.h"
+
+
+const int ICON_SIZE = 38;
+const int MARGE_HEIGH = 4;
+const int CONTACT_ITEM_MARGE_WIDTH = 50;
+const int BTN_SELECTED_OFFSET_X = 10;
+const int BTN_SELECTED_OFFSET_Y = 5;
+const int USER_PIC_OFFSET_X = BTN_SELECTED_OFFSET_X + 80;
+const int USER_PIC_OFFSET_Y = BTN_SELECTED_OFFSET_Y + 20;
+const int FULL_NAME_OFFSET_X = USER_PIC_OFFSET_X + 50;
+const int FULL_NAME_OFFSET_Y = 5;
+const int MOBILE_NUMBER_OFFSET_X = FULL_NAME_OFFSET_X;
+const int MOBILE_NUMBER_OFFSET_Y = FULL_NAME_OFFSET_Y + 30;
+
+const int BTN_SELECTED_MARGE_WIDTH = 130;
+
+// GroupWidgetItem
+const int BTN_OPEN_GROUP_OFFSET_X = 10;
+const int BTN_OPEN_GROUP_OFFSET_Y = 5;
+const int BTN_GROUP_SELECTED_OFFSET_X = BTN_OPEN_GROUP_OFFSET_X + 60;
+const int BTN_GROUP_SELECTED_OFFSET_Y = 5;
+const int GROUP_USER_PIC_OFFSET_X = BTN_GROUP_SELECTED_OFFSET_X + 80;
+const int GROUP_USER_PIC_OFFSET_Y = BTN_OPEN_GROUP_OFFSET_Y + 25;
+const int GROUP_NAME_OFFSET_X = GROUP_USER_PIC_OFFSET_X + 50;
+const int GROUP_NAME_OFFSET_Y = 20;
+
+const int ITEM_HEIGHT = 60;
+
+const int BTN_TOOL_WIDTH = 60;
+const int BTN_TOOL_HEIGHT = 60;
+
+class ContactWidgetItem : public QObject
+{
+    Q_OBJECT
+public:
+    ContactWidgetItem(QObject *parent = 0);
+    ~ContactWidgetItem();
+
+    void loadUserPic();
+    int move(int x, int y, QWidget *parent = 0);
+    void showAll();
+    void hideAll();
+    void reSet();
+    void setData( Item &item );
+    void setSelected(bool selected);
+
+    QToolButton *btn_selected;
+    QLabel *label_fullname;
+    QLabel *label_mobile_number;
+    QLabel *label_user_pic;
+    QString user_pic_uri;
+
+    QString full_name;
+    QString mobile_number;
+    QString group_owner;
+    QString uid;
+
+    int m_x;
+    int m_height;
+    bool m_isSelected;
+    bool m_isGroup;
+    QColor m_color;
+
+Q_SIGNALS:
+    void itemUpdate();
+    void itemSelected( ContactWidgetItem *item, bool selected );
+
+public Q_SLOTS:
+    void btn_selected_clicked();
+};
+
+#endif // CONTACTWIDGETITEM_H