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

parley

parley.h

Go to the documentation of this file.
00001 /***************************************************************************
00002 
00003     Copyright 2008 Avgoustinos Kadis <avgoustinos.kadis@kdemail.net>
00004 
00005  ***************************************************************************/
00006 
00007 /***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 #ifndef SCRIPTOBJECTPARLEY_H
00016 #define SCRIPTOBJECTPARLEY_H
00017 
00018 #include "document.h"
00019 
00020 #include <QObject>
00021 #include <KAction>
00022 #include <KDebug>
00023 
00024 #include <keduvocdeclension.h>
00025 
00026 #include <KStandardDirs>
00027 
00028 class Editor;
00029 class Translator;
00030 
00120 namespace Scripting
00121 {
00122 
00123 
00149     class Parley : public QObject
00150     {
00151             Q_OBJECT
00153             Q_PROPERTY ( QObject * document READ getDocument )
00155             Q_PROPERTY ( QObject * doc READ getDocument )
00157             Q_PROPERTY ( QObject * activeLesson READ activeLesson )
00158 
00159 //             Q_ENUMS ( Number Case Person Gender Definiteness )
00160             Q_ENUMS ( Flags )
00161 
00162         public:
00163 
00164             enum Flags
00165             {
00166                 // This is used for both empty flags and to denote no flags of the correct type were set.
00167                 NoInformation = 0x0,
00168 
00169                 // Gender
00170                 Masculine = 0x1,
00171                 Feminine = 0x2,
00172                 Neuter = 0x4,
00173 
00174                 // Plurality
00175                 Singular = 0x10,
00176                 Dual = 0x20,
00177                 Plural = 0x40,
00178 
00179                 // Part of Speech
00180                 Verb = 0x100,
00181                 Noun = 0x200,
00182                 Pronoun = 0x400,
00183                 Adjective = 0x800,
00184                 Adverb = 0x1000,
00185                 Article = 0x2000,
00186                 Conjunction = 0x4000,
00187 
00188                 // Person
00189                 First = 0x10000,
00190                 Second = 0x20000,
00191                 Third = 0x40000,
00192 
00193                 // Declension Case
00194                 Nominative = 0x80000,
00195                 Genitive = 0x100000,
00196                 Dative = 0x200000,
00197                 Accusative = 0x400000,
00198                 Ablative = 0x800000,
00199                 Locative = 0x1000000,
00200                 Vocative = 0x2000000,
00201 
00202                 // Other assorted flags
00203                 Definite = 0x4000000, // The article is definite
00204                 Indefinite = 0x8000000, // The article is indefinite
00205                 Regular = 0x10000000,
00206                 Irregular = 0x20000000
00207             };
00208 
00209             Parley ( Editor * editor );
00210 
00211             ~Parley();
00212 
00213             /*
00214              * Emits translateWord signal so the script function connected to it translate the @p word
00215              * @param word Word to translate
00216              * @param fromLanguage The language of @p word to translate from
00217              * @param toLanguage The language you want to translate to
00218              */
00219             void callTranslateWord ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
00220 
00221             //sets the translator object
00222 //             void setTranslator ( Translator* translator ) { m_translator = translator; }
00223             Translator * translator() { return m_translator; }
00224 
00225             //Returns the active document
00226             QObject* getDocument() { return m_doc; }
00227 
00228             //Returns the active lesson
00229             QObject* activeLesson();
00230 
00231         public Q_SLOTS:
00232 
00233             QStringList dataDirs()
00234             {
00235                 return KGlobal::dirs()->findDirs ( "data","parley" );
00236             }
00237 
00238             QStringList pluginDirs()
00239             {
00240                 return KGlobal::dirs()->findDirs ( "data","parley/plugins" );
00241             }
00242 
00244             QVariantList selectedEntries();
00245 
00247             QVariantList selectedTranslations();
00248 
00267             void addTranslation ( QString word,QString fromLanguage,QString toLanguage, QString translation );
00272             QStringList locales();
00273 
00279             QString localeName ( QString locale );
00280 
00282             /*
00283              * Open the Parley Document @p file
00284              * Usage:
00285              * @code
00286              * import Parley
00287              * Parley.open("Vocab/MyVocab.kvtml")
00288              * @endcode
00289              * @param file Parley Document file path (ex. /home/kde-user/MyVocab.kvtml)
00290              */
00291             void open ( QString filename );
00292 
00340             QObject * newDocument() { return new Document(); }
00341 
00369             QObject * newAction ( const QString & name, const QString & text = QString() );
00370 
00371         Q_SIGNALS:
00389             void translateWord ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
00390             /* Emits when the translation of a word is finished (from all the scripts) [not to be used by scripts] */
00391             void translationFinished ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
00392             /* Emits when the translation of a word starts [not to be used by scripts] */
00393             void translationStarted ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
00394 
00395         private:
00396             Translator* m_translator;
00397             Document* m_doc;
00398             Editor * m_editor;
00399     };
00400 
00401 }
00402 #endif

parley

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

kdeedu

Skip menu "kdeedu"
  •     lib
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal