LibKEduVocDocument

keduvoctranslation.h
1/*
2 * Vocabulary Expression Translation for KDE Edu
3 * SPDX-FileCopyrightText: 2007-2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KEDUVOCTRANSLATION_H
8#define KEDUVOCTRANSLATION_H
9
10#include "keduvocconjugation.h"
11#include "keduvocdocument_export.h"
12#include "keduvoctext.h"
13#include <QMap>
14#include <QString>
15#include <QUrl>
17class KEduVocWordType;
20
21/**
22 @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
23*/
24class KEDUVOCDOCUMENT_EXPORT KEduVocTranslation : public KEduVocText
25{
26public:
27 enum Related {
28 Synonym,
29 Antonym,
30 FalseFriend,
31 };
32
33 /**
34 * Default constructor for an empty translation.
35 */
37
38 /**
39 * Constructor
40 * @param entry
41 * @param translation is used as translation
42 */
43 KEduVocTranslation(KEduVocExpression *entry, const QString &translation);
44
45 /** copy constructor for d-pointer safety */
47
48 /**
49 * Destructor
50 */
52
53 KEduVocExpression *entry();
54
55 /** Sets the pronunciation of this expression
56 * @param expression pronunciation of this index
57 */
58 void setPronunciation(const QString &expression);
59
60 /** Returns the pronunciation of this expression
61 * @return pronunciation or "" if none available
62 */
63 QString pronunciation() const;
64
65 /** Returns comments of this expression
66 * @return comment or "" if no comment available
67 */
68 QString comment() const;
69
70 /** Sets comment of this expression
71 * @param expr comment of this index
72 */
73 void setComment(const QString &expr);
74
75 /** Sets example this expression
76 * @param expression example of this index
77 */
78 void setExample(const QString &expression);
79
80 /** Returns example of this expression
81 * @return example or "" if no string available
82 */
83 QString example() const;
84
85 /** Sets paraphrase of this expression
86 * @param expression paraphrase of this index
87 */
88 void setParaphrase(const QString &expression);
89
90 /** Returns paraphrase of this expression
91 * @return paraphrase or "" if no string available
92 */
93 QString paraphrase() const;
94
95 /** Returns antonym of this expression
96 * @return antonym or "" if no string available
97 */
99
100 /** Returns the word type of this expression, you will get a 0 pointer
101 * if wordtype is not set for the translation
102 *
103 * @return type or "" if no type available
104 */
105 KEduVocWordType *wordType() const;
106
107 /** Sets the word type of this expression
108 * @param wordType type of this expression ("" = none)
109 */
110 void setWordType(KEduVocWordType *wordType);
111
112 /** Returns the leitner box of this translation
113 * @return the box
114 */
115 KEduVocLeitnerBox *leitnerBox() const;
116
117 /** Sets the leitner box of this translation
118 * @param leitnerBox the box
119 */
120 void setLeitnerBox(KEduVocLeitnerBox *leitnerBox);
121
122 /**
123 * This method is deprecated, please use @see getConjugation() @see setConjugation()
124 * Returns a conjugation if available
125 * @param tense tense of the requested conjugation
126 * @return the conjugation
127 */
128 KEDUVOCDOCUMENT_DEPRECATED KEduVocConjugation &conjugation(const QString &tense);
129
130 /**
131 * Returns a conjugation if available
132 * @param tense tense of the requested conjugation
133 * @return the conjugation
134 */
135 KEduVocConjugation getConjugation(const QString &tense) const;
136
137 /** adds conjugations or replaces them, if they exist.
138 * @param tense tense
139 * @param conjugation conjugation
140 */
141 void setConjugation(const QString &tense, const KEduVocConjugation &conjugation);
142
143 /**
144 * Returns a pointer to the declension object of this translation.
145 * Returns 0 if no declension object exists!
146 * @return the declension
147 */
148 KEduVocDeclension *declension();
149
150 /**
151 * Set a new declension for a translation
152 * @param declension
153 */
154 void setDeclension(KEduVocDeclension *declension);
155
156 /**
157 * Bad, only used for tense entry page, will be deleted later. Deprecated.
158 * @param conjugations
159 */
160 void setConjugations(const QMap<QString, KEduVocConjugation> &conjugations);
161
162 QStringList conjugationTenses() const;
163
164 /**
165 * Bad, only compatibility. Deprecated.
166 * @return
167 */
168 KEDUVOCDOCUMENT_DEPRECATED QMap<QString, KEduVocConjugation> conjugations() const;
169
170 /**
171 * Comparison forms of adjectives/adverbs.
172 */
173 KEDUVOCDOCUMENT_DEPRECATED QString comparative() const;
174 KEDUVOCDOCUMENT_DEPRECATED void setComparative(const QString &comparative);
175 // TODO rename to comparative and remove the deprecated function
176 KEduVocText comparativeForm() const;
177 void setComparativeForm(const KEduVocText &comparative);
178
179 KEDUVOCDOCUMENT_DEPRECATED QString superlative() const;
180 KEDUVOCDOCUMENT_DEPRECATED void setSuperlative(const QString &superlative);
181 KEduVocText superlativeForm() const;
182 void setSuperlativeForm(const KEduVocText &superlative);
183
184 KEduVocText article() const;
185 void setArticle(const KEduVocText &article);
186
187 /**
188 * This method is deprecated, please use @see getMultipleChoice() @see setMultipleChoice()
189 * Returns multiple choice if available
190 */
191 KEDUVOCDOCUMENT_DEPRECATED QStringList &multipleChoice();
192
193 /**
194 * Returns multiple choice if available
195 * @return list of multiple choice answers
196 */
197 QStringList getMultipleChoice() const;
198
199 /** Sets multiple choice
200 * @param choices multiple choice block
201 */
202 void setMultipleChoice(const QStringList &choices);
203
204 /** Get the sound url for this translation if it exists */
205 QUrl soundUrl();
206
207 /** Set the sound url for this translation
208 * @param url url of the sound file */
209 void setSoundUrl(const QUrl &url);
210
211 /** Get the image url for this translation if it exists */
212 QUrl imageUrl();
213
214 /** Set the image url for this translation
215 * @param url url of the image
216 */
217 void setImageUrl(const QUrl &url);
218
219 /**
220 * Add a false friend
221 * @param falseFriend false friend of this index
222 */
223 void addFalseFriend(KEduVocTranslation *falseFriend);
224
225 /**
226 * Remove a false friend
227 * @param falseFriend false friend of this index
228 */
229 void removeFalseFriend(KEduVocTranslation *falseFriend);
230
231 /**
232 * Returns false friends of this expression
233 * @return list of false friends
234 */
235 QList<KEduVocTranslation *> falseFriends() const;
236
237 /**
238 * Add a synonym
239 * @param synonym
240 */
241 void addSynonym(KEduVocTranslation *synonym);
242
243 /**
244 * Remove a synonym
245 * @param synonym
246 */
247 void removeSynonym(KEduVocTranslation *synonym);
248
249 /**
250 * Returns synonyms of this expression
251 * @return synonyms
252 */
253 QList<KEduVocTranslation *> synonyms() const;
254
255 /**
256 * Add a antonym
257 * @param antonym
258 */
259 void addAntonym(KEduVocTranslation *antonym);
260
261 /**
262 * Remove a antonym
263 * @param antonym
264 */
265 void removeAntonym(KEduVocTranslation *antonym);
266
267 /**
268 * Returns antonyms of this expression
269 * @return antonyms
270 */
271 QList<KEduVocTranslation *> antonyms() const;
272
273 /**
274 * Equal operator to assign a translation to another one.
275 * @param translation translation to be copied
276 * @return reference to the new translation
277 */
279
280 /**
281 * Compare two translations, including word type etc.
282 * @param translation
283 * @return true if equal
284 */
285 bool operator==(const KEduVocTranslation &translation) const;
286
287 void fromKVTML2(QDomElement &parent);
288 void toKVTML2(QDomElement &parent);
289
290private:
291 class KEduVocTranslationPrivate;
292 KEduVocTranslationPrivate *const d;
293
294 // for the copy constructor
295 void setEntry(KEduVocExpression *entry);
296 friend class KEduVocExpression;
297};
298
299#endif
The conjugation of a verb.
A declension contains all forms that a NOUN possibly can have.
This class contains one vocabulary expression as an original with one or more translations.
Leitner Boxes are an alternative grading system.
A text in vocabulary documents.
Definition keduvoctext.h:50
bool operator==(const KEduVocText &other) const
Compare two sets of grades.
KEduVocText & operator=(const KEduVocText &other)
Equal operator to copy grades.
QString antonym() const
Returns antonym of this expression.
class to store translation word types
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 3 2025 11:59:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.