X-Git-Url: https://git.ralfj.de/multypo.git/blobdiff_plain/036922ba5e90ae7f6f6abe3f99b1783dec5132fc..e6207dc52430a9fcbfd7df03f46c2876fc05154b:/qt/player.cpp diff --git a/qt/player.cpp b/qt/player.cpp index 4049788..4c84eb7 100644 --- a/qt/player.cpp +++ b/qt/player.cpp @@ -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 = "";