From 9a7f888ff21af84cfadf13982ebec40271bc6c54 Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Thu, 17 Oct 2024 16:35:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build2/qt/HGSolutionWin.pro | 8 ++- sdk/webscan/WebUser.cpp | 104 ++++++++++++++++++------------------ sdk/webscan/WebUser.h | 2 +- 3 files changed, 59 insertions(+), 55 deletions(-) diff --git a/build2/qt/HGSolutionWin.pro b/build2/qt/HGSolutionWin.pro index 415bb425..72c7ac54 100644 --- a/build2/qt/HGSolutionWin.pro +++ b/build2/qt/HGSolutionWin.pro @@ -14,7 +14,8 @@ SUBDIRS += \ HGUpgrade \ HGFWUpgrade \ HGScanner2 \ - HGScanTool + HGScanTool \ + HGWebScan HGImgFmt.depends = \ HGBase @@ -67,3 +68,8 @@ HGScanTool.depends = \ HGBase \ HGImgFmt \ HGImgProc + +HGWebScan.depends = \ + HGBase \ + HGImgFmt \ + HGImgProc diff --git a/sdk/webscan/WebUser.cpp b/sdk/webscan/WebUser.cpp index bb7fc657..5e49e1aa 100644 --- a/sdk/webscan/WebUser.cpp +++ b/sdk/webscan/WebUser.cpp @@ -982,57 +982,7 @@ void WebUser::ScanNew(const std::string& devName, const std::string& devParam) if (NULL != m_devHandle) { - cJSON* json = cJSON_Parse(devParam.c_str()); - if (NULL != json) - { - cJSON* p = json->child; - while (NULL != p) - { - if (0 == strcmp(p->string, "filepath")) - { - char filePath[260]; - HGBase_StandardiseFileName(p->valuestring, filePath, 260); - m_filepath = filePath; -#ifdef _WIN32 - if (m_filepath[m_filepath.size() - 1] != '\\') - m_filepath.push_back('\\'); -#else - if (m_filepath[m_filepath.size() - 1] != '/') - m_filepath.push_back('/'); -#endif - } - else if (0 == strcmp(p->string, "fileprefix")) - m_fileprefix = p->valuestring; - else if (0 == strcmp(p->string, "deletefilesbeforescan")) - m_deletefilesbeforescan = p->valuestring; - else if (0 == strcmp(p->string, "filetype")) - m_filetype = p->valuestring; - else if (0 == strcmp(p->string, "showbase64")) - m_showbase64 = p->valuestring; - else if (0 == strcmp(p->string, "source")) - m_source = p->valuestring; - else if (0 == strcmp(p->string, "mode")) - m_mode = p->valuestring; - else if (0 == strcmp(p->string, "resolution")) - m_resolution = p->valuestring; - else if (0 == strcmp(p->string, "page-auto")) - m_pageauto = p->valuestring; - else if (0 == strcmp(p->string, "paper-size")) - m_papersize = p->valuestring; - else if (0 == strcmp(p->string, "blank-page-skip")) - m_blankpageskip = p->valuestring; - else if (0 == strcmp(p->string, "blank-page-skip-sensitivity")) - m_blankpageskipsensitivity = p->valuestring; - else if (0 == strcmp(p->string, "multifeed-detection")) - m_multifeeddetection = p->valuestring; - - p = p->next; - } - - cJSON_Delete(json); - } - - SetParam(); + SetParam(devParam); HGBase_CreateEvent(HGFALSE, HGFALSE, &m_scanEvent); assert(NULL != m_scanEvent); @@ -1896,9 +1846,57 @@ void WebUser::ClearPath(const std::string& path) #endif } -void WebUser::SetParam() +void WebUser::SetParam(const std::string& devParam) { - // Set Param + cJSON* json = cJSON_Parse(devParam.c_str()); + if (NULL != json) + { + cJSON* p = json->child; + while (NULL != p) + { + if (0 == strcmp(p->string, "filepath")) + { + char filePath[260]; + HGBase_StandardiseFileName(p->valuestring, filePath, 260); + m_filepath = filePath; +#ifdef _WIN32 + if (m_filepath[m_filepath.size() - 1] != '\\') + m_filepath.push_back('\\'); +#else + if (m_filepath[m_filepath.size() - 1] != '/') + m_filepath.push_back('/'); +#endif + } + else if (0 == strcmp(p->string, "fileprefix")) + m_fileprefix = p->valuestring; + else if (0 == strcmp(p->string, "deletefilesbeforescan")) + m_deletefilesbeforescan = p->valuestring; + else if (0 == strcmp(p->string, "filetype")) + m_filetype = p->valuestring; + else if (0 == strcmp(p->string, "showbase64")) + m_showbase64 = p->valuestring; + else if (0 == strcmp(p->string, "source")) + m_source = p->valuestring; + else if (0 == strcmp(p->string, "mode")) + m_mode = p->valuestring; + else if (0 == strcmp(p->string, "resolution")) + m_resolution = p->valuestring; + else if (0 == strcmp(p->string, "page-auto")) + m_pageauto = p->valuestring; + else if (0 == strcmp(p->string, "paper-size")) + m_papersize = p->valuestring; + else if (0 == strcmp(p->string, "blank-page-skip")) + m_blankpageskip = p->valuestring; + else if (0 == strcmp(p->string, "blank-page-skip-sensitivity")) + m_blankpageskipsensitivity = p->valuestring; + else if (0 == strcmp(p->string, "multifeed-detection")) + m_multifeeddetection = p->valuestring; + + p = p->next; + } + + cJSON_Delete(json); + } if (m_mode == "Lineart") { diff --git a/sdk/webscan/WebUser.h b/sdk/webscan/WebUser.h index cbfb865c..267cb23b 100644 --- a/sdk/webscan/WebUser.h +++ b/sdk/webscan/WebUser.h @@ -59,7 +59,7 @@ private: static std::string GetBase64(const std::string& filePath); static std::string GetBase64(const HGByte* data, HGUInt size); static void ClearPath(const std::string &path); - void SetParam(); + void SetParam(const std::string& devParam); HGBool SetParam(const char* optionName, const HGVoid* data); bool ShakeHand(const std::string& head);