#I9PIHN【需求28549】【次要】【主题制作工坊】【图标主题】界面多个位置显示英文

This commit is contained in:
like 2024-05-29 10:13:13 +08:00
parent 329be69271
commit 68aa2ed82d
3 changed files with 88 additions and 51 deletions

View File

@ -486,17 +486,15 @@ void IconThemeWidget::initPlaceandDeviceEditWidget()
m_placescrollArea->setWidget(viewportWidget);
QVBoxLayout *mainLayout = new QVBoxLayout(viewportWidget);
viewportWidget->setLayout(mainLayout);
// QMap<QString,QString>* appicon_name_CH = new QMap<QString,QString>;
// QList<QString> keys = m_placesiconpathmap->keys();
// appicon_name_CH = m_preview->initSystemIconName(appicon_name_CH,keys);
QMap<QString,QString>* placeicon_name_CH = new QMap<QString,QString>;
QList<QString> placekeys = m_placesiconpathmap->keys();
placeicon_name_CH = m_preview->initPlaceIconName(placeicon_name_CH,placekeys);
for (auto it = m_placesiconpathmap->begin(); it != m_placesiconpathmap->end(); ++it) {
const QString& widgetName = it.key();
const QString& filePath = it.value();
IconEditWidget* widget = new IconEditWidget(viewportWidget);
widget->setdefaulticon(filePath);
widget->setdefaulticonname(it.key());
widget->setdefaulticonname(placeicon_name_CH->value(it.key()));
widget->setProperty("widgetname",widgetName);
QPushButton *line = new QPushButton();
line->setDisabled(true);
@ -559,12 +557,16 @@ void IconThemeWidget::initPlaceandDeviceEditWidget()
});
}
QMap<QString,QString>* deviceicon_name_CH = new QMap<QString,QString>;
QList<QString> devicekeys = m_devicesiconpathmap->keys();
deviceicon_name_CH = m_preview->initDeviceIconName(deviceicon_name_CH,devicekeys);
for (auto it = m_devicesiconpathmap->begin(); it != m_devicesiconpathmap->end(); ++it) {
const QString& widgetName = it.key();
const QString& filePath = it.value();
IconEditWidget* widget = new IconEditWidget(viewportWidget);
widget->setdefaulticon(filePath);
widget->setdefaulticonname(it.key());
widget->setdefaulticonname(deviceicon_name_CH->value(it.key()));
widget->setProperty("widgetname",widgetName);
QPushButton *line = new QPushButton();
line->setDisabled(true);

View File

@ -373,6 +373,7 @@ void ImageWidget::updateIconMap(const QMap<QString, QString>* newIconMap, QStrin
for (const auto& pair : sortedList1) {
const QString& widgetName = pair.first;
const QString& filePath = pair.second;
const QString& translatedWidgetName = tr(widgetName.toUtf8().constData());
QPixmap pixmap(filePath);
if (!pixmap.isNull()) {
@ -384,7 +385,7 @@ void ImageWidget::updateIconMap(const QMap<QString, QString>* newIconMap, QStrin
item->setData(0, widgetName);
item->setData(1, filePath);
QGraphicsTextItem* textItem = scene->addText(widgetName);
QGraphicsTextItem* textItem = scene->addText(translatedWidgetName);
textItem->setPos(col * 160, row * 160 + 128);
QRectF textRect = textItem->boundingRect();
textItem->setPos(col * 160 + (128 - textRect.width()) / 2, row * 160 + 120);
@ -566,59 +567,91 @@ void ImageWidget::miniscale()
QMap<QString, QString> *ImageWidget::initIconName(QMap<QString, QString> *name_CH, QList<QString> keys)
{
name_CH->insert(keys[0],tr("生物特征管理工具"));
name_CH->insert(keys[1],tr("文件保护箱"));
name_CH->insert(keys[2],tr("刻录"));
name_CH->insert(keys[3],tr("天气"));
name_CH->insert(keys[4],tr("安全中心"));
name_CH->insert(keys[5],tr("闹钟"));
name_CH->insert(keys[6],tr("工具箱"));
name_CH->insert(keys[7],tr("计算器"));
name_CH->insert(keys[8],tr("摄像头"));
name_CH->insert(keys[9],tr("多端协同"));
name_CH->insert(keys[10],tr("字体管理器"));
name_CH->insert(keys[11],tr("安装器"));
name_CH->insert(keys[12],tr("飞书"));
name_CH->insert(keys[13],tr("日志查看器"));
name_CH->insert(keys[14],tr("音乐"));
name_CH->insert(keys[15],tr("新功能介绍"));
name_CH->insert(keys[16],tr("便签本"));
name_CH->insert(keys[17],tr("麒麟管家"));
name_CH->insert(keys[18],tr("看图"));
name_CH->insert(keys[19],tr("打印机"));
name_CH->insert(keys[20],tr("录音"));
name_CH->insert(keys[21],tr("截图"));
name_CH->insert(keys[22],tr("服务与支持"));
name_CH->insert(keys[23],tr("软件商店"));
name_CH->insert(keys[24],tr("U盘启动器"));
name_CH->insert(keys[25],tr("用户手册"));
name_CH->insert(keys[26],tr("影音"));
name_CH->insert(keys[27],tr("文件管理器"));
name_CH->insert(keys[28],tr("设置"));
name_CH->insert(keys[29],tr("系统监视器"));
name_CH->insert(keys[30],tr("终端"));
name_CH->insert(keys[31],tr("备份还原"));
name_CH->insert(keys[0],tr("biometric-manager"));
name_CH->insert(keys[1],tr("box-manager"));
name_CH->insert(keys[2],tr("burner"));
name_CH->insert(keys[3],tr("indicator-china-weather"));
name_CH->insert(keys[4],tr("ksc-defender"));
name_CH->insert(keys[5],tr("kylin-alarm-clock"));
name_CH->insert(keys[6],tr("kylin-assistant"));
name_CH->insert(keys[7],tr("kylin-calculator"));
name_CH->insert(keys[8],tr("kylin-camera"));
name_CH->insert(keys[9],tr("kylin-connectivity"));
name_CH->insert(keys[10],tr("kylin-font-viewer"));
name_CH->insert(keys[11],tr("kylin-installer"));
name_CH->insert(keys[12],tr("kylin-ipmsg"));
name_CH->insert(keys[13],tr("kylin-log-viewer"));
name_CH->insert(keys[14],tr("kylin-music"));
name_CH->insert(keys[15],tr("kylin-new-function-introduction"));
name_CH->insert(keys[16],tr("kylin-notebook"));
name_CH->insert(keys[17],tr("kylin-os-manager"));
name_CH->insert(keys[18],tr("kylin-photo-viewer"));
name_CH->insert(keys[19],tr("kylin-printer"));
name_CH->insert(keys[20],tr("kylin-recorder"));
name_CH->insert(keys[21],tr("kylin-screenshot"));
name_CH->insert(keys[22],tr("kylin-service-support"));
name_CH->insert(keys[23],tr("kylin-software-center"));
name_CH->insert(keys[24],tr("kylin-usb-creator"));
name_CH->insert(keys[25],tr("kylin-user-guide"));
name_CH->insert(keys[26],tr("kylin-video"));
name_CH->insert(keys[27],tr("system-file-manager"));
name_CH->insert(keys[28],tr("ukui-control-center"));
name_CH->insert(keys[29],tr("ukui-system-monitor"));
name_CH->insert(keys[30],tr("utilities-terminal"));
name_CH->insert(keys[31],tr("yhkylin-backup-tools"));
return name_CH;
}
QMap<QString, QString> *ImageWidget::initSystemIconName(QMap<QString, QString> *name_CH, QList<QString> keys)
{
name_CH->insert(keys[0],tr("账户"));
name_CH->insert(keys[1],tr("系统"));
name_CH->insert(keys[2],tr("设备"));
name_CH->insert(keys[3],tr("网络"));
name_CH->insert(keys[4],tr("个性化"));
name_CH->insert(keys[5],tr("时间和语言"));
name_CH->insert(keys[6],tr("更新"));
name_CH->insert(keys[7],tr("安全"));
name_CH->insert(keys[8],tr("应用"));
name_CH->insert(keys[9],tr("搜索"));
name_CH->insert(keys[10],tr("应用"));
name_CH->insert(keys[0],tr("kylin-settings-account"));
name_CH->insert(keys[1],tr("kylin-settings-system"));
name_CH->insert(keys[2],tr("kylin-settings-devices"));
name_CH->insert(keys[3],tr("kylin-settings-network"));
name_CH->insert(keys[4],tr("kylin-settings-personalized"));
name_CH->insert(keys[5],tr("kylin-settings-update"));
name_CH->insert(keys[6],tr("kylin-settings-datetime"));
name_CH->insert(keys[7],tr("kylin-settings-security"));
name_CH->insert(keys[8],tr("kylin-settings-application"));
name_CH->insert(keys[9],tr("kylin-settings-search"));
name_CH->insert(keys[10],tr("kylin-settings-commoninfo"));
return name_CH;
}
QMap<QString, QString> *ImageWidget::initPlaceIconName(QMap<QString, QString> *name_CH, QList<QString> keys)
{
name_CH->insert(keys[0],tr("document-open-recent"));
name_CH->insert(keys[1],tr("folder-documents"));
name_CH->insert(keys[2],tr("folder-download"));
name_CH->insert(keys[3],tr("folder-dropbox"));
name_CH->insert(keys[4],tr("folder-music"));
name_CH->insert(keys[5],tr("folder-open"));
name_CH->insert(keys[6],tr("folder-pictures"));
name_CH->insert(keys[7],tr("folder-publicshare"));
name_CH->insert(keys[8],tr("folder-templates"));
name_CH->insert(keys[9],tr("folder-videos"));
name_CH->insert(keys[10],tr("inode-directory"));
name_CH->insert(keys[11],tr("user-desktop"));
name_CH->insert(keys[12],tr("user-home"));
name_CH->insert(keys[13],tr("user-trash-full"));
name_CH->insert(keys[14],tr("user-trash"));
return name_CH;
}
QMap<QString, QString> *ImageWidget::initDeviceIconName(QMap<QString, QString> *name_CH, QList<QString> keys)
{
name_CH->insert(keys[0],tr("computer"));
name_CH->insert(keys[1],tr("cupsprinter"));
name_CH->insert(keys[2],tr("drive-harddisk"));
name_CH->insert(keys[3],tr("drive-removable-media-usb"));
name_CH->insert(keys[4],tr("input-keyboard"));
name_CH->insert(keys[5],tr("input-mouse"));
name_CH->insert(keys[6],tr("scanner"));
return name_CH;
}
/**
* @brief
*

View File

@ -86,6 +86,8 @@ public:
void miniscale();
QMap<QString, QString> *initIconName(QMap<QString, QString> *name_CH, QList<QString> keys);
QMap<QString, QString> *initSystemIconName(QMap<QString, QString> *name_CH, QList<QString> keys);
QMap<QString, QString> *initPlaceIconName(QMap<QString, QString> *name_CH, QList<QString> keys);
QMap<QString, QString> *initDeviceIconName(QMap<QString, QString> *name_CH, QList<QString> keys);
private:
const QMap<QString,QString>* m_iconMap;
QPixmap* image;