QString m_hint;
/// Paraphrase
QString m_paraphrase;
- /// A synonyme for a word: sick and ill, student and pupil
- QString m_synonym;
/// An example
QString m_example;
- /// An antonym - the opposite: hot - cold
- QString m_antonym;
/// Pronunciation
QString m_pronunciation;
/// Image url
KEduVocDeclension* m_declension;
- /// One false friend string per other language
- QMap<int, QString> m_falseFriends;
+ // connections to other translations
+ /// Synonyms for a word: sick and ill, student and pupil
+ QList< KEduVocTranslation* > m_synonyms;
+ /// An antonym - the opposite: hot - cold
+ QList< KEduVocTranslation* > m_antonyms;
+ /// List of false friends
+ QList< KEduVocTranslation* > m_falseFriends;
};
d->m_wordType = other.d->m_wordType;
d->m_comment = other.d->m_comment;
d->m_paraphrase = other.d->m_paraphrase;
- d->m_synonym = other.d->m_synonym;
d->m_example = other.d->m_example;
- d->m_antonym = other.d->m_antonym;
d->m_pronunciation = other.d->m_pronunciation;
d->m_conjugations = other.d->m_conjugations;
d->m_comparative = other.d->m_comparative;
d->m_superlative = other.d->m_superlative;
d->m_multipleChoice = other.d->m_multipleChoice;
- d->m_falseFriends = other.d->m_falseFriends;
d->m_imageUrl = other.d->m_imageUrl;
d->m_soundUrl = other.d->m_soundUrl;
- /// @todo add declensions
+ d->m_synonyms = other.d->m_synonyms;
+ d->m_antonyms = other.d->m_antonyms;
+ d->m_falseFriends = other.d->m_falseFriends;
+ if (other.d->m_declension) {
+ d->m_declension = new KEduVocDeclension(*other.d->m_declension);
+ }
}
KEduVocTranslation::~KEduVocTranslation()
bool KEduVocTranslation::operator == ( const KEduVocTranslation & translation ) const
{
return KEduVocText::operator==(translation) &&
- d->m_wordType == translation.d->m_wordType &&
- d->m_comment == translation.d->m_comment &&
- d->m_paraphrase == translation.d->m_paraphrase &&
- d->m_synonym == translation.d->m_synonym &&
- d->m_example == translation.d->m_example &&
- d->m_antonym == translation.d->m_antonym &&
- d->m_pronunciation == translation.d->m_pronunciation &&
- d->m_imageUrl == translation.d->m_imageUrl &&
- d->m_soundUrl == translation.d->m_soundUrl &&
- d->m_comparative == translation.d->m_comparative &&
- d->m_superlative == translation.d->m_superlative &&
- d->m_multipleChoice == translation.d->m_multipleChoice &&
- d->m_falseFriends == translation.d->m_falseFriends &&
- d->m_conjugations == translation.d->m_conjugations;
+ d->m_wordType == translation.d->m_wordType &&
+ d->m_comment == translation.d->m_comment &&
+ d->m_paraphrase == translation.d->m_paraphrase &&
+ d->m_example == translation.d->m_example &&
+ d->m_pronunciation == translation.d->m_pronunciation &&
+ d->m_imageUrl == translation.d->m_imageUrl &&
+ d->m_soundUrl == translation.d->m_soundUrl &&
+ d->m_comparative == translation.d->m_comparative &&
+ d->m_superlative == translation.d->m_superlative &&
+ d->m_multipleChoice == translation.d->m_multipleChoice &&
+ d->m_synonyms == translation.d->m_synonyms &&
+ d->m_antonyms == translation.d->m_antonyms &&
+ d->m_falseFriends == translation.d->m_falseFriends &&
+ d->m_conjugations == translation.d->m_conjugations;
+ /// @todo check and include declensions d->m_declension == translation.d->m_declension;
}
KEduVocTranslation & KEduVocTranslation::operator = ( const KEduVocTranslation & translation )
d->m_wordType = translation.d->m_wordType;
d->m_comment = translation.d->m_comment;
d->m_paraphrase = translation.d->m_paraphrase;
- d->m_synonym = translation.d->m_synonym;
d->m_example = translation.d->m_example;
- d->m_antonym = translation.d->m_antonym;
d->m_pronunciation = translation.d->m_pronunciation;
d->m_imageUrl = translation.d->m_imageUrl;
d->m_soundUrl = translation.d->m_soundUrl;
d->m_superlative = translation.d->m_superlative;
d->m_multipleChoice = translation.d->m_multipleChoice;
d->m_falseFriends = translation.d->m_falseFriends;
+ d->m_synonyms = translation.d->m_synonyms;
+ d->m_antonyms = translation.d->m_antonyms;
d->m_conjugations = translation.d->m_conjugations;
+ if (translation.d->m_declension) {
+ d->m_declension = new KEduVocDeclension(*translation.d->m_declension);
+ }
return *this;
}
}
-void KEduVocTranslation::setFalseFriend( int indexFrom, const QString & expr )
+void KEduVocTranslation::addFalseFriend( KEduVocTranslation* falseFriend )
{
- d->m_falseFriends[indexFrom] = expr.simplified();
+ d->m_falseFriends.append(falseFriend);
}
-QString KEduVocTranslation::falseFriend( int indexFrom ) const
+QList< KEduVocTranslation* > KEduVocTranslation::falseFriends() const
{
- return d->m_falseFriends.value( indexFrom );
+ return d->m_falseFriends;
}
-void KEduVocTranslation::setSynonym( const QString & expr )
+void KEduVocTranslation::addSynonym( KEduVocTranslation* synonym )
{
- d->m_synonym = expr.simplified();
+ d->m_synonyms.append(synonym);
}
-QString KEduVocTranslation::synonym() const
+QList<KEduVocTranslation*> KEduVocTranslation::synonyms() const
{
- return d->m_synonym;
+ return d->m_synonyms;
}
-void KEduVocTranslation::setExample( const QString & expr )
+void KEduVocTranslation::addAntonym( KEduVocTranslation* antonym )
{
- d->m_example = expr.simplified();
+ d->m_antonyms.append(antonym);
}
-QString KEduVocTranslation::example() const
+QList<KEduVocTranslation*> KEduVocTranslation::antonyms() const
{
- return d->m_example;
+ return d->m_antonyms;
}
-void KEduVocTranslation::setParaphrase( const QString & expr )
+void KEduVocTranslation::setExample( const QString & expr )
{
- d->m_paraphrase = expr.simplified();
+ d->m_example = expr.simplified();
}
-QString KEduVocTranslation::paraphrase() const
+QString KEduVocTranslation::example() const
{
- return d->m_paraphrase;
+ return d->m_example;
}
-void KEduVocTranslation::setAntonym( const QString & expr )
+void KEduVocTranslation::setParaphrase( const QString & expr )
{
- d->m_antonym = expr.simplified();
+ d->m_paraphrase = expr.simplified();
}
-QString KEduVocTranslation::antonym() const
+QString KEduVocTranslation::paraphrase() const
{
- return d->m_antonym;
+ return d->m_paraphrase;
}
// <pronunciation>
KEduVocKvtml2Writer::appendTextElement( parent, KVTML_PRONUNCIATION, pronunciation() );
- // <antonym>
- KEduVocKvtml2Writer::appendTextElement( parent, KVTML_ANTONYM, antonym() );
-
- // <synonym>
- KEduVocKvtml2Writer::appendTextElement( parent, KVTML_SYNONYM, synonym() );
-
// <example>
KEduVocKvtml2Writer::appendTextElement( parent, KVTML_EXAMPLE, example() );
// <paraphrase>
KEduVocKvtml2Writer::appendTextElement( parent, KVTML_PARAPHRASE, paraphrase() );
+
+ ///@todo synonyms, antonyms
+ ///@todo false friends
}
void KEduVocTranslation::fromKVTML2(QDomElement & parent)
setPronunciation( parent.firstChildElement( KVTML_PRONUNCIATION ).text() );
- //<antonym></antonym>
- setAntonym( parent.firstChildElement( KVTML_ANTONYM ).text() );
-
- //<synonym></synonym>
- setSynonym( parent.firstChildElement( KVTML_SYNONYM ).text() );
-
//<example></example>
setExample( parent.firstChildElement( KVTML_EXAMPLE ).text() );
//<paraphrase></paraphrase>
setParaphrase( parent.firstChildElement( KVTML_PARAPHRASE ).text() );
-
// conjugations
QDomElement conjugationElement = parent.firstChildElement( KVTML_CONJUGATION );
while ( !conjugationElement.isNull() ) {
conjugationElement = conjugationElement.nextSiblingElement( KVTML_CONJUGATION );
}
+ ///@todo synonyms, antonym
+ ///@todo false friends
}
*/
void setComment( const QString & expr );
- /** sets false friend of this expression
- * @param indexFrom index of original translation
- * @param expression false friend of this index
- */
- void setFalseFriend( int indexFrom, const QString & expression );
-
- /**
- * returns false friend of this expression
- * @param indexFrom index of original translation
- * @return false friend or "" if no string available
- */
- QString falseFriend( int indexFrom ) const;
-
- /** sets synonym this expression
- * @param expression synonym of this index
- */
- void setSynonym( const QString & expression );
-
- /** returns synonym of this expression
- * @return synonym or "" if no string available
- */
- QString synonym() const;
-
/** sets example this expression
* @param expression example of this index
*/
*/
void setImageUrl(const KUrl &url);
+ /**
+ * add a false friend
+ * @param falseFriend false friend of this index
+ */
+ void addFalseFriend( KEduVocTranslation* falseFriend );
+
+ /**
+ * returns false friends of this expression
+ * @return list of false friends
+ */
+ QList<KEduVocTranslation*> falseFriends() const;
+
+ /**
+ * add a synonym
+ * @param synonym
+ */
+ void addSynonym( KEduVocTranslation* synonym );
+
+ /**
+ * returns synonyms of this expression
+ * @return synonyms
+ */
+ QList<KEduVocTranslation*> synonyms() const;
+
+ /**
+ * add a antonym
+ * @param antonym
+ */
+ void addAntonym( KEduVocTranslation* antonym );
+
+ /**
+ * returns antonyms of this expression
+ * @return antonyms
+ */
+ QList<KEduVocTranslation*> antonyms() const;
+
/**
* Equal operator to assing a translation to another one.
* @param translation translation to be copied