//! returns dictionary type (xdxf, google translate, etc)
virtual QString type() const = 0;
- //! returns information about dictionary in html (name, authors, etc)
+ //! returns information about dictionary (name, authors, etc)
virtual QString infoNote() const = 0;
/*! returns DictDialog object that creates dialogs
return this->key()==translation->key();
}
- //! \return parsed raw format into html
- virtual QString toHtml() const = 0;
+ //! \return parsed raw format into xml
+ virtual QString toXml() const = 0;
//! \return whether given translation is taken from bookmarks
virtual bool isBookmark() const {
return _key;
}
- //! \return parsed raw format into html
- QString toHtml() const {
+ //! \return parsed raw format into xml
+ QString toXml() const {
if(!_key.size() || !_bookmarks)
return "";
cur.prepare("insert into bookmarks values (?,?,?)");
cur.addBindValue(translation->key());
cur.addBindValue(removeAccents(translation->key()));
- cur.addBindValue(translation->toHtml());
+ cur.addBindValue(translation->toXml());
cur.exec();
db.close();
}
QList<Translation*> searchWordList(QString word);
/*! Searches for final translation of a given word
- \return word translation list in text format xml or html to be formatted
+ \return word translation list in text format xml to be formatted
and displayed
\param word word to search for
*/
/*! \return translation text for corresponding Translation object */
QString toHtml() const {
QString trans;
- trans = _tr->toHtml();
+ trans = _tr->toXml();
return trans;
}
loadDicts(_configPath);
connect(&_resultWatcher, SIGNAL(finished()), this, SLOT(translationReady()));
- connect(&_htmlResultWatcher, SIGNAL(finished()), this,
- SLOT(htmlTranslationReady()));
+ connect(&_xmlResultWatcher, SIGNAL(finished()), this,
+ SLOT(xmlTranslationReady()));
connect(&_bookmarkWatcher, SIGNAL(finished()), this,
SLOT(bookmarksListReady()));
connect(&_bookmarkSearchWatcher, SIGNAL(finished()), this,
foreach(CommonDictInterface* dict, _dicts.keys())
dict->stop();
stopped = true;
- _innerHtmlResult.cancel();
+ _innerXmlResult.cancel();
_innerResult.cancel();
Q_EMIT searchCanceled();
}
-QStringList Backbone::htmls() {
- return _htmlResult;
+QStringList Backbone::xmls() {
+ return _xmlResult;
}
-void Backbone::searchHtml(QList<Translation *> translations) {
- _htmlResult.clear();
+void Backbone::searchXml(QList<Translation *> translations) {
+ _xmlResult.clear();
QList<TranslationPtr> dummy;
stopped = false;
}
}
- _innerHtmlResult = QtConcurrent::mapped(dummy,
+ _innerXmlResult = QtConcurrent::mapped(dummy,
&TranslationPtr::toHtml);
- _htmlResultWatcher.setFuture(_innerHtmlResult);
+ _xmlResultWatcher.setFuture(_innerXmlResult);
}
-void Backbone::htmlTranslationReady() {
+void Backbone::xmlTranslationReady() {
- QFutureIterator<QString> it(_innerHtmlResult);
+ QFutureIterator<QString> it(_innerXmlResult);
QSet<QString> uniqe;
while(it.hasNext())
uniqe.insert(it.next());
- _htmlResult.clear();
- _htmlResult = uniqe.toList();
+ _xmlResult.clear();
+ _xmlResult = uniqe.toList();
if(!stopped)
- Q_EMIT htmlReady();
+ Q_EMIT xmlReady();
}
- GUI calls result()
Final translation:
- - GUI calls searchHtml()
- - Backbone starts toHtml for each translation object in separate threads
- - Backbone sets FutureWatcher to be notified after last toHtml returns
+ - GUI calls searchXml()
+ - Backbone starts toXml for each translation object in separate threads
+ - Backbone sets FutureWatcher to be notified after last toXml returns
- Backbone fetches translation from Future<...> objects and calls
- htmlReady()
- - Gui calls htmlResult()
+ xmlReady()
+ - Gui calls xmlResult()
*/
class Backbone : public QObject
//! \return maximum number of words that plugin could find
int searchLimit() const;
- //! \return final translation (after searching for html)
- QStringList htmls();
+ //! \return final translation (after searching for xml)
+ QStringList xmls();
/*! maximum number of translations that each plugin may return; it must be
public static because of QtConcurent::mapped restrictions about
/*! Fired by FutureWatcher when search result is ready, fetch Future to
final result
*/
- void htmlTranslationReady();
+ void xmlTranslationReady();
/*! Removes given dictionary
\param dict dictionary to be deleted
/*! Saves plugins new state/configuration after each change */
void dictUpdated();
- /*! Performs search for final translation (html/xml) form
+ /*! Performs search for final translation (xml) form
\param list of Translation* to be searched for
*/
- void searchHtml(QList<Translation*>);
+ void searchXml(QList<Translation*>);
/*! adds bookmarks to given translations (translation object is fetched and
//! emitted when there are search results ready to fetch
void ready();
- //! emitted when html result is ready to fetch
- void htmlReady();
+ //! emitted when xml result is ready to fetch
+ void xmlReady();
//! thrown when searches are stopped
void searchCanceled();
QFuture<QList<Translation*> > _innerResult; //Res of concurrent word search
- QFuture<QString> _innerHtmlResult; // Result of html search
+ QFuture<QString> _innerXmlResult; // Result of xml search
QFuture<QList<Translation*> > _innerBookmarks; //Res of search in bookmarks
QFuture<QList<Translation*> > _innerListBookmarks; //Res of search in bookmarks
- QFuture<QStringList> _innerHtmlBookmarks; //Html result of bookmarks search
+ QFuture<QStringList> _innerXmlBookmarks; //Xml result of bookmarks search
QMultiHash<QString, Translation*> _result; //Final result of word search
- QStringList _htmlResult; // Final result of html search
+ QStringList _xmlResult; // Final result of xml search
QList<Translation*> _bookmarksResult; // Final result of search in bookmarks
QFutureWatcher<QList<Translation*> > _resultWatcher;
QFutureWatcher<QList<Translation*> > _bookmarkWatcher;
QFutureWatcher<QList<Translation*> > _bookmarkSearchWatcher;
- QFutureWatcher<QString> _htmlResultWatcher;
+ QFutureWatcher<QString> _xmlResultWatcher;
QString _pluginPath;
hideWelcomeScreen();
#endif
- Q_EMIT showTranslation(backbone->htmls());
+ Q_EMIT showTranslation(backbone->xmls());
#ifdef Q_WS_MAEMO_5
notifyManager->screenChanged();
#endif
backbone, SLOT(search(QString)));
connect(this, SIGNAL(searchTranslations(QList<Translation*>)),
- backbone, SLOT(searchHtml(QList<Translation*>)));
+ backbone, SLOT(searchXml(QList<Translation*>)));
connect(this, SIGNAL(stopSearching()),
backbone, SLOT(stopSearching()));
connect(backbone, SIGNAL(ready()),
this, SIGNAL(setIdle()));
- connect(backbone, SIGNAL(htmlReady()),
+ connect(backbone, SIGNAL(xmlReady()),
this, SIGNAL(setIdle()));
connect(backbone, SIGNAL(ready()),
this, SLOT(wordListReady()));
- connect(backbone, SIGNAL(htmlReady()),
+ connect(backbone, SIGNAL(xmlReady()),
this, SLOT(translationsReady()));
connect(backbone, SIGNAL(searchCanceled()),
//! Displays translation of word found in dictionaries
/*!
- Displays many translations of word, formatted as html.
+ Displays many translations of word, formatted as xml.
*/
class TranslationWidget : public QScrollArea {
Q_OBJECT
//! returns dictionary type (xdxf, google translate, etc)
QString type() const;
- //! returns information about dictionary in html (name, authors, etc)
+ //! returns information about dictionary (name, authors, etc)
QString infoNote() const;
//! sets the language to which the translation is done
return _key;
}
-QString TranslationGoogle::toHtml() const {
+QString TranslationGoogle::toXml() const {
QString result("");
if(!googlePlugin)
return result;
QList<Translation*> translations=googlePlugin->searchWordList(_key);
qDebug()<<"test: "<<translations.size();
if(translations.size()>0 && translations.at(0))
- return translations.at(0)->toHtml();
+ return translations.at(0)->toXml();
return "";
}
//! \return word to be translated
QString key() const;
- //! \return parsed raw format into html
- QString toHtml() const;
+ //! \return parsed raw format into xml
+ QString toXml() const;
/*! sets the word for which we want to find a translation
\param word for which we want to find a translation */
return _key;
}
-QString TranslationXdxf::toHtml() const {
+QString TranslationXdxf::toXml() const {
QString result("");
if(!xdxfPlugin)
return result;
//! \return word to be translated
QString key() const;
- //! \return parsed raw format into html
- QString toHtml() const;
+ //! \return parsed raw format into xml
+ QString toXml() const;
/*! sets the word for which we want to find a translation
\param word for which we want to find a translation */
//! returns dictionary type (xdxf, google translate, etc)
QString type() const;
- //! returns information about dictionary in html (name, authors, etc)
+ //! returns information about dictionary in xml (name, authors, etc)
QString infoNote() const;
/*! returns DictDialog object that creates dialogs