#include <HighScoresWidget.h>
Definition at line 15 of file HighScoresWidget.h.
◆ HighScoresWidget()
HighScoresWidget::HighScoresWidget |
( |
Session * | session | ) |
|
|
explicit |
Definition at line 17 of file HighScoresWidget.C.
19{
22}
Wt::Auth::Dbo::UserDatabase< AuthInfo > UserDatabase
◆ update()
void HighScoresWidget::update |
( |
| ) |
|
Definition at line 24 of file HighScoresWidget.C.
25{
27
29
31
34 yourScore =
"Congratulations! You are currently leading the pack.";
35 else {
36 yourScore =
"You are currently ranked number "
38 + ". Almost there !";
39 }
40
42 score->addStyleClass("score");
43
45
47
48 table->elementAt(0, 0)->addNew<WText>(
"Rank");
49 table->elementAt(0, 1)->addNew<WText>(
"User");
50 table->elementAt(0, 2)->addNew<WText>(
"Games");
51 table->elementAt(0, 3)->addNew<WText>(
"Score");
52 table->elementAt(0, 4)->addNew<WText>(
"Last game");
53 table->setHeaderCount(1);
54
57 for (
auto& user :
top) {
58
62 }
63
66 table->elementAt(
row, 1)->addNew<WText>(user.name);
69 if (!user.lastGame.isNull())
70 table->elementAt(
row, 4)->addNew<WText>(user.lastGame.timeTo(WDateTime::currentDateTime()) +
" ago");
71 else
72 table->elementAt(
row, 4)->addNew<WText>(
"---");
73
76 }
77
80}
std::vector< User > topUsers(int limit)
std::string userName() const
Wt::Auth::Login & login()
◆ session_
The documentation for this class was generated from the following files: