From 05b2584fa4d773f5a88ed3ce98f5dd8304e11c34 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 12 Jun 2023 23:47:17 +0200 Subject: First commit --- account.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 account.cpp (limited to 'account.cpp') diff --git a/account.cpp b/account.cpp new file mode 100644 index 0000000..5e30184 --- /dev/null +++ b/account.cpp @@ -0,0 +1,25 @@ +#include "account.h" + +Account::Account(Client *const c, QListWidget *const list, + QWidget *const parent) : + QWidget(parent) +{ + const auto it = new QListWidgetItem(list); + const auto w = new QWidget; + + ui.setupUi(w); + ui.jid->setText(c->configuration().jidBare()); + ui.connected->setChecked( + c->state() == Client::State::ConnectedState); + + connect(c, &Client::stateChanged, this, + [this] (const Client::State state) + { + ui.connected->setChecked( + state == Client::State::ConnectedState); + }); + + it->setSizeHint(w->sizeHint()); + list->addItem(it); + list->setItemWidget(it, w); +} -- cgit v1.2.3