6 Player::Player(QWidget* parent) : score(0), state(Naming) {
7 theLabel = new QLabel (parent);
8 parent->layout()->addWidget(theLabel);
9 qDebug() << "Player created";
12 void Player::handleKey(QString str)
14 // edit "current line"
15 if (str.length() == 1) {
18 else if (str == "BackSpace") {
21 // see if this does anything useful
24 theLabel->setText(currentWord);
25 if (str == "Return") {
28 theLabel->setText("<READY>");
34 theLabel->setText(currentWord);
39 void Player::wordComplete(int points)
43 theLabel->setText("<COMPLETE>");
46 QString Player::getCurrentWord() {
47 Q_ASSERT(state == Typing);
51 void Player::nextWord() {
53 theLabel->setText(currentWord);
57 void Player::showScore() {
58 Q_ASSERT(state == Waiting);
59 theLabel->setText(QString ("Spieler %1 hat %2 Punkte.").arg(name).arg(score));