添加设置界面图标

This commit is contained in:
yangjiaxuan 2023-06-01 17:18:46 +08:00
parent 5fa8480bf9
commit 12232a782d
12 changed files with 85 additions and 4 deletions

View File

@ -2,6 +2,17 @@
<qresource prefix="/translation">
<file>TwainUI_zh_CN.qm</file>
<file>TwainUI_zh_EN.qm</file>
<file>qt_zh_CN.qm</file>
<file>qt_zh_CN.qm</file>
</qresource>
<qresource prefix="/logo">
<file>image_rsc/logo/auge_logo.ico</file>
<file>image_rsc/logo/Cumtenn_logo.ico</file>
<file>image_rsc/logo/Hanvon_logo1.ico</file>
<file>image_rsc/logo/Lanxum_logo.ico</file>
<file>image_rsc/logo/logo.ico</file>
<file>image_rsc/logo/Microtek_logo.ico</file>
<file>image_rsc/logo/NoBrand_logo.ico</file>
<file>image_rsc/logo/RightWay_logo.ico</file>
<file>image_rsc/logo/uniscan.ico</file>
</qresource>
</RCC>

View File

@ -1,6 +1,7 @@
#include "hg_settingdialog.h"
#include <QDebug>
#include <QLatin1String>
#include <shlobj.h>
#include "cutpapertool.h"
#include "setpicclrtool.h"
#include "base/HGDef.h"
@ -44,12 +45,15 @@ hg_settingdialog::hg_settingdialog(SANE_Handle handle, const SANEAPI* saneApi, b
setAttribute(Qt::WA_DeleteOnClose, true);
setIcon();
HGChar cfgpath[512] = {0};
QString old;
HGBase_GetConfigPath(cfgpath, _countof(cfgpath) - 1);
HGBase_GetConfigPath(cfgpath, 512);
GetConfigPath(cfgpath, 512);
HGBase_CreateDir(cfgpath);
dev_que_.set_root_dir(cfgpath);
old = QString::fromStdString(cfgpath) + PATH_SYMBOL + "scanner.schm";
QString old = QString::fromStdString(cfgpath) + PATH_SYMBOL + "scanner.schm";
if(QFile::exists(old))
dev_que::update_old_cfg(old.toStdString().c_str());
@ -1587,6 +1591,54 @@ gb::sane_config_schm *hg_settingdialog::getCurScheme()
return cur_scheme_;
}
HGResult hg_settingdialog::GetConfigPath(HGChar* configPath, HGUInt maxLen)
{
if (NULL == configPath || 0 == maxLen)
{
return HGBASE_ERR_INVALIDARG;
}
const char *appName = "HuaGoScan";
#if defined(OEM_HANWANG)
appName = "HanvonScan";
#elif defined(OEM_LISICHENG)
appName = "LanxumScan";
#elif defined(OEM_CANGTIAN)
appName = "CumtennScan";
#elif defined(OEM_ZHONGJING)
appName = "MicrotekScan";
#elif defined(OEM_ZIGUANG)
appName = "UniScan";
#endif
#if defined(HG_CMP_MSC)
CHAR cfgPath[MAX_PATH] = { 0 };
BOOL ret = SHGetSpecialFolderPathA(NULL, cfgPath, CSIDL_APPDATA, FALSE);
if (!ret)
return HGBASE_ERR_FAIL;
if (cfgPath[strlen(cfgPath) - 1] != '\\')
strcat(cfgPath, "\\");
strcat(cfgPath, appName);
strcat(cfgPath, "\\Cfg\\");
#else
char cfgPath[512] = { 0 };
struct passwd* pw = getpwuid(getuid());
strcpy(cfgPath, pw->pw_dir);
if (cfgPath[strlen(cfgPath) - 1] != '/')
strcat(cfgPath, "/");
strcat(cfgPath, ".");
strcat(cfgPath, appName);
strcat(cfgPath, "/Cfg/");
#endif
if (maxLen < strlen(cfgPath) + 1)
return HGBASE_ERR_FAIL;
strcpy(configPath, cfgPath);
return HGBASE_ERR_OK;
}
//生成UTF-8编码的MD5值
QString hg_settingdialog::md5(QString key)
{
@ -1871,6 +1923,22 @@ void hg_settingdialog::apply_current_scheme(void)
{
dev_que::apply_scheme(&m_saneAPI, m_devHandle, cur_scheme_);
}
void hg_settingdialog::setIcon()
{
this->setWindowIcon(QIcon(":logo/image_rsc/logo/logo.ico"));
#if defined(OEM_HANWANG)
this->setWindowIcon(QIcon(":logo/image_rsc/logo/Hanvon_logo1.ico"));
#elif defined(OEM_LISICHENG)
this->setWindowIcon(QIcon(":logo/image_rsc/logo/Lanxum_logo.ico"));
#elif defined(OEM_CANGTIAN)
this->setWindowIcon(QIcon(":logo/image_rsc/logo/Cumtenn_logo.ico"));
#elif defined(OEM_ZHONGJING)
this->setWindowIcon(QIcon(":logo/image_rsc/logo/Microtek_logo.ico"));
#elif defined(OEM_ZIGUANG)
this->setWindowIcon(QIcon(":logo/image_rsc/logo/uniscan.ico"));
#endif
}
std::string sane_val_to_string(const char* val, SANE_Value_Type type)
{
char buf[128] = {0};

View File

@ -94,6 +94,7 @@ private:
QSettings *m_configIniRead;
private:
HGResult GetConfigPath(HGChar* configPath, HGUInt maxLen);
QString md5(QString key);
const void* find_option_description(int id); // return const SANE_Option_Descriptor* pointer
const void* find_option_description(const std::string& title, int* id); // return const SANE_Option_Descriptor* pointer
@ -105,6 +106,7 @@ private:
void cancel_setting(void);
std::string getAppVersion();
void apply_current_scheme(void);
void setIcon();
private:
QVector<QPair<QPair<int, QVariant>, QString>> m_list_IdValueTitle;

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB