diff --git a/article_maker.cc b/article_maker.cc index 5df14417..41f97422 100644 --- a/article_maker.cc +++ b/article_maker.cc @@ -465,7 +465,7 @@ void ArticleRequest::altSearchFinished() if ( altSearches.empty() ) { #ifdef QT_DEBUG - qDebug( "alts finished\n" ); + qDebug( "alts finished" ); #endif // They all've finished! Now we can look up bodies @@ -534,7 +534,7 @@ void ArticleRequest::bodyFinished() if ( bodyDone ) return; - GD_DPRINTF( "some body finished\n" ); + GD_DPRINTF( "some body finished" ); bool wasUpdated = false; @@ -546,7 +546,7 @@ void ArticleRequest::bodyFinished() { // Good - GD_DPRINTF( "one finished.\n" ); + GD_DPRINTF( "one finished." ); Dictionary::DataRequest & req = *bodyRequests.front(); @@ -672,13 +672,13 @@ void ArticleRequest::bodyFinished() foundAnyDefinitions = true; } - GD_DPRINTF( "erasing..\n" ); + GD_DPRINTF( "erasing.." ); bodyRequests.pop_front(); - GD_DPRINTF( "erase done..\n" ); + GD_DPRINTF( "erase done.." ); } else { - GD_DPRINTF( "one not finished.\n" ); + GD_DPRINTF( "one not finished." ); break; } } diff --git a/article_netmgr.cc b/article_netmgr.cc index b627adc1..110f9151 100644 --- a/article_netmgr.cc +++ b/article_netmgr.cc @@ -254,9 +254,9 @@ QNetworkReply * ArticleNetworkAccessManager::getArticleReply( QNetworkRequest co sptr< Dictionary::DataRequest > ArticleNetworkAccessManager::getResource( QUrl const & url, QString & contentType ) { - GD_DPRINTF( "getResource: %ls\n", url.toString().toStdWString().c_str() ); - GD_DPRINTF( "scheme: %ls\n", url.scheme().toStdWString().c_str() ); - GD_DPRINTF( "host: %ls\n", url.host().toStdWString().c_str() ); + GD_DPRINTF( "getResource: %ls", url.toString().toStdWString().c_str() ); + GD_DPRINTF( "scheme: %ls", url.scheme().toStdWString().c_str() ); + GD_DPRINTF( "host: %ls", url.host().toStdWString().c_str() ); if ( url.scheme() == "gdlookup" ) { diff --git a/dsl.cc b/dsl.cc index 6302feee..6125342e 100644 --- a/dsl.cc +++ b/dsl.cc @@ -1556,32 +1556,8 @@ void DslDictionary::getArticleText( uint32_t articleAddress, QString & headword, /// DslDictionary::getArticle() -class DslArticleRequest; - -class DslArticleRequestRunnable: public QRunnable -{ - DslArticleRequest & r; - QSemaphore & hasExited; - -public: - - DslArticleRequestRunnable( DslArticleRequest & r_, - QSemaphore & hasExited_ ): r( r_ ), - hasExited( hasExited_ ) - {} - - ~DslArticleRequestRunnable() - { - hasExited.release(); - } - - virtual void run(); -}; - class DslArticleRequest: public Dictionary::DataRequest { - friend class DslArticleRequestRunnable; - wstring word; vector< wstring > alts; DslDictionary & dict; @@ -1597,11 +1573,10 @@ public: DslDictionary & dict_, bool ignoreDiacritics_ ): word( word_ ), alts( alts_ ), dict( dict_ ), ignoreDiacritics( ignoreDiacritics_ ) { - QThreadPool::globalInstance()->start( - new DslArticleRequestRunnable( *this, hasExited ) ); + QThreadPool::globalInstance()->start( [ this ]() { this->run(); } ); } - void run(); // Run from another thread by DslArticleRequestRunnable + void run(); virtual void cancel() { @@ -1611,15 +1586,10 @@ public: ~DslArticleRequest() { isCancelled.ref(); - hasExited.acquire(); + //hasExited.acquire(); } }; -void DslArticleRequestRunnable::run() -{ - r.run(); -} - void DslArticleRequest::run() { if ( Utils::AtomicInt::loadAcquire( isCancelled ) ) @@ -1759,32 +1729,8 @@ sptr< Dictionary::DataRequest > DslDictionary::getArticle( wstring const & word, //// DslDictionary::getResource() -class DslResourceRequest; - -class DslResourceRequestRunnable: public QRunnable -{ - DslResourceRequest & r; - QSemaphore & hasExited; - -public: - - DslResourceRequestRunnable( DslResourceRequest & r_, - QSemaphore & hasExited_ ): r( r_ ), - hasExited( hasExited_ ) - {} - - ~DslResourceRequestRunnable() - { - hasExited.release(); - } - - virtual void run(); -}; - class DslResourceRequest: public Dictionary::DataRequest { - friend class DslResourceRequestRunnable; - DslDictionary & dict; string resourceName; @@ -1799,11 +1745,10 @@ public: dict( dict_ ), resourceName( resourceName_ ) { - QThreadPool::globalInstance()->start( - new DslResourceRequestRunnable( *this, hasExited ) ); + QThreadPool::globalInstance()->start( [ this ]() { this->run(); } ); } - void run(); // Run from another thread by DslResourceRequestRunnable + void run(); virtual void cancel() { @@ -1813,15 +1758,10 @@ public: ~DslResourceRequest() { isCancelled.ref(); - hasExited.acquire(); + //hasExited.acquire(); } }; -void DslResourceRequestRunnable::run() -{ - r.run(); -} - void DslResourceRequest::run() { // Some runnables linger enough that they are cancelled before they start diff --git a/goldendict.pro b/goldendict.pro index c854d055..f540a509 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -124,7 +124,6 @@ unix:!mac { DEFINES += HAVE_X11 lessThan(QT_MAJOR_VERSION, 6): QT += x11extras -# greaterThan(QT_MAJOR_VERSION, 5): QT += gui-private CONFIG += link_pkgconfig @@ -139,9 +138,7 @@ unix:!mac { libavcodec \ libswresample \ } - arm { - #LIBS += -liconv - } else { + !arm { LIBS += -lX11 -lXtst }