parley
translation.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SCRIPTINGSCRIPTOBJECTTRANSLATION_H
00016 #define SCRIPTINGSCRIPTOBJECTTRANSLATION_H
00017
00018 #include <keduvocdeclension.h>
00019 #include <keduvocconjugation.h>
00020
00021 #include "keduvoctranslation.h"
00022 #include "keduvocwordtype.h"
00023 #include "expression.h"
00024 #include "text.h"
00025
00026 #include <QObject>
00027
00028 namespace Scripting
00029 {
00030
00036 class Translation : public Text
00037 {
00038 Q_OBJECT
00040 Q_PROPERTY ( QString pronunciation READ pronunciation WRITE setPronunciation )
00042 Q_PROPERTY ( QString comment READ comment WRITE setComment )
00044 Q_PROPERTY ( QString example READ example WRITE setExample )
00046 Q_PROPERTY ( QString paraphrase READ paraphrase WRITE setParaphrase )
00047
00048
00050 Q_PROPERTY ( QString comparative READ comparative WRITE setComparative )
00052 Q_PROPERTY ( QString superlative READ superlative WRITE setSuperlative )
00054 Q_PROPERTY ( QString soundUrl READ soundUrl WRITE setSoundUrl )
00056 Q_PROPERTY ( QString imageUrl READ soundUrl WRITE setImageUrl )
00057 public:
00058
00059
00060
00061 Translation ( Expression * entry );
00062
00063
00064
00065
00066
00067 Translation ( Expression * entry, const QString & translation );
00068
00069
00070
00071
00072
00073 Translation ( KEduVocTranslation * translation );
00074
00075 ~Translation();
00076
00077 KEduVocTranslation* kEduVocTranslation() { return m_translation; }
00078
00079 template <class T, class S>
00080 QVariantList toVariantList ( QList<T*> objList ) const;
00081
00082
00083
00084
00085
00086
00087 QString pronunciation() const { return m_translation->pronunciation(); }
00088
00089 void setPronunciation ( const QString & expression ) { m_translation->setPronunciation ( expression ); }
00090
00091
00092 QString comment() const { return m_translation->comment(); }
00093
00094 void setComment ( const QString & expr ) { m_translation->setComment ( expr ); }
00095
00096
00097
00098
00099 QString example() const { return m_translation->example(); }
00100
00101
00102 void setExample ( const QString & expression ) { m_translation->setExample ( expression ); }
00103
00104
00105
00106
00107 void setParaphrase ( const QString & expression ) { m_translation->setParaphrase ( expression ); }
00108
00109
00110
00111
00112 QString paraphrase() const { return m_translation->paraphrase(); }
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 void setWordType ( KEduVocWordType* wordType ) { m_translation->setWordType ( wordType ); }
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 QString comparative() const { return m_translation->comparative(); }
00169 void setComparative ( const QString& comparative ) { m_translation->setComparative ( comparative ); }
00170 QString superlative() const { return m_translation->superlative(); }
00171 void setSuperlative ( const QString& superlative ) { m_translation->setSuperlative ( superlative ); }
00172
00173
00174
00175
00176
00177
00178
00179
00180 QString soundUrl() { return m_translation->soundUrl().path(); }
00181
00182
00183
00184 void setSoundUrl ( const QString &url ) { m_translation->setSoundUrl ( url ); }
00185
00186
00187 QString imageUrl() { return m_translation->soundUrl().path(); }
00188
00189
00190
00191
00192 void setImageUrl ( const QString &url ) { m_translation->setImageUrl ( url ); }
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 public slots:
00215 void addFalseFriend ( Translation* falseFriend ) { m_translation->addFalseFriend ( falseFriend->kEduVocTranslation() ); }
00216
00221 void removeFalseFriend ( Translation* falseFriend ) { m_translation->removeFalseFriend ( falseFriend->kEduVocTranslation() ); }
00222
00227 void addSynonym ( Translation* synonym ) { m_translation->addSynonym ( synonym->kEduVocTranslation() ); }
00228
00233 void removeSynonym ( Translation* synonym ) { m_translation->removeSynonym ( synonym->kEduVocTranslation() ); }
00234
00239 void addAntonym ( Translation* antonym ) { m_translation->addAntonym ( antonym->kEduVocTranslation() ); }
00240
00245 void removeAntonym ( Translation* antonym ) { m_translation->removeAntonym ( antonym->kEduVocTranslation() ); }
00246
00251 QVariantList falseFriends() const { return toVariantList<KEduVocTranslation,Translation> ( m_translation->falseFriends() ); }
00252
00257 QVariantList synonyms() const { return toVariantList<KEduVocTranslation,Translation> ( m_translation->synonyms() ); }
00258
00263 QVariantList antonyms() const { return toVariantList<KEduVocTranslation,Translation> ( m_translation->antonyms() ); }
00264
00266 QString wordType() const;
00267
00269 QStringList multipleChoice() { return m_translation->multipleChoice(); }
00270
00272 QStringList conjugationTenses() const { return m_translation->conjugationTenses(); }
00273
00297 void setConjugationText ( const QString& conjugation, const QString& tense, const KEduVocWordFlags& flags );
00298
00306 void setConjugation ( QObject * conjugation, const QString& tense, const KEduVocWordFlags& flags );
00307
00308
00316 QObject * conjugation ( const QString & tense, const KEduVocWordFlags& flags );
00317
00323 QStringList conjugationTexts ( const QString& tense );
00324
00331 QStringList conjugationTexts ( const QString& tense, const KEduVocWordFlags& flags );
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352 private:
00353 KEduVocTranslation * m_translation;
00354
00355 };
00356
00357
00358 template <class T, class S>
00359 QVariantList Translation::toVariantList ( QList<T*> objList ) const
00360 {
00361 QVariantList list;
00362 foreach ( T * t, objList )
00363 {
00364 QObject * obj = new S ( t );
00365 list.push_back ( qVariantFromValue ( obj ) );
00366 }
00367 return list;
00368 }
00369
00370
00371 }
00372
00373 #endif