First commit
[hidecallerid] / src / idwidget.h
diff --git a/src/idwidget.h b/src/idwidget.h
new file mode 100644 (file)
index 0000000..7e8840d
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef IDWIDGET_H
+#define IDWIDGET_H
+
+#include <QtGui/qpushbutton.h>
+#include <QtGui/qinputdialog.h>
+#include <QtGui/qpainter.h>
+#include "tpsession.h"
+
+class IdWidget : public QPushButton
+{
+    Q_OBJECT
+
+private:
+
+    bool showId;
+    tpSession *tp;
+    QPixmap *pHidden;
+    QPixmap *pShown;
+
+public:
+    IdWidget(tpSession *tp);
+
+    QSize sizeHint() const
+    {
+        return QSize(200, 75);
+    }
+
+public slots:
+    void changeState();
+    void setButtonState(bool showId);
+
+protected:
+    void paintEvent(QPaintEvent *event)
+    {
+        QPainter p(this);
+        p.setBrush(QColor(0, 0, 0, 128));
+        p.setPen(Qt::NoPen);
+        p.drawRoundedRect(rect(), 25, 25);
+        p.end();
+
+        QPushButton::paintEvent(event);
+    }
+};
+
+#endif