X-Git-Url: https://git.ralfj.de/multypo.git/blobdiff_plain/7a18f439db0b8a7d55ffd0368bb0159afa79ab62..4978fd909202554270ec12c87d78a990001b17e4:/qt/player.cpp diff --git a/qt/player.cpp b/qt/player.cpp index c75bb46..036d547 100644 --- a/qt/player.cpp +++ b/qt/player.cpp @@ -27,22 +27,22 @@ void Player::handleKey(QString str) if (str == "Return") { name = currentWord; state = Waiting; - setLabel(name, READY_COLOR); + setLabel("", READY_COLOR); } break; case Waiting: break; case Typing: - setLabel(currentWord, BASE_COLOR, name+":"); + setLabel(currentWord, BASE_COLOR); break; } } -void Player::setLabel(QString body, QString color, QString header) +void Player::setLabel(QString body, QString color) { QString text = QString("").arg(color); - if (!header.isEmpty()) { - text += QString("%1
").arg(Qt::escape(header)); + if (state >= Waiting) { + text += QString("%1:
").arg(Qt::escape(name)); } text += Qt::escape(body); theLabel->setText(text); @@ -52,7 +52,7 @@ void Player::wordComplete(int points) { score += points; state = Waiting; - setLabel(currentWord, READY_COLOR, name+":"); + setLabel(currentWord, READY_COLOR); } QString Player::getCurrentWord() { @@ -63,11 +63,11 @@ QString Player::getCurrentWord() { void Player::nextWord() { Q_ASSERT(state == Waiting); currentWord = ""; - setLabel("", BASE_COLOR, name+":"); + setLabel("", BASE_COLOR); state = Typing; } void Player::showScore() { Q_ASSERT(state == Waiting); - setLabel(QString ("Spieler %1 hat %2 Punkte.").arg(name).arg(score), READY_COLOR); + setLabel(QString ("%1 Punkte").arg(score), READY_COLOR); }