From ed03f2b9bff804cb6ece677aca5949f86b9252f6 Mon Sep 17 00:00:00 2001 From: Greedysky Date: Thu, 19 Jan 2023 20:59:50 +0800 Subject: [PATCH] refactor: Optimize common library module[500211] --- TTKCommon/ttknumberdefine.h | 10 +++-- TTKModule/TTKCore/ocrCoreKits/OCRCoreKits.pri | 1 + TTKModule/TTKCore/ocrCoreKits/ocrobject.h | 15 ++----- .../TTKCore/ocrCoreKits/ocrotherdefine.h | 39 +++++++++++++++++++ 4 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 TTKModule/TTKCore/ocrCoreKits/ocrotherdefine.h diff --git a/TTKCommon/ttknumberdefine.h b/TTKCommon/ttknumberdefine.h index 2f68466..8fe642a 100644 --- a/TTKCommon/ttknumberdefine.h +++ b/TTKCommon/ttknumberdefine.h @@ -43,7 +43,7 @@ #define MT_D2M (MT_D2H * MT_H2M) #define MT_D2S qint64(MT_D2M * MT_M2S) #define MT_D2MS qint64(MT_D2S * MT_S2MS) -// + #define MH_BS 1 @@ -71,7 +71,7 @@ #define MH_TB2KB qint64(MH_TB2MB * MH_MB2KB) #define MH_TB2B qint64(MH_TB2KB * MH_KB2B) #define MH_TB2BS qint64(MH_TB2B * MH_B2BS) -// + #define MA_0 0 #define MA_30 30 @@ -82,7 +82,7 @@ #define MA_180 180 #define MA_270 270 #define MA_360 360 -// + #define MB_0 0 #define MB_32 32 @@ -95,7 +95,9 @@ #define MB_500 500 #define MB_750 750 #define MB_1000 1000 -// +#define MV_MIN 0 +#define MV_MAX 100 + #endif // TTKNUMBERDEFINE_H diff --git a/TTKModule/TTKCore/ocrCoreKits/OCRCoreKits.pri b/TTKModule/TTKCore/ocrCoreKits/OCRCoreKits.pri index 57b1b72..ee5a7c0 100644 --- a/TTKModule/TTKCore/ocrCoreKits/OCRCoreKits.pri +++ b/TTKModule/TTKCore/ocrCoreKits/OCRCoreKits.pri @@ -21,6 +21,7 @@ INCLUDEPATH += $$PWD HEADERS += \ $$PWD/ocrbackgroundmanager.h \ $$PWD/ocrobject.h \ + $$PWD/ocrotherdefine.h \ $$PWD/ocrruntimemanager.h SOURCES += \ diff --git a/TTKModule/TTKCore/ocrCoreKits/ocrobject.h b/TTKModule/TTKCore/ocrCoreKits/ocrobject.h index 5cbc534..3033a3e 100644 --- a/TTKModule/TTKCore/ocrCoreKits/ocrobject.h +++ b/TTKModule/TTKCore/ocrCoreKits/ocrobject.h @@ -24,16 +24,13 @@ #include "ttkglobal.h" // -#define DOWNLOAD_DIR TTK_STRCAT("Downloads", TTK_SEPARATOR) -#define LANGUAGE_DIR TTK_STRCAT("GLanguage", TTK_SEPARATOR) - - #define DIR_PREFIX "dir" #define JPG_FILE_SUFFIX "jpg" #define EXE_FILE_SUFFIX "exe" #define COM_FILE_SUFFIX "com" + #define JPG_FILE TTK_STRCAT(TTK_DOT, JPG_FILE_SUFFIX) #define EXE_FILE TTK_STRCAT(TTK_DOT, EXE_FILE_SUFFIX) #define COM_FILE TTK_STRCAT(TTK_DOT, COM_FILE_SUFFIX) @@ -45,19 +42,15 @@ #define APP_EXE_NAME TTK_STRCAT(APP_NAME, EXE_FILE) +#define DOWNLOAD_DIR TTK_STRCAT("Downloads", TTK_SEPARATOR) +#define LANGUAGE_DIR TTK_STRCAT("GLanguage", TTK_SEPARATOR) + #define DOWNLOAD_DIR_FULL OCRObject::applicationPath() + TTK_PDIR + DOWNLOAD_DIR #define LANGUAGE_DIR_FULL OCRObject::applicationPath() + LANGUAGE_DIR #define WINDOW_WIDTH_MIN 850 #define WINDOW_HEIGHT_MIN 550 -// -#define DEFAULT_INDEX_LEVEL0 -1 -#define DEFAULT_INDEX_LEVEL1 -999 -#define DEFAULT_INDEX_LEVEL2 -888 -#define DEFAULT_INDEX_LEVEL3 -777 -#define DEFAULT_INDEX_LEVEL4 -666 -#define DEFAULT_INDEX_LEVEL5 -555 /*! @brief The namespace of the application object. diff --git a/TTKModule/TTKCore/ocrCoreKits/ocrotherdefine.h b/TTKModule/TTKCore/ocrCoreKits/ocrotherdefine.h new file mode 100644 index 0000000..fd2e0e2 --- /dev/null +++ b/TTKModule/TTKCore/ocrCoreKits/ocrotherdefine.h @@ -0,0 +1,39 @@ +#ifndef OCROTHERDEFINE_H +#define OCROTHERDEFINE_H + +/*************************************************************************** + * This file is part of the TTK OCR project + * Copyright (C) 2015 - 2023 Greedysky Studio + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; If not, see . + ***************************************************************************/ + +#include + +#define TTK_TIME_FORMAT "hh:mm" +#define TTK_STIME_FORMAT "hh:mm:ss" +#define TTK_YEAR_FORMAT "yyyy-MM-dd" +#define TTK_YEAR_TIME_FORMAT "yyyy-MM-dd hh:mm" +#define TTK_YEAR_STIME_FORMAT "yyyy-MM-dd hh:mm:ss" + +#define TTK_ITEM_SIZE_S 25 +#define TTK_ITEM_SIZE_M 30 +#define TTK_ITEM_SIZE_L 40 +#define TTK_ITEM_SIZE_XL 60 + +#define TTK_LOW_LEVEL -999 +#define TTK_NORMAL_LEVEL -1 +#define TTK_HIGH_LEVEL 999 + +#endif // OCROTHERDEFINE_H