+#include "player.h"
+
+#include <QLayout>
+
+static QString colorToString(QColor col)
+{
+ return QString("#%1%2%3").arg(col.red(), 2, 16, QChar('0'))
+ .arg(col.green(), 2, 16, QChar('0'))
+ .arg(col.blue(), 2, 16, QChar('0'));
+}
+
+Player::Player(QWidget* parent) {
+ theLabel = new QLabel (parent);
+ parent->layout()->addWidget(theLabel);
+}
+
+void Player::handleKey(QString str) {
+ if (str.length() == 1) {
+ currentLine += str;
+ } else if (name.isNull() && str == "Return") {
+ // set name
+ name = currentLine;
+ currentLine = "";
+ } else if (str == "BackSpace") {
+ currentLine.chop(1);
+ }
+ theLabel->setText(currentLine);
+}