• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kanagram

  • sources
  • kde-4.14
  • kdeedu
  • kanagram
  • src
kanagramenginehelper.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * This file is part of the Kanagram project
3  * Copyright (c) 2012 Laszlo Papp <lpapp@kde.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #include "kanagramenginehelper.h"
21 
22 #include <kanagramsettings.h>
23 
24 #include <sharedkvtmlfiles.h>
25 
26 #include <Phonon/MediaObject>
27 
28 #include <KDE/KStandardDirs>
29 #include <KDE/KLocale>
30 #include <KGlobalSettings>
31 #include <KConfigDialog>
32 #include <KAction>
33 #include <KActionCollection>
34 #include <KHelpMenu>
35 #include <KMessageBox>
36 #include <KShortcutsEditor>
37 #include <kspeech.h>
38 #include <ktoolinvocation.h>
39 #include "kspeechinterface.h"
40 
41 #include <kanagramsettings.h>
42 #include "mainsettings.h"
43 #include "vocabsettings.h"
44 
45 
46 #include <QtGui/QApplication>
47 
48 KanagramEngineHelper::KanagramEngineHelper(KanagramGame* kanagramGame, QObject* parent)
49  : QObject(parent)
50  , m_kanagramGame(kanagramGame)
51  ,m_speller(NULL)
52  ,m_player(NULL)
53  ,m_kspeech(0)
54  , m_insertCounter(0)
55  ,m_totalScore(0)
56 {
57  m_speller = new Sonnet::Speller();
58  m_speller->setLanguage(m_kanagramGame->sanitizedDataLanguage());
59  m_helpMenu = new KHelpMenu(NULL, KGlobal::mainComponent().aboutData());
60 
61  loadSettings();
62  setupJovie();
63 }
64 
65 KanagramEngineHelper::~KanagramEngineHelper()
66 {
67  delete m_kanagramGame;
68  delete m_speller;
69  m_speller=NULL;
70  delete m_player;
71  m_player=NULL;
72 }
73 
74 QString KanagramEngineHelper::createNextAnagram()
75 {
76  m_kanagramGame->nextAnagram();
77  QString anagram;
78  anagram = m_kanagramGame->anagram();
79  if (m_useSounds)
80  {
81  play("chalk.ogg");
82  }
83  return anagram;
84 }
85 
86 QStringList KanagramEngineHelper::insertInCurrentOriginalWord(int index, const QString& letter)
87 {
88  int anagramWordSize = m_kanagramGame->word().size();
89 
90  if (anagramWordSize != m_currentOriginalWord.size()
91  || m_currentOriginalWord.size() == m_insertCounter)
92  {
93  m_currentOriginalWord.clear();
94  m_insertCounter = 0;
95  }
96 
97  while (m_currentOriginalWord.size() < anagramWordSize)
98  m_currentOriginalWord.append("");
99 
100  m_currentOriginalWord.replace(index, letter);
101  ++m_insertCounter;
102  return m_currentOriginalWord;
103 }
104 
105 QStringList KanagramEngineHelper::removeInCurrentOriginalWord(int index)
106 {
107  m_currentOriginalWord.replace(index, "");
108  --m_insertCounter;
109  return m_currentOriginalWord;
110 }
111 
112 QString KanagramEngineHelper::anagramOriginalWord()
113 {
114  QString originalWord = m_kanagramGame->word();
115  if (KanagramSettings::enablePronunciation())
116  {
117  // User wants words spoken, but if there's no audio file, play right.ogg
118  if (m_kanagramGame->audioFile().isEmpty())
119  say(m_kanagramGame->word());
120  else
121  // otherwise play the sound associated with the word.
122  play(m_kanagramGame->audioFile().pathOrUrl());
123  }
124  return originalWord;
125 }
126 
127 QString KanagramEngineHelper::showHint() const
128 {
129  QString hint = m_kanagramGame->hint();
130  return hint;
131 }
132 
133 QString KanagramEngineHelper::categoryName() const
134 {
135  QString categoryTitle = m_kanagramGame->documentTitle();
136  return categoryTitle;
137 }
138 
139 QString KanagramEngineHelper::nextVocabulary()
140 {
141  m_kanagramGame->nextVocabulary();
142  if (m_useSounds)
143  {
144  play("chalk.ogg");
145  }
146  return m_kanagramGame->documentTitle();
147 }
148 
149 QString KanagramEngineHelper::previousVocabulary()
150 {
151  m_kanagramGame->previousVocabulary();
152  if (m_useSounds)
153  {
154  play("chalk.ogg");
155  }
156  return m_kanagramGame->documentTitle();
157 }
158 
159 
160 bool KanagramEngineHelper::checkWord(QString answer)
161 {
162  QString enteredWord = answer.toLower().trimmed();
163  QString word = m_kanagramGame->word().toLower().trimmed();
164  bool spellcheck = m_speller->isValid() && m_speller->isCorrect(enteredWord);
165  if (!enteredWord.isEmpty())
166  {
167  if (enteredWord == word || stripAccents(enteredWord) == stripAccents(word) ||
168  (spellcheck && isAnagram(enteredWord, word)))
169  {
170  if (KanagramSettings::enablePronunciation())
171  {
172  // User wants words spoken, but if there's no audio file, play right.ogg
173  if (m_kanagramGame->audioFile().isEmpty())
174  say(m_kanagramGame->word());
175  else
176  // otherwise play the sound associated with the word.
177  play(m_kanagramGame->audioFile().pathOrUrl());
178  }
179  else if (m_useSounds)
180  {
181  // Otherwise just play right.ogg
182  play("right.ogg");
183  }
184  return true;
185  }
186  else
187  {
188  if (m_useSounds) play("wrong.ogg");
189  return false;
190  }
191  }
192  else
193  return false;
194 }
195 
196 bool KanagramEngineHelper::isAnagram(QString& enteredword, QString& word)
197 {
198  QString test = word;
199  if (enteredword.length() <= word.length())
200  {
201  for (int i=0; i < enteredword.length(); i++)
202  {
203  int found = test.indexOf(enteredword[i]);
204 
205  if (found != -1)
206  {
207  test.remove(found, 1);
208  }
209  else
210  break;
211  }
212 
213  if (test.isEmpty())
214  return true;
215  else
216  return false;
217  }
218  else
219  return false;
220 }
221 
222 int KanagramEngineHelper::getNumericSetting(QString settingString)
223 {
224  int indexFound_setting = settingString.size();
225  for (int k = 0; k < indexFound_setting; ++k)
226  {
227  if (!settingString.at(k).isDigit())
228  {
229  indexFound_setting = k;
230  break;
231  }
232  }
233  return settingString.left(indexFound_setting).toInt();
234 }
235 
236 void KanagramEngineHelper::loadSettings()
237 {
238  QString hideTime = KanagramSettings::hintHideTime();
239 
240  if (hideTime.at(0).isDigit())
241  {
242  // because the choices are 0, 3, 5, 7, 9
243  m_hintHideTime = (hideTime.at(0).digitValue() * 2) + 1;
244 
245  // reset to 0 if it's 1 to allow for the don't hide option
246  if (m_hintHideTime == 1)
247  {
248  m_hintHideTime = 0;
249  }
250  }
251  else
252  {
253  m_hintHideTime = 0;
254  }
255 
256  QString resolveTime = KanagramSettings::resolveTime();
257 
258  if (resolveTime.at(0).isDigit())
259  {
260 
261  // because the choices are 0, 15, 30, 45, 60 seconds
262  m_resolveTime = (resolveTime.at(0).digitValue()) * 15;
263  }
264  else
265  {
266  m_resolveTime = 0;
267  }
268 
269  QString scoreTime = KanagramSettings::scoreTime();
270 
271  m_scoreTime = getNumericSetting(scoreTime);
272  m_scoreTime = (m_scoreTime + 1)*15;
273 
274  QString correctAnswerScore = KanagramSettings::correctAnswerScore();
275 
276  m_correctAnswerScore = getNumericSetting(correctAnswerScore);
277  m_correctAnswerScore = (m_correctAnswerScore + 1)*5;
278 
279  QString incorrectAnswerScore = KanagramSettings::incorrectAnswerScore();
280 
281  m_incorrectAnswerScore = getNumericSetting(incorrectAnswerScore);
282  m_incorrectAnswerScore = (m_incorrectAnswerScore + 1)*(-1);
283 
284  QString revealAnswerScore = KanagramSettings::revealAnswerScore();
285 
286  m_revealAnswerScore = getNumericSetting(revealAnswerScore);
287  m_revealAnswerScore = (m_revealAnswerScore + 1)*(-2);
288 
289  QString skippedWordScore = KanagramSettings::skippedWordScore();
290 
291  m_skippedWordScore = getNumericSetting(skippedWordScore);
292  m_skippedWordScore = (m_skippedWordScore + 1)*(-2);
293 
294  if (KanagramSettings::dataLanguage().isEmpty())
295  {
296  QStringList userLanguagesCode = KGlobal::locale()->languageList();
297  QStringList sharedKvtmlFilesLanguages = SharedKvtmlFiles::languages();
298  QString foundLanguage;
299  foreach (const QString &userLanguageCode, userLanguagesCode)
300  {
301  if (sharedKvtmlFilesLanguages.contains(userLanguageCode))
302  {
303  foundLanguage = userLanguageCode;
304  break;
305  }
306  }
307 
308  KanagramSettings::setDataLanguage(!foundLanguage.isEmpty() ? foundLanguage : "en");
309  }
310 
311  m_useSounds = KanagramSettings::useSounds();
312  m_enablePronunciation = KanagramSettings::enablePronunciation();
313 }
314 
315 void KanagramEngineHelper::refreshVocabularies()
316 {
317  if (m_kanagramGame->refreshVocabularyList())
318  {
319  // vocab/word are no longer valid, so get new ones and hide the hint
320  m_kanagramGame->nextVocabulary();
321  m_kanagramGame->nextAnagram();
322  //hideHint();
323 
324  if (m_useSounds)
325  {
326  play("chalk.ogg");
327  }
328 
329  // save the default vocab now that it's changed
330  KanagramSettings::setDefaultVocabulary(m_kanagramGame->filename());
331  KanagramSettings::self()->writeConfig();
332  m_vocabSettings->refreshView();
333  }
334 }
335 
336 void KanagramEngineHelper::reloadSettings()
337 {
338  loadSettings();
339  refreshVocabularies();
340 }
341 
342 void KanagramEngineHelper::play(const QString& filename)
343 {
344  if (!filename.isEmpty())
345  {
346  QString soundFile = KStandardDirs::locate("appdata", "sounds/" + filename);
347  if (soundFile.isEmpty())
348  soundFile = filename;
349 
350  if (!m_player)
351  {
352  m_player = Phonon::createPlayer(Phonon::GameCategory, soundFile);
353  }
354  else
355  {
356  m_player->setCurrentSource(soundFile);
357  }
358  m_player->play();
359  }
360 }
361 
362 QString KanagramEngineHelper::stripAccents(QString& original)
363 {
364  QString noAccents;
365  QString decomposed = original.normalized(QString::NormalizationForm_D);
366  for (int i = 0; i < decomposed.length(); ++i) {
367  if ( decomposed[i].category() != QChar::Mark_NonSpacing ) {
368  noAccents.append(decomposed[i]);
369  }
370  }
371  return noAccents;
372 }
373 
374 bool KanagramEngineHelper::compareWords() const
375 {
376  return m_currentOriginalWord.join("") == m_kanagramGame->word();
377 }
378 
379 void KanagramEngineHelper::slotShowSettings()
380 {
381  if (!KConfigDialog::showDialog("settings"))
382  {
383  m_configDialog = new KConfigDialog( NULL, "settings", KanagramSettings::self() );
384  //m_configDialog->setAttribute(Qt::WA_DeleteOnClose);
385  connect(m_configDialog, SIGNAL(finished()), this, SLOT(reloadSettings()));
386 
387  // add the main settings page
388  MainSettings * mainSettingsPage = new MainSettings( m_configDialog );
389  connect (mainSettingsPage, SIGNAL(settingsChanged()), this, SLOT(reloadSettings()));
390  m_configDialog->addPage(mainSettingsPage , i18nc("@title:group main settings page name", "General" ), "preferences-other" );
391 
392  // create and add the vocabsettings page
393  m_vocabSettings = new VocabSettings( m_configDialog );
394  m_configDialog->addPage(m_vocabSettings, i18n("Vocabularies"), "document-properties" );
395 
396  // now make and add the shortcuts page
397  connect(m_configDialog, SIGNAL(accepted()), this, SLOT(slotSaveSettings()));
398  connect(m_configDialog, SIGNAL(rejected()), this, SLOT(slotSettingsCancelled()));
399 
400  m_configDialog->setHelp("kanagram/index.html");
401  m_configDialog->resize(600, 500);
402  m_configDialog->show();
403  }
404 }
405 
406 void KanagramEngineHelper::resetTotalScore()
407 {
408  m_totalScore=0;
409 }
410 
411 void KanagramEngineHelper::increaseScore(int points)
412 {
413  m_totalScore+=points;
414 }
415 
416 int KanagramEngineHelper::totalScore()
417 {
418  return m_totalScore;
419 }
420 
421 int KanagramEngineHelper::correctAnswerScore()
422 {
423  QString correctAnswerScore = KanagramSettings::correctAnswerScore();
424 
425  m_correctAnswerScore = getNumericSetting(correctAnswerScore);
426  return ((m_correctAnswerScore + 1)*5);
427 }
428 
429 int KanagramEngineHelper::incorrectAnswerScore()
430 {
431  QString incorrectAnswerScore = KanagramSettings::incorrectAnswerScore();
432 
433  m_incorrectAnswerScore = getNumericSetting(incorrectAnswerScore);
434  return ((m_incorrectAnswerScore + 1)*(-1));
435 }
436 
437 int KanagramEngineHelper::revealAnswerScore()
438 {
439  QString revealAnswerScore = KanagramSettings::revealAnswerScore();
440 
441  m_revealAnswerScore = getNumericSetting(revealAnswerScore);
442  return ((m_revealAnswerScore + 1)*(-2));
443 }
444 
445 int KanagramEngineHelper::skippedWordScore()
446 {
447  QString skippedWordScore = KanagramSettings::skippedWordScore();
448 
449  m_skippedWordScore = getNumericSetting(skippedWordScore);
450  return ((m_skippedWordScore + 1)*(-2));
451 }
452 
453 void KanagramEngineHelper::aboutKanagram()
454 {
455  m_helpMenu->aboutApplication();
456 }
457 
458 void KanagramEngineHelper::aboutKDE()
459 {
460  m_helpMenu->aboutKDE();
461 }
462 
463 void KanagramEngineHelper::kanagramHandbook()
464 {
465  m_helpMenu->appHelpActivated();
466 }
467 
468 void KanagramEngineHelper::setupJovie()
469 {
470  // If KTTSD not running, start it.
471  QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered( "org.kde.kttsd" );
472  bool kttsdactive = false;
473  if ( reply.isValid() )
474  kttsdactive = reply.value();
475  if ( !kttsdactive )
476  {
477  QString error;
478  if ( KToolInvocation::startServiceByDesktopName( "kttsd", QStringList(), &error ) )
479  {
480  QMessageBox::warning(NULL, i18n("Speech System Failure"), i18n( "Starting Jovie Text-to-Speech service Failed: %1", error ) );
481  }
482  else
483  {
484  kttsdactive = true;
485  }
486  }
487  if ( kttsdactive && m_kspeech==0)
488  {
489  // creating the connection to the kspeech interface
490  m_kspeech = new org::kde::KSpeech( "org.kde.kttsd", "/KSpeech", QDBusConnection::sessionBus() );
491  m_kspeech->setParent(this);
492  m_kspeech->setApplicationName( "Kanagram" );
493  }
494 }
495 
496 void KanagramEngineHelper::say(QString text)
497 {
498  if ( text.isEmpty() )
499  return;
500 
501  this->setupJovie();
502  if ( this->m_kspeech )
503  {
504  QDBusReply< int > reply = this->m_kspeech->say(text, KSpeech::soPlainText );
505  }
506 }
507 
508 void KanagramEngineHelper::slotSaveSettings()
509 {
510  // TODO: Update the current puzzle based on the new settings
511 }
512 
513 void KanagramEngineHelper::slotSettingsCancelled()
514 {
515 }
516 
517 void KanagramEngineHelper::slotEnableApplyButton()
518 {
519  m_configDialog->enableButtonApply(true);
520 }
521 
522 int KanagramEngineHelper::hintHideTime()
523 {
524  QString hideTime = KanagramSettings::hintHideTime();
525 
526  m_hintHideTime = getNumericSetting(hideTime);
527  if(m_hintHideTime)
528  return ((m_hintHideTime*2)+1);
529  else
530  return 0;
531 }
532 
533 void KanagramEngineHelper::setHintHideTime(int hintHideTime)
534 {
535  KanagramSettings::setHintHideTime(QString::number(hintHideTime));
536  emit hintHideTimeChanged();
537 }
538 
539 int KanagramEngineHelper::resolveTime()
540 {
541  return KanagramSettings::resolveTime().toInt();
542 }
543 
544 void KanagramEngineHelper::setResolveTime(int resolveTime)
545 {
546  KanagramSettings::setResolveTime(QString::number(resolveTime));
547  emit resolveTimeChanged();
548 }
549 
550 int KanagramEngineHelper::scoreTime()
551 {
552  QString scoreTime = KanagramSettings::scoreTime();
553 
554  m_scoreTime = getNumericSetting(scoreTime);
555  return ((m_scoreTime + 1)*15);
556 }
557 
558 bool KanagramEngineHelper::useSounds()
559 {
560  return KanagramSettings::useSounds();
561 }
562 
563 void KanagramEngineHelper::setUseSounds(bool useSounds)
564 {
565  KanagramSettings::setUseSounds(useSounds);
566  emit useSoundsToggled();
567 }
568 
569 QString KanagramEngineHelper::defaultVocabulary()
570 {
571  return KanagramSettings::defaultVocabulary();
572 }
573 
574 void KanagramEngineHelper::setDefaultVocabulary(const QString& defaultVocabulary)
575 {
576  KanagramSettings::setDefaultVocabulary(defaultVocabulary);
577  emit defaultVocabularyChanged();
578 }
579 
580 void KanagramEngineHelper::saveSettings()
581 {
582  KanagramSettings::self()->writeConfig();
583  m_kanagramGame->refreshVocabularyList();
584 }
585 
586 #include "kanagramenginehelper.moc"
KanagramEngineHelper::setupJovie
void setupJovie()
setup kde text-to-speech daemon
Definition: kanagramenginehelper.cpp:468
KanagramSettings::enablePronunciation
static bool enablePronunciation()
Get Turns pronunciations on/off.
Definition: kanagramsettings.h:222
KanagramEngineHelper::~KanagramEngineHelper
~KanagramEngineHelper()
Definition: kanagramenginehelper.cpp:65
QList::clear
void clear()
KanagramEngineHelper::resolveTime
int resolveTime()
Definition: kanagramenginehelper.cpp:539
QString::indexOf
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QString::append
QString & append(QChar ch)
KanagramEngineHelper::kanagramHandbook
Q_INVOKABLE void kanagramHandbook()
Definition: kanagramenginehelper.cpp:463
KanagramEngineHelper::hintHideTime
Q_INVOKABLE int hintHideTime()
Definition: kanagramenginehelper.cpp:522
KanagramEngineHelper::play
void play(const QString &filename)
Definition: kanagramenginehelper.cpp:342
KanagramEngineHelper::compareWords
Q_INVOKABLE bool compareWords() const
Definition: kanagramenginehelper.cpp:374
QDBusReply
Phonon::MediaObject::play
void play()
QDBusConnection::interface
QDBusConnectionInterface * interface() const
KanagramSettings::resolveTime
static QString resolveTime()
Get This setting allows you to set in seconds how much time is available for resolving the anagram...
Definition: kanagramsettings.h:70
QChar::isDigit
bool isDigit() const
QString::size
int size() const
KanagramEngineHelper::categoryName
Q_INVOKABLE QString categoryName() const
Definition: kanagramenginehelper.cpp:133
KanagramEngineHelper::totalScore
Q_INVOKABLE int totalScore()
Definition: kanagramenginehelper.cpp:416
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
KanagramEngineHelper::getNumericSetting
int getNumericSetting(QString settingString)
Definition: kanagramenginehelper.cpp:222
KanagramGame::anagram
QString anagram() const
Get the anagram to show.
Definition: kanagramgame.cpp:242
KanagramGame::refreshVocabularyList
bool refreshVocabularyList()
Refresh the list of vocabulary files available from what we find on disk.
Definition: kanagramgame.cpp:105
QChar::digitValue
int digitValue() const
QDBusReply::isValid
bool isValid() const
KanagramEngineHelper::KanagramEngineHelper
KanagramEngineHelper(KanagramGame *kanagramGame, QObject *parent=0)
Definition: kanagramenginehelper.cpp:48
KanagramSettings::scoreTime
static QString scoreTime()
Get This setting allows you to set in seconds the time interval of the score timer.
Definition: kanagramsettings.h:89
QDBusConnection::sessionBus
QDBusConnection sessionBus()
kanagramenginehelper.h
KanagramEngineHelper::resetTotalScore
Q_INVOKABLE void resetTotalScore()
Definition: kanagramenginehelper.cpp:406
KanagramEngineHelper::stripAccents
QString stripAccents(QString &original)
Definition: kanagramenginehelper.cpp:362
QStringList::join
QString join(const QString &separator) const
KanagramEngineHelper::loadSettings
void loadSettings()
Definition: kanagramenginehelper.cpp:236
QString::remove
QString & remove(int position, int n)
Phonon::createPlayer
MediaObject * createPlayer(Phonon::Category category, const MediaSource &source)
KanagramGame::hint
Q_INVOKABLE QString hint() const
Get this anagram's hint.
Definition: kanagramgame.cpp:247
KanagramEngineHelper::createNextAnagram
Q_INVOKABLE QString createNextAnagram()
Definition: kanagramenginehelper.cpp:74
KanagramSettings::setUseSounds
static void setUseSounds(bool v)
Set Turns sounds on/off.
Definition: kanagramsettings.h:174
QDBusConnectionInterface::isServiceRegistered
QDBusReply< bool > isServiceRegistered(const QString &serviceName) const
VocabSettings::refreshView
void refreshView()
reload the list of vocabularies from what's on disk
Definition: vocabsettings.cpp:53
KanagramSettings::setHintHideTime
static void setHintHideTime(const QString &v)
Set This setting allows you to set in seconds how long Kanagram's hint bubble is shown.
Definition: kanagramsettings.h:41
KanagramGame::word
QString word() const
Get this anagram's answer.
Definition: kanagramgame.cpp:252
KanagramSettings::useSounds
static bool useSounds()
Get Turns sounds on/off.
Definition: kanagramsettings.h:184
QList::size
int size() const
QString::normalized
QString normalized(NormalizationForm mode) const
KanagramEngineHelper::anagramOriginalWord
Q_INVOKABLE QString anagramOriginalWord()
Definition: kanagramenginehelper.cpp:112
KanagramEngineHelper::previousVocabulary
Q_INVOKABLE QString previousVocabulary()
Definition: kanagramenginehelper.cpp:149
KanagramGame::sanitizedDataLanguage
QString sanitizedDataLanguage() const
Get the sanitized data language used.
Definition: kanagramgame.cpp:68
KanagramEngineHelper::correctAnswerScore
Q_INVOKABLE int correctAnswerScore()
Definition: kanagramenginehelper.cpp:421
KanagramSettings::self
static KanagramSettings * self()
Definition: kanagramsettings.cpp:17
QString::number
QString number(int n, int base)
kanagramsettings.h
QList::append
void append(const T &value)
KanagramEngineHelper::incorrectAnswerScore
Q_INVOKABLE int incorrectAnswerScore()
Definition: kanagramenginehelper.cpp:429
KanagramGame::audioFile
KUrl audioFile()
Get this anagram's audio URL.
Definition: kanagramgame.cpp:367
KanagramEngineHelper::say
void say(QString text)
speak the word
Definition: kanagramenginehelper.cpp:496
KanagramEngineHelper::checkWord
Q_INVOKABLE bool checkWord(QString answer)
Definition: kanagramenginehelper.cpp:160
KanagramEngineHelper::aboutKDE
Q_INVOKABLE void aboutKDE()
Definition: kanagramenginehelper.cpp:458
QObject
KanagramEngineHelper::showHint
Q_INVOKABLE QString showHint() const
Definition: kanagramenginehelper.cpp:127
KanagramEngineHelper::reloadSettings
Q_INVOKABLE void reloadSettings()
Definition: kanagramenginehelper.cpp:336
QDBusReply::value
Type value() const
KanagramGame::previousVocabulary
void previousVocabulary()
Use the previous vocabulary file in the list.
Definition: kanagramgame.cpp:146
QString::toInt
int toInt(bool *ok, int base) const
QString::isEmpty
bool isEmpty() const
QString::trimmed
QString trimmed() const
KanagramEngineHelper::slotSettingsCancelled
Q_INVOKABLE void slotSettingsCancelled()
Definition: kanagramenginehelper.cpp:513
KanagramSettings::setDataLanguage
static void setDataLanguage(const QString &v)
Set Set the default translation.
Definition: kanagramsettings.h:250
KanagramEngineHelper::setUseSounds
void setUseSounds(bool useSounds)
Definition: kanagramenginehelper.cpp:563
KanagramEngineHelper::setHintHideTime
void setHintHideTime(int hintHideTime)
Definition: kanagramenginehelper.cpp:533
QString
KanagramSettings::incorrectAnswerScore
static QString incorrectAnswerScore()
Get This setting allows you to set the score associated with an incorrect answer. ...
Definition: kanagramsettings.h:127
QStringList
KanagramSettings::revealAnswerScore
static QString revealAnswerScore()
Get This setting allows you to set the score associated with reveal answer.
Definition: kanagramsettings.h:146
KanagramEngineHelper::revealAnswerScore
Q_INVOKABLE int revealAnswerScore()
Definition: kanagramenginehelper.cpp:437
VocabSettings
Vocabulary Settings class.
Definition: vocabsettings.h:34
KanagramEngineHelper::defaultVocabulary
QString defaultVocabulary()
Definition: kanagramenginehelper.cpp:569
QString::toLower
QString toLower() const
Phonon::MediaObject::setCurrentSource
void setCurrentSource(const MediaSource &source)
vocabsettings.h
KanagramEngineHelper::increaseScore
Q_INVOKABLE void increaseScore(int points)
Definition: kanagramenginehelper.cpp:411
KanagramEngineHelper::setDefaultVocabulary
void setDefaultVocabulary(const QString &defaultVocabulary)
Definition: kanagramenginehelper.cpp:574
KanagramEngineHelper::nextVocabulary
Q_INVOKABLE QString nextVocabulary()
Definition: kanagramenginehelper.cpp:139
KanagramEngineHelper::insertInCurrentOriginalWord
Q_INVOKABLE QStringList insertInCurrentOriginalWord(int index, const QString &letter)
Definition: kanagramenginehelper.cpp:86
KanagramEngineHelper::defaultVocabularyChanged
void defaultVocabularyChanged()
KanagramGame::nextVocabulary
void nextVocabulary()
Use the next vocabulary file in the list.
Definition: kanagramgame.cpp:162
KanagramEngineHelper::saveSettings
void saveSettings()
Definition: kanagramenginehelper.cpp:580
KanagramGame
game api
Definition: kanagramgame.h:41
QString::at
const QChar at(int position) const
KanagramEngineHelper::refreshVocabularies
void refreshVocabularies()
Definition: kanagramenginehelper.cpp:315
KanagramGame::nextAnagram
void nextAnagram()
Set the index to the next word.
Definition: kanagramgame.cpp:181
KanagramEngineHelper::hintHideTimeChanged
void hintHideTimeChanged()
QString::length
int length() const
KanagramSettings::skippedWordScore
static QString skippedWordScore()
Get This setting allows you to set the score associated with a skipped word.
Definition: kanagramsettings.h:165
QString::left
QString left(int n) const
KanagramEngineHelper::slotEnableApplyButton
Q_INVOKABLE void slotEnableApplyButton()
Definition: kanagramenginehelper.cpp:517
QMessageBox::warning
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
KanagramEngineHelper::slotShowSettings
Q_INVOKABLE void slotShowSettings()
invoke the settings dialog
Definition: kanagramenginehelper.cpp:379
KanagramEngineHelper::skippedWordScore
Q_INVOKABLE int skippedWordScore()
Definition: kanagramenginehelper.cpp:445
KanagramEngineHelper::aboutKanagram
Q_INVOKABLE void aboutKanagram()
Definition: kanagramenginehelper.cpp:453
KanagramSettings::dataLanguage
static QString dataLanguage()
Get Set the default translation.
Definition: kanagramsettings.h:260
KanagramEngineHelper::useSoundsToggled
void useSoundsToggled()
KanagramGame::documentTitle
QString documentTitle() const
Get the current vocabulary file's title.
Definition: kanagramgame.cpp:286
KanagramGame::filename
QString filename() const
Get the current vocabulary file's filename.
Definition: kanagramgame.cpp:237
KanagramEngineHelper::removeInCurrentOriginalWord
Q_INVOKABLE QStringList removeInCurrentOriginalWord(int index)
Definition: kanagramenginehelper.cpp:105
KanagramEngineHelper::useSounds
bool useSounds()
Definition: kanagramenginehelper.cpp:558
MainSettings
user preferences page of the config dialog allows choosing a hint hide time, the language, and the sound settings
Definition: mainsettings.h:33
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KanagramSettings::correctAnswerScore
static QString correctAnswerScore()
Get This setting allows you to set the score associated with a correct answer.
Definition: kanagramsettings.h:108
KanagramEngineHelper::isAnagram
bool isAnagram(QString &enteredword, QString &word)
Definition: kanagramenginehelper.cpp:196
KanagramEngineHelper::resolveTimeChanged
void resolveTimeChanged()
KanagramEngineHelper::setResolveTime
void setResolveTime(int resolveTime)
Definition: kanagramenginehelper.cpp:544
KanagramEngineHelper::scoreTime
Q_INVOKABLE int scoreTime()
Definition: kanagramenginehelper.cpp:550
KanagramEngineHelper::slotSaveSettings
Q_INVOKABLE void slotSaveSettings()
Definition: kanagramenginehelper.cpp:508
KanagramSettings::defaultVocabulary
static QString defaultVocabulary()
Get Set the default vocabulary.
Definition: kanagramsettings.h:241
mainsettings.h
KanagramSettings::setDefaultVocabulary
static void setDefaultVocabulary(const QString &v)
Set Set the default vocabulary.
Definition: kanagramsettings.h:231
KanagramSettings::hintHideTime
static QString hintHideTime()
Get This setting allows you to set in seconds how long Kanagram's hint bubble is shown.
Definition: kanagramsettings.h:51
KanagramSettings::setResolveTime
static void setResolveTime(const QString &v)
Set This setting allows you to set in seconds how much time is available for resolving the anagram...
Definition: kanagramsettings.h:60
QList::replace
void replace(int i, const T &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:12:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kanagram

Skip menu "kanagram"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal