name input and game start works
[multypo.git] / qt / player.cpp
index 40497881224caaea2026fc0549dd4d9e605eb02f..871ecb9d474182fd1ad50ddd6790fff4a4d71d42 100644 (file)
@@ -14,10 +14,28 @@ Player::Player(QWidget* parent) {
        parent->layout()->addWidget(theLabel);
 }
 
+
+bool Player::hasName() {
+       return !name.isNull();
+}
+
+QString Player::getName() {
+       return name;
+}
+
+QString Player::getCurrentLine() {
+       return currentLine;
+}
+
+void Player::resetText() {
+       currentLine.clear();
+       theLabel->setText(currentLine);
+}
+
 void Player::handleKey(QString str) {
        if (str.length() == 1) {
                currentLine += str;
-       } else if (name.isNull() && str == "Return") {
+       } else if (!hasName() && str == "Return") {
                // set name
                name = currentLine;
                currentLine = "";