projects
/
multypo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7a18f43
)
more consistent display of player name
author
Ralf Jung
<post@ralfj.de>
Thu, 17 Jul 2014 14:49:46 +0000
(16:49 +0200)
committer
Ralf Jung
<post@ralfj.de>
Thu, 17 Jul 2014 14:49:46 +0000
(16:49 +0200)
qt/player.cpp
patch
|
blob
|
history
qt/player.h
patch
|
blob
|
history
diff --git
a/qt/player.cpp
b/qt/player.cpp
index c75bb4614ec71fb004c41e8dda348dddb55f3452..036d547d4482405524cbb37f53e7020eba2cb6b7 100644
(file)
--- a/
qt/player.cpp
+++ b/
qt/player.cpp
@@
-27,22
+27,22
@@
void Player::handleKey(QString str)
if (str == "Return") {
name = currentWord;
state = Waiting;
if (str == "Return") {
name = currentWord;
state = Waiting;
- setLabel(
name
, READY_COLOR);
+ setLabel(
"<Bereit>"
, READY_COLOR);
}
break;
case Waiting:
break;
case Typing:
}
break;
case Waiting:
break;
case Typing:
- setLabel(currentWord, BASE_COLOR
, name+":"
);
+ setLabel(currentWord, BASE_COLOR);
break;
}
}
break;
}
}
-void Player::setLabel(QString body, QString color
, QString header
)
+void Player::setLabel(QString body, QString color)
{
QString text = QString("<font color=%1>").arg(color);
{
QString text = QString("<font color=%1>").arg(color);
- if (
!header.isEmpty()
) {
- text += QString("<font size=-3>%1
</font><br>").arg(Qt::escape(header
));
+ if (
state >= Waiting
) {
+ text += QString("<font size=-3>%1
:</font><br>").arg(Qt::escape(name
));
}
text += Qt::escape(body);
theLabel->setText(text);
}
text += Qt::escape(body);
theLabel->setText(text);
@@
-52,7
+52,7
@@
void Player::wordComplete(int points)
{
score += points;
state = Waiting;
{
score += points;
state = Waiting;
- setLabel(currentWord, READY_COLOR
, name+":"
);
+ setLabel(currentWord, READY_COLOR);
}
QString Player::getCurrentWord() {
}
QString Player::getCurrentWord() {
@@
-63,11
+63,11
@@
QString Player::getCurrentWord() {
void Player::nextWord() {
Q_ASSERT(state == Waiting);
currentWord = "";
void Player::nextWord() {
Q_ASSERT(state == Waiting);
currentWord = "";
- setLabel("<
Eingabe erscheint hier>", BASE_COLOR, name+":"
);
+ setLabel("<
Warte auf Eingabe>", BASE_COLOR
);
state = Typing;
}
void Player::showScore() {
Q_ASSERT(state == Waiting);
state = Typing;
}
void Player::showScore() {
Q_ASSERT(state == Waiting);
- setLabel(QString ("
Spieler %1 hat %2 Punkte.").arg(name
).arg(score), READY_COLOR);
+ setLabel(QString ("
%1 Punkte"
).arg(score), READY_COLOR);
}
}
diff --git
a/qt/player.h
b/qt/player.h
index f28028f6687a7316f9832e6cb0af1725e28c6ab7..cb628cc4d40e52990fe08aa7dceac593888ae05f 100644
(file)
--- a/
qt/player.h
+++ b/
qt/player.h
@@
-36,7
+36,7
@@
private:
State state;
State state;
- void setLabel(QString body, QString color
, QString header = ""
);
+ void setLabel(QString body, QString color);
};
#endif // PLAYER_H
};
#endif // PLAYER_H