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

klettres

  • sources
  • kde-4.14
  • kdeedu
  • klettres
  • src
klettres.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2001-2008 by Anne-Marie Mahfouf *
3  * annma@kde.org *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program 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 *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #include "klettres.h"
22 
23 //Qt includes
24 #include <QBitmap>
25 #include <QDir>
26 #include <QFile>
27 #include <QLabel>
28 #include <QPainter>
29 #include <QTextStream>
30 #include <QDomDocument>
31 #include <QWidget>
32 
33 //KDE includes
34 #include <KAction>
35 #include <KActionCollection>
36 #include <KComboBox>
37 #include <KConfigDialog>
38 #include <KLocale>
39 #include <KMenuBar>
40 #include <KMessageBox>
41 #include <KNumInput>
42 #include <KSelectAction>
43 #include <KStandardAction>
44 #include <KStandardDirs>
45 #include <KStatusBar>
46 #include <KToggleAction>
47 #include <KToolBar>
48 #include <KIcon>
49 #include <KApplication>
50 #include <KGlobal>
51 
52 #include <knewstuff3/downloaddialog.h>
53 //Project includes
54 #include "ui_fontsdlg.h"
55 #include "timer.h"
56 #include "prefs.h"
57 #include "langutils.h"
58 #include "kltheme.h"
59 
60 class fontsdlg : public QWidget, public Ui::fontsdlg
61 {
62  public:
63  fontsdlg( QWidget * parent ) : QWidget(parent)
64  {
65  setupUi(this);
66  }
67 };
68 
69 const int ID_KIDB = 100;
70 const int ID_GROWNB = 101;
71 const int ID_MENUBARB = 102;
72 
73 KLettres::KLettres()
74  : KXmlGuiWindow( 0)
75 {
76  setObjectName( QLatin1String("KLettres") );
77  mNewStuff = 0;
78  m_view = new KLettresView(this);
79  setMinimumSize( QSize( 800, 600 ) );
80  //Tell the KXmlGuiWindow that this is indeed the main widget
81  setCentralWidget(m_view);
82  //Populate Languages menu with m_languageNames
83  m_languageNames = LangUtils::getLanguagesNames(LangUtils::getLanguages());
84  //MainWindow GUI: menus, tolbars and statusbar
85  setupActions();
86  setupStatusbar();
87  setupToolbars();
88  //Load Settings
89  loadSettings();
90  //Setup current language sounds
91  soundFactory = new SoundFactory(this, "sounds");
92  //Start game
93  m_view->game();
94 }
95 
96 KLettres::~KLettres()
97 {
98 }
99 
100 bool KLettres::loadLayout(QDomDocument &layoutDocument)
101 {
102  QFile layoutFile(KStandardDirs::locate("data", "klettres/"+Prefs::language()+"/sounds.xml"));
103  //if xml file is not found, program exits
104  if (!layoutFile.exists()) {
105  kWarning() << "sounds.xml file not found in $KDEDIR/share/apps/klettres/"+Prefs::language() ;
106  QString mString=i18n("The file sounds.xml was not found in\n"
107  "$KDEDIR/share/apps/klettres/\n\n"
108  "Please install this file and start KLettres again.\n\n");
109  KMessageBox::information( this, mString,i18n("KLettres - Error") );
110  qApp->quit();//exit(1);
111  }
112 
113  if (!layoutFile.open(QIODevice::ReadOnly)) {
114  return false;
115  }
116 
117  //Check if document is well-formed
118  if (!layoutDocument.setContent(&layoutFile)) {
119  layoutFile.close();
120  return false;
121  }
122 
123  layoutFile.close();
124 
125  return true;
126 }
127 
128 void KLettres::setupActions()
129 {
130  KAction *m_newAction = actionCollection()->addAction("play_new");
131  m_newAction->setText(i18n("New Sound"));
132  m_newAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N));
133  m_newAction->setIcon(KIcon("document-new")); // ### better icon for this?
134  connect(m_newAction, SIGNAL(triggered(bool)), m_view, SLOT(game()));
135  m_newAction->setToolTip(i18n("Play a new sound"));
136  m_newAction->setWhatsThis(i18n("You can play a new sound by clicking this button or using the File menu, New Sound."));
137 
138  QAction *m_stuffAction = actionCollection()->addAction("downloadnewstuff");
139  m_stuffAction->setText(i18n("Get Alphabet in New Language..."));
140  m_stuffAction->setIcon(KIcon("get-hot-new-stuff"));
141  connect(m_stuffAction, SIGNAL(triggered(bool)), this, SLOT(slotDownloadNewStuff()));
142 
143  KAction *m_playAgainAction = actionCollection()->addAction("play_again");
144  m_playAgainAction->setText(i18n("Replay Sound"));
145  m_playAgainAction->setShortcut(QKeySequence(Qt::Key_F5));
146  m_playAgainAction->setIcon(KIcon("media-playback-start"));
147  m_playAgainAction->setToolTip(i18n("Play the same sound again"));
148  connect(m_playAgainAction, SIGNAL(triggered(bool)), m_view, SLOT(slotPlayAgain()));
149  m_playAgainAction->setWhatsThis(i18n("You can replay the same sound again by clicking this button or using the File menu, Replay Sound."));
150  KStandardAction::quit(kapp, SLOT(quit()), actionCollection());
151 
152  m_menubarAction = KStandardAction::showMenubar(this, SLOT(slotMenubar()), actionCollection());
153 
154  m_levelAction = actionCollection()->add<KSelectAction>("levels");
155  m_levelAction->setText(i18nc("@label:listbox which difficulty level to use", "L&evel"));
156  m_levelAction->setToolTip(i18n("Select the level"));
157  m_levelAction->setWhatsThis(i18n("You can select the level: level 1 displays a letter and you hear it; level 2 does not display the letter, you only hear it; level 3 displays a syllable and you hear it; level 4 does not display the syllable, you only hear it."));
158 
159  m_languageAction = actionCollection()->add<KSelectAction>("languages");
160  m_languageAction->setText(i18nc("@label:listbox", "&Language"));
161  m_languageAction->setItems(m_languageNames);
162 
163  m_levelsNames.append(i18ncp("@item:inlistbox choose level", "Level %1" , "Level %1", 1));
164  m_levelsNames.append(i18ncp("@item:inlistbox choose level", "Level %1" , "Level %1", 2));
165  m_levelsNames.append(i18ncp("@item:inlistbox choose level", "Level %1" , "Level %1", 3));
166  m_levelsNames.append(i18ncp("@item:inlistbox choose level", "Level %1" , "Level %1", 4));
167  m_levelAction->setItems(m_levelsNames);
168  m_levelAction->setCurrentItem(Prefs::level()-1);
169 
170  m_themeAction = actionCollection()->add<KSelectAction>("looks");
171  m_themeAction->setText(i18n("Themes"));
172  m_themeAction->setItems(KLThemeFactory::instance()->themeList());
173  m_themeAction->setCurrentItem(Prefs::theme());
174  m_themeAction->setToolTip(i18n("Select the theme"));
175  m_themeAction->setWhatsThis(i18n("Here you can change the theme for KLettres. A theme consists in the background picture and the font color for the letter displayed."));
176 
177  m_kidAction = actionCollection()->add<KToggleAction>("mode_kid");
178  m_kidAction->setText(i18n("Mode Kid"));
179  m_kidAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_K));
180  m_kidAction->setIcon(KIcon("klettres_kids"));
181  connect(m_kidAction, SIGNAL(triggered(bool)), this, SLOT(slotModeKid()));
182  m_kidAction->setWhatsThis(i18n("If you are in the Grown-up mode, clicking on this button will set up the Kid mode. The Kid mode has no menubar and the font is bigger in the statusbar."));
183 
184  m_grownupAction = actionCollection()->add<KToggleAction>("mode_grownup");
185  m_grownupAction->setText(i18n("Mode Grown-up"));
186  m_grownupAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_G));
187  m_grownupAction->setIcon(KIcon("klettres_grownup"));
188  connect(m_grownupAction, SIGNAL(triggered(bool)), this, SLOT(slotModeGrownup()));
189  m_grownupAction->setWhatsThis(i18n("The Grownup mode is the normal mode where you can see the menubar."));
190 
191  connect(m_levelAction, SIGNAL(triggered(int)), this, SLOT(slotChangeLevel(int)));
192  connect(m_languageAction, SIGNAL(triggered(int)), this, SLOT(slotChangeLanguage(int)));
193  connect(m_themeAction, SIGNAL(triggered(int)), this, SLOT(slotChangeTheme(int)));
194 
195  KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
196 
197  setupGUI();
198 }
199 
200 void KLettres::setupStatusbar()
201 {
202  KStatusBar *st=statusBar();
203  m_langLabel = new QLabel(st);
204  m_levLabel = new QLabel(st);
205  st->addWidget(m_langLabel);
206  st->insertFixedItem("", 1);//add a space
207  st->addWidget(m_levLabel);
208  statusBar();
209 }
210 
211 void KLettres::setupToolbars()
212 {
213  // Toolbar for special characters
214  specialCharToolbar = toolBar("specialCharToolbar");
215  addToolBar ( Qt::BottomToolBarArea, specialCharToolbar);
216 }
217 
218 void KLettres::optionsPreferences()
219 {
220  if(KConfigDialog::showDialog("settings")) {
221  return;
222  }
223 
224  KConfigDialog *dialog = new KConfigDialog(this, "settings", Prefs::self());
225  dialog->addPage(new fontsdlg(0), i18n("Font Settings"), "preferences-desktop-font");
226  //fontsdlg is the page name, mFont is the widget name, Font Settings is the page display string
227  //fonts is the icon
228  Timer *m_timer = new Timer();
229  dialog->addPage(m_timer, i18n("Timer"), "chronometer");
230  connect(dialog, SIGNAL(settingsChanged(const QString &)), this, SLOT(slotUpdateSettings()));
231  dialog->setAttribute( Qt::WA_DeleteOnClose );
232  dialog->setHelp(QString(), "klettres");
233  dialog->show();
234 }
235 
236 void KLettres::loadSettings()
237 {
238  if (LangUtils::getLanguages().indexOf(Prefs::language()) <0) {
239  Prefs::setLanguage("en");
240  }
241  QString langString = LangUtils::getLanguagesNames(LangUtils::getLanguages())[LangUtils::getLanguages().indexOf(Prefs::language())];
242  m_languageAction->setCurrentItem(LangUtils::getLanguages().indexOf(Prefs::language()));
243  langString.remove('&');
244  m_langLabel->setText(langString);
245  loadLangToolBar();
246  // load default level
247  m_levLabel->setText(i18nc("@info:status the current level chosen", "(Level %1)", Prefs::level()));
248 
249  m_view->setTheme(KLThemeFactory::instance()->buildTheme(Prefs::theme()));
250 
251  if (Prefs::mode() == Prefs::EnumMode::grownup) {
252  slotModeGrownup();
253  } else {
254  slotModeKid();
255  }
256 
257  m_menubarAction->setChecked(Prefs::menuBarBool());
258  slotMenubar();
259 }
260 
261 void KLettres::slotDownloadNewStuff()
262 {
263  QPointer<KNS3::DownloadDialog> dialog(new KNS3::DownloadDialog("klettres.knsrc", this));
264  if ( dialog->exec() == QDialog::Accepted ) {
265  // do nothing
266  }
267 
268  delete dialog;
269 
270  //look for languages dirs installed
271  QStringList languages = LangUtils::getLanguages();
272  m_languageNames = LangUtils::getLanguagesNames(languages);
273 
274  //refresh Languages menu
275  m_languageAction->setItems(m_languageNames);
276  slotChangeLanguage(languages.indexOf(Prefs::language()));
277  m_languageAction->setCurrentItem(languages.indexOf(Prefs::language()));
278 }
279 
280 void KLettres::slotMenubar()
281 {
282  menuBar()->setVisible(m_menubarAction->isChecked());
283  Prefs::setMenuBarBool(m_menubarAction->isChecked());
284  Prefs::self()->writeConfig();
285 }
286 
287 void KLettres::slotUpdateSettings()
288 {
289  m_view->m_timer = Prefs::kidTimer();
290  m_view->m_timer = Prefs::grownTimer();
291  //apply the font
292  m_view->setFont(Prefs::font());
293 }
294 
295 void KLettres::slotChangeLevel(int newLevel)
296 {
297  Prefs::setLevel(newLevel+1);
298  Prefs::self()->writeConfig();
299  updateLevMenu(newLevel);
300  //TODO is that necessary? Change level effectively by reloading sounds
301 
302  //this is duplicated in changeLanguage()
303  soundFactory->change(Prefs::language());
304  //update game effectively
305  m_view->randomInt = 0;
306  m_view->game();
307 }
308 
309 void KLettres::updateLevMenu(int id)
310 {
311  //m_levelCombo->setCurrentItem(id);
312  m_levelAction->setCurrentItem(id);
313  m_levLabel->setText(i18nc("@info:status the current level chosen", "(Level %1)", Prefs::level()));
314 }
315 
316 void KLettres::slotChangeLanguage(int newIndex)
317 {
318  // Write new language ISO in config
319  QString newLanguage = LangUtils::getLanguages()[newIndex];
320  Prefs::setLanguage(newLanguage);
321  Prefs::self()->writeConfig();
322  // Update the StatusBar
323  QString langString = LangUtils::getLanguagesNames(LangUtils::getLanguages())[newIndex];
324  langString.remove('&');
325  m_langLabel->setText(langString);
326  loadLangToolBar();
327  // Change language effectively
328  bool ok = loadLayout(soundFactory->m_layoutsDocument);
329 
330  if (ok) {
331  soundFactory->change(Prefs::language());
332  }
333 
334  m_view->randomInt = 0;
335  m_view->game();
336 }
337 
338 void KLettres::slotChangeTheme(int index)
339 {
340  Prefs::setTheme(index);
341  Prefs::self()->writeConfig();
342  m_view->setTheme(KLThemeFactory::instance()->buildTheme(index));
343 }
344 
345 void KLettres::slotModeGrownup()
346 {
347  QPalette pal;
348  pal.setColor( QPalette::Background, Qt::white);
349  statusBar()->setPalette( pal );
350  QFont f_lab( "Serif" , 10); //font for statusBar
351  m_levLabel->setFont(f_lab);
352  m_langLabel->setFont(f_lab);
353  m_menubarAction->setChecked(true);
354  m_grownupAction->setChecked(true);
355  m_kidAction->setChecked(false);
356  m_grownupAction->setToolTip(i18n("Grown-up mode is currently active"));
357  m_kidAction->setToolTip(i18n("Switch to Kid mode"));
358  menuBar()->show();
359  m_view->m_timer = Prefs::grownTimer();
360  Prefs::setMode(Prefs::EnumMode::grownup);
361  Prefs::self()->writeConfig();
362 }
363 
364 void KLettres::slotModeKid()
365 {
366  QPalette pal;
367  pal.setColor( QPalette::Background, Qt::white);
368  statusBar()->setPalette( pal );
369  QFont f_lab( "Serif" , 12); //font for statusBar
370  f_lab.setBold(true);
371  m_levLabel->setFont(f_lab);
372  m_langLabel->setFont(f_lab);
373  m_menubarAction->setChecked(false);
374  m_kidAction->setChecked(true);
375  m_kidAction->setToolTip(i18n("Kid mode is currently active"));
376  m_grownupAction->setToolTip(i18n("Switch to Grown-up mode"));
377  m_grownupAction->setChecked(false);
378  menuBar()->hide();
379  m_view->m_timer = Prefs::kidTimer();
380  Prefs::setMode(Prefs::EnumMode::kid);
381  Prefs::self()->writeConfig();
382 }
383 
384 void KLettres::loadLangToolBar()
385 {
386  QString lang = Prefs::language();
387 
388  specialCharToolbar->clear();
389 
390  if (LangUtils::hasSpecialChars(lang)) {//Dutch, English, French and Italian have no special characters
391  allData.clear();
392  QString myString=QString("klettres/%1.txt").arg(lang);
393  QFile myFile;
394  myFile.setFileName(KStandardDirs::locate("data",myString));
395 
396  if (!myFile.exists()) {
397  QString mString=i18n("File $KDEDIR/share/apps/klettres/%1.txt not found;\n"
398  "please check your installation.", lang);
399  KMessageBox::sorry( this, mString,
400  i18n("Error") );
401  qApp->quit();
402  }
403 
404  //we open the file and store info into the stream...
405  QFile openFileStream(myFile.fileName());
406  openFileStream.open(QIODevice::ReadOnly);
407  QTextStream readFileStr(&openFileStream);
408  readFileStr.setCodec("UTF-8");
409  //allData contains all the words from the file
410  allData = readFileStr.readAll().split('\n');
411  openFileStream.close();
412 
413  for (int i=0; i<(int) allData.count(); ++i) {
414  if (!allData[i].isEmpty()) {
415  QAction *act = specialCharToolbar->addAction(allData.at(i));
416  act->setIcon(charIcon(allData.at(i).at(0)));
417  // used to carry the id
418  act->setData(i);
419  connect(act, SIGNAL(triggered(bool)), this, SLOT(slotPasteChar()));
420  }
421  }
422 
423  specialCharToolbar->show();
424  update();
425  } else {
426  specialCharToolbar->hide();
427  }
428 }
429 
430 void KLettres::slotPasteChar()
431 {
432  QAction *act = qobject_cast<QAction*>(sender());
433  if (!act) {
434  return;
435  }
436 
437  bool ok = true;
438  int id = act->data().toInt(&ok);
439 
440  if (!ok || id < 0 || id >= allData.count()) {
441  return;
442  }
443 
444  m_view->m_letterEdit->insert(allData.at(id));
445 }
446 
447 QIcon KLettres::charIcon(const QChar & c)
448 {
450  QString s = KStandardDirs::locateLocal("icon", "char" + QString::number(c.unicode()) + ".png");
451 
452  QRect r(4, 4, 120, 120);
453 
455  QFont font;
456  font.setFamily( "Arial" );
457  font.setPixelSize(120);
458  font.setWeight(QFont::Normal);
459 
461  QPixmap pm(128, 128);
462  pm.fill(Qt::white);
463  QPainter p(&pm);
464  p.setFont(font);
465  p.setPen(Qt::black);
466  p.drawText(r, Qt::AlignCenter, (QString) c);
467 
469  QBitmap bm(128, 128);
470  bm.fill(Qt::color0);
471  QPainter b(&bm);
472  b.setFont(font);
473  b.setPen(Qt::color1);
474  b.drawText(r, Qt::AlignCenter, (QString) c);
475 
477  pm.setMask(bm);
478 
480  pm.save(s, "PNG");
481 
482  return QIcon(pm);
483 }
484 
485 #include "klettres.moc"
QTextStream::setCodec
void setCodec(QTextCodec *codec)
QAction::setText
void setText(const QString &text)
QList::clear
void clear()
KLettres::slotChangeLanguage
void slotChangeLanguage(int)
Set the new language.
Definition: klettres.cpp:316
QWidget
QWidget::setupUi
void setupUi(QWidget *widget)
KLettres::setupToolbars
void setupToolbars()
Create main and second toolbars.
Definition: klettres.cpp:211
KLettres::charIcon
QIcon charIcon(const QChar &c)
generates icons for the special characters toolbar
Definition: klettres.cpp:447
KLettres::m_languageNames
QStringList m_languageNames
All available language names.
Definition: klettres.h:54
KLettres::slotMenubar
void slotMenubar()
Hide/Show the menubar.
Definition: klettres.cpp:280
QPixmap::fill
void fill(const QColor &color)
QPalette::setColor
void setColor(ColorGroup group, ColorRole role, const QColor &color)
Prefs::setMenuBarBool
static void setMenuBarBool(bool v)
Set Whether the menubar is shown or hidden.
Definition: prefs.h:71
KLettresView::game
void game()
Start playing displaying a new letter/syllable, playing the associated sound.
Definition: klettresview.cpp:148
QChar
QString::split
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QAction::data
QVariant data() const
QFont
QAction::setIcon
void setIcon(const QIcon &icon)
QList::at
const T & at(int i) const
QFile::fileName
QString fileName() const
QPointer
klettres.h
QFile::setFileName
void setFileName(const QString &name)
Prefs::language
static QString language()
Get Language.
Definition: prefs.h:43
KLettres::setupActions
void setupActions()
Build the main window menus.
Definition: klettres.cpp:128
KLettresView::setTheme
void setTheme(KLTheme *theme)
set the chosen theme
Definition: klettresview.cpp:87
KLettres::m_langLabel
QLabel * m_langLabel
Label stating the language in the statusbar.
Definition: klettres.h:84
prefs.h
QFont::setWeight
void setWeight(int weight)
QFile::exists
bool exists() const
Prefs::level
static int level()
Get Difficulty level.
Definition: prefs.h:131
QString::remove
QString & remove(int position, int n)
ID_GROWNB
const int ID_GROWNB
Definition: klettres.cpp:70
KLettresView::m_timer
int m_timer
The timer value i.e. the time for displaying the letters/syllables.
Definition: klettresview.h:59
KLettres::slotModeGrownup
void slotModeGrownup()
Switch to the grown-up look, menubar is shown.
Definition: klettres.cpp:345
KLettresView
This class serves as the view for KLettres.
Definition: klettresview.h:42
KLettres::updateLevMenu
void updateLevMenu(int id)
Update the level menu and level combobox.
Definition: klettres.cpp:309
QFile
KLettres::loadLayout
bool loadLayout(QDomDocument &layoutDocument)
Load the xml file.
Definition: klettres.cpp:100
QTextStream
timer.h
KLettres::slotUpdateSettings
void slotUpdateSettings()
Set the new font and the new timers.
Definition: klettres.cpp:287
QBitmap
QFont::setBold
void setBold(bool enable)
Prefs::self
static Prefs * self()
Definition: prefs.cpp:17
KLettres::KLettres
KLettres()
Constructor.
Definition: klettres.cpp:73
QFont::setPixelSize
void setPixelSize(int pixelSize)
QRect
QPainter::setFont
void setFont(const QFont &font)
QString::number
QString number(int n, int base)
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
QPixmap::save
bool save(const QString &fileName, const char *format, int quality) const
KXmlGuiWindow
Prefs::menuBarBool
static bool menuBarBool()
Get Whether the menubar is shown or hidden.
Definition: prefs.h:81
QVariant::toInt
int toInt(bool *ok) const
Prefs::grownTimer
static int grownTimer()
Get Grown-up Timer.
Definition: prefs.h:169
KLettres::slotChangeLevel
void slotChangeLevel(int)
Set the new level.
Definition: klettres.cpp:295
Prefs::kidTimer
static int kidTimer()
Get Kid Timer.
Definition: prefs.h:150
QPainter::setPen
void setPen(const QColor &color)
KLettres::m_languageAction
KSelectAction * m_languageAction
Action that sets up the Language menu.
Definition: klettres.h:62
QPainter
QPainter::drawText
void drawText(const QPointF &position, const QString &text)
KLettres::m_levLabel
QLabel * m_levLabel
Label stating the level in the statusbar.
Definition: klettres.h:86
KLettres::mNewStuff
KLNewStuff * mNewStuff
Create a KNewStuff instance.
Definition: klettres.h:113
Prefs::font
static QFont font()
Get Font.
Definition: prefs.h:188
KLettres::slotPasteChar
void slotPasteChar()
When a button is clicked on the characters toolbar, the corresponding character is written in the lin...
Definition: klettres.cpp:430
QLabel::setText
void setText(const QString &)
SoundFactory
This class manages the sounds to play in KLettres, reading the data about the sounds in the sounds...
Definition: soundfactory.h:47
QString
QChar::unicode
ushort unicode() const
KLettresView::m_letterEdit
KLineEdit * m_letterEdit
The line where the user enters his/her input.
Definition: klettresview.h:65
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
Prefs::EnumMode::kid
Definition: prefs.h:23
QStringList
KLettres::soundFactory
SoundFactory * soundFactory
Sound class.
Definition: klettres.h:52
QPixmap
SoundFactory::change
void change(const QString &currentLanguage)
Change the language when the user changes the language in the Languages menu.
Definition: soundfactory.cpp:59
QAction::setData
void setData(const QVariant &userData)
Prefs::theme
static int theme()
Get Theme.
Definition: prefs.h:62
QPixmap::setMask
void setMask(const QBitmap &mask)
QSize
KLettres::m_themeAction
KSelectAction * m_themeAction
Action that sets up the Look menu.
Definition: klettres.h:78
QWidget::setFont
void setFont(const QFont &)
KLThemeFactory::instance
static KLThemeFactory * instance()
Definition: kltheme.cpp:234
QDomDocument
QFile::close
virtual void close()
KLettres::m_levelsNames
QStringList m_levelsNames
Holds the levels.
Definition: klettres.h:88
KLettres::slotModeKid
void slotModeKid()
Switch to the kid look, menubar is hidden.
Definition: klettres.cpp:364
Prefs::setLevel
static void setLevel(int v)
Set Difficulty level.
Definition: prefs.h:109
KLettres::loadLangToolBar
void loadLangToolBar()
Set the correct buttons on the second toolbar according to the language.
Definition: klettres.cpp:384
KLettres::m_levelAction
KSelectAction * m_levelAction
Action that sets up the Level menu.
Definition: klettres.h:76
Prefs::setLanguage
static void setLanguage(const QString &v)
Set Language.
Definition: prefs.h:33
KLettres::specialCharToolbar
KToolBar * specialCharToolbar
Second toolbar with buttons of special characters per language.
Definition: klettres.h:94
QLatin1String
QKeySequence
KLettres::loadSettings
void loadSettings()
Load the configuration settings and apply them.
Definition: klettres.cpp:236
Prefs::mode
static int mode()
Get Mode.
Definition: prefs.h:100
ID_KIDB
const int ID_KIDB
Definition: klettres.cpp:69
QAction
QFont::setFamily
void setFamily(const QString &family)
KLettres::slotChangeTheme
void slotChangeTheme(int)
Change Look from menu Look.
Definition: klettres.cpp:338
KLettres::m_view
KLettresView * m_view
Call an instance of the KLettresView widget.
Definition: klettres.h:72
KLettres::allData
QStringList allData
All the special characters from a language file, these characters will be as buttons on the Special C...
Definition: klettres.h:117
langutils.h
KLettres::optionsPreferences
void optionsPreferences()
Display the Configure KLettres dialog.
Definition: klettres.cpp:218
Prefs::setTheme
static void setTheme(int v)
Set Theme.
Definition: prefs.h:52
KLettres::m_kidAction
KToggleAction * m_kidAction
Action allowing the Kid mode.
Definition: klettres.h:80
ID_MENUBARB
const int ID_MENUBARB
Definition: klettres.cpp:71
Prefs::setMode
static void setMode(int v)
Set Mode.
Definition: prefs.h:90
QStringList::indexOf
int indexOf(const QRegExp &rx, int from) const
KLettres::~KLettres
virtual ~KLettres()
Destructor.
Definition: klettres.cpp:96
Timer
Timer widget in Settings dialog.
Definition: timer.h:35
kltheme.h
Prefs::EnumMode::grownup
Definition: prefs.h:23
KLettres::setupStatusbar
void setupStatusbar()
Create and setup statusbar.
Definition: klettres.cpp:200
QLabel
QTextStream::readAll
QString readAll()
KLettres::m_menubarAction
KToggleAction * m_menubarAction
Action that enables the ShowMenuBar item in the Settings menu.
Definition: klettres.h:74
KLettresView::randomInt
int randomInt
The index to the random sequence.
Definition: klettresview.h:61
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
KLettres::m_grownupAction
KToggleAction * m_grownupAction
Action allowing the Grownup mode.
Definition: klettres.h:82
LangUtils::getLanguagesNames
static QStringList getLanguagesNames(QStringList languagesList)
All available languages translated names.
Definition: langutils.cpp:91
QPalette
SoundFactory::m_layoutsDocument
QDomDocument m_layoutsDocument
The language document.
Definition: soundfactory.h:75
LangUtils::hasSpecialChars
static bool hasSpecialChars(const QString &lang)
Definition: langutils.cpp:30
QIcon
QDomDocument::setContent
bool setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn)
KLettres::slotDownloadNewStuff
void slotDownloadNewStuff()
Call the Get New Stuff dialog.
Definition: klettres.cpp:261
LangUtils::getLanguages
static QStringList getLanguages()
Available languages ISO names.
Definition: langutils.cpp:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:12:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

klettres

Skip menu "klettres"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

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