#include "player.h"
#include <QLayout>
+#include <QDebug>
static QString colorToString(QColor col)
{
theLabel = new QLabel (parent);
parent->layout()->addWidget(theLabel);
modifyable = true;
+ qDebug() << "Player created";
}
-
bool Player::hasName() {
- return !name.isNull();
+ return !name.isEmpty();
}
QString Player::getName() {
modifyable = true;
}
-void Player::handleKey(QString str) {
+bool Player::handleKey(QString str) {
if (!modifyable)
- return;
+ return false;
+ bool newChar = false;
if (str.length() == 1) {
currentLine += str;
+ newChar = true;
} else if (!hasName() && str == "Return") {
// set name
name = currentLine;
currentLine.chop(1);
}
theLabel->setText(currentLine);
+ return newChar;
}