diff --git a/cockatrice/src/game/phase.cpp b/cockatrice/src/game/phase.cpp index a8498354a..32c9060ee 100644 --- a/cockatrice/src/game/phase.cpp +++ b/cockatrice/src/game/phase.cpp @@ -1,8 +1,16 @@ #include "phase.h" -Phase::Phase(const char *_name, QString _color, QString _soundFileName) : color(_color), soundFileName(_soundFileName) +Phase::Phase(const QString &_name, const QString &_color, const QString &_soundFileName) + : name(_name), color(_color), soundFileName(_soundFileName) { - name = tr(_name); +} + +/** + * @return The translated name for the phase + */ +QString Phase::getName() const +{ + return tr(name.toUtf8().data()); } Phase Phases::getPhase(int phase) diff --git a/cockatrice/src/game/phase.h b/cockatrice/src/game/phase.h index d882a0391..217f13f0f 100644 --- a/cockatrice/src/game/phase.h +++ b/cockatrice/src/game/phase.h @@ -1,16 +1,20 @@ #ifndef PHASE_H #define PHASE_H +#include #include -#include class Phase { Q_DECLARE_TR_FUNCTIONS(Phase) + QString name; + public: - QString name, color, soundFileName; - Phase(const char *_name, QString _color, QString _soundFileName); + QString color, soundFileName; + Phase(const QString &_name, const QString &_color, const QString &_soundFileName); + + QString getName() const; }; struct Phases diff --git a/cockatrice/src/server/message_log_widget.cpp b/cockatrice/src/server/message_log_widget.cpp index 568253e31..4f50a2554 100644 --- a/cockatrice/src/server/message_log_widget.cpp +++ b/cockatrice/src/server/message_log_widget.cpp @@ -616,7 +616,7 @@ void MessageLogWidget::logSetActivePhase(int phaseNumber) soundEngine->playSound(phase.soundFileName); appendHtml("" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + - phase.name + ""); + phase.getName() + ""); } void MessageLogWidget::logSetActivePlayer(Player *player)