Logo Search packages:      
Sourcecode: kanagram version File versions  Download package

void Kanagram::checkWord (  ) [private, slot]

check the entered word against the answer, and move on, or reset as necessary

Definition at line 781 of file kanagram.cpp.

References KanagramGame::getWord(), hideHint(), m_game, m_inputBox, KanagramGame::nextAnagram(), play(), resetInputBox(), and stripAccents().

Referenced by Kanagram(), and mousePressEvent().

{
    QPalette palette;
    QString enteredWord = m_inputBox->text().toLower().trimmed();
    QString word = m_game->getWord().toLower().trimmed();
    if (!enteredWord.isEmpty())
    {
        if (enteredWord == word || stripAccents(enteredWord) == stripAccents(word))
        {
            if (m_useSounds) play("right.ogg");
            palette.setColor(m_inputBox->backgroundRole(), QColor(0, 255, 0));
            QTimer::singleShot(1000, this, SLOT(resetInputBox()));
            m_inputBox->clear();
            hideHint();
            m_game->nextAnagram();
        }
        else
        {
            if (m_useSounds) play("wrong.ogg");
            palette.setColor(m_inputBox->backgroundRole(), QColor(255, 0, 0));
            QTimer::singleShot(1000, this, SLOT(resetInputBox()));
            m_inputBox->clear();
        }
        m_inputBox->setPalette(palette);
        update();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index