• Skip to content
  • Skip to link menu
KDE API Documentation - Wordlist Class Reference (GCompris-qt)
  • KDE Home
  • Contact Us
 

GCompris-qt

  • View on LXR
  • Comments
Signals | Public Member Functions | Properties | List of all members
Wordlist Class Reference
Core QML Components

Inherits QtQuick.Item, and Item.

Signals

void error (string msg)
 

Public Member Functions

void appendRandomWord (string word)
 
void getLevelWordList (int level)
 
void getMaxSubLevel (int level)
 
void getRandomWord ()
 
void initRandomWord (int level)
 
void loadFromFile (string fname)
 

Properties

string defaultFilename
 
string filename
 
bool useDefault
 
object wordList
 

Detailed Description

A Wordlist component loads and maintains GCompris wordlists.

It loads wordlists from json-files, validates its content and exposes wordlists and levels to activities.

It expects and returns the following wordlist format (UTF8 encoded):

{
"name":"default-gd",
"description":"GĂ idhlig",
"locale":"gd",
"levels":[ { "level":1,
"speed":150, <-- optional
"fallspeed":7000, <-- optional
"sublevels":10, <-- optional
"words":["a","jim", "beam", ... ]}, <-- mandatory
{ "level":2, ... }
]
}
See also
JsonParser

Definition at line 50 of file Wordlist.qml.

Member Function Documentation

void Wordlist::appendRandomWord ( string  word)

Re-add a random word to a shuffled word list.

Parameters
wordWord to append.
See also
initRandomWord
void Wordlist::error ( string  msg)
signal

Emitted if an error occurs.

Parameters
msgError message.
void Wordlist::getLevelWordList ( int  level)

Get wordlist data for level.

Parameters
levelLevel.
Returns
type:object wordlist data.
void Wordlist::getMaxSubLevel ( int  level)

Get number of sub-levels in level.

Parameters
levelLevel.
Returns
type:int Number of sublevels.
void Wordlist::getRandomWord ( )

Returns the next random word from a shuffled wordlist.

See also
initRandomWord
void Wordlist::initRandomWord ( int  level)

Build a random word list for level.

We don't want to propose several time the same word. First call initRandomWord(level) to create the initial shuffled list of words. Then call getRandomWord() to get the words one at a time. If a word was not found by the child, add it again to the list with appendRandomWord(word)

Parameters
levelLevel.
void Wordlist::loadFromFile ( string  fname)

Load Wordlist from file fname.

Parameters
fnameFilename to load wordlist from.

Property Documentation

string Wordlist::defaultFilename

Default filename to be used if the language specific wordlist file could not be loaded.

Default is emtpy.

Definition at line 58 of file Wordlist.qml.

string Wordlist::filename

Name of the file to load the language specific wordlist from.

Default is empty. Can also be passed directly in loadFromFile(). If set in the QML definition, the wordlist is autoloaded onCompleted.

Definition at line 72 of file Wordlist.qml.

bool Wordlist::useDefault

Whether to automatically fallback to the default filename if the language specific wordlist file could not be loaded.

Default is true.

Definition at line 65 of file Wordlist.qml.

object Wordlist::wordList

Complete Wordlist content loaded.

You probably want to use one of the convenience accessors like getLevelWordList(). Default is empty.

Definition at line 79 of file Wordlist.qml.


The documentation for this class was generated from the following file:
  • Wordlist.qml
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Tue Jun 2 2015 21:47:48 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

GCompris-qt

Skip menu "GCompris-qt"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Modules

Class Picker

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