_history = new History(5, this);
}
+
+
Backbone::Backbone(QString pluginPath, QString configPath, bool dry,
QObject *parent)
: QObject(parent)
-
QHash<CommonDictInterface*, bool > Backbone::getDictionaries() {
return _dicts;
}
-
QList<CommonDictInterface* > Backbone::getPlugins() {
return _plugins;
}
-
History* Backbone::history() {
return _history;
}
-
QMultiHash<QString, Translation*> Backbone::result() {
return _result;
}
-
void Backbone::stopSearching() {
foreach(CommonDictInterface* dict, _dicts.keys())
dict->stop();
+ stopped = true;
_innerHtmlResult.cancel();
_innerResult.cancel();
+ Q_EMIT searchCanceled();
}
-
-
-
void Backbone::search(QString word) {
_result.clear();
mappedSearch = word.toLower();
//_time.restart();
+ stopped = false;
_innerResult = QtConcurrent::mapped(activeDicts(), mapSearch);
_resultWatcher.setFuture(_innerResult);
-
void Backbone::selectedDictionaries(QList<CommonDictInterface* > activeDicts) {
foreach(CommonDictInterface* dict, _dicts.keys())
if(activeDicts.contains(dict))
-
-
-
void Backbone::translationReady() {
//if(!_innerResult.isFinished())
// return;
}
//qDebug () << "time " << _time.elapsed();
- Q_EMIT ready();
+ if(!stopped)
+ Q_EMIT ready();
}
QStringList Backbone::getFilesFromDir(QString dir, QStringList nameFilter) {
void Backbone::searchHtml(QList<Translation *> translations) {
_htmlResult.clear();
QList<TranslationPtr> dummy;
+ stopped = false;
//_time.restart();
foreach(Translation* tr, translations)
dummy.append(TranslationPtr(tr));
_htmlResult.append(it.next());
//qDebug() << "time " << _time.elapsed();
- if(_htmlResult.size())
+ if(!stopped)
Q_EMIT htmlReady();
}