Set number of thred to idealCount+1=cores number+1
[mdictionary] / trunk / src / base / backbone / backbone.cpp
index 97b8857..d297fbc 100644 (file)
@@ -39,7 +39,12 @@ class TranslationPtr {
     Translation* _tr;
 public:
     TranslationPtr(Translation* tr) :_tr(tr) {}
-    QString toHtml() const {return _tr->toHtml();}
+    QString toHtml() const {
+        QString trans;
+        trans = _tr->toHtml();
+        return trans;
+
+    }
 };
 
 void Backbone::init() {
@@ -69,6 +74,9 @@ void Backbone::init() {
    connect(&_timerHtmlSearch, SIGNAL(timeout()), this,
            SLOT(htmlTranslationReady()));
 
+   QThreadPool::globalInstance()->setMaxThreadCount(
+           QThreadPool::globalInstance()->maxThreadCount()+1);
+
    _history = new History(5, this);
 }
 
@@ -228,9 +236,6 @@ void Backbone::addDictionary(CommonDictInterface *dict, bool active) {
 
 
 
-int Backbone::activeSearches() const {
-    return -1; //TODO
-}
 
 
 
@@ -238,6 +243,7 @@ void Backbone::translationReady() {
     if(!_innerResult.isFinished())
         return;
     QFutureIterator<QList<Translation*> > it(_innerResult);
+    _timerSearch.stop();
 
     while(it.hasNext()) {
         QList<Translation* > list = it.next();
@@ -245,7 +251,6 @@ void Backbone::translationReady() {
             _result.insert(trans->key().toLower(), trans);
     }
 
-    _timerSearch.stop();
     Q_EMIT ready();
 }