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);
|
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()
|
void PlayModel::clear()
|
||||||
{
|
{
|
||||||
setCoord(Coord());
|
setCoord(Coord());
|
||||||
|
@ -54,3 +63,9 @@ void PlayModel::setWord(const wstring &iWord)
|
||||||
emit wordChanged(iWord, m_prevWord);
|
emit wordChanged(iWord, m_prevWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PlayModel::onMoveChanged()
|
||||||
|
{
|
||||||
|
emit moveChanged(m_currWord, m_currCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ class PlayModel: public QObject
|
||||||
DEFINE_LOGGER();
|
DEFINE_LOGGER();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
PlayModel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the word and the coordinates.
|
* Remove the word and the coordinates.
|
||||||
* This may emit both the wordChanged() and the coordChanged() signals.
|
* This may emit both the wordChanged() and the coordChanged() signals.
|
||||||
|
@ -62,6 +64,11 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void coordChanged(const Coord &iNewCoord, const Coord &iOldCoord);
|
void coordChanged(const Coord &iNewCoord, const Coord &iOldCoord);
|
||||||
void wordChanged(const wstring &iNewWord, const wstring &iOldWord);
|
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:
|
private:
|
||||||
Coord m_currCoord;
|
Coord m_currCoord;
|
||||||
|
|
Loading…
Reference in a new issue