370 lines
8.3 KiB
C++
370 lines
8.3 KiB
C++
#include "UiConfig.h"
|
|
#include <QVector>
|
|
#include <QDebug>
|
|
|
|
|
|
const int UiConfig::GLOBAL_FONT_SIZE[SUPPORT_SCREEN_SIZE_QUANTITY] = {11, 20, 20, 8, 8};
|
|
|
|
const QString UiConfig::WELCOME[SUPPORT_SCREEN_SIZE_QUANTITY] = {
|
|
":/res/image/start-600-1024.jpg",
|
|
":/res/image/start-800-1280.jpg",
|
|
":/res/image/start-720-1280.jpg",
|
|
":/res/image/start-800-1280.jpg",
|
|
":/res/image/start-720-1280.jpg"
|
|
};
|
|
|
|
|
|
const QString UiConfig::LANGUAGE_FILE[SUPPORT_LANGUAGE_QUANTITY] = {
|
|
"", "FaceTick_TC.qm", "FaceTick_EN.qm", "FaceTick_JP.qm", "FaceTick_KR.qm",
|
|
"FaceTick_SP.qm", "FaceTick_TH.qm", "FaceTick_PT.qm", "FaceTick_IT.qm", "FaceTick_IW.qm",
|
|
"FaceTick_FR.qm", "FaceTick_DE.qm", "FaceTick_TR.qm", "FaceTick_HU.qm"};
|
|
const int UiConfig::DEV_NAME_FONT_SIZE[SUPPORT_SCREEN_SIZE_QUANTITY][SUPPORT_LANGUAGE_QUANTITY] = {
|
|
{25, 25, 15, 25, 25, 15, 25, 15, 15, 15, 15, 15, 15, 15},
|
|
{50, 50, 30, 50, 50, 30, 50, 30, 30, 30, 30, 30, 30, 30},
|
|
{50, 50, 30, 50, 50, 30, 50, 30, 30, 30, 30, 30, 30, 30},
|
|
{20, 20, 12, 20, 20, 12, 20, 12, 12, 12, 12, 12, 12, 12},
|
|
{20, 20, 12, 20, 20, 12, 20, 12, 12, 12, 12, 12, 12, 12}
|
|
};
|
|
const int UiConfig::MASK_FONT_SIZE[SUPPORT_SCREEN_SIZE_QUANTITY][SUPPORT_LANGUAGE_QUANTITY] = {
|
|
{20, 20, 14, 12, 20, 12, 12, 12, 8, 12, 12, 14, 12, 12},
|
|
{40, 40, 28, 24, 40, 24, 24, 26, 18, 24, 24, 28, 24, 24},
|
|
{40, 40, 28, 24, 40, 24, 24, 26, 18, 24, 24, 28, 24, 24},
|
|
{15, 15, 10, 9, 12, 10, 10, 8, 7, 10, 10, 11, 10, 8},
|
|
{15, 15, 10, 9, 12, 10, 10, 8, 7, 10, 10, 11, 10, 8}
|
|
};
|
|
const int UiConfig::PERSON_MSG_FONT_SIZE[SUPPORT_SCREEN_SIZE_QUANTITY][SUPPORT_LANGUAGE_QUANTITY] = {
|
|
{20, 20, 14, 15, 12, 15, 14, 13, 9, 12, 10, 13, 13, 9},
|
|
{40, 40, 28, 30, 24, 30, 28, 26, 19, 26, 22, 26, 26, 19},
|
|
{40, 40, 28, 30, 24, 30, 28, 26, 19, 26, 22, 26, 26, 19},
|
|
{14, 15, 9, 10, 10, 12, 11, 8, 8, 10, 6, 8, 10, 8},
|
|
{15, 15, 9, 10, 10, 12, 11, 8, 8, 10, 6, 8, 10, 8}
|
|
};
|
|
|
|
const long long UiConfig::UI_VERSION = 202011171553;
|
|
|
|
UiConfig* UiConfig::m_instance = nullptr;
|
|
|
|
UiConfig* UiConfig::GetInstance()
|
|
{
|
|
if( m_instance == nullptr )
|
|
{
|
|
m_instance = new UiConfig();
|
|
}
|
|
return m_instance;
|
|
}
|
|
|
|
UiConfig::UiConfig()
|
|
{
|
|
m_languageType = 0;
|
|
memset(m_recoUiTunningFontSize, 0, sizeof(m_recoUiTunningFontSize));
|
|
}
|
|
|
|
UiConfig::~UiConfig()
|
|
{
|
|
|
|
}
|
|
|
|
void UiConfig::setUiConfig(const ScreenSize_E config)
|
|
{
|
|
m_screenSize = config;
|
|
if(ScreenSize_7inch == config){ //haiqing 7inch
|
|
m_screenWidth = 600;
|
|
m_screenHeight = 1024;
|
|
}
|
|
else if(ScreenSize_8inch == config || ScreenSize_8inch_rk == config){
|
|
m_screenWidth = 800;
|
|
m_screenHeight = 1280;
|
|
}
|
|
else if(ScreenSize_5inch == config || ScreenSize_5inch_rk == config){
|
|
m_screenWidth = 720;
|
|
m_screenHeight = 1280;
|
|
}
|
|
else {
|
|
//nop
|
|
}
|
|
}
|
|
|
|
void UiConfig::setUiFaceFrameSize(const FaceFrameSize_E config)
|
|
{
|
|
m_faceFrameSize = config;
|
|
}
|
|
|
|
int UiConfig::getUiWidth() const
|
|
{
|
|
return m_screenWidth;
|
|
}
|
|
|
|
int UiConfig::getUiHeight() const
|
|
{
|
|
return m_screenHeight;
|
|
}
|
|
|
|
const QString& UiConfig::getWelcome() const
|
|
{
|
|
return WELCOME[(int)m_screenSize];
|
|
}
|
|
|
|
#if 0
|
|
bool UiConfig::is7inch() const
|
|
{
|
|
return (ScreenSize_7inch == m_screenSize);
|
|
}
|
|
|
|
bool UiConfig::is8inch() const
|
|
{
|
|
return (ScreenSize_8inch == m_screenSize);
|
|
}
|
|
|
|
bool UiConfig::is5inch() const
|
|
{
|
|
return (ScreenSize_5inch == m_screenSize);
|
|
}
|
|
#endif
|
|
|
|
bool UiConfig::is8inchA038HaimanFaceFrame() const
|
|
{
|
|
return FaceFrameSize_8inchHaiman_A038 == m_faceFrameSize;
|
|
}
|
|
|
|
bool UiConfig::is8inchA038JinggongFaceFrame() const
|
|
{
|
|
return FaceFrameSize_8inchJinggong_A038 == m_faceFrameSize;
|
|
}
|
|
|
|
int UiConfig::getScreenConfigIndex() const
|
|
{
|
|
return static_cast<int>(m_screenSize);
|
|
}
|
|
|
|
int UiConfig::getGlobalFontSize() const
|
|
{
|
|
return GLOBAL_FONT_SIZE[static_cast<int>(m_screenSize)];
|
|
}
|
|
|
|
int UiConfig::setLanguageType(const int type)
|
|
{
|
|
m_languageType = type;
|
|
return 0;
|
|
}
|
|
|
|
int UiConfig::getLanguageType() const
|
|
{
|
|
return m_languageType;
|
|
}
|
|
|
|
#ifdef CUSTOM_QRCODE_AREA //自定义扫描框
|
|
|
|
int UiConfig::getQRCodeAreaCoordinateX() const
|
|
{
|
|
return m_QRCodeAreaX;
|
|
}
|
|
|
|
int UiConfig::getQRCodeAreaCoordinateY() const
|
|
{
|
|
return m_QRCodeAreaY;
|
|
}
|
|
|
|
int UiConfig::getQRCodeAreaWidth() const
|
|
{
|
|
return (m_screenWidth - (m_QRCodeAreaX * 2));
|
|
}
|
|
|
|
int UiConfig::getQRCodeAreaHeight() const
|
|
{
|
|
//区域为正方形
|
|
return getQRCodeAreaWidth();
|
|
}
|
|
|
|
void UiConfig::setQRCodeAreaCoordinateX(const int x)
|
|
{
|
|
m_QRCodeAreaX = x;
|
|
}
|
|
|
|
void UiConfig::setQRCodeAreaCoordinateY(const int y)
|
|
{
|
|
m_QRCodeAreaY = y;
|
|
}
|
|
|
|
#else
|
|
|
|
int UiConfig::getQRCodeAreaCoordinateX() const
|
|
{
|
|
return QRCODE_AREA_COORDINATE_X;
|
|
}
|
|
|
|
int UiConfig::getQRCodeAreaCoordinateY() const
|
|
{
|
|
return QRCODE_AREA_COORDINATE_Y;
|
|
}
|
|
|
|
int UiConfig::getQRCodeAreaWidth() const
|
|
{
|
|
return (m_screenWidth - (QRCODE_AREA_COORDINATE_X * 2));
|
|
}
|
|
|
|
int UiConfig::getQRCodeAreaHeight() const
|
|
{
|
|
//区域为正方形
|
|
return getQRCodeAreaWidth();
|
|
//return (m_screenHeight - (QRCODE_AREA_COORDINATE_Y * 2));
|
|
}
|
|
|
|
#endif
|
|
|
|
void UiConfig::setHardwareTesting(bool sw)
|
|
{
|
|
m_bIsHardwareTesting = sw;
|
|
}
|
|
|
|
bool UiConfig::getHardwareTesting() const
|
|
{
|
|
return m_bIsHardwareTesting;
|
|
}
|
|
|
|
void UiConfig::showFaceFrameByTempExist(bool set)
|
|
{
|
|
m_bShowFaceFrame = set;
|
|
}
|
|
|
|
bool UiConfig::isFaceFrameShowByTempExist() const
|
|
{
|
|
return m_bShowFaceFrame;
|
|
}
|
|
|
|
void UiConfig::setTpAvailable(bool available)
|
|
{
|
|
m_bTpAvailable = available;
|
|
}
|
|
|
|
bool UiConfig::isTpAvailable() const
|
|
{
|
|
return m_bTpAvailable;
|
|
}
|
|
|
|
void UiConfig::setfuncNotSupport(Func_E func)
|
|
{
|
|
if(func < sizeof(m_ullfuncNotSupp) * 8){
|
|
m_ullfuncNotSupp |= (1 << func);
|
|
}
|
|
}
|
|
|
|
bool UiConfig::isFuncNotSupport(Func_E func) const
|
|
{
|
|
if(func < sizeof(m_ullfuncNotSupp) * 8){
|
|
return (bool)(m_ullfuncNotSupp & (1 << func));
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void UiConfig::setRecoUiStyle(int style) {
|
|
if (style >= 0) {
|
|
m_recoUiStyle = style;
|
|
}
|
|
}
|
|
|
|
bool UiConfig::isRecoUiStyleClassical() const
|
|
{
|
|
return (0 == m_recoUiStyle);
|
|
}
|
|
|
|
bool UiConfig::isRecoUiStyleStandard() const
|
|
{
|
|
return (1 == m_recoUiStyle);
|
|
}
|
|
|
|
bool UiConfig::isRecoUiStyleColor() const
|
|
{
|
|
return (2 == m_recoUiStyle);
|
|
}
|
|
|
|
bool UiConfig::isRecoUiStyleAd() const
|
|
{
|
|
return (3 == m_recoUiStyle);
|
|
}
|
|
|
|
bool UiConfig::isRecoUiStyleScene() const
|
|
{
|
|
return (4 == m_recoUiStyle);
|
|
}
|
|
|
|
|
|
#if 0
|
|
void UiConfig::setRecoUiFontSizeScale(int sizeType)
|
|
{
|
|
m_recoUiFontSizeType = sizeType;
|
|
}
|
|
|
|
float UiConfig::recoUiFontSizeScale() const
|
|
{
|
|
const QVector<float> scales{1.0f, 1.25f, 1.5f};
|
|
return m_recoUiFontSizeType < scales.size() ? scales[m_recoUiFontSizeType] : 1.0f;
|
|
}
|
|
#endif
|
|
|
|
void UiConfig::setRecoUiFontSize(unsigned index, int size)
|
|
{
|
|
if(index < sizeof (m_recoUiTunningFontSize) / sizeof (m_recoUiTunningFontSize[0])){
|
|
m_recoUiTunningFontSize[index] = size;
|
|
}
|
|
}
|
|
|
|
int UiConfig::recoUiFontSize(unsigned index) const
|
|
{
|
|
if(index < sizeof (m_recoUiTunningFontSize) / sizeof (m_recoUiTunningFontSize[0])){
|
|
return m_recoUiTunningFontSize[index];
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int UiConfig::setRecoUITextCfg(RecoUiTextCfg::enTextType type, RecoUiTextCfg::enDisMode mode, const char* cusText, RecoUiTextCfg::enFontSize fontSize)
|
|
{
|
|
m_textCfg[type].m_mode = mode;
|
|
m_textCfg[type].m_cusText = cusText;
|
|
m_textCfg[type].m_fontSize = fontSize;
|
|
return 0;
|
|
}
|
|
|
|
float UiConfig::recoUiTextCfgFontSize(RecoUiTextCfg::enTextType type)
|
|
{
|
|
const float scales[] = {1.0f, 1.2f, 0.8f, 1.4f};
|
|
return scales[UiConfig::GetInstance()->m_textCfg[type].m_fontSize];
|
|
}
|
|
|
|
void UiConfig::setDefaultScreensaver(int index)
|
|
{
|
|
m_defaultScreensaver = index;
|
|
}
|
|
|
|
int UiConfig::defaultScreensaver() const
|
|
{
|
|
return m_defaultScreensaver;
|
|
}
|
|
|
|
bool UiConfig::isRkDevice() const
|
|
{
|
|
return (ScreenSize_8inch_rk == m_screenSize || ScreenSize_5inch_rk == m_screenSize);
|
|
}
|
|
|
|
void UiConfig::setDevTestStatus(bool test)
|
|
{
|
|
m_isDevTesting = test;
|
|
}
|
|
|
|
bool UiConfig::isDevTesting() const
|
|
{
|
|
return m_isDevTesting;
|
|
}
|
|
|
|
void UiConfig::setFastCfgStatus(bool cfg)
|
|
{
|
|
m_isFastCfging = cfg;
|
|
}
|
|
|
|
bool UiConfig::isFastCfging() const
|
|
{
|
|
return m_isFastCfging;
|
|
}
|
|
|
|
|
|
|