2021-09-16 16:05:46 +08:00
|
|
|
|
|
|
|
#include "functypeconverter.h"
|
|
|
|
|
|
|
|
FuncTypeConverter::FuncTypeConverter()
|
|
|
|
{
|
|
|
|
m_metaModule = QMetaEnum::fromType<FuncTypeConverter::FunType>();
|
|
|
|
}
|
|
|
|
|
|
|
|
FuncTypeConverter::~FuncTypeConverter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QString FuncTypeConverter::keycodeTokeystring(int code){
|
|
|
|
//未匹配到则返回空
|
|
|
|
return m_metaModule.valueToKey(code);
|
|
|
|
}
|
|
|
|
|
|
|
|
int FuncTypeConverter::keystringTokeycode(QString string){
|
|
|
|
//QString to const char *
|
|
|
|
QByteArray ba = string.toUpper().toLocal8Bit(); const char * str = ba.data();
|
|
|
|
return m_metaModule.keyToValue(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 功能编码对应的功能名称
|
|
|
|
* @param code 功能编码
|
|
|
|
* @return 功能名称
|
|
|
|
*/
|
|
|
|
QString FuncTypeConverter::keycodeTokeyi18nstring(int code)
|
|
|
|
{
|
|
|
|
QString nameString;
|
|
|
|
switch (code) {
|
|
|
|
case BACKUP_SYSTEM:
|
|
|
|
nameString = tr("System Backup");
|
|
|
|
break;
|
|
|
|
case RESTORE_SYSTEM:
|
|
|
|
nameString = tr("System Recovery");
|
|
|
|
break;
|
|
|
|
case BACKUP_DATA:
|
|
|
|
nameString = tr("Data Backup");
|
|
|
|
break;
|
|
|
|
case RESTORE_DATA:
|
|
|
|
nameString = tr("Data Recovery");
|
|
|
|
break;
|
|
|
|
case OPERATION_LOG:
|
|
|
|
nameString = tr("Log Records");
|
|
|
|
break;
|
|
|
|
case GHOST_IMAGE:
|
|
|
|
nameString = tr("Ghost Image");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nameString;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 功能编码对应的主题图标名称
|
|
|
|
* @param code 功能编码
|
|
|
|
* @return 主题图标名称
|
|
|
|
*/
|
|
|
|
QString FuncTypeConverter::keycodeToThemeIconString(int code)
|
|
|
|
{
|
|
|
|
QString nameString;
|
|
|
|
switch (code) {
|
|
|
|
case BACKUP_SYSTEM:
|
2022-02-11 13:48:46 +08:00
|
|
|
nameString = "ukui-bf-system-backup-symbolic";
|
2021-09-16 16:05:46 +08:00
|
|
|
break;
|
|
|
|
case RESTORE_SYSTEM:
|
2022-02-11 13:48:46 +08:00
|
|
|
nameString = "ukui-bf-system-restore-symbolic";
|
2021-09-16 16:05:46 +08:00
|
|
|
break;
|
|
|
|
case BACKUP_DATA:
|
2022-02-11 13:48:46 +08:00
|
|
|
nameString = "ukui-bf-data-backup-symbolic";
|
2021-09-16 16:05:46 +08:00
|
|
|
break;
|
|
|
|
case RESTORE_DATA:
|
2022-02-11 13:48:46 +08:00
|
|
|
nameString = "ukui-bf-data-restore-symbolic";
|
2021-09-16 16:05:46 +08:00
|
|
|
break;
|
|
|
|
case OPERATION_LOG:
|
2022-06-29 17:34:08 +08:00
|
|
|
nameString = "ukui-catalogue-symbolic";
|
2021-09-16 16:05:46 +08:00
|
|
|
break;
|
|
|
|
case GHOST_IMAGE:
|
2022-02-11 13:48:46 +08:00
|
|
|
nameString = "ukui-bf-ghost-mirror-symbolic";
|
2021-09-16 16:05:46 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nameString;
|
|
|
|
}
|