--- /dev/null
+#include "idwidget.h"
+
+IdWidget::IdWidget(tpSession *tp)
+ : QPushButton()
+{
+ this->tp = tp;
+ setAttribute(Qt::WA_TranslucentBackground);
+ QObject::connect(this, SIGNAL(clicked()), this, SLOT(changeState()));
+ QObject::connect(tp, SIGNAL(privacyUpdated(bool)), this, SLOT(setButtonState(bool)));
+ pHidden = new QPixmap(":/icons/hidden.png");
+ pShown = new QPixmap(":/icons/shown.png");
+}
+
+void IdWidget::setButtonState(bool showId)
+{
+ QPixmap *pixmap;
+ this->showId = showId;
+
+ if(showId) {
+ pixmap = pShown;
+ setText("Id Shown");
+ }
+ else {
+ pixmap = pHidden;
+ setText("Id Hidden");
+ }
+
+ QIcon icon(*pixmap);
+ QSize iconSize(pixmap->width(), pixmap->height());
+ setIconSize(iconSize);
+ setIcon(icon);
+}
+
+void IdWidget::changeState()
+{
+ if(showId) {
+ tp->setPrivacy(false);
+ }
+ else {
+ tp->setPrivacy(true);
+ }
+}