mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
PlayModel: add a moveChanged() signal for convenience
This commit is contained in:
parent
7f5651b4bb
commit
d686f1a083
2 changed files with 22 additions and 0 deletions
|
@ -24,6 +24,15 @@
|
|||
INIT_LOGGER(qt, PlayModel);
|
||||
|
||||
|
||||
PlayModel::PlayModel()
|
||||
{
|
||||
QObject::connect(this, SIGNAL(coordChanged(const Coord&, const Coord&)),
|
||||
this, SLOT(onMoveChanged()));
|
||||
QObject::connect(this, SIGNAL(wordChanged(const wstring&, const wstring&)),
|
||||
this, SLOT(onMoveChanged()));
|
||||
}
|
||||
|
||||
|
||||
void PlayModel::clear()
|
||||
{
|
||||
setCoord(Coord());
|
||||
|
@ -54,3 +63,9 @@ void PlayModel::setWord(const wstring &iWord)
|
|||
emit wordChanged(iWord, m_prevWord);
|
||||
}
|
||||
|
||||
|
||||
void PlayModel::onMoveChanged()
|
||||
{
|
||||
emit moveChanged(m_currWord, m_currCoord);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ class PlayModel: public QObject
|
|||
DEFINE_LOGGER();
|
||||
|
||||
public:
|
||||
PlayModel();
|
||||
|
||||
/**
|
||||
* Remove the word and the coordinates.
|
||||
* This may emit both the wordChanged() and the coordChanged() signals.
|
||||
|
@ -62,6 +64,11 @@ public:
|
|||
signals:
|
||||
void coordChanged(const Coord &iNewCoord, const Coord &iOldCoord);
|
||||
void wordChanged(const wstring &iNewWord, const wstring &iOldWord);
|
||||
/// Emitted whenever coordChanged() or wordChanged() is emitted
|
||||
void moveChanged(const wstring &iWord, const Coord &iCoord);
|
||||
|
||||
private slots:
|
||||
void onMoveChanged();
|
||||
|
||||
private:
|
||||
Coord m_currCoord;
|
||||
|
|
Loading…
Reference in a new issue