parley
parley.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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
00160 Q_ENUMS ( Flags )
00161
00162 public:
00163
00164 enum Flags
00165 {
00166
00167 NoInformation = 0x0,
00168
00169
00170 Masculine = 0x1,
00171 Feminine = 0x2,
00172 Neuter = 0x4,
00173
00174
00175 Singular = 0x10,
00176 Dual = 0x20,
00177 Plural = 0x40,
00178
00179
00180 Verb = 0x100,
00181 Noun = 0x200,
00182 Pronoun = 0x400,
00183 Adjective = 0x800,
00184 Adverb = 0x1000,
00185 Article = 0x2000,
00186 Conjunction = 0x4000,
00187
00188
00189 First = 0x10000,
00190 Second = 0x20000,
00191 Third = 0x40000,
00192
00193
00194 Nominative = 0x80000,
00195 Genitive = 0x100000,
00196 Dative = 0x200000,
00197 Accusative = 0x400000,
00198 Ablative = 0x800000,
00199 Locative = 0x1000000,
00200 Vocative = 0x2000000,
00201
00202
00203 Definite = 0x4000000,
00204 Indefinite = 0x8000000,
00205 Regular = 0x10000000,
00206 Irregular = 0x20000000
00207 };
00208
00209 Parley ( Editor * editor );
00210
00211 ~Parley();
00212
00213
00214
00215
00216
00217
00218
00219 void callTranslateWord ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
00220
00221
00222
00223 Translator * translator() { return m_translator; }
00224
00225
00226 QObject* getDocument() { return m_doc; }
00227
00228
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
00284
00285
00286
00287
00288
00289
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
00391 void translationFinished ( const QString & word,const QString& fromLanguage,const QString& toLanguage );
00392
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