Rename slots to indicate what the methods actually do

This commit is contained in:
Olivier Teulière 2012-10-06 13:00:54 +02:00
parent ca5c6cff0d
commit 1e94c56067
2 changed files with 13 additions and 15 deletions

View file

@ -55,15 +55,15 @@ PlayWordMediator::PlayWordMediator(QObject *parent, QLineEdit &iEditPlay,
// Set all the connections
QObject::connect(&m_lineEditPlay, SIGNAL(textChanged(const QString&)),
this, SLOT(lineEditPlay_textChanged()));
this, SLOT(updatePointsAndState()));
QObject::connect(&m_lineEditPlay, SIGNAL(returnPressed()),
this, SLOT(lineEditPlay_returnPressed()));
this, SLOT(playWord()));
QObject::connect(&m_lineEditCoord, SIGNAL(textChanged(const QString&)),
this, SLOT(lineEditCoord_textChanged(const QString&)));
this, SLOT(onCoordChanged(const QString&)));
QObject::connect(&m_lineEditCoord, SIGNAL(returnPressed()),
this, SLOT(lineEditCoord_returnPressed()));
this, SLOT(playWord()));
QObject::connect(&m_pushButtonPlay, SIGNAL(clicked()),
this, SLOT(pushButtonPlay_clicked()));
this, SLOT(playWord()));
QObject::connect(&m_coordModel, SIGNAL(coordChanged(const Coord&, const Coord&)),
this, SLOT(updateCoord(const Coord&, const Coord&)));
}
@ -115,7 +115,7 @@ bool PlayWordMediator::GetPlayedWord(QLineEdit &iEditWord,
}
void PlayWordMediator::lineEditPlay_textChanged()
void PlayWordMediator::updatePointsAndState()
{
bool acceptableInput =
m_lineEditPlay.hasAcceptableInput() &&
@ -138,7 +138,7 @@ void PlayWordMediator::lineEditPlay_textChanged()
}
void PlayWordMediator::lineEditPlay_returnPressed()
void PlayWordMediator::playWord()
{
if (!m_lineEditPlay.hasAcceptableInput() ||
!m_lineEditCoord.hasAcceptableInput())
@ -206,12 +206,12 @@ void PlayWordMediator::lineEditPlay_returnPressed()
}
void PlayWordMediator::lineEditCoord_textChanged(const QString &iText)
void PlayWordMediator::onCoordChanged(const QString &iText)
{
Coord c(wfq(iText));
if (!(m_coordModel.getCoord() == c))
m_coordModel.setCoord(Coord(wfq(iText)));
lineEditPlay_textChanged();
updatePointsAndState();
}
@ -232,7 +232,7 @@ void PlayWordMediator::updateCoord(const Coord &, const Coord &iNewCoord)
if (!m_lineEditPlay.hasFocus() && !m_lineEditCoord.hasFocus())
m_lineEditPlay.setFocus();
lineEditPlay_textChanged();
updatePointsAndState();
}

View file

@ -82,11 +82,9 @@ signals:
void notifyProblem(QString iMsg);
private slots:
void lineEditPlay_textChanged();
void lineEditPlay_returnPressed();
void lineEditCoord_textChanged(const QString &iText);
void lineEditCoord_returnPressed() { lineEditPlay_returnPressed(); }
void pushButtonPlay_clicked() { lineEditPlay_returnPressed(); }
void playWord();
void updatePointsAndState();
void onCoordChanged(const QString &iText);
void updateCoord(const Coord &, const Coord &iNewCoord);
private: