projects
/
multypo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ralfs Fixes
[multypo.git]
/
qt
/
player.cpp
diff --git
a/qt/player.cpp
b/qt/player.cpp
index 4c84eb74a182ba66b2ef472b0d58ae07e8fcbe88..937bbab739dddb597f1bbf310a3187ac6a0c5a4a 100644
(file)
--- a/
qt/player.cpp
+++ b/
qt/player.cpp
@@
-1,6
+1,7
@@
#include "player.h"
#include <QLayout>
#include "player.h"
#include <QLayout>
+#include <QDebug>
static QString colorToString(QColor col)
{
static QString colorToString(QColor col)
{
@@
-13,11
+14,11
@@
Player::Player(QWidget* parent) {
theLabel = new QLabel (parent);
parent->layout()->addWidget(theLabel);
modifyable = true;
theLabel = new QLabel (parent);
parent->layout()->addWidget(theLabel);
modifyable = true;
+ qDebug() << "Player created";
}
}
-
bool Player::hasName() {
bool Player::hasName() {
- return !name.is
Null
();
+ return !name.is
Empty
();
}
QString Player::getName() {
}
QString Player::getName() {
@@
-39,11
+40,13
@@
void Player::resetText() {
modifyable = true;
}
modifyable = true;
}
-
void
Player::handleKey(QString str) {
+
bool
Player::handleKey(QString str) {
if (!modifyable)
if (!modifyable)
- return;
+ return false;
+ bool newChar = false;
if (str.length() == 1) {
currentLine += str;
if (str.length() == 1) {
currentLine += str;
+ newChar = true;
} else if (!hasName() && str == "Return") {
// set name
name = currentLine;
} else if (!hasName() && str == "Return") {
// set name
name = currentLine;
@@
-52,4
+55,5
@@
void Player::handleKey(QString str) {
currentLine.chop(1);
}
theLabel->setText(currentLine);
currentLine.chop(1);
}
theLabel->setText(currentLine);
+ return newChar;
}
}