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

parley

  • sources
  • kde-4.12
  • kdeedu
  • parley
  • src
  • scripts
  • scripting
parley.h
Go to the documentation of this file.
1 /***************************************************************************
2 
3  Copyright 2008 Avgoustinos Kadis <avgoustinos.kadis@kdemail.net>
4 
5  ***************************************************************************/
6 
7 /***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef SCRIPTOBJECTPARLEY_H
16 #define SCRIPTOBJECTPARLEY_H
17 
18 #include "document.h"
19 
20 #include <QObject>
21 #include <KAction>
22 #include <KDebug>
23 
24 #include <keduvocdeclension.h>
25 
26 #include <KStandardDirs>
27 
28 namespace Editor {
29  class EditorWindow;
30 }
31 class Translator;
32 
122 namespace Scripting
123 {
124 
125 
151  class Parley : public QObject
152  {
153  Q_OBJECT
155  Q_PROPERTY ( QObject * document READ getDocument )
157  Q_PROPERTY ( QObject * doc READ getDocument )
159  Q_PROPERTY ( QObject * activeLesson READ activeLesson )
160 
161 // Q_ENUMS ( Number Case Person Gender Definiteness )
162  Q_ENUMS ( Flags )
163 
164  public:
165 
166  enum Flags
167  {
168  // This is used for both empty flags and to denote no flags of the correct type were set.
169  NoInformation = 0x0,
170 
171  // Gender
172  Masculine = 0x1,
173  Feminine = 0x2,
174  Neuter = 0x4,
175 
176  // Plurality
177  Singular = 0x10,
178  Dual = 0x20,
179  Plural = 0x40,
180 
181  // Part of Speech
182  Verb = 0x100,
183  Noun = 0x200,
184  Pronoun = 0x400,
185  Adjective = 0x800,
186  Adverb = 0x1000,
187  Article = 0x2000,
188  Conjunction = 0x4000,
189 
190  // Person
191  First = 0x10000,
192  Second = 0x20000,
193  Third = 0x40000,
194 
195  // Declension Case
196  Nominative = 0x80000,
197  Genitive = 0x100000,
198  Dative = 0x200000,
199  Accusative = 0x400000,
200  Ablative = 0x800000,
201  Locative = 0x1000000,
202  Vocative = 0x2000000,
203 
204  // Other assorted flags
205  Definite = 0x4000000, // The article is definite
206  Indefinite = 0x8000000, // The article is indefinite
207  Regular = 0x10000000,
208  Irregular = 0x20000000
209  };
210 
211  Parley ( Editor::EditorWindow * editor );
212 
213  ~Parley();
214 
215  /*
216  * Emits translateWord signal so the script function connected to it translate the @p word
217  * @param word Word to translate
218  * @param fromLanguage The language of @p word to translate from
219  * @param toLanguage The language you want to translate to
220  */
221  void callTranslateWord ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
222 
223  //sets the translator object
224 // void setTranslator ( Translator* translator ) { m_translator = translator; }
225  Translator * translator() { return m_translator; }
226 
227  //Returns the active document
228  QObject* getDocument() { return m_doc; }
229 
230  //Returns the active lesson
231  QObject* activeLesson();
232 
233  public Q_SLOTS:
234 
235  QStringList dataDirs()
236  {
237  return KGlobal::dirs()->findDirs ( "data","parley" );
238  }
239 
240  QStringList pluginDirs()
241  {
242  return KGlobal::dirs()->findDirs ( "data","parley/plugins" );
243  }
244 
246  QVariantList selectedEntries();
247 
249  QVariantList selectedTranslations();
250 
269  void addTranslation ( QString word,QString fromLanguage,QString toLanguage, QString translation );
274  QStringList locales();
275 
281  QString localeName ( QString locale );
282 
284  /*
285  * Open the Parley Document @p file
286  * Usage:
287  * @code
288  * import Parley
289  * Parley.open("Vocab/MyVocab.kvtml")
290  * @endcode
291  * @param file Parley Document file path (ex. /home/kde-user/MyVocab.kvtml)
292  */
293  void open ( QString filename );
294 
342  QObject * newDocument() { return new Document(); }
343 
371  QObject * newAction ( const QString & name, const QString & text = QString() );
372 
373  Q_SIGNALS:
391  void translateWord ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
392  /* Emits when the translation of a word is finished (from all the scripts) [not to be used by scripts] */
393  void translationFinished ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
394  /* Emits when the translation of a word starts [not to be used by scripts] */
395  void translationStarted ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
396 
397  private:
398  Translator* m_translator;
399  Document* m_doc;
400  Editor::EditorWindow * m_editor;
401  };
402 
403 }
404 #endif
Scripting::Parley::getDocument
QObject * getDocument()
Definition: parley.h:228
Scripting::Parley::newAction
QObject * newAction(const QString &name, const QString &text=QString())
Creates and adds to the Scripts menu a new KAction (see KAction documentation)
Definition: parley.cpp:146
Scripting::Parley::Indefinite
Definition: parley.h:206
Scripting::Parley::addTranslation
void addTranslation(QString word, QString fromLanguage, QString toLanguage, QString translation)
Adds the found translation of the word from language fromLanguage to language toLanguage to Parley tr...
Definition: parley.cpp:61
Scripting::Parley::selectedEntries
QVariantList selectedEntries()
Returns a list of Expression objects (the selected entries of the active lesson)
Definition: parley.cpp:90
Scripting::Parley::First
Definition: parley.h:191
Scripting::Parley::Second
Definition: parley.h:192
Scripting::Parley::Ablative
Definition: parley.h:200
Scripting::Parley::pluginDirs
QStringList pluginDirs()
Definition: parley.h:240
Scripting::Parley::callTranslateWord
void callTranslateWord(const QString &word, const QString &fromLanguage, const QString &toLanguage)
Definition: parley.cpp:54
Scripting::Parley::translationStarted
void translationStarted(const QString &word, const QString &fromLanguage, const QString &toLanguage)
Scripting::Parley::Dative
Definition: parley.h:198
Scripting::Parley::translateWord
void translateWord(const QString &word, const QString &fromLanguage, const QString &toLanguage)
Slots (script functions) connected to this signal are called when a translation of word is requested...
Scripting::Parley::Genitive
Definition: parley.h:197
QObject
Scripting::Parley::NoInformation
Definition: parley.h:169
Scripting::Parley::Regular
Definition: parley.h:207
Scripting::Parley::Locative
Definition: parley.h:201
Scripting::Parley::Third
Definition: parley.h:193
Scripting::Parley::open
void open(QString filename)
Definition: parley.cpp:78
Scripting::Document
KEduVocDocument wrapping class for Kross scripts.
Definition: document.h:66
Scripting::Parley::Flags
Flags
Definition: parley.h:166
Scripting::Parley::Pronoun
Definition: parley.h:184
Scripting::Parley::doc
QObject doc
Abreviation of document property (same as Parley.document)
Definition: parley.h:157
Scripting::Parley::Irregular
Definition: parley.h:208
Scripting::Parley::dataDirs
QStringList dataDirs()
Definition: parley.h:235
document.h
Scripting::Parley::Neuter
Definition: parley.h:174
Scripting::Parley::locales
QStringList locales()
Returns a list of all available locales (to be used by the scripts)
Definition: parley.cpp:67
Scripting::Parley::Masculine
Definition: parley.h:172
Scripting::Parley::Vocative
Definition: parley.h:202
Scripting::Parley::Adjective
Definition: parley.h:185
Scripting::Parley::activeLesson
QObject * activeLesson()
Scripting::Parley::Feminine
Definition: parley.h:173
Translator
Keeps the translated words.
Definition: translator.h:74
Scripting::Parley::selectedTranslations
QVariantList selectedTranslations()
Returns a list of Translation objects (the selected translations of the active lesson) ...
Definition: parley.cpp:117
Scripting::Parley
Parley scripting class (main entry point of a Parley Kross script)
Definition: parley.h:151
Scripting::Parley::Article
Definition: parley.h:187
Scripting::Parley::Parley
Parley(Editor::EditorWindow *editor)
Definition: parley.cpp:42
Scripting::Parley::translationFinished
void translationFinished(const QString &word, const QString &fromLanguage, const QString &toLanguage)
Scripting::Parley::Conjunction
Definition: parley.h:188
Scripting::Parley::Noun
Definition: parley.h:183
Scripting::Parley::Accusative
Definition: parley.h:199
Scripting::Parley::Plural
Definition: parley.h:179
Editor::EditorWindow
Definition: editor.h:46
Scripting::Parley::document
QObject document
Read-only property of the active document.
Definition: parley.h:155
Scripting::Parley::localeName
QString localeName(QString locale)
Gives the language name of the given locale.
Definition: parley.cpp:73
Scripting::Parley::Nominative
Definition: parley.h:196
Scripting::Parley::Adverb
Definition: parley.h:186
Scripting::Parley::Verb
Definition: parley.h:182
Scripting::Parley::Definite
Definition: parley.h:205
Scripting::Parley::~Parley
~Parley()
Definition: parley.cpp:48
Scripting::Parley::Dual
Definition: parley.h:178
Scripting::Parley::translator
Translator * translator()
Definition: parley.h:225
Scripting::Parley::newDocument
QObject * newDocument()
Creates a new document and returns a reference to it.
Definition: parley.h:342
Scripting::Parley::Singular
Definition: parley.h:177
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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