players get points now which are shown per word
[multypo.git] / qt / player.cpp
index 40497881224caaea2026fc0549dd4d9e605eb02f..4c84eb74a182ba66b2ef472b0d58ae07e8fcbe88 100644 (file)
@@ -12,12 +12,39 @@ static QString colorToString(QColor col)
 Player::Player(QWidget* parent) {
        theLabel = new QLabel (parent);
        parent->layout()->addWidget(theLabel);
+       modifyable = true;
+}
+
+
+bool Player::hasName() {
+       return !name.isNull();
+}
+
+QString Player::getName() {
+       return name;
+}
+
+QString Player::getCurrentLine() {
+       return currentLine;
+}
+
+void Player::setWaiting(QString labeltext) {
+       theLabel->setText(labeltext);
+       modifyable = false;
+}
+
+void Player::resetText() {
+       currentLine.clear();
+       theLabel->setText(currentLine);
+       modifyable = true;
 }
 
 void Player::handleKey(QString str) {
+       if (!modifyable)
+               return;
        if (str.length() == 1) {
                currentLine += str;
-       } else if (name.isNull() && str == "Return") {
+       } else if (!hasName() && str == "Return") {
                // set name
                name = currentLine;
                currentLine = "";