From c6f895c15c7f879124558c2f97b7a158a4ac27a3 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Wed, 28 Dec 2022 06:13:36 -0500 Subject: [PATCH 01/14] fix: when darkreader mode changes in perferences, reload all pages --- mainwindow.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mainwindow.cc b/mainwindow.cc index 6ec9981d..e7f7ce1b 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -2213,6 +2213,10 @@ void MainWindow::editPreferences() needReload = true; } + if (cfg.preferences.darkReaderMode != p.darkReaderMode) { + needReload = true; + } + if( cfg.preferences.collapseBigArticles != p.collapseBigArticles || cfg.preferences.articleSizeLimit != p.articleSizeLimit ) { From a28aec3c9fb71a982a2400d8cf4f3fdc645dbe34 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Wed, 28 Dec 2022 21:19:58 -0500 Subject: [PATCH 02/14] fix: clipboard changes isn't ignored --- mainwindow.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index e7f7ce1b..3968c2d1 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -890,11 +890,18 @@ void MainWindow::clipboardChange( QClipboard::Mode m) if(m == QClipboard::Selection){ - // Multiple ways to stoping a word from showing up when selecting + // Multiple ways to stopping a word from showing up when selecting - // Explictly disabled on preferences + // Explicitly disabled on preferences if(!cfg.preferences.trackSelectionScan) return; + // Explicitly disabled on preferences to ignore gd's own selection + + if( cfg.preferences.ignoreOwnClipboardChanges + && QApplication::clipboard()->ownsSelection() ){ + return ; + } + // Keyboard Modifier if(cfg.preferences.enableScanPopupModifiers && !KeyboardState::checkModifiersPressed(cfg.preferences.scanPopupModifiers)){ From bdc43650bbfab6c802c357d986d29558dd6fda2a Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Wed, 28 Dec 2022 21:36:02 -0500 Subject: [PATCH 03/14] fix: add a mini delay for selection clipboard --- mainwindow.cc | 3 ++- scanpopup.cc | 17 +++++------------ scanpopup.hh | 6 ++---- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 3968c2d1..8a2973b3 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -915,7 +915,8 @@ void MainWindow::clipboardChange( QClipboard::Mode m) return; } - scanPopup->translateWordFromSelection(); + // Use delay show to prevent multiple popups while selection in progress + scanPopup->selectionDelayTimer.start(); } #else scanPopup ->translateWordFromClipboard(); diff --git a/scanpopup.cc b/scanpopup.cc index 12805fa3..59c7ac1e 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -288,10 +288,11 @@ ScanPopup::ScanPopup( QWidget * parent, translateWordFromSelection(); }); - delayTimer.setSingleShot( true ); - delayTimer.setInterval( 200 ); + // Use delay show to prevent multiple popups while selection in progress + selectionDelayTimer.setSingleShot( true ); + selectionDelayTimer.setInterval( 200 ); - connect( &delayTimer, &QTimer::timeout, this, &ScanPopup::delayShow ); + connect( &selectionDelayTimer, &QTimer::timeout, this, &ScanPopup::translateWordFromSelection ); #endif applyZoomFactor(); @@ -457,14 +458,6 @@ void ScanPopup::translateWord( QString const & word ) ); } -#ifdef HAVE_X11 -void ScanPopup::delayShow() -{ - QString subtype = "plain"; - handleInputWord( QApplication::clipboard()->text( subtype, QClipboard::Selection ) ); -} -#endif - [[deprecated("Favor the mainWindow's clipboardChanged ones")]] void ScanPopup::clipboardChanged( QClipboard::Mode m ) { @@ -487,7 +480,7 @@ void ScanPopup::clipboardChanged( QClipboard::Mode m ) if( m == QClipboard::Selection ) { // Use delay show to prevent multiple popups while selection in progress - delayTimer.start(); + selectionDelayTimer.start(); return; } #endif diff --git a/scanpopup.hh b/scanpopup.hh index 12f1b6fa..23ba454a 100644 --- a/scanpopup.hh +++ b/scanpopup.hh @@ -58,6 +58,8 @@ public: /// Interaction with scan flag window void showScanFlag(); void hideScanFlag(); + + QTimer selectionDelayTimer; #endif signals: @@ -146,7 +148,6 @@ private: #ifdef HAVE_X11 ScanFlag * scanFlag; - QTimer delayTimer; #endif bool mouseEnteredOnce; @@ -235,9 +236,6 @@ private slots: void titleChanged( ArticleView *, QString const & title ); -#ifdef HAVE_X11 - void delayShow(); -#endif }; #endif From b933d522459b562aaaf114686ac022ba89f01289 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Wed, 28 Dec 2022 21:37:09 -0500 Subject: [PATCH 04/14] fix: remove unused clipboard change method in scanpopup --- scanpopup.cc | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/scanpopup.cc b/scanpopup.cc index 59c7ac1e..fa5b5873 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -458,38 +458,6 @@ void ScanPopup::translateWord( QString const & word ) ); } -[[deprecated("Favor the mainWindow's clipboardChanged ones")]] -void ScanPopup::clipboardChanged( QClipboard::Mode m ) -{ - - if( !isScanningEnabled ) - return; - -#ifdef HAVE_X11 - if( cfg.preferences.ignoreOwnClipboardChanges && ownsClipboardMode( m ) ) - return; - - if(m == QClipboard::Clipboard && !cfg.preferences.trackClipboardScan){ - return; - } - - if(m == QClipboard::Selection && !cfg.preferences.trackSelectionScan){ - return; - } - - if( m == QClipboard::Selection ) - { - // Use delay show to prevent multiple popups while selection in progress - selectionDelayTimer.start(); - return; - } -#endif - - QString subtype = "plain"; - - handleInputWord( QApplication::clipboard()->text( subtype, m ) ); -} - void ScanPopup::mouseHovered( QString const & str, bool forcePopup ) { handleInputWord( str, forcePopup ); From 7fa87b6b4284cb8647cefb4c55e24d1dda03de08 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Wed, 28 Dec 2022 21:58:27 -0500 Subject: [PATCH 05/14] fix: remove unused isScanningEnabled, the logic is handled in mainwindow::clipboardChanged() --- mainwindow.cc | 5 ----- scanpopup.cc | 19 ------------------- scanpopup.hh | 8 -------- 3 files changed, 32 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 8a2973b3..961e3e05 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -1529,9 +1529,6 @@ void MainWindow::makeScanPopup() scanPopup->setStyleSheet( styleSheet() ); - if ( enableScanningAction->isChecked() ) - scanPopup->enableScanning(); - connect( scanPopup.get(), SIGNAL(editGroupRequested( unsigned ) ), this, SLOT(editDictionaries( unsigned )), Qt::QueuedConnection ); @@ -3176,7 +3173,6 @@ void MainWindow::scanEnableToggled( bool on ) { if ( on ) { - scanPopup->enableScanning(); #ifdef Q_OS_MAC if( !MacMouseOver::isAXAPIEnabled() ) mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, @@ -3186,7 +3182,6 @@ void MainWindow::scanEnableToggled( bool on ) } else { - scanPopup->disableScanning(); enableScanningAction->setIcon(QIcon(":/icons/wizard.svg")); } } diff --git a/scanpopup.cc b/scanpopup.cc index fa5b5873..eae092c2 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -71,7 +71,6 @@ ScanPopup::ScanPopup( QWidget * parent, History & history_ ): QMainWindow( parent ), cfg( cfg_ ), - isScanningEnabled( false ), allDictionaries( allDictionaries_ ), groups( groups_ ), history( history_ ), @@ -303,8 +302,6 @@ ScanPopup::~ScanPopup() { saveConfigData(); - disableScanning(); - ungrabGesture( Gestures::GDPinchGestureType ); ungrabGesture( Gestures::GDSwipeGestureType ); } @@ -318,22 +315,6 @@ void ScanPopup::saveConfigData() cfg.popupWindowAlwaysOnTop = ui.onTopButton->isChecked(); } -void ScanPopup::enableScanning() -{ - if ( !isScanningEnabled ) - { - isScanningEnabled = true; - } -} - -void ScanPopup::disableScanning() -{ - if ( isScanningEnabled ) - { - isScanningEnabled = false; - } -} - void ScanPopup::inspectElementWhenPinned( QWebEnginePage * page ){ if(cfg.pinPopupWindow) emit inspectSignal(page); diff --git a/scanpopup.hh b/scanpopup.hh index 23ba454a..6e18e048 100644 --- a/scanpopup.hh +++ b/scanpopup.hh @@ -36,12 +36,6 @@ public: History & ); ~ScanPopup(); - - /// Enables scanning. When the object is created, the scanning is disabled - /// initially. - void enableScanning(); - /// Disables scanning. - void disableScanning(); /// Applies current zoom factor to the popup's view. Should be called when /// it's changed. @@ -128,7 +122,6 @@ private: void updateDictionaryBar(); Config::Class & cfg; - bool isScanningEnabled; std::vector< sptr< Dictionary::Class > > const & allDictionaries; std::vector< sptr< Dictionary::Class > > dictionariesUnmuted; Instances::Groups const & groups; @@ -195,7 +188,6 @@ private: void updateSuggestionList(); void updateSuggestionList( QString const & text ); private slots: - void clipboardChanged( QClipboard::Mode ); void mouseHovered( QString const & , bool forcePopup); void currentGroupChanged( int ); void prefixMatchFinished(); From 2aeed5e705a66d6ff53da94110b78e086a121e57 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Thu, 29 Dec 2022 02:07:40 -0500 Subject: [PATCH 06/14] clang-tidy: apply modernize-use-override --- .clang-tidy | 8 +++++-- aard.cc | 34 +++++++++++++++--------------- articleview.cc | 2 +- bgl.cc | 50 +++++++++++++++++++++---------------------- btreeidx.cc | 2 +- chinese.cc | 2 +- dictdfiles.cc | 30 +++++++++++++------------- dictserver.cc | 32 ++++++++++++++-------------- dsl.cc | 44 +++++++++++++++++++------------------- epwing.cc | 50 +++++++++++++++++++++---------------------- forvo.cc | 18 ++++++++-------- gls.cc | 48 +++++++++++++++++++++--------------------- hunspell.cc | 36 +++++++++++++++---------------- lsa.cc | 16 +++++++------- mainwindow.cc | 2 +- mdx.cc | 44 +++++++++++++++++++------------------- mediawiki.cc | 30 +++++++++++++------------- programs.cc | 18 ++++++++-------- sdict.cc | 34 +++++++++++++++--------------- slob.cc | 42 ++++++++++++++++++------------------- sounddir.cc | 16 +++++++------- stardict.cc | 48 +++++++++++++++++++++--------------------- voiceengines.cc | 18 ++++++++-------- website.cc | 28 ++++++++++++------------- xdxf.cc | 56 ++++++++++++++++++++++++------------------------- zim.cc | 40 +++++++++++++++++------------------ zipsounds.cc | 16 +++++++------- 27 files changed, 384 insertions(+), 380 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 89594506..02b85527 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -29,7 +29,11 @@ Checks: > -readability-identifier-length, -readability-function-cognitive-complexity, CheckOptions: - - key: modernize-loop-convert.MinConfidence - value: reasonable + - key: modernize-loop-convert.MinConfidence + value: reasonable + - key: modernize-use-override.IgnoreDestructors + value: 1 + - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors + value: 1 ... diff --git a/aard.cc b/aard.cc index cc2c3563..e5e7807a 100644 --- a/aard.cc +++ b/aard.cc @@ -239,43 +239,43 @@ class AardDictionary: public BtreeIndexing::BtreeDictionary ~AardDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual QString const& getDescription(); + QString const& getDescription() override; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "AARD", Qt::CaseInsensitive ) @@ -284,7 +284,7 @@ class AardDictionary: public BtreeIndexing::BtreeDictionary protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -666,7 +666,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class AardArticleRequest: public Dictionary::DataRequest @@ -694,7 +694,7 @@ public: void run(); // Run from another thread by DslArticleRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/articleview.cc b/articleview.cc index 5fa91ece..46af83cc 100644 --- a/articleview.cc +++ b/articleview.cc @@ -127,7 +127,7 @@ public: /// Create text without diacriticss /// and store diacritic marks positions - virtual void setText( QString const & baseString ) + void setText( QString const & baseString ) override { accentMarkPos.clear(); normalizedString.clear(); diff --git a/bgl.cc b/bgl.cc index aba2ae30..2fc4ce40 100644 --- a/bgl.cc +++ b/bgl.cc @@ -198,49 +198,49 @@ namespace BglDictionary( string const & id, string const & indexFile, string const & dictionaryFile ); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & ) + sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & ) override ; - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual QString const& getDescription(); + bool ignoreDiacritics ) override; + QString const& getDescription() override; - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "BGL", Qt::CaseInsensitive ) @@ -249,7 +249,7 @@ namespace protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -509,7 +509,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class BglHeadwordsRequest: public Dictionary::WordSearchRequest @@ -534,7 +534,7 @@ public: void run(); // Run from another thread by BglHeadwordsRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -656,7 +656,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class BglArticleRequest: public Dictionary::DataRequest @@ -684,7 +684,7 @@ public: void run(); // Run from another thread by BglArticleRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -951,7 +951,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class BglResourceRequest: public Dictionary::DataRequest @@ -985,7 +985,7 @@ public: void run(); // Run from another thread by BglResourceRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1126,8 +1126,8 @@ sptr< Dictionary::DataRequest > BglDictionary::getResource( string const & name { return resources; } protected: - virtual void handleBabylonResource( string const & filename, - char const * data, size_t size ); + void handleBabylonResource( string const & filename, + char const * data, size_t size ) override; }; void ResourceHandler::handleBabylonResource( string const & filename, diff --git a/btreeidx.cc b/btreeidx.cc index 4a48bb37..a1f4c58b 100644 --- a/btreeidx.cc +++ b/btreeidx.cc @@ -126,7 +126,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; void BtreeWordSearchRunnable::run() diff --git a/chinese.cc b/chinese.cc index 8f272f7f..b6191d75 100644 --- a/chinese.cc +++ b/chinese.cc @@ -31,7 +31,7 @@ public: ~CharacterConversionDictionary(); std::vector< gd::wstring > getAlternateWritings( gd::wstring const & ) - noexcept; + noexcept override; }; CharacterConversionDictionary::CharacterConversionDictionary( std::string const & id, diff --git a/dictdfiles.cc b/dictdfiles.cc index 4de4d047..7344cbba 100644 --- a/dictdfiles.cc +++ b/dictdfiles.cc @@ -100,45 +100,45 @@ public: ~DictdDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual QString const& getDescription(); + QString const& getDescription() override; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "DICTD", Qt::CaseInsensitive ) diff --git a/dictserver.cc b/dictserver.cc index 4845cc75..0dca7263 100644 --- a/dictserver.cc +++ b/dictserver.cc @@ -209,35 +209,35 @@ public: strategies.append( "prefix" ); } - virtual string getName() noexcept + string getName() noexcept override { return name; } - virtual map< Property, string > getProperties() noexcept + map< Property, string > getProperties() noexcept override { return map< Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return 0; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return 0; } - virtual sptr< WordSearchRequest > prefixMatch( wstring const &, - unsigned long maxResults ) ; + sptr< WordSearchRequest > prefixMatch( wstring const &, + unsigned long maxResults ) override ; - virtual sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, - wstring const &, bool ) + sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, + wstring const &, bool ) override ; - virtual quint32 getLangFrom() const + quint32 getLangFrom() const override { return langId; } - virtual quint32 getLangTo() const + quint32 getLangTo() const override { return langId; } - virtual QString const & getDescription(); + QString const & getDescription() override; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; void getServerDatabases(); @@ -366,7 +366,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class DictServerWordSearchRequest: public Dictionary::WordSearchRequest @@ -397,7 +397,7 @@ public: hasExited.acquire(); } - virtual void cancel(); + void cancel() override; }; @@ -580,7 +580,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class DictServerArticleRequest: public Dictionary::DataRequest @@ -611,7 +611,7 @@ public: hasExited.acquire(); } - virtual void cancel(); + void cancel() override; }; diff --git a/dsl.cc b/dsl.cc index d6354966..ba21f1bf 100644 --- a/dsl.cc +++ b/dsl.cc @@ -181,26 +181,26 @@ public: vector< string > const & dictionaryFiles, int maxPictureWidth_ ); - virtual void deferredInit(); + void deferredInit() override; ~DslDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } inline virtual string getResourceDir1() const @@ -211,30 +211,30 @@ public: - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual QString const& getDescription(); + bool ignoreDiacritics ) override; + QString const& getDescription() override; - virtual QString getMainFilename(); + QString getMainFilename() override; - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { if( ensureInitDone().size() ) return; @@ -244,16 +244,16 @@ public: && ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize ); } - virtual uint32_t getFtsIndexVersion() + uint32_t getFtsIndexVersion() override { return CurrentFtsIndexVersion; } protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; private: - virtual string const & ensureInitDone(); + string const & ensureInitDone() override; void doDeferredInit(); /// Loads the article. Does not process the DSL language. @@ -1588,7 +1588,7 @@ public: void run(); - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1763,7 +1763,7 @@ public: void run(); - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/epwing.cc b/epwing.cc index d01b2205..d426ef09 100644 --- a/epwing.cc +++ b/epwing.cc @@ -97,46 +97,46 @@ public: ~EpwingDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return bookName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual QString const& getDescription(); + QString const& getDescription() override; - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { if( ensureInitDone().size() ) return; @@ -152,19 +152,19 @@ public: static bool isJapanesePunctiation( gd::wchar ch ); - virtual sptr< Dictionary::WordSearchRequest > prefixMatch( wstring const &, - unsigned long ) + sptr< Dictionary::WordSearchRequest > prefixMatch( wstring const &, + unsigned long ) override ; - virtual sptr< Dictionary::WordSearchRequest > stemmedMatch( wstring const &, + sptr< Dictionary::WordSearchRequest > stemmedMatch( wstring const &, unsigned minLength, unsigned maxSuffixVariation, - unsigned long maxResults ) + unsigned long maxResults ) override ; protected: - void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -460,7 +460,7 @@ public: QVector< int > & offsets, multimap< wstring, pair< string, string > > & mainArticles ); - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -677,7 +677,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class EpwingResourceRequest: public Dictionary::DataRequest @@ -704,7 +704,7 @@ public: void run(); // Run from another thread by EpwingResourceRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -860,7 +860,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class EpwingWordSearchRequest: public BtreeIndexing::BtreeWordSearchRequest @@ -884,7 +884,7 @@ public: new EpwingWordSearchRunnable( *this, hasExited ) ); } - virtual void findMatches(); + void findMatches() override; }; void EpwingWordSearchRunnable::run() diff --git a/forvo.cc b/forvo.cc index b33b219a..73168469 100644 --- a/forvo.cc +++ b/forvo.cc @@ -42,20 +42,20 @@ public: { } - virtual string getName() noexcept + string getName() noexcept override { return name; } - virtual map< Property, string > getProperties() noexcept + map< Property, string > getProperties() noexcept override { return map< Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return 0; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return 0; } - virtual sptr< WordSearchRequest > prefixMatch( wstring const & /*word*/, - unsigned long /*maxResults*/ ) + sptr< WordSearchRequest > prefixMatch( wstring const & /*word*/, + unsigned long /*maxResults*/ ) override { sptr< WordSearchRequestInstant > sr = std::make_shared(); @@ -64,13 +64,13 @@ public: return sr; } - virtual sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, - wstring const &, bool ) + sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, + wstring const &, bool ) override ; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; }; diff --git a/gls.cc b/gls.cc index 0a414e9d..81cc6576 100644 --- a/gls.cc +++ b/gls.cc @@ -372,52 +372,52 @@ public: ~GlsDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & ) + sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & ) override ; - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; - virtual QString const& getDescription(); + QString const& getDescription() override; - virtual QString getMainFilename(); + QString getMainFilename() override; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); + bool ignoreDiacritics ) override; - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "GLS", Qt::CaseInsensitive ) @@ -425,7 +425,7 @@ public: } protected: - void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -886,7 +886,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class GlsHeadwordsRequest: public Dictionary::WordSearchRequest @@ -910,7 +910,7 @@ public: void run(); // Run from another thread by StardictHeadwordsRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1005,7 +1005,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class GlsArticleRequest: public Dictionary::DataRequest @@ -1033,7 +1033,7 @@ public: void run(); // Run from another thread by GlsArticleRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1185,7 +1185,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class GlsResourceRequest: public Dictionary::DataRequest @@ -1212,7 +1212,7 @@ public: void run(); // Run from another thread by GlsResourceRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/hunspell.cc b/hunspell.cc index cf90325a..adcc9b33 100644 --- a/hunspell.cc +++ b/hunspell.cc @@ -67,39 +67,39 @@ public: { } - virtual string getName() noexcept + string getName() noexcept override { return name; } - virtual map< Property, string > getProperties() noexcept + map< Property, string > getProperties() noexcept override { return map< Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return 0; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return 0; } - virtual sptr< WordSearchRequest > prefixMatch( wstring const &, - unsigned long maxResults ) + sptr< WordSearchRequest > prefixMatch( wstring const &, + unsigned long maxResults ) override ; - virtual sptr< WordSearchRequest > findHeadwordsForSynonym( wstring const & ) + sptr< WordSearchRequest > findHeadwordsForSynonym( wstring const & ) override ; - virtual sptr< DataRequest > getArticle( wstring const &, + sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ) + bool ) override ; - virtual bool isLocalDictionary() + bool isLocalDictionary() override { return true; } - virtual vector< wstring > getAlternateWritings( const wstring & word ) noexcept; + vector< wstring > getAlternateWritings( const wstring & word ) noexcept override; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -199,7 +199,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class HunspellArticleRequest: public Dictionary::DataRequest @@ -228,7 +228,7 @@ public: void run(); // Run from another thread by HunspellArticleRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -363,7 +363,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class HunspellHeadwordsRequest: public Dictionary::WordSearchRequest @@ -392,7 +392,7 @@ public: void run(); // Run from another thread by HunspellHeadwordsRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -538,7 +538,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class HunspellPrefixMatchRequest: public Dictionary::WordSearchRequest @@ -567,7 +567,7 @@ public: void run(); // Run from another thread by HunspellPrefixMatchRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/lsa.cc b/lsa.cc index 70e2b076..d2ee78d0 100644 --- a/lsa.cc +++ b/lsa.cc @@ -164,29 +164,29 @@ public: LsaDictionary( string const & id, string const & indexFile, vector< string > const & dictionaryFiles ); - virtual string getName() noexcept; + string getName() noexcept override; - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.soundsCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return getArticleCount(); } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; }; string LsaDictionary::getName() noexcept diff --git a/mainwindow.cc b/mainwindow.cc index 961e3e05..9b46c2d2 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -86,7 +86,7 @@ using std::pair; class InitSSLRunnable : public QRunnable { - virtual void run() + void run() override { /// This action force SSL library initialisation which may continue a few seconds QSslConfiguration::setDefaultConfiguration( QSslConfiguration::defaultConfiguration() ); diff --git a/mdx.cc b/mdx.cc index 9e9125cc..6e372e70 100644 --- a/mdx.cc +++ b/mdx.cc @@ -225,56 +225,56 @@ public: ~MdxDictionary(); - virtual void deferredInit(); + void deferredInit() override; - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const & word, + sptr< Dictionary::DataRequest > getArticle( wstring const & word, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) ; - virtual QString const & getDescription(); + bool ignoreDiacritics ) override ; + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; + QString const & getDescription() override; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { if( ensureInitDone().size() ) return; @@ -288,11 +288,11 @@ public: protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; private: - virtual string const & ensureInitDone(); + string const & ensureInitDone() override; void doDeferredInit(); /// Loads an article with the given offset, filling the given strings. @@ -558,7 +558,7 @@ public: void run(); - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -709,7 +709,7 @@ public: void run(); - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1338,7 +1338,7 @@ public: { } - virtual void handleRecord( QString const & headWord, MdictParser::RecordInfo const & recordInfo ) + void handleRecord( QString const & headWord, MdictParser::RecordInfo const & recordInfo ) override { // Save the article's record info uint32_t articleAddress = chunks.startNewBlock(); @@ -1361,7 +1361,7 @@ public: { } - virtual void handleRecord( QString const & fileName, MdictParser::RecordInfo const & recordInfo ) + void handleRecord( QString const & fileName, MdictParser::RecordInfo const & recordInfo ) override { uint32_t resourceInfoAddress = chunks.startNewBlock(); chunks.addToBlock( &recordInfo, sizeof( recordInfo ) ); diff --git a/mediawiki.cc b/mediawiki.cc index 6a4c137e..57b9e96b 100644 --- a/mediawiki.cc +++ b/mediawiki.cc @@ -48,33 +48,33 @@ public: langId = LangCoder::code2toInt( url.mid( n - 2, 2 ).toLatin1().data() ); } - virtual string getName() noexcept + string getName() noexcept override { return name; } - virtual map< Property, string > getProperties() noexcept + map< Property, string > getProperties() noexcept override { return map< Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return 0; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return 0; } - virtual sptr< WordSearchRequest > prefixMatch( wstring const &, - unsigned long maxResults ) ; + sptr< WordSearchRequest > prefixMatch( wstring const &, + unsigned long maxResults ) override ; - virtual sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, - wstring const &, bool ); + sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, + wstring const &, bool ) override; - virtual quint32 getLangFrom() const + quint32 getLangFrom() const override { return langId; } - virtual quint32 getLangTo() const + quint32 getLangTo() const override { return langId; } protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; }; @@ -111,11 +111,11 @@ public: ~MediaWikiWordSearchRequest(); - virtual void cancel(); + void cancel() override; private: - virtual void downloadFinished(); + void downloadFinished() override; }; MediaWikiWordSearchRequest::MediaWikiWordSearchRequest( wstring const & str, @@ -212,13 +212,13 @@ public: QString const & url, QNetworkAccessManager & mgr, Class * dictPtr_ ); - virtual void cancel(); + void cancel() override; private: void addQuery( QNetworkAccessManager & mgr, wstring const & word ); - virtual void requestFinished( QNetworkReply * ); + void requestFinished( QNetworkReply * ) override; /// This simple set implementation should be much more efficient than tree- /// and hash-based standard/Qt containers when there are very few elements. diff --git a/programs.cc b/programs.cc index 299bc460..81044627 100644 --- a/programs.cc +++ b/programs.cc @@ -30,30 +30,30 @@ public: { } - virtual string getName() noexcept + string getName() noexcept override { return prg.name.toUtf8().data(); } - virtual map< Property, string > getProperties() noexcept + map< Property, string > getProperties() noexcept override { return map< Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return 0; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return 0; } - virtual sptr< WordSearchRequest > prefixMatch( wstring const & word, - unsigned long maxResults ) + sptr< WordSearchRequest > prefixMatch( wstring const & word, + unsigned long maxResults ) override ; - virtual sptr< DataRequest > getArticle( wstring const &, + sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, - wstring const &, bool ) + wstring const &, bool ) override ; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; }; sptr< WordSearchRequest > ProgramsDictionary::prefixMatch( wstring const & word, diff --git a/sdict.cc b/sdict.cc index 76afa53b..88423f99 100644 --- a/sdict.cc +++ b/sdict.cc @@ -143,43 +143,43 @@ class SdictDictionary: public BtreeIndexing::BtreeDictionary ~SdictDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual QString const & getDescription(); + QString const & getDescription() override; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "SDICT", Qt::CaseInsensitive ) @@ -187,7 +187,7 @@ class SdictDictionary: public BtreeIndexing::BtreeDictionary } protected: - void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -500,7 +500,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class SdictArticleRequest: public Dictionary::DataRequest @@ -528,7 +528,7 @@ public: void run(); // Run from another thread by DslArticleRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/slob.cc b/slob.cc index 8ebc89b6..41277735 100644 --- a/slob.cc +++ b/slob.cc @@ -587,63 +587,63 @@ class SlobDictionary: public BtreeIndexing::BtreeDictionary ~SlobDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; - virtual QString const& getDescription(); + QString const& getDescription() override; /// Loads the resource. void loadResource( std::string &resourceName, string & data ); - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; quint64 getArticlePos(uint32_t articleNumber ); - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "SLOB", Qt::CaseInsensitive ) && ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize ); } - virtual uint32_t getFtsIndexVersion() + uint32_t getFtsIndexVersion() override { return 2; } protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -1329,7 +1329,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class SlobArticleRequest: public Dictionary::DataRequest @@ -1357,7 +1357,7 @@ public: void run(); // Run from another thread by DslArticleRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1518,7 +1518,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class SlobResourceRequest: public Dictionary::DataRequest @@ -1545,7 +1545,7 @@ public: void run(); // Run from another thread by ZimResourceRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/sounddir.cc b/sounddir.cc index ebd0884c..b9b5f54c 100644 --- a/sounddir.cc +++ b/sounddir.cc @@ -79,30 +79,30 @@ public: vector< string > const & dictionaryFiles, QString const & iconFilename_ ); - virtual string getName() noexcept + string getName() noexcept override { return name; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.soundsCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return getArticleCount(); } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; }; SoundDirDictionary::SoundDirDictionary( string const & id, diff --git a/stardict.cc b/stardict.cc index 9d63d964..4d4d10f5 100644 --- a/stardict.cc +++ b/stardict.cc @@ -158,51 +158,51 @@ public: ~StardictDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return bookName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.wordCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount + idxHeader.synWordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & ) + sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & ) override ; - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; - virtual QString const& getDescription(); + QString const& getDescription() override; - virtual QString getMainFilename(); + QString getMainFilename() override; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "STARDICT", Qt::CaseInsensitive ) @@ -210,7 +210,7 @@ public: } protected: - void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -1226,7 +1226,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class StardictHeadwordsRequest: public Dictionary::WordSearchRequest @@ -1251,7 +1251,7 @@ public: void run(); // Run from another thread by StardictHeadwordsRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1345,7 +1345,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class StardictArticleRequest: public Dictionary::DataRequest @@ -1374,7 +1374,7 @@ public: void run(); // Run from another thread by StardictArticleRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1639,7 +1639,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class StardictResourceRequest: public Dictionary::DataRequest @@ -1666,7 +1666,7 @@ public: void run(); // Run from another thread by StardictResourceRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/voiceengines.cc b/voiceengines.cc index 9d8e326b..1b8dfbf6 100644 --- a/voiceengines.cc +++ b/voiceengines.cc @@ -44,30 +44,30 @@ public: { } - virtual string getName() noexcept + string getName() noexcept override { return voiceEngine.name.toUtf8().data(); } - virtual map< Property, string > getProperties() noexcept + map< Property, string > getProperties() noexcept override { return map< Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return 0; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return 0; } - virtual sptr< WordSearchRequest > prefixMatch( wstring const & word, - unsigned long maxResults ) + sptr< WordSearchRequest > prefixMatch( wstring const & word, + unsigned long maxResults ) override ; - virtual sptr< DataRequest > getArticle( wstring const &, + sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, - wstring const &, bool ) + wstring const &, bool ) override ; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; }; sptr< WordSearchRequest > VoiceEnginesDictionary::prefixMatch( wstring const & /*word*/, diff --git a/website.cc b/website.cc index b98346a8..77655e1e 100644 --- a/website.cc +++ b/website.cc @@ -54,33 +54,33 @@ public: dictionaryDescription = temp; } - virtual string getName() noexcept + string getName() noexcept override { return name; } - virtual map< Property, string > getProperties() noexcept + map< Property, string > getProperties() noexcept override { return map< Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return 0; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return 0; } - virtual sptr< WordSearchRequest > prefixMatch( wstring const & word, - unsigned long ) ; + sptr< WordSearchRequest > prefixMatch( wstring const & word, + unsigned long ) override ; - virtual sptr< DataRequest > getArticle( wstring const &, + sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts, - wstring const & context, bool ) + wstring const & context, bool ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) ; + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; void isolateWebCSS( QString & css ); protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; }; sptr< WordSearchRequest > WebSiteDictionary::prefixMatch( wstring const & /*word*/, @@ -112,11 +112,11 @@ public: ~WebSiteArticleRequest() {} - virtual void cancel(); + void cancel() override; private: - virtual void requestFinished( QNetworkReply * ); + void requestFinished( QNetworkReply * ) override; static QTextCodec * codecForHtml( QByteArray const & ba ); }; @@ -429,11 +429,11 @@ public: ~WebSiteResourceRequest() {} - virtual void cancel(); + void cancel() override; private: - virtual void requestFinished( QNetworkReply * ); + void requestFinished( QNetworkReply * ) override; }; WebSiteResourceRequest::WebSiteResourceRequest( QString const & url_, diff --git a/xdxf.cc b/xdxf.cc index e9cd4e0a..bea69777 100644 --- a/xdxf.cc +++ b/xdxf.cc @@ -147,60 +147,60 @@ public: ~XdxfDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; - virtual QString const& getDescription(); + QString const& getDescription() override; - virtual QString getMainFilename(); + QString getMainFilename() override; - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "XDXF", Qt::CaseInsensitive ) && ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize ); } - virtual uint32_t getFtsIndexVersion() + uint32_t getFtsIndexVersion() override { return 1; } protected: - void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -454,7 +454,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class XdxfArticleRequest: public Dictionary::DataRequest @@ -482,7 +482,7 @@ public: void run(); // Run from another thread by XdxfArticleRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -700,22 +700,22 @@ protected: dictData *dz; - virtual bool isSequential () const + bool isSequential () const override { return false; } // Which is a lie, but else pos() won't work - bool waitForReadyRead ( int ) + bool waitForReadyRead ( int ) override { return !gzeof( gz ); } - qint64 bytesAvailable() const + qint64 bytesAvailable() const override { return ( gzeof( gz ) ? 0 : 1 ) + QIODevice::bytesAvailable(); } - virtual qint64 readData( char * data, qint64 maxSize ); + qint64 readData( char * data, qint64 maxSize ) override; - virtual bool atEnd() const; + bool atEnd() const override; - virtual qint64 writeData ( const char * /*data*/, qint64 /*maxSize*/ ) + qint64 writeData ( const char * /*data*/, qint64 /*maxSize*/ ) override { return -1; } }; @@ -983,7 +983,7 @@ public: hasExited.release(); } - virtual void run(); + void run() override; }; class XdxfResourceRequest: public Dictionary::DataRequest @@ -1010,7 +1010,7 @@ public: void run(); // Run from another thread by XdxfResourceRequestRunnable - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/zim.cc b/zim.cc index 2a04319c..8fab4705 100644 --- a/zim.cc +++ b/zim.cc @@ -180,7 +180,7 @@ public: ZimFile( const QString & name ); ~ZimFile(); - virtual void setFileName( const QString & name ); + void setFileName( const QString & name ) override; bool open(); void close() { @@ -671,63 +671,63 @@ class ZimDictionary: public BtreeIndexing::BtreeDictionary ~ZimDictionary(); - virtual string getName() noexcept + string getName() noexcept override { return dictionaryName; } - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.articleCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return idxHeader.wordCount; } - inline virtual quint32 getLangFrom() const + inline quint32 getLangFrom() const override { return idxHeader.langFrom; } - inline virtual quint32 getLangTo() const + inline quint32 getLangTo() const override { return idxHeader.langTo; } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; - virtual QString const& getDescription(); + QString const& getDescription() override; /// Loads the resource. void loadResource( std::string &resourceName, string & data ); - virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, + sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString, int searchMode, bool matchCase, int distanceBetweenWords, int maxResults, bool ignoreWordsOrder, - bool ignoreDiacritics ); - virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text ); + bool ignoreDiacritics ) override; + void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override; quint32 getArticleText( uint32_t articleAddress, QString & headword, QString & text, set< quint32 > * loadedArticles ); - virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ); + void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration ) override; - virtual void setFTSParameters( Config::FullTextSearch const & fts ) + void setFTSParameters( Config::FullTextSearch const & fts ) override { can_FTS = fts.enabled && !fts.disabledTypes.contains( "ZIM", Qt::CaseInsensitive ) && ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize ); } - virtual void sortArticlesOffsetsForFTS( QVector< uint32_t > & offsets, QAtomicInt & isCancelled ); + void sortArticlesOffsetsForFTS( QVector< uint32_t > & offsets, QAtomicInt & isCancelled ) override; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; private: @@ -1280,7 +1280,7 @@ public: void run(); - virtual void cancel() + void cancel() override { isCancelled.ref(); } @@ -1452,7 +1452,7 @@ public: void run(); - virtual void cancel() + void cancel() override { isCancelled.ref(); } diff --git a/zipsounds.cc b/zipsounds.cc index 8a4e086a..a901a49e 100644 --- a/zipsounds.cc +++ b/zipsounds.cc @@ -114,29 +114,29 @@ public: ZipSoundsDictionary( string const & id, string const & indexFile, vector< string > const & dictionaryFiles ); - virtual string getName() noexcept; + string getName() noexcept override; - virtual map< Dictionary::Property, string > getProperties() noexcept + map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); } - virtual unsigned long getArticleCount() noexcept + unsigned long getArticleCount() noexcept override { return idxHeader.soundsCount; } - virtual unsigned long getWordCount() noexcept + unsigned long getWordCount() noexcept override { return getArticleCount(); } - virtual sptr< Dictionary::DataRequest > getArticle( wstring const &, + sptr< Dictionary::DataRequest > getArticle( wstring const &, vector< wstring > const & alts, wstring const &, - bool ignoreDiacritics ) + bool ignoreDiacritics ) override ; - virtual sptr< Dictionary::DataRequest > getResource( string const & name ) + sptr< Dictionary::DataRequest > getResource( string const & name ) override ; protected: - virtual void loadIcon() noexcept; + void loadIcon() noexcept override; }; ZipSoundsDictionary::ZipSoundsDictionary( string const & id, From 0d149337caf54f5617d329d507d8db11554b6f76 Mon Sep 17 00:00:00 2001 From: shenlebantongying Date: Thu, 29 Dec 2022 04:02:57 -0500 Subject: [PATCH 07/14] lingua: add " " to --- src/dict/lingualibre.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dict/lingualibre.cpp b/src/dict/lingualibre.cpp index 4787cea6..455a0bf5 100644 --- a/src/dict/lingualibre.cpp +++ b/src/dict/lingualibre.cpp @@ -469,9 +469,9 @@ void LinguaArticleRequest::requestFinished( QNetworkReply * r ) string audiolink = pageJsonObj[ "imageinfo" ].toArray().at( 0 ).toObject()[ "url" ].toString().toHtmlEscaped().toStdString(); articleBody += addAudioLink( audiolink, dictionaryId ); - articleBody += ")"; articleBody += R"(Play)"; articleBody += title; articleBody += "
"; From 43859df43116a5b20575328dcf92742f959c55c5 Mon Sep 17 00:00:00 2001 From: shenlebantongying Date: Thu, 29 Dec 2022 04:11:34 -0500 Subject: [PATCH 08/14] lingua: add " " to links --- src/dict/lingualibre.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dict/lingualibre.cpp b/src/dict/lingualibre.cpp index 455a0bf5..e0525bb1 100644 --- a/src/dict/lingualibre.cpp +++ b/src/dict/lingualibre.cpp @@ -468,7 +468,7 @@ void LinguaArticleRequest::requestFinished( QNetworkReply * r ) string title = pageJsonObj[ "title" ].toString().toHtmlEscaped().toStdString(); string audiolink = pageJsonObj[ "imageinfo" ].toArray().at( 0 ).toObject()[ "url" ].toString().toHtmlEscaped().toStdString(); - articleBody += addAudioLink( audiolink, dictionaryId ); + articleBody += addAudioLink( "\""+audiolink+"\"", dictionaryId ); articleBody += R"()"; From 7daf9b4e5665c345ab0f284853da456f53c95a2e Mon Sep 17 00:00:00 2001 From: shenlebantongying Date: Thu, 29 Dec 2022 04:44:46 -0500 Subject: [PATCH 09/14] fix: articleview style switching --- mainwindow.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 9b46c2d2..e93a6bc1 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -2211,14 +2211,17 @@ void MainWindow::editPreferences() bool needReload = false; // See if we need to reapply Qt stylesheets - if ( cfg.preferences.addonStyle != p.addonStyle || cfg.preferences.darkMode != p.darkMode) + if( cfg.preferences.darkMode != p.darkMode ) { applyQtStyleSheet( p.addonStyle, p.darkMode ); - articleMaker.setDisplayStyle( p.displayStyle, p.addonStyle ); - needReload = true; } - if (cfg.preferences.darkReaderMode != p.darkReaderMode) { + // see if we need to reapply articleview style + if( cfg.preferences.displayStyle != p.displayStyle || + cfg.preferences.addonStyle != p.addonStyle || + cfg.preferences.darkReaderMode != p.darkReaderMode ) + { + articleMaker.setDisplayStyle( p.displayStyle, p.addonStyle ); needReload = true; } From e8063bf0ebc342db6774926a16c72a44b2cd8745 Mon Sep 17 00:00:00 2001 From: shenlebantongying Date: Thu, 29 Dec 2022 07:10:21 -0500 Subject: [PATCH 10/14] replace dict group's hotkeyedit with qKeySequenceEdit --- config.hh | 8 ++++++-- dictgroupwidget.ui | 49 +++++++++++++++++++++++++++++++++++++++------- groups_widgets.cc | 9 +++++++-- 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/config.hh b/config.hh index 0b3fa9d2..e52f3718 100644 --- a/config.hh +++ b/config.hh @@ -157,8 +157,12 @@ struct HotKey HotKey(); - /// We use the first two keys of QKeySequence, with modifiers being stored - /// in the first one. + /// Hotkey's constructor, take a QKeySequence's first two keys + /// 1st key's modifier will be the `modifiers` above + /// 1st key without modifier will becomes `key1` + /// 2nd key without modifier will becomes `key2` + /// The relation between the int and qt's KeyCode should consult qt's doc + HotKey( QKeySequence const & ); QKeySequence toKeySequence() const; diff --git a/dictgroupwidget.ui b/dictgroupwidget.ui index 3a576329..808002e9 100644 --- a/dictgroupwidget.ui +++ b/dictgroupwidget.ui @@ -19,6 +19,9 @@ + + 3 + @@ -75,7 +78,37 @@ - + + + + 0 + 0 + + + + + 80 + 0 + + + + + + + + + 0 + 0 + + + + + :/icons/clear.png:/icons/clear.png + + + + + @@ -101,14 +134,16 @@ QListWidget
groups_widgets.hh
- - HotKeyEdit - QLineEdit -
hotkeyedit.hh
-
- + + + clearShortCut + clicked() + shortcut + clear() + + diff --git a/groups_widgets.cc b/groups_widgets.cc index 513b9e3e..fa5e3696 100644 --- a/groups_widgets.cc +++ b/groups_widgets.cc @@ -33,6 +33,11 @@ DictGroupWidget::DictGroupWidget( QWidget * parent, ui.setupUi( this ); ui.dictionaries->populate( Instances::Group( group, dicts, Config::Group() ).dictionaries, dicts ); +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) + ui.shortcut->setClearButtonEnabled(true); + ui.clearShortCut->hide(); +#endif + // Populate icons' list QStringList icons = QDir( ":/flags/" ).entryList( QDir::Files, QDir::NoSort ); @@ -61,7 +66,7 @@ DictGroupWidget::DictGroupWidget( QWidget * parent, if ( usesIconData ) ui.groupIcon->setCurrentIndex( 1 ); - ui.shortcut->setHotKey( Config::HotKey( group.shortcut ) ); + ui.shortcut->setKeySequence( group.shortcut ); ui.favoritesFolder->setText( group.favoritesFolder ); @@ -126,7 +131,7 @@ Config::Group DictGroupWidget::makeGroup() const g.icon = ui.groupIcon->itemData( currentIndex ).toString(); - g.shortcut = ui.shortcut->getHotKey().toKeySequence(); + g.shortcut = ui.shortcut->keySequence(); g.favoritesFolder = ui.favoritesFolder->text().replace( '\\', '/' ); From e2bd010b1965da573dd2610e811e0039c8bc676c Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Thu, 29 Dec 2022 11:36:01 -0500 Subject: [PATCH 11/14] fix: Unsatisfactory "Close To Tray" behavior on macOS --- mainwindow.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index e93a6bc1..5cae5c1b 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -2922,10 +2922,23 @@ void MainWindow::toggleMainWindow( bool onlyShow ) else if ( !onlyShow ) { + +// On Windows and Linux, a hidden window won't show a task bar icon +// When trayicon is enabled, the duplication is unneeded + +// On macOS, a hidden window will still show on the Dock, +// but click it won't bring it back, thus we can only minimize it. + +#ifdef Q_OS_MAC + if (cfg.preferences.enableTrayIcon) + showMinimized(); +#else if (cfg.preferences.enableTrayIcon) - hide(); + hide(); else - showMinimized(); + showMinimized(); +#endif + if( headwordsDlg ) headwordsDlg->hide(); From 794d4b934f29fac116222a92209ced038ee65fcf Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Fri, 30 Dec 2022 01:11:22 +0800 Subject: [PATCH 12/14] fix: replace hhotkeyedit with qkeysequenceedit related to #291 --- config.cc | 4 ++-- config.hh | 4 ++-- hotkeywrapper.cc | 6 ++++++ hotkeywrapper.hh | 2 ++ mainwindow.cc | 10 ++-------- preferences.cc | 8 ++++---- preferences.ui | 17 ++--------------- 7 files changed, 20 insertions(+), 31 deletions(-) diff --git a/config.cc b/config.cc index d56cbd55..2660095a 100644 --- a/config.cc +++ b/config.cc @@ -1782,7 +1782,7 @@ void save( Class const & c ) preferences.appendChild( opt ); opt = dd.createElement( "mainWindowHotkey" ); - opt.appendChild( dd.createTextNode( c.preferences.mainWindowHotkey.toKeySequence().toString() ) ); + opt.appendChild( dd.createTextNode( c.preferences.mainWindowHotkey.toString() ) ); preferences.appendChild( opt ); opt = dd.createElement( "enableClipboardHotkey" ); @@ -1790,7 +1790,7 @@ void save( Class const & c ) preferences.appendChild( opt ); opt = dd.createElement( "clipboardHotkey" ); - opt.appendChild( dd.createTextNode( c.preferences.clipboardHotkey.toKeySequence().toString() ) ); + opt.appendChild( dd.createTextNode( c.preferences.clipboardHotkey.toString() ) ); preferences.appendChild( opt ); opt = dd.createElement( "startWithScanPopupOn" ); diff --git a/config.hh b/config.hh index e52f3718..2d097cc4 100644 --- a/config.hh +++ b/config.hh @@ -320,9 +320,9 @@ struct Preferences bool searchInDock; bool enableMainWindowHotkey; - HotKey mainWindowHotkey; + QKeySequence mainWindowHotkey; bool enableClipboardHotkey; - HotKey clipboardHotkey; + QKeySequence clipboardHotkey; bool startWithScanPopupOn; bool enableScanPopupModifiers; diff --git a/hotkeywrapper.cc b/hotkeywrapper.cc index a5eae039..6dda6116 100644 --- a/hotkeywrapper.cc +++ b/hotkeywrapper.cc @@ -329,6 +329,12 @@ bool HotkeyWrapper::setGlobalKey( int key, int key2, return true; } +bool HotkeyWrapper::setGlobalKey( QKeySequence & seq, int handle ) +{ + Config::HotKey hk(seq); + return setGlobalKey(hk.key1,hk.key2,hk.modifiers,handle); +} + #if( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) bool HotkeyWrapper::winEvent ( MSG * message, long * result ) #else diff --git a/hotkeywrapper.hh b/hotkeywrapper.hh index 00ad0965..dc537c75 100644 --- a/hotkeywrapper.hh +++ b/hotkeywrapper.hh @@ -68,6 +68,8 @@ public: bool setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier, int handle ); + bool setGlobalKey( QKeySequence & , int ); + /// Unregisters everything void unregister(); diff --git a/mainwindow.cc b/mainwindow.cc index e93a6bc1..f48ce208 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -2971,17 +2971,11 @@ void MainWindow::installHotKeys() } if ( cfg.preferences.enableMainWindowHotkey ) - hotkeyWrapper->setGlobalKey( cfg.preferences.mainWindowHotkey.key1, - cfg.preferences.mainWindowHotkey.key2, - cfg.preferences.mainWindowHotkey.modifiers, - 0 ); + hotkeyWrapper->setGlobalKey( cfg.preferences.mainWindowHotkey,0 ); if ( cfg.preferences.enableClipboardHotkey && scanPopup.get() ) { - hotkeyWrapper->setGlobalKey( cfg.preferences.clipboardHotkey.key1, - cfg.preferences.clipboardHotkey.key2, - cfg.preferences.clipboardHotkey.modifiers, - 1 ); + hotkeyWrapper->setGlobalKey( cfg.preferences.clipboardHotkey,1 ); } connect( hotkeyWrapper.get(), diff --git a/preferences.cc b/preferences.cc index 6cdebbc8..33fb3c63 100644 --- a/preferences.cc +++ b/preferences.cc @@ -178,9 +178,9 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ): #endif ui.enableMainWindowHotkey->setChecked( p.enableMainWindowHotkey ); - ui.mainWindowHotkey->setHotKey( p.mainWindowHotkey ); + ui.mainWindowHotkey->setKeySequence( p.mainWindowHotkey ); ui.enableClipboardHotkey->setChecked( p.enableClipboardHotkey ); - ui.clipboardHotkey->setHotKey( p.clipboardHotkey ); + ui.clipboardHotkey->setKeySequence( p.clipboardHotkey ); ui.startWithScanPopupOn->setChecked( p.startWithScanPopupOn ); ui.enableScanPopupModifiers->setChecked( p.enableScanPopupModifiers ); @@ -398,9 +398,9 @@ Config::Preferences Preferences::getPreferences() p.darkMode = ui.darkMode->isChecked(); p.darkReaderMode = ui.darkReaderMode->isChecked(); p.enableMainWindowHotkey = ui.enableMainWindowHotkey->isChecked(); - p.mainWindowHotkey = ui.mainWindowHotkey->getHotKey(); + p.mainWindowHotkey = ui.mainWindowHotkey->keySequence(); p.enableClipboardHotkey = ui.enableClipboardHotkey->isChecked(); - p.clipboardHotkey = ui.clipboardHotkey->getHotKey(); + p.clipboardHotkey = ui.clipboardHotkey->keySequence(); p.startWithScanPopupOn = ui.startWithScanPopupOn->isChecked(); p.enableScanPopupModifiers = ui.enableScanPopupModifiers->isChecked(); diff --git a/preferences.ui b/preferences.ui index d0f40859..983f327f 100644 --- a/preferences.ui +++ b/preferences.ui @@ -709,11 +709,7 @@ in the pressed state when the word selection changes. - - - false - - + @@ -740,11 +736,7 @@ in the pressed state when the word selection changes. - - - false - - + @@ -1760,11 +1752,6 @@ from Stardict, Babylon and GLS dictionaries - - HotKeyEdit - QLineEdit -
hotkeyedit.hh
-
StylesComboBox QComboBox From 068c2f9a2141e9cf6a7e71f8a075602eda2426ad Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Fri, 30 Dec 2022 01:12:57 +0800 Subject: [PATCH 13/14] fix: remove hotkeyedit.cc(.hh) --- goldendict.pro | 2 - hotkeyedit.cc | 220 ------------------------------------------------- hotkeyedit.hh | 41 --------- 3 files changed, 263 deletions(-) delete mode 100644 hotkeyedit.cc delete mode 100644 hotkeyedit.hh diff --git a/goldendict.pro b/goldendict.pro index f80b063a..462cc346 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -327,7 +327,6 @@ HEADERS += folding.hh \ processwrapper.hh \ hotkeywrapper.hh \ searchpanewidget.hh \ - hotkeyedit.hh \ langcoder.hh \ editdictionaries.hh \ loaddictionaries.hh \ @@ -467,7 +466,6 @@ SOURCES += folding.cc \ wstring_qt.cc \ processwrapper.cc \ hotkeywrapper.cc \ - hotkeyedit.cc \ langcoder.cc \ editdictionaries.cc \ loaddictionaries.cc \ diff --git a/hotkeyedit.cc b/hotkeyedit.cc deleted file mode 100644 index 6ba4f27d..00000000 --- a/hotkeyedit.cc +++ /dev/null @@ -1,220 +0,0 @@ -/* This file is (c) 2008-2012 Konstantin Isakov - * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ - -#include "hotkeyedit.hh" -#include - -#ifdef Q_OS_WIN -#include -#endif - -HotKeyEdit::HotKeyEdit( QWidget * parent ): - QLineEdit( parent ), - currentModifiers( 0 ), currentKey1( 0 ), currentKey2( 0 ), - continuingCombo( false ) -{ - renderCurrentValue(); - installEventFilter( this ); -} - -void HotKeyEdit::setHotKey( Config::HotKey const & hk ) -{ - currentModifiers = hk.modifiers; - currentKey1 = hk.key1; - currentKey2 = hk.key2; - - renderCurrentValue(); -} - -Config::HotKey HotKeyEdit::getHotKey() const -{ - Config::HotKey hk; - - hk.modifiers = currentModifiers; - hk.key1 = currentKey1; - hk.key2 = currentKey2; - - return hk; -} - -void HotKeyEdit::renderCurrentValue() -{ - QString result; - - if ( currentKey1 ) - { - result = QKeySequence( currentKey1 | currentModifiers ).toString( QKeySequence::NativeText ); - - if ( currentKey2 ) - result += "+" + QKeySequence( currentKey2 ).toString( QKeySequence::NativeText ); - } - - setText( result ); -} - -void HotKeyEdit::keyPressEvent( QKeyEvent * event ) -{ - int key = event->key(); - Qt::KeyboardModifiers modifiers = event->modifiers() & ~Qt::KeypadModifier; - -#ifdef Q_OS_WIN - if( objectName() == "mainWindowHotkey" || objectName() == "clipboardHotkey" ) - { - int newkey = VkeyToQTkey( event->nativeVirtualKey() ); - if( newkey ) - key = newkey; - } -#endif - - switch( key ) - { - case 0: - case Qt::Key_unknown: - case Qt::Key_Shift: - case Qt::Key_Control: - case Qt::Key_Meta: - case Qt::Key_Alt: - case Qt::Key_AltGr: - continuingCombo = false; - QLineEdit::keyPressEvent( event ); - break; - - default: - { - if ( !modifiers && - ( ( key == Qt::Key_Backspace ) || ( key == Qt::Key_Delete ) ) ) - { - // Delete current combo - currentKey1 = 0; - currentKey2 = 0; - currentModifiers = Qt::NoModifier; - continuingCombo = false; - } - else - if ( !continuingCombo ) - { - if ( modifiers || event->text().isEmpty() ) // Don't allow plain letters - { - currentKey2 = 0; - currentKey1 = key; - currentModifiers = modifiers; - continuingCombo = true; - } - } - else - { - currentKey2 = key; - continuingCombo = false; - } - - renderCurrentValue(); - } - break; - } -} - -void HotKeyEdit::keyReleaseEvent( QKeyEvent * event ) -{ - switch( event->key() ) - { - case 0: - case Qt::Key_unknown: - case Qt::Key_Shift: - case Qt::Key_Control: - case Qt::Key_Meta: - case Qt::Key_Alt: - case Qt::Key_AltGr: - continuingCombo = false; - break; - } - - QLineEdit::keyReleaseEvent( event ); -} - -bool HotKeyEdit::eventFilter( QObject *, QEvent * event ) -{ - if( event->type() == QEvent::ShortcutOverride ) - { - event->accept(); - return true; - } - return false; -} - -#ifdef Q_OS_WIN - -int HotKeyEdit::VkeyToQTkey( quint32 vkey ) -{ - if ( vkey >= Qt::Key_A && vkey <= Qt::Key_Z) - return vkey; - - switch( vkey ) - { - case VK_NUMPAD0: return Qt::Key_0; - case VK_NUMPAD1: return Qt::Key_1; - case VK_NUMPAD2: return Qt::Key_2; - case VK_NUMPAD3: return Qt::Key_3; - case VK_NUMPAD4: return Qt::Key_4; - case VK_NUMPAD5: return Qt::Key_5; - case VK_NUMPAD6: return Qt::Key_6; - case VK_NUMPAD7: return Qt::Key_7; - case VK_NUMPAD8: return Qt::Key_8; - case VK_NUMPAD9: return Qt::Key_9; - case VK_DIVIDE: return Qt::Key_Slash; - case VK_MULTIPLY: return Qt::Key_Asterisk; - case VK_SUBTRACT: return Qt::Key_Minus; - case VK_ADD: return Qt::Key_Plus; - case VK_DECIMAL: return Qt::Key_Period; - case VK_F1: return Qt::Key_F1; - case VK_F2: return Qt::Key_F2; - case VK_F3: return Qt::Key_F3; - case VK_F4: return Qt::Key_F4; - case VK_F5: return Qt::Key_F5; - case VK_F6: return Qt::Key_F6; - case VK_F7: return Qt::Key_F7; - case VK_F8: return Qt::Key_F8; - case VK_F9: return Qt::Key_F9; - case VK_F10: return Qt::Key_F10; - case VK_F11: return Qt::Key_F11; - case VK_F12: return Qt::Key_F12; - case VK_F13: return Qt::Key_F13; - case VK_F14: return Qt::Key_F14; - case VK_F15: return Qt::Key_F15; - case VK_F16: return Qt::Key_F16; - case VK_F17: return Qt::Key_F17; - case VK_F18: return Qt::Key_F18; - case VK_F19: return Qt::Key_F19; - case VK_F20: return Qt::Key_F20; - case VK_F21: return Qt::Key_F21; - case VK_F22: return Qt::Key_F22; - case VK_F23: return Qt::Key_F23; - case VK_F24: return Qt::Key_F24; - case 0x30: return Qt::Key_ParenRight; - case 0x31: return Qt::Key_Exclam; - case 0x32: return Qt::Key_At; - case 0x33: return Qt::Key_NumberSign; - case 0x34: return Qt::Key_Dollar; - case 0x35: return Qt::Key_Percent; - case 0x36: return Qt::Key_AsciiCircum; - case 0x37: return Qt::Key_Ampersand; - case 0x38: return Qt::Key_copyright; - case 0x39: return Qt::Key_ParenLeft; - case VK_OEM_MINUS: return Qt::Key_Underscore; - case VK_OEM_PLUS: return Qt::Key_Equal; - case VK_OEM_1: return Qt::Key_Semicolon; - case VK_OEM_2: return Qt::Key_Question; - case VK_OEM_3: return Qt::Key_QuoteLeft; - case VK_OEM_4: return Qt::Key_BracketLeft; - case VK_OEM_5: return Qt::Key_Backslash; - case VK_OEM_6: return Qt::Key_BracketRight; - case VK_OEM_7: return Qt::Key_Apostrophe; - case VK_OEM_COMMA: return Qt::Key_Less; - case VK_OEM_PERIOD: return Qt::Key_Greater; - - default:; - } - - return 0; -} - -#endif diff --git a/hotkeyedit.hh b/hotkeyedit.hh deleted file mode 100644 index 512c0319..00000000 --- a/hotkeyedit.hh +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is (c) 2008-2012 Konstantin Isakov - * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ - -#ifndef __HOTKEYEDIT_HH_INCLUDED__ -#define __HOTKEYEDIT_HH_INCLUDED__ - -#include "config.hh" -#include - -// This widget allows grabbing a hotkey -class HotKeyEdit: public QLineEdit -{ - Q_OBJECT - - Qt::KeyboardModifiers currentModifiers; - int currentKey1, currentKey2; - - bool continuingCombo; - -public: - - HotKeyEdit( QWidget * parent = 0 ); - - void setHotKey( Config::HotKey const & ); - Config::HotKey getHotKey() const; - -protected: - - void keyPressEvent( QKeyEvent * event ); - void keyReleaseEvent( QKeyEvent * event ); - -private: - - void renderCurrentValue(); - bool eventFilter( QObject *, QEvent * event ); -#ifdef Q_OS_WIN - int VkeyToQTkey( quint32 vkey ); -#endif -}; - -#endif From d5544ca058f72febd8c7ba9e0b405bf95057b406 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Fri, 30 Dec 2022 10:09:37 +0800 Subject: [PATCH 14/14] fix: method definition in linux and macos --- hotkeywrapper.cc | 18 ++++++++++++------ hotkeywrapper.hh | 5 ++++- machotkeywrapper.mm | 6 ++++++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/hotkeywrapper.cc b/hotkeywrapper.cc index 6dda6116..9adbf771 100644 --- a/hotkeywrapper.cc +++ b/hotkeywrapper.cc @@ -295,6 +295,12 @@ void HotkeyWrapper::init() hwnd = (HWND)root->winId(); } +bool HotkeyWrapper::setGlobalKey( QKeySequence const & seq, int handle ) +{ + Config::HotKey hk(seq); + return setGlobalKey(hk.key1,hk.key2,hk.modifiers,handle); +} + bool HotkeyWrapper::setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier, int handle ) { @@ -329,12 +335,6 @@ bool HotkeyWrapper::setGlobalKey( int key, int key2, return true; } -bool HotkeyWrapper::setGlobalKey( QKeySequence & seq, int handle ) -{ - Config::HotKey hk(seq); - return setGlobalKey(hk.key1,hk.key2,hk.modifiers,handle); -} - #if( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) bool HotkeyWrapper::winEvent ( MSG * message, long * result ) #else @@ -628,6 +628,12 @@ void HotkeyWrapper::handleRecordEvent( XRecordInterceptData * data ) XRecordFreeData( data ); } +bool HotkeyWrapper::setGlobalKey( QKeySequence const & seq, int handle ) +{ + Config::HotKey hk(seq); + return setGlobalKey(hk.key1,hk.key2,hk.modifiers,handle); +} + bool HotkeyWrapper::setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier, int handle ) { diff --git a/hotkeywrapper.hh b/hotkeywrapper.hh index dc537c75..e1705576 100644 --- a/hotkeywrapper.hh +++ b/hotkeywrapper.hh @@ -30,6 +30,7 @@ #include "ex.hh" #include "qtsingleapplication.h" #include "utils.hh" +#include "config.hh" ////////////////////////////////////////////////////////////////////////// @@ -68,7 +69,7 @@ public: bool setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier, int handle ); - bool setGlobalKey( QKeySequence & , int ); + bool setGlobalKey( QKeySequence const & , int ); /// Unregisters everything void unregister(); @@ -183,6 +184,8 @@ public: int handle ) { return true; } + bool setGlobalKey( QKeySequence const &, int ) { return true; } + void unregister() {} diff --git a/machotkeywrapper.mm b/machotkeywrapper.mm index ddd9e9b9..75e4b947 100644 --- a/machotkeywrapper.mm +++ b/machotkeywrapper.mm @@ -180,6 +180,12 @@ void HotkeyWrapper::unregister() (static_cast< QHotkeyApplication * >( qApp ))->unregisterWrapper( this ); } +bool HotkeyWrapper::setGlobalKey( QKeySequence const & seq, int handle ) +{ + Config::HotKey hk(seq); + return setGlobalKey(hk.key1,hk.key2,hk.modifiers,handle); +} + bool HotkeyWrapper::setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier, int handle ) { if ( !key )