diff --git a/src/app.cpp b/src/app.cpp index 708891a..b7c48fe 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -276,7 +276,7 @@ std::string App::getGenderShortByGender(std::string gender) { return ""; } -void App::updateUserlist(Wt::Json::Array unsortedUserList) { +void App::updateUserlist(Wt::Json::Array unsortedUserList, int size) { userListContainer_->clear(); userListContainer_->resize(Wt::WLength(15, Wt::LengthUnit::FontEm), Wt::WLength::Auto); auto layout = userListContainer_->setLayout(std::make_unique()); @@ -284,6 +284,7 @@ void App::updateUserlist(Wt::Json::Array unsortedUserList) { layout->setContentsMargins(0, 0, 0, 0); userListContainer_->setOverflow(Wt::Overflow::Auto, Wt::Orientation::Vertical); userListContainer_->setOverflow(Wt::Overflow::Hidden, Wt::Orientation::Horizontal); + layout->addNew(Wt::WString("Logged in: {1}").arg(size)); auto sortedUserList = sortUserList(unsortedUserList); for (Wt::Json::Object &user: sortedUserList) { addUserItemToLayout(layout, user); @@ -1073,7 +1074,7 @@ void App::incomingBroadcast() { auto broadcasts = server_.getBroadcastsForSession(sessionId()); for (Wt::Json::Object &broadcast: broadcasts) { if (broadcast["type"] == "userlist") { - updateUserlist(broadcast["data"]); + updateUserlist(broadcast["data"], (int)broadcast["count"]); } else if (broadcast["type"] == "logout") { server_.disconnect(this); } else if (broadcast["type"] == "messagequeue") { diff --git a/src/app.h b/src/app.h index 9972fdc..7798d30 100644 --- a/src/app.h +++ b/src/app.h @@ -112,7 +112,7 @@ private: void handleLogin(Wt::WLineEdit *userName, Wt::WComboBox *countryWidget, Wt::WSpinBox *ageWidget, Wt::WComboBox *genderWidget); void populateGenderComboBox(Wt::WComboBox *genderWidget); std::string getGenderShortByGender(std::string gender); - void updateUserlist(Wt::Json::Array userList); + void updateUserlist(Wt::Json::Array userList, int size); std::vector sortUserList(Wt::Json::Array unsortedUserList); void createMenu(); void addLeaveButton();