From 03af31c6fc92a23a6f9b030c8b6006ec4f5fb342 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Mon, 17 Apr 2023 20:41:47 -0400 Subject: [PATCH] refactor: move common/base/utils into /src/common/ --- goldendict.pro | 73 ++++++++++++----------- src/article_maker.cc | 19 +++--- src/common/0README.md | 3 + src/{ => common}/base_type.hh | 0 src/{ => common}/ex.hh | 0 src/{ => common}/file.cc | 0 src/{ => common}/file.hh | 0 src/{ => common}/filetype.cc | 0 src/{ => common}/filetype.hh | 0 src/{ => common}/fsencoding.cc | 0 src/{ => common}/fsencoding.hh | 0 src/{ => common}/gddebug.cc | 0 src/{ => common}/gddebug.hh | 0 src/{ => common}/globalbroadcaster.cc | 0 src/{ => common}/globalbroadcaster.hh | 0 src/{base => common}/globalregex.cc | 0 src/{base => common}/globalregex.hh | 0 src/{ => common}/htmlescape.cc | 0 src/{ => common}/htmlescape.hh | 0 src/{ => common}/iconv.cc | 0 src/{ => common}/iconv.hh | 0 src/{ => common}/inc_case_folding.hh | 0 src/{ => common}/inc_diacritic_folding.hh | 0 src/{ => common}/mutex.cc | 0 src/{ => common}/mutex.hh | 0 src/{ => common}/sptr.hh | 0 src/{ => common}/ufile.cc | 0 src/{ => common}/ufile.hh | 0 src/{ => common}/utf8.cc | 0 src/{ => common}/utf8.hh | 0 src/{ => common}/utils.cc | 0 src/{ => common}/utils.hh | 0 src/{ => common}/wstring.hh | 0 src/{ => common}/wstring_qt.cc | 0 src/{ => common}/wstring_qt.hh | 0 src/dict/epwing.cc | 2 +- src/dict/mdx.cc | 20 +++---- src/{ => dict}/ripemd.cc | 0 src/{ => dict}/ripemd.hh | 0 src/ftshelpers.cc | 2 +- src/fulltextsearch.cc | 2 +- src/ui/mainwindow.cc | 3 +- 42 files changed, 62 insertions(+), 62 deletions(-) create mode 100644 src/common/0README.md rename src/{ => common}/base_type.hh (100%) rename src/{ => common}/ex.hh (100%) rename src/{ => common}/file.cc (100%) rename src/{ => common}/file.hh (100%) rename src/{ => common}/filetype.cc (100%) rename src/{ => common}/filetype.hh (100%) rename src/{ => common}/fsencoding.cc (100%) rename src/{ => common}/fsencoding.hh (100%) rename src/{ => common}/gddebug.cc (100%) rename src/{ => common}/gddebug.hh (100%) rename src/{ => common}/globalbroadcaster.cc (100%) rename src/{ => common}/globalbroadcaster.hh (100%) rename src/{base => common}/globalregex.cc (100%) rename src/{base => common}/globalregex.hh (100%) rename src/{ => common}/htmlescape.cc (100%) rename src/{ => common}/htmlescape.hh (100%) rename src/{ => common}/iconv.cc (100%) rename src/{ => common}/iconv.hh (100%) rename src/{ => common}/inc_case_folding.hh (100%) rename src/{ => common}/inc_diacritic_folding.hh (100%) rename src/{ => common}/mutex.cc (100%) rename src/{ => common}/mutex.hh (100%) rename src/{ => common}/sptr.hh (100%) rename src/{ => common}/ufile.cc (100%) rename src/{ => common}/ufile.hh (100%) rename src/{ => common}/utf8.cc (100%) rename src/{ => common}/utf8.hh (100%) rename src/{ => common}/utils.cc (100%) rename src/{ => common}/utils.hh (100%) rename src/{ => common}/wstring.hh (100%) rename src/{ => common}/wstring_qt.cc (100%) rename src/{ => common}/wstring_qt.hh (100%) rename src/{ => dict}/ripemd.cc (100%) rename src/{ => dict}/ripemd.hh (100%) diff --git a/goldendict.pro b/goldendict.pro index 08b5752e..f5c88c88 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -34,7 +34,8 @@ CONFIG( release, debug|release ) { # DEPENDPATH += . generators INCLUDEPATH += . INCLUDEPATH += ./src/ -INCLUDEPATH += ./src/ui # for compiled .ui files to find headers +INCLUDEPATH += ./src/ui # for compiled .ui files to find headers +INCLUDEPATH += ./src/common QT += core \ gui \ @@ -283,10 +284,27 @@ HEADERS += \ src/audiolink.hh \ src/audioplayerfactory.hh \ src/audioplayerinterface.hh \ - src/base/globalregex.hh \ - src/base_type.hh \ src/btreeidx.hh \ src/chunkedstorage.hh \ + src/common/base_type.hh \ + src/common/ex.hh \ + src/common/file.hh \ + src/common/filetype.hh \ + src/common/fsencoding.hh \ + src/common/gddebug.hh \ + src/common/globalbroadcaster.hh \ + src/common/globalregex.hh \ + src/common/htmlescape.hh \ + src/common/iconv.hh \ + src/common/inc_case_folding.hh \ + src/common/inc_diacritic_folding.hh \ + src/common/mutex.hh \ + src/common/sptr.hh \ + src/common/ufile.hh \ + src/common/utf8.hh \ + src/common/utils.hh \ + src/common/wstring.hh \ + src/common/wstring_qt.hh \ src/config.hh \ src/country.hh \ src/decompress.hh \ @@ -312,6 +330,7 @@ HEADERS += \ src/dict/mdx.hh \ src/dict/mediawiki.hh \ src/dict/programs.hh \ + src/dict/ripemd.hh \ src/dict/romaji.hh \ src/dict/russiantranslit.hh \ src/dict/sdict.hh \ @@ -327,29 +346,19 @@ HEADERS += \ src/dict/zim.hh \ src/dict/zipsounds.hh \ src/dictzip.hh \ - src/ex.hh \ src/externalaudioplayer.hh \ src/externalviewer.hh \ src/ffmpegaudio.hh \ src/ffmpegaudioplayer.hh \ - src/file.hh \ - src/filetype.hh \ src/folding.hh \ - src/fsencoding.hh \ src/ftshelpers.hh \ src/fulltextsearch.hh \ src/gdappstyle.hh \ - src/gddebug.hh \ src/gestures.hh \ - src/globalbroadcaster.hh \ src/headwordsmodel.hh \ src/history.hh \ src/hotkeywrapper.hh \ - src/htmlescape.hh \ - src/iconv.hh \ src/iframeschemehandler.hh \ - src/inc_case_folding.hh \ - src/inc_diacritic_folding.hh \ src/indexedzip.hh \ src/initializing.hh \ src/instances.hh \ @@ -357,15 +366,11 @@ HEADERS += \ src/langcoder.hh \ src/language.hh \ src/multimediaaudioplayer.hh \ - src/mutex.hh \ src/parsecmdline.hh \ src/resourceschemehandler.hh \ - src/ripemd.hh \ src/splitfile.hh \ - src/sptr.hh \ src/termination.hh \ src/tiff.hh \ - src/ufile.hh \ src/ui/about.hh \ src/ui/article_inspect.hh \ src/ui/articleview.hh \ @@ -393,15 +398,11 @@ HEADERS += \ src/ui/searchpanewidget.hh \ src/ui/stylescombobox.hh \ src/ui/translatebox.hh \ - src/utf8.hh \ - src/utils.hh \ src/webmultimediadownload.hh \ src/weburlrequestinterceptor.hh \ src/wordfinder.hh \ src/wordlist.hh \ - src/wstring.hh \ - src/wstring_qt.hh \ - src/zipfile.hh + src/zipfile.hh \ FORMS += $$files(src/ui/*.ui) @@ -412,9 +413,21 @@ SOURCES += \ src/atomic_rename.cc \ src/audiolink.cc \ src/audioplayerfactory.cc \ - src/base/globalregex.cc \ src/btreeidx.cc \ src/chunkedstorage.cc \ + src/common/file.cc \ + src/common/filetype.cc \ + src/common/fsencoding.cc \ + src/common/gddebug.cc \ + src/common/globalbroadcaster.cc \ + src/common/globalregex.cc \ + src/common/htmlescape.cc \ + src/common/iconv.cc \ + src/common/mutex.cc \ + src/common/ufile.cc \ + src/common/utf8.cc \ + src/common/utils.cc \ + src/common/wstring_qt.cc \ src/config.cc \ src/country.cc \ src/decompress.cc \ @@ -440,6 +453,7 @@ SOURCES += \ src/dict/mdx.cc \ src/dict/mediawiki.cc \ src/dict/programs.cc \ + src/dict/ripemd.cc \ src/dict/romaji.cc \ src/dict/russiantranslit.cc \ src/dict/sdict.cc \ @@ -458,21 +472,14 @@ SOURCES += \ src/externalaudioplayer.cc \ src/externalviewer.cc \ src/ffmpegaudio.cc \ - src/file.cc \ - src/filetype.cc \ src/folding.cc \ - src/fsencoding.cc \ src/ftshelpers.cc \ src/fulltextsearch.cc \ src/gdappstyle.cc \ - src/gddebug.cc \ src/gestures.cc \ - src/globalbroadcaster.cc \ src/headwordsmodel.cc \ src/history.cc \ src/hotkeywrapper.cc \ - src/htmlescape.cc \ - src/iconv.cc \ src/iframeschemehandler.cc \ src/indexedzip.cc \ src/initializing.cc \ @@ -482,14 +489,11 @@ SOURCES += \ src/language.cc \ src/main.cc \ src/multimediaaudioplayer.cc \ - src/mutex.cc \ src/parsecmdline.cc \ src/resourceschemehandler.cc \ - src/ripemd.cc \ src/splitfile.cc \ src/termination.cc \ src/tiff.cc \ - src/ufile.cc \ src/ui/about.cc \ src/ui/article_inspect.cc \ src/ui/articleview.cc \ @@ -515,13 +519,10 @@ SOURCES += \ src/ui/searchpanel.cc \ src/ui/stylescombobox.cc \ src/ui/translatebox.cc \ - src/utf8.cc \ - src/utils.cc \ src/webmultimediadownload.cc \ src/weburlrequestinterceptor.cc \ src/wordfinder.cc \ src/wordlist.cc \ - src/wstring_qt.cc \ src/zipfile.cc #speech to text diff --git a/src/article_maker.cc b/src/article_maker.cc index 9dc82937..dd74c340 100644 --- a/src/article_maker.cc +++ b/src/article_maker.cc @@ -3,19 +3,18 @@ #include "article_maker.hh" #include "config.hh" -#include "htmlescape.hh" -#include "utf8.hh" -#include "wstring_qt.hh" -#include -#include -#include -#include #include "folding.hh" -#include "langcoder.hh" #include "gddebug.hh" -#include "utils.hh" #include "globalbroadcaster.hh" -#include "base/globalregex.hh" +#include "globalregex.hh" +#include "htmlescape.hh" +#include "langcoder.hh" +#include "utils.hh" +#include "wstring_qt.hh" +#include +#include +#include +#include using std::vector; using std::string; diff --git a/src/common/0README.md b/src/common/0README.md new file mode 100644 index 00000000..2138f8fd --- /dev/null +++ b/src/common/0README.md @@ -0,0 +1,3 @@ +Code shared everywhere. + +Consider this folder as somehow "standard library" diff --git a/src/base_type.hh b/src/common/base_type.hh similarity index 100% rename from src/base_type.hh rename to src/common/base_type.hh diff --git a/src/ex.hh b/src/common/ex.hh similarity index 100% rename from src/ex.hh rename to src/common/ex.hh diff --git a/src/file.cc b/src/common/file.cc similarity index 100% rename from src/file.cc rename to src/common/file.cc diff --git a/src/file.hh b/src/common/file.hh similarity index 100% rename from src/file.hh rename to src/common/file.hh diff --git a/src/filetype.cc b/src/common/filetype.cc similarity index 100% rename from src/filetype.cc rename to src/common/filetype.cc diff --git a/src/filetype.hh b/src/common/filetype.hh similarity index 100% rename from src/filetype.hh rename to src/common/filetype.hh diff --git a/src/fsencoding.cc b/src/common/fsencoding.cc similarity index 100% rename from src/fsencoding.cc rename to src/common/fsencoding.cc diff --git a/src/fsencoding.hh b/src/common/fsencoding.hh similarity index 100% rename from src/fsencoding.hh rename to src/common/fsencoding.hh diff --git a/src/gddebug.cc b/src/common/gddebug.cc similarity index 100% rename from src/gddebug.cc rename to src/common/gddebug.cc diff --git a/src/gddebug.hh b/src/common/gddebug.hh similarity index 100% rename from src/gddebug.hh rename to src/common/gddebug.hh diff --git a/src/globalbroadcaster.cc b/src/common/globalbroadcaster.cc similarity index 100% rename from src/globalbroadcaster.cc rename to src/common/globalbroadcaster.cc diff --git a/src/globalbroadcaster.hh b/src/common/globalbroadcaster.hh similarity index 100% rename from src/globalbroadcaster.hh rename to src/common/globalbroadcaster.hh diff --git a/src/base/globalregex.cc b/src/common/globalregex.cc similarity index 100% rename from src/base/globalregex.cc rename to src/common/globalregex.cc diff --git a/src/base/globalregex.hh b/src/common/globalregex.hh similarity index 100% rename from src/base/globalregex.hh rename to src/common/globalregex.hh diff --git a/src/htmlescape.cc b/src/common/htmlescape.cc similarity index 100% rename from src/htmlescape.cc rename to src/common/htmlescape.cc diff --git a/src/htmlescape.hh b/src/common/htmlescape.hh similarity index 100% rename from src/htmlescape.hh rename to src/common/htmlescape.hh diff --git a/src/iconv.cc b/src/common/iconv.cc similarity index 100% rename from src/iconv.cc rename to src/common/iconv.cc diff --git a/src/iconv.hh b/src/common/iconv.hh similarity index 100% rename from src/iconv.hh rename to src/common/iconv.hh diff --git a/src/inc_case_folding.hh b/src/common/inc_case_folding.hh similarity index 100% rename from src/inc_case_folding.hh rename to src/common/inc_case_folding.hh diff --git a/src/inc_diacritic_folding.hh b/src/common/inc_diacritic_folding.hh similarity index 100% rename from src/inc_diacritic_folding.hh rename to src/common/inc_diacritic_folding.hh diff --git a/src/mutex.cc b/src/common/mutex.cc similarity index 100% rename from src/mutex.cc rename to src/common/mutex.cc diff --git a/src/mutex.hh b/src/common/mutex.hh similarity index 100% rename from src/mutex.hh rename to src/common/mutex.hh diff --git a/src/sptr.hh b/src/common/sptr.hh similarity index 100% rename from src/sptr.hh rename to src/common/sptr.hh diff --git a/src/ufile.cc b/src/common/ufile.cc similarity index 100% rename from src/ufile.cc rename to src/common/ufile.cc diff --git a/src/ufile.hh b/src/common/ufile.hh similarity index 100% rename from src/ufile.hh rename to src/common/ufile.hh diff --git a/src/utf8.cc b/src/common/utf8.cc similarity index 100% rename from src/utf8.cc rename to src/common/utf8.cc diff --git a/src/utf8.hh b/src/common/utf8.hh similarity index 100% rename from src/utf8.hh rename to src/common/utf8.hh diff --git a/src/utils.cc b/src/common/utils.cc similarity index 100% rename from src/utils.cc rename to src/common/utils.cc diff --git a/src/utils.hh b/src/common/utils.hh similarity index 100% rename from src/utils.hh rename to src/common/utils.hh diff --git a/src/wstring.hh b/src/common/wstring.hh similarity index 100% rename from src/wstring.hh rename to src/common/wstring.hh diff --git a/src/wstring_qt.cc b/src/common/wstring_qt.cc similarity index 100% rename from src/wstring_qt.cc rename to src/common/wstring_qt.cc diff --git a/src/wstring_qt.hh b/src/common/wstring_qt.hh similarity index 100% rename from src/wstring_qt.hh rename to src/common/wstring_qt.hh diff --git a/src/dict/epwing.cc b/src/dict/epwing.cc index 0d5a6501..2a922c6d 100644 --- a/src/dict/epwing.cc +++ b/src/dict/epwing.cc @@ -25,7 +25,7 @@ #include "utf8.hh" #include "filetype.hh" #include "ftshelpers.hh" -#include "base/globalregex.hh" +#include "globalregex.hh" #include "sptr.hh" namespace Epwing { diff --git a/src/dict/mdx.cc b/src/dict/mdx.cc index 233c193c..1514f4f4 100644 --- a/src/dict/mdx.cc +++ b/src/dict/mdx.cc @@ -30,19 +30,17 @@ #include #endif -#include -#include -#include -#include -#include -#include -#include - -#include - +#include "globalregex.hh" #include "tiff.hh" #include "utils.hh" -#include "base/globalregex.hh" +#include +#include +#include +#include +#include +#include +#include +#include #include namespace Mdx diff --git a/src/ripemd.cc b/src/dict/ripemd.cc similarity index 100% rename from src/ripemd.cc rename to src/dict/ripemd.cc diff --git a/src/ripemd.hh b/src/dict/ripemd.hh similarity index 100% rename from src/ripemd.hh rename to src/dict/ripemd.hh diff --git a/src/ftshelpers.cc b/src/ftshelpers.cc index 452bf53d..6b993f34 100644 --- a/src/ftshelpers.cc +++ b/src/ftshelpers.cc @@ -21,7 +21,7 @@ #include "wildcard.hh" #include -#include "base/globalregex.hh" +#include "globalregex.hh" #include #include diff --git a/src/fulltextsearch.cc b/src/fulltextsearch.cc index ec392581..88e922f0 100644 --- a/src/fulltextsearch.cc +++ b/src/fulltextsearch.cc @@ -19,7 +19,7 @@ #include #endif -#include "base/globalregex.hh" +#include "globalregex.hh" namespace FTS { diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index e9dc21c3..127d9cec 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -39,7 +39,6 @@ #include "gddebug.hh" #include "dictinfo.hh" -#include "fsencoding.hh" #include "historypanewidget.hh" #include "utils.hh" #include @@ -47,7 +46,7 @@ #include "resourceschemehandler.hh" #include "keyboardstate.hh" -#include "base/globalregex.hh" +#include "globalregex.hh" #ifdef Q_OS_MAC #include "macos/macmouseover.hh"