From 5f00061f319258f2fe17be2db0246045cc78e31b Mon Sep 17 00:00:00 2001 From: likehomedream Date: Thu, 2 Nov 2023 11:31:20 +0800 Subject: [PATCH 1/2] add translations --- kylin-theme-builder.pro | 7 +- src/fileProcess/filecheck.cpp | 8 +- src/main.cpp | 7 +- src/maininterface.cpp | 6 + src/mainwindow.cpp | 12 +- src/module/cursorthemewidget.cpp | 2 +- src/module/globalthemewidget.cpp | 32 +-- src/module/historywidget.cpp | 4 +- src/module/iconthemewidget.cpp | 6 +- src/module/infocreatewidget.cpp | 28 +-- src/titlebar.cpp | 8 +- translation/themebuilder_en_US.qm | Bin 0 -> 23 bytes translation/themebuilder_en_US.ts | 313 ++++++++++++++++++++++++++++++ translation/themebuilder_zh_CN.qm | Bin 0 -> 3695 bytes translation/themebuilder_zh_CN.ts | 313 ++++++++++++++++++++++++++++++ 15 files changed, 695 insertions(+), 51 deletions(-) create mode 100644 translation/themebuilder_en_US.qm create mode 100644 translation/themebuilder_en_US.ts create mode 100644 translation/themebuilder_zh_CN.qm create mode 100644 translation/themebuilder_zh_CN.ts diff --git a/kylin-theme-builder.pro b/kylin-theme-builder.pro index 5878063..70cf06f 100644 --- a/kylin-theme-builder.pro +++ b/kylin-theme-builder.pro @@ -80,4 +80,9 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin RESOURCES += \ resource.qrc -DISTFILES += +DISTFILES += \ + translation/themebuilder_en_US.qm \ + translation/themebuilder_zh_CN.qm + +TRANSLATIONS += translation/themebuilder_zh_CN.ts \ + translation/themebuilder_en_US.ts \ diff --git a/src/fileProcess/filecheck.cpp b/src/fileProcess/filecheck.cpp index ab7472d..9f3c02b 100644 --- a/src/fileProcess/filecheck.cpp +++ b/src/fileProcess/filecheck.cpp @@ -28,22 +28,22 @@ bool FileCheck::isLegalWallPaperFile(const QString& filePath, const QString& typ if (type == "wallpaper") { if (imageSize.width() != 3840 || imageSize.height() != 2160){ - QMessageBox::information(nullptr, tr("错误"), tr("壁纸尺寸必须为3840x2160")); + QMessageBox::information(nullptr, tr("error"), tr("The wallpaper size must be 3840x2160")); return false; } qint64 maxSize = 10 * 1024 * 1024; // 10 MB if (fileSize > maxSize){ - QMessageBox::information(nullptr, tr("错误"), tr("文件大小不能超过10MB")); + QMessageBox::information(nullptr, tr("error"), tr("The file size cannot exceed 10MB")); return false; } } else if (type == "cover") { if (imageSize.width() != 1640 || imageSize.height() != 1080){ - QMessageBox::information(nullptr, tr("错误"), tr("封面尺寸必须为1640x1080")); + QMessageBox::information(nullptr, tr("error"), tr("Cover size must be 1640x1080")); return false; } qint64 maxSize = 5 * 1024 * 1024; // 5 MB if (fileSize > maxSize){ - QMessageBox::information(nullptr, tr("错误"), tr("文件大小不能超过5MB")); + QMessageBox::information(nullptr, tr("error"), tr("The file size cannot exceed 5MB")); return false; } } diff --git a/src/main.cpp b/src/main.cpp index 6aef901..354b028 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,13 @@ #include "mainwindow.h" - +#include +#include +#include int main(int argc, char *argv[]) { QApplication a(argc, argv); + QTranslator translator; + translator.load("../kylin-theme-builder/translation/themebuilder_zh_CN.qm"); + qApp->installTranslator(&translator); MainWindow w; w.show(); return a.exec(); diff --git a/src/maininterface.cpp b/src/maininterface.cpp index 9cc5d55..4c16bff 100644 --- a/src/maininterface.cpp +++ b/src/maininterface.cpp @@ -122,12 +122,18 @@ void MainInterface::initLeftBar() QButtonGroup *bootbuttonGroup = new QButtonGroup(m_navigationwidget); m_globalbtn = new TypeButton(m_navigationwidget); + m_globalbtn->setText(tr("GlobalTheme")); m_iconbtn = new TypeButton(m_navigationwidget); + m_iconbtn->setText(tr("IconTheme")); m_cursorbtn = new TypeButton(m_navigationwidget); + m_cursorbtn->setText(tr("CursorTheme")); m_plymouthbtn = new TypeButton(m_navigationwidget); + m_plymouthbtn->setText(tr("PlymouthTheme")); m_grubbtn = new TypeButton(m_navigationwidget); + m_grubbtn->setText(tr("GrubTheme")); m_buildbtn = new QPushButton(m_navigationwidget); + m_buildbtn->setText(tr("Start Building")); buttonGroup->addButton(m_globalbtn); buttonGroup->addButton(m_iconbtn); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 24bc3c3..b49c388 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -68,10 +68,10 @@ void MainWindow::initUI() QHBoxLayout *labellayout = new QHBoxLayout(); QLabel *Label = new QLabel(m_guideWidget); - Label->setText("主题打包上传工具 "); + Label->setText(tr("kylin-theme-builder")); // QPushButton *guideLabel = new QPushButton(m_guideWidget); QLabel *guideLabel = new QLabel(m_guideWidget); - QString str = "" + tr("使用指南") + ""; + QString str = "" + tr("User guide") + ""; guideLabel->setText(str); guideLabel->setTextFormat(Qt::RichText); guideLabel->setCursor(Qt::PointingHandCursor); @@ -102,13 +102,13 @@ void MainWindow::initUI() } QIcon icon = QIcon(QPixmap(":/resource/background/homepage-global.png")); - m_globalbtn->setEntry(icon,"全局主题"); + m_globalbtn->setEntry(icon,tr("Global Theme")); QIcon icon1 = QIcon(QPixmap(":/resource/background/homepage-icons.png")); - m_iconbtn->setEntry(icon1,"图标主题"); + m_iconbtn->setEntry(icon1,tr("Icon Theme")); QIcon icon2 = QIcon(QPixmap(":/resource/background/homepage-cursor.png")); - m_cursorbtn->setEntry(icon2,"光标主题"); + m_cursorbtn->setEntry(icon2,tr("Cursor Theme")); QIcon icon3 = QIcon(QPixmap(":/resource/background/homepage-boot.png")); - m_bootbtn->setEntry(icon3,"启动个性化"); + m_bootbtn->setEntry(icon3,tr("Boot Theme")); m_entrywidget->setLayout(alllayout); QScrollArea* scrollArea = new QScrollArea; diff --git a/src/module/cursorthemewidget.cpp b/src/module/cursorthemewidget.cpp index a4fb146..e768050 100644 --- a/src/module/cursorthemewidget.cpp +++ b/src/module/cursorthemewidget.cpp @@ -116,7 +116,7 @@ void CursorThemeWidget::initRightWidget() if (clickedButton) { CursorEditWidget* clickedWidget = qobject_cast(clickedButton->parentWidget()); if (clickedWidget) { - QString newFilePath = QFileDialog::getOpenFileName(this, tr("选择SVG文件"), "", tr("SVG 文件 (*.svg)")); + QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), "", tr("SVG file (*.svg)")); if (!newFilePath.isEmpty()) { if (m_iconpathmap->contains(widgetName)) { diff --git a/src/module/globalthemewidget.cpp b/src/module/globalthemewidget.cpp index 0e6405d..4a4eb79 100644 --- a/src/module/globalthemewidget.cpp +++ b/src/module/globalthemewidget.cpp @@ -89,7 +89,7 @@ void GlobalThemeWidget::initCoverWidget() if(m_info.isEdit){ title->setText("111111111111111111111111"); }else{ - title->setText("全局主题效果图"); + title->setText(tr("Overall theme rendering")); } QVBoxLayout *layout = new QVBoxLayout(); @@ -112,7 +112,7 @@ void GlobalThemeWidget::initCoverWidget() cover->setLayout(coverlayout); connect(m_coverbtn, &QPushButton::clicked, this, [=]() { - QString newFilePath = QFileDialog::getOpenFileName(this, tr("选择图片文件"), "", tr("图片文件 (*.png *.jpg)")); + QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)")); bool legalFile = FileCheck::isLegalWallPaperFile(newFilePath,"cover"); if (newFilePath.isEmpty() || !legalFile) { @@ -138,7 +138,7 @@ void GlobalThemeWidget::initWallPaperWidget() m_wallpaperwidget = new QWidget(m_viewportwidget); m_wallpaperwidget->setFixedHeight(182); QLabel *title = new QLabel(m_wallpaperwidget); - title->setText("全局主题效果图"); + title->setText(tr("Desktop wallpaper")); QVBoxLayout *layout = new QVBoxLayout(); QWidget *cover = new QWidget(m_wallpaperwidget); @@ -158,7 +158,7 @@ void GlobalThemeWidget::initWallPaperWidget() wallpaperbtn->setIconSize(wallpaperbtn->size()); connect(wallpaperbtn, &QPushButton::clicked, this, [=]() { - QString newFilePath = QFileDialog::getOpenFileName(this, tr("选择图片文件"), "", tr("图片文件 (*.png *.jpg)")); + QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)")); if (!newFilePath.isEmpty() && FileCheck::isLegalWallPaperFile(newFilePath,"wallpaper")) { updateWallpaperFilePath(newFilePath); @@ -186,12 +186,12 @@ void GlobalThemeWidget::initExteriorWidget() m_exteriorwidget->setFixedHeight(65); QLabel *title = new QLabel(m_exteriorwidget); title->setFixedWidth(m_exteriorwidget->width()); - title->setText("窗口外观"); + title->setText(tr("Window appearance")); QHBoxLayout *layout = new QHBoxLayout(); QComboBox *combobox = new QComboBox(m_exteriorwidget); - combobox->addItem("浅色",QColor(255, 255, 255)); - combobox->addItem("深色", QColor(29, 29, 29)); + combobox->addItem(tr("light"),QColor(255, 255, 255)); + combobox->addItem(tr("dark"), QColor(29, 29, 29)); connect(combobox, QOverload::of(&QComboBox::currentIndexChanged), this, [=](int index){ QColor selectedColor = combobox->itemData(index).value(); QString overlayImage; @@ -221,7 +221,7 @@ void GlobalThemeWidget::initFilletWidget() m_filletwidget->setFixedHeight(65); QLabel *title = new QLabel(m_filletwidget); title->setFixedWidth(m_filletwidget->width()); - title->setText("控件圆角"); + title->setText(tr("Control fillet")); QHBoxLayout *layout = new QHBoxLayout(); m_filletslider = new QSlider(m_filletwidget); @@ -262,16 +262,16 @@ void GlobalThemeWidget::AccentColorWidget() m_accentcolorwidget->setFixedHeight(65); QLabel *title = new QLabel(m_accentcolorwidget); title->setFixedWidth(m_accentcolorwidget->width()); - title->setText("强调色"); + title->setText(tr("Accent colour")); QHBoxLayout *layout = new QHBoxLayout(); m_combobox = new QComboBox(m_accentcolorwidget); - m_combobox->addItem("daybreakBlue",QColor(55, 144, 250)); - m_combobox->addItem("jamPurple", QColor(120, 115, 245)); - m_combobox->addItem("magenta", QColor(235, 48, 150)); - m_combobox->addItem("sunRed", QColor(243, 34, 45)); - m_combobox->addItem("sunsetOrange", QColor(246, 140, 39)); - m_combobox->addItem("dustGold", QColor(249, 197, 61)); - m_combobox->addItem("polarGreen", QColor(82, 196, 41)); + m_combobox->addItem(tr("daybreakBlue"),QColor(55, 144, 250)); + m_combobox->addItem(tr("jamPurple"), QColor(120, 115, 245)); + m_combobox->addItem(tr("magenta"), QColor(235, 48, 150)); + m_combobox->addItem(tr("sunRed"), QColor(243, 34, 45)); + m_combobox->addItem(tr("sunsetOrange"), QColor(246, 140, 39)); + m_combobox->addItem(tr("dustGold"), QColor(249, 197, 61)); + m_combobox->addItem(tr("polarGreen"), QColor(82, 196, 41)); connect(m_combobox, QOverload::of(&QComboBox::currentIndexChanged), this, [=](int index){ diff --git a/src/module/historywidget.cpp b/src/module/historywidget.cpp index c3b4478..e299e0d 100644 --- a/src/module/historywidget.cpp +++ b/src/module/historywidget.cpp @@ -9,9 +9,9 @@ HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent) QWidget *textWidget = new QWidget(); QHBoxLayout *textlayout = new QHBoxLayout(); QLabel *historyLabel = new QLabel(textWidget); - historyLabel->setText("历史记录"); + historyLabel->setText(tr("Historical record")); QLabel *tipsLabel = new QLabel(textWidget); - tipsLabel->setText("仅保留30天内的记录"); + tipsLabel->setText(tr("Records are kept for 30 days only")); textlayout->addWidget(historyLabel); textlayout->addStretch(1); diff --git a/src/module/iconthemewidget.cpp b/src/module/iconthemewidget.cpp index bf91fb4..78c778b 100644 --- a/src/module/iconthemewidget.cpp +++ b/src/module/iconthemewidget.cpp @@ -78,7 +78,7 @@ void IconThemeWidget::initEditWidget() clickedWidget = qobject_cast(widget); if (clickedWidget) { - QString newFilePath = QFileDialog::getOpenFileName(this, tr("选择SVG文件"), "", tr("SVG 文件 (*.svg)")); + QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), "", tr("SVG file (*.svg)")); if (!newFilePath.isEmpty()) { m_customiconpathmap->insert(widgetName, newFilePath); @@ -161,7 +161,7 @@ void IconThemeWidget::initSystemEditWidget() clickedWidget = qobject_cast(widget); if (clickedWidget) { - QString newFilePath = QFileDialog::getOpenFileName(this, tr("选择SVG文件"), "", tr("SVG 文件 (*.svg)")); + QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), "", tr("SVG file (*.svg)")); if (!newFilePath.isEmpty()) { //check if(FileCheck::isLegalIconFile(newFilePath)){ @@ -255,7 +255,9 @@ void IconThemeWidget::initRightWidget() QButtonGroup *group = new QButtonGroup(m_changebuttonwidget); m_appiconbtn = new QPushButton(); + m_appiconbtn->setText(tr("APP")); m_systemiconbtn = new QPushButton(); + m_systemiconbtn->setText(tr("System setting")); group->setExclusive(true); group->addButton(m_appiconbtn); group->addButton(m_systemiconbtn); diff --git a/src/module/infocreatewidget.cpp b/src/module/infocreatewidget.cpp index c3b3d9a..dcc8c73 100644 --- a/src/module/infocreatewidget.cpp +++ b/src/module/infocreatewidget.cpp @@ -40,7 +40,7 @@ void InfoCreateWidget::InitThemeName(){ m_themeNameCNLayout = new QHBoxLayout(); m_themeNameCNLabel = new QLabel(); m_themeNameCNLineEdit = new QLineEdit(); - m_themeNameCNLabel->setText("ThemeName-CN"); + m_themeNameCNLabel->setText(tr("ThemeName-CN")); m_themeNameCNLineEdit->setEchoMode(QLineEdit::Normal); m_themeNameCNLayout->addWidget(m_themeNameCNLabel); @@ -49,7 +49,7 @@ void InfoCreateWidget::InitThemeName(){ m_themeNameENLayout = new QHBoxLayout(); m_themeNameENLabel = new QLabel(); m_themeNameENLineEdit = new QLineEdit(); - m_themeNameENLabel->setText("ThemeName-EN"); + m_themeNameENLabel->setText(tr("ThemeName-EN")); m_themeNameENLineEdit->setEchoMode(QLineEdit::Normal); m_themeNameENLayout->addWidget(m_themeNameENLabel); @@ -63,7 +63,7 @@ void InfoCreateWidget::InitBuilderInfo(){ m_builderNameLayout = new QHBoxLayout(); m_builderNameLabel = new QLabel(); m_builderNameLineEdit = new QLineEdit(); - m_builderNameLabel->setText("Builder Name"); + m_builderNameLabel->setText(tr("Builder Name")); m_builderNameLineEdit->setEchoMode(QLineEdit::Normal); m_builderNameLayout->addWidget(m_builderNameLabel); @@ -72,7 +72,7 @@ void InfoCreateWidget::InitBuilderInfo(){ m_builderMailLayout = new QHBoxLayout(); m_builderMailLabel = new QLabel(); m_builderMailLineEdit = new QLineEdit(); - m_builderMailLabel->setText("Builder Mail"); + m_builderMailLabel->setText(tr("Builder Mail")); m_builderMailLineEdit->setEchoMode(QLineEdit::Normal); m_builderMailLayout->addWidget(m_builderMailLabel); @@ -85,9 +85,9 @@ void InfoCreateWidget::InitInfoBtn(const QString &m_state){ m_exitBtn = new QPushButton(); m_recogniseBtn = new QPushButton(); m_createDebBtn = new QPushButton(); - m_exitBtn->setText("Back"); - m_recogniseBtn->setText("OK"); - m_createDebBtn->setText("Create"); + m_exitBtn->setText(tr("Back")); + m_recogniseBtn->setText(tr("OK")); + m_createDebBtn->setText(tr("Create")); m_infoBtnLayout->addWidget(m_exitBtn); m_infoBtnLayout->addWidget(m_recogniseBtn); @@ -141,7 +141,7 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){ QPalette m_fontqpe; m_fontqpe.setColor(QPalette::WindowText,Qt::red); m_warningMessage2->setPalette(m_fontqpe); - m_warningMessage2->setText("输入格式错误!"); + m_warningMessage2->setText(tr("Input format error!")); m_themeENNameState = false; m_recogniseBtn->setEnabled(false); m_createDebBtn->setEnabled(false); @@ -150,7 +150,7 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){ QPalette m_fontqpe; m_fontqpe.setColor(QPalette::WindowText,Qt::red); m_warningMessage2->setPalette(m_fontqpe); - m_warningMessage2->setText("输入为空!"); + m_warningMessage2->setText(tr("Input is empty!")); m_themeENNameState = false; m_recogniseBtn->setEnabled(false); m_createDebBtn->setEnabled(false); @@ -163,7 +163,7 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){ QRegExp englishRegexp("[A-Za-z0-9]+$"); if(m_themeNameENLineEdit != nullptr){ if (englishRegexp.exactMatch(m_builderName)){ - m_warningMessage3->setText(""); + m_warningMessage3->setText("Input is empty!"); m_builderNameState = true; if (m_themeENNameState && m_builderMailState && m_builderNameState){ m_recogniseBtn->setEnabled(true); @@ -176,7 +176,7 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){ QPalette m_fontqpe; m_fontqpe.setColor(QPalette::WindowText,Qt::red); m_warningMessage3->setPalette(m_fontqpe); - m_warningMessage3->setText("输入格式错误!"); + m_warningMessage3->setText("Input format error!"); m_builderNameState = false; m_recogniseBtn->setEnabled(false); m_createDebBtn->setEnabled(false); @@ -185,7 +185,7 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){ QPalette m_fontqpe; m_fontqpe.setColor(QPalette::WindowText,Qt::red); m_warningMessage3->setPalette(m_fontqpe); - m_warningMessage3->setText("输入为空!"); + m_warningMessage3->setText("Input is empty!"); m_builderNameState = false; m_recogniseBtn->setEnabled(false); m_createDebBtn->setEnabled(false); @@ -211,7 +211,7 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){ QPalette m_fontqpe; m_fontqpe.setColor(QPalette::WindowText,Qt::red); m_warningMessage4->setPalette(m_fontqpe); - m_warningMessage4->setText("输入格式错误!"); + m_warningMessage4->setText("Input format error!"); m_builderMailState = false; m_recogniseBtn->setEnabled(false); m_createDebBtn->setEnabled(false); @@ -220,7 +220,7 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){ QPalette m_fontqpe; m_fontqpe.setColor(QPalette::WindowText,Qt::red); m_warningMessage4->setPalette(m_fontqpe); - m_warningMessage4->setText("输入为空!"); + m_warningMessage4->setText("Input is empty!"); m_builderMailState = false; m_recogniseBtn->setEnabled(false); m_createDebBtn->setEnabled(false); diff --git a/src/titlebar.cpp b/src/titlebar.cpp index 14e5a5d..19732df 100644 --- a/src/titlebar.cpp +++ b/src/titlebar.cpp @@ -32,13 +32,13 @@ TitleBar::TitleBar(QWidget *parent) : QWidget(parent) QMenu* menu = new QMenu(m_optionbtn); - QAction* saveAction = new QAction(tr("保存路径"), menu); + QAction* saveAction = new QAction(tr("Save path"), menu); menu->addAction(saveAction); - QAction* aboutAction = new QAction(tr("关于"), menu); + QAction* aboutAction = new QAction(tr("about"), menu); menu->addAction(aboutAction); - QAction* helpAction = new QAction(tr("帮助"), menu); + QAction* helpAction = new QAction(tr("help"), menu); menu->addAction(helpAction); - QAction* exitAction = new QAction(tr("退出"), menu); + QAction* exitAction = new QAction(tr("exit"), menu); menu->addAction(exitAction); m_optionbtn->setMenu(menu); diff --git a/translation/themebuilder_en_US.qm b/translation/themebuilder_en_US.qm new file mode 100644 index 0000000000000000000000000000000000000000..9dad8dffceb9623e88f8b96d9cd0caf25574c6fa GIT binary patch literal 23 fcmcE7ks@*G{hX<16=n7(EZlpygMop8iIEWihQJ9+ literal 0 HcmV?d00001 diff --git a/translation/themebuilder_en_US.ts b/translation/themebuilder_en_US.ts new file mode 100644 index 0000000..7167f57 --- /dev/null +++ b/translation/themebuilder_en_US.ts @@ -0,0 +1,313 @@ + + + + + CursorThemeWidget + + + Select SVG file + + + + + SVG file (*.svg) + + + + + FileCheck + + + + + + error + + + + + The wallpaper size must be 3840x2160 + + + + + The file size cannot exceed 10MB + + + + + Cover size must be 1640x1080 + + + + + The file size cannot exceed 5MB + + + + + GlobalThemeWidget + + + Overall theme rendering + + + + + + Select picture file + + + + + + Picture file (*.png *.jpg) + + + + + Desktop wallpaper + + + + + Window appearance + + + + + light + + + + + dark + + + + + Control fillet + + + + + Accent colour + + + + + daybreakBlue + + + + + jamPurple + + + + + magenta + + + + + sunRed + + + + + sunsetOrange + + + + + dustGold + + + + + polarGreen + + + + + HistoryWidget + + + Historical record + + + + + Records are kept for 30 days only + + + + + IconThemeWidget + + + + Select SVG file + + + + + + SVG file (*.svg) + + + + + APP + + + + + System setting + + + + + InfoCreateWidget + + + ThemeName-CN + + + + + ThemeName-EN + + + + + Builder Name + + + + + Builder Mail + + + + + Back + + + + + OK + + + + + Create + + + + + Input format error! + + + + + Input is empty! + + + + + MainInterface + + + GlobalTheme + + + + + IconTheme + + + + + CursorTheme + + + + + PlymouthTheme + + + + + GrubTheme + + + + + Start Building + + + + + MainWindow + + + kylin-theme-builder + + + + + User guide + + + + + Global Theme + + + + + Icon Theme + + + + + Cursor Theme + + + + + Boot Theme + + + + + TitleBar + + + Menu + + + + + Save path + + + + + about + + + + + help + + + + + exit + + + + diff --git a/translation/themebuilder_zh_CN.qm b/translation/themebuilder_zh_CN.qm new file mode 100644 index 0000000000000000000000000000000000000000..d5f4a036d0660faff54cc1c6e99e426863e5531b GIT binary patch literal 3695 zcmbuBeQeZp7{{O6x?bs1Zd)V~oa^pdyJ%)I%`WcfENi4B*)dP_!6;dlg`LBLJHMX7DKhuLMO) zRsu}<2H4Rd0EPqhQwAU)0Q*}AuRYK@b00q639B!**VRB`+k1Gw0+c6XsCyEO(|;lN zH4MKy08nrzymw;}dhLQA!_VXIFX4oNoc{~Y%s+p?-?KfpP5%O)AM|Wk{0hcnc{Xmk z0iclg41L;->xk#~eK!I4X5#gGeExkw*}4trv#en4&(EUI?t;Nt^8w&!;kx~wp$^NW zx(LRVVn+Aka|}Op)iCnyY|XRw^%T3h-}c|dzC{jV-j}f79{v*j2D~pVdJTDvyY?^S zA)39izi`cmUq@~$C!c->pWnb8T-c6v+QJ=Nj(Xk$zWLlSjAz6rP8-DE<^EY!yD_hA z{x@D*hH-fPAD>*0dc#xtp2K*2?@!shsTAXy7ntQK$NP}IvLk`+sxn-EHZc0r6PTA8 zT@IY|K9_0L$!LJ`$i1({yM4m20a0Up_0(HQX!N>{Vp$z6iC1jur5>U?B(k%X6 zB(&7=ow7psvbmL+u0**PZXa9$T?^i!b(TR@K&|8YKczh-C8T zq+BHUcF*=$d(Eo9JNA#<8>xXRsD|qx1U>j)2o^zziq5Fjx`@GNtykWF{^eDVNo3Y+t7^aEMw3;$m;iAYv-4SZ*%t#(`~TwthxA zE{-!>rzvqauf)!+_pG~yGQKrpy3sOp#m$IGFUv`%NRbmsw|-+YFPeJ)ZtCGpiwSIU z(KW35o9g?|QpB%oifGgsgs5(m{vkP%W5i}GHA-C5Cr3K>tZAb@0VFcSY`_vsfk4=j72K!z6{4)z^~w*j(diBC>x(YLB4XOZYN1{IMCGDx9-({6TUDrzJD3g2)%KfcTb=bGx1UONKn zJ0<6n$+ivRJ5}pdlNg<%M4T@a&OW=6*LReRLpi6$B#^&(UUW1v_wG5uG>ZA^3@hg3 zISItIoS6`wk51xbNCzZpqNCPg>Jn^JdefR^Cf%F@(dvfwb7wL|iv?3OOx|hlvH8hU zk9?{5!y0~*QAfXB#q41>R>FyO4`l1^hKzkN(C7l$s=FW;l+SOM&jo0>&nlC=LM!#~ zugu_FCoDPcOz6Zs0(S4j1fl4zBTd~DnwsiWWVOPyKVd3j*}cJjT@z{Mf$xOz&7WC8 zRLfq*HOr<#!lIEaRl}iGcRX^mV}Q#01hI?ox@aaZT+K9PB9GFQMPdwJe4bTXplN(d WVMvdhZ_( + + + + CursorThemeWidget + + + Select SVG file + 选择SVG文件 + + + + SVG file (*.svg) + SVG 文件 (*.svg) + + + + FileCheck + + + + + + error + 错误 + + + + The wallpaper size must be 3840x2160 + 壁纸尺寸必须为3840x2160 + + + + The file size cannot exceed 10MB + 文件大小不能超过10MB + + + + Cover size must be 1640x1080 + 封面尺寸必须为1640x1080 + + + + The file size cannot exceed 5MB + 文件大小不能超过5MB + + + + GlobalThemeWidget + + + Overall theme rendering + 全局主题效果图 + + + + + Select picture file + 选择图片文件 + + + + + Picture file (*.png *.jpg) + 图片文件 (*.png *.jpg) + + + + Desktop wallpaper + 桌面壁纸 + + + + Window appearance + 窗口外观 + + + + light + 浅色 + + + + dark + 深色 + + + + Control fillet + 控件圆角 + + + + Accent colour + 强调色 + + + + daybreakBlue + 拂晓蓝 + + + + jamPurple + 果酱紫 + + + + magenta + 玫瑰红 + + + + sunRed + 烈日红 + + + + sunsetOrange + 日暮橙 + + + + dustGold + 薄雾金 + + + + polarGreen + 极光绿 + + + + HistoryWidget + + + Historical record + 历史记录 + + + + Records are kept for 30 days only + 仅保留30天内的记录 + + + + IconThemeWidget + + + + Select SVG file + 选择SVG文件 + + + + + SVG file (*.svg) + SVG 文件 (*.svg) + + + + APP + APP + + + + System setting + 系统设置 + + + + InfoCreateWidget + + + ThemeName-CN + 主题名称-中文 + + + + ThemeName-EN + 主题名称-英文 + + + + Builder Name + 创作者 + + + + Builder Mail + 联系邮箱 + + + + Back + 取消 + + + + OK + 确定 + + + + Create + 创建 + + + + Input format error! + 输入格式错误! + + + + Input is empty! + 输入为空! + + + + MainInterface + + + GlobalTheme + 全局样式 + + + + IconTheme + 图标主题 + + + + CursorTheme + 光标主题 + + + + PlymouthTheme + 开机动画 + + + + GrubTheme + 启动个性化 + + + + Start Building + 制作全局主题 + + + + MainWindow + + + kylin-theme-builder + 主题打包工具 + + + + User guide + 使用指南 + + + + Global Theme + 全局主题 + + + + Icon Theme + 图标主题 + + + + Cursor Theme + 光标主题 + + + + Boot Theme + 启动个性化 + + + + TitleBar + + + Menu + 菜单 + + + + Save path + 保存路径 + + + + about + 关于 + + + + help + 帮助 + + + + exit + 退出 + + + From 8469269eebaa3d35bd6a9f0140ce6986040eda7e Mon Sep 17 00:00:00 2001 From: likehomedream Date: Thu, 2 Nov 2023 17:40:58 +0800 Subject: [PATCH 2/2] add transparencywidget and windowfilletwidget --- src/fileProcess/configfilemanager.cpp | 6 +-- src/module/globalthemewidget.cpp | 61 +++++++++++++++++++++++++-- src/module/globalthemewidget.h | 8 +++- 3 files changed, 68 insertions(+), 7 deletions(-) diff --git a/src/fileProcess/configfilemanager.cpp b/src/fileProcess/configfilemanager.cpp index 0f9d10e..7c91a64 100644 --- a/src/fileProcess/configfilemanager.cpp +++ b/src/fileProcess/configfilemanager.cpp @@ -10,8 +10,8 @@ ConfigFileManager::ConfigFileManager(bool ishistory, const QString& time, QObjec createJson(); }else{ m_time = time; - jsonFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/scr/config/"+ "default.json"; - confFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/scr/config/"+ "theme.conf"; + jsonFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/src/config/"+ "default.json"; + confFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/src/config/"+ "theme.conf"; qDebug()<<"have"; } @@ -67,7 +67,7 @@ bool ConfigFileManager::modifyRadiusJson(int radius) QFile configFile(confFilePath); if (!configFile.open(QIODevice::ReadWrite | QIODevice::Text)) { - qDebug() << "Failed to open config file"; + qDebug() << "Failed to open config file"<addWidget(m_coverwidget); mainLayout->addStretch(1); mainLayout->addWidget(m_wallpaperwidget); @@ -72,6 +75,10 @@ void GlobalThemeWidget::initRightWidget() mainLayout->addStretch(1); mainLayout->addWidget(m_accentcolorwidget); mainLayout->addStretch(1); + mainLayout->addWidget(m_transparencywidget); + mainLayout->addStretch(1); + mainLayout->addWidget(m_windowfilletwidget); + mainLayout->addStretch(1); m_viewportwidget->setLayout(mainLayout); @@ -255,9 +262,8 @@ void GlobalThemeWidget::initFilletWidget() m_filletwidget->setLayout(layout); } -void GlobalThemeWidget::AccentColorWidget() +void GlobalThemeWidget::initAccentColorWidget() { - m_accentcolorwidget = new QWidget(m_viewportwidget); m_accentcolorwidget = new QWidget(m_viewportwidget); m_accentcolorwidget->setFixedHeight(65); QLabel *title = new QLabel(m_accentcolorwidget); @@ -291,6 +297,55 @@ void GlobalThemeWidget::AccentColorWidget() m_accentcolorwidget->setLayout(layout); } +void GlobalThemeWidget::initTransparencyWidget() +{ + m_transparencywidget = new QWidget(m_viewportwidget); + m_transparencywidget->setFixedHeight(65); + QHBoxLayout *layout = new QHBoxLayout(); + QLabel *title = new QLabel(tr("Window transparency")); + m_transparencyslider = new QSlider(m_filletwidget); + + m_transparencyslider->setOrientation(Qt::Horizontal); + m_transparencyslider->setFixedWidth(210); + m_transparencyslider->setRange(0,100); + m_transparencyslider->setSingleStep(1); + m_transparencyslider->setTickInterval(1); + m_transparencyslider->setFixedWidth(120); + m_transparencyslider->setValue(65); + + QPushButton *showButton = new QPushButton(m_filletwidget); + showButton->setDisabled(true); + showButton->setFixedSize(60,36); + int value = 0; + value = m_transparencyslider->value(); + showButton->setText(QString::number(m_transparencyslider->value())+"%"); + QObject::connect(m_transparencyslider, &QSlider::valueChanged, [=](int value) { + showButton->setText(QString::number(value)+"%"); + }); + layout->addWidget(title); + layout->addWidget(m_transparencyslider); + layout->addWidget(showButton); + + m_transparencywidget->setLayout(layout); +} + +void GlobalThemeWidget::initWindowFilletWidget() +{ + m_windowfilletwidget = new QWidget(m_viewportwidget); + m_transparencywidget->setFixedHeight(65); + QHBoxLayout *layout = new QHBoxLayout(); + QLabel *title = new QLabel(tr("Window fillet")); + + m_filletcombobox = new QComboBox(m_windowfilletwidget); + m_filletcombobox->addItem(tr("Large"),QColor(55, 144, 250)); + m_filletcombobox->addItem(tr("Medium"), QColor(120, 115, 245)); + m_filletcombobox->addItem(tr("Small"), QColor(120, 115, 245)); + + layout->addWidget(title); + layout->addWidget(m_filletcombobox); + m_windowfilletwidget->setLayout(layout); +} + void GlobalThemeWidget::updateWallpaperFilePath(const QString& coverFilePath) { m_wallpaperpath = coverFilePath; diff --git a/src/module/globalthemewidget.h b/src/module/globalthemewidget.h index 9901465..846e5aa 100644 --- a/src/module/globalthemewidget.h +++ b/src/module/globalthemewidget.h @@ -38,7 +38,9 @@ private: void initWallPaperWidget(); void initExteriorWidget(); void initFilletWidget(); - void AccentColorWidget(); + void initAccentColorWidget(); + void initTransparencyWidget(); + void initWindowFilletWidget(); void updateWallpaperFilePath(const QString& coverFilePath); void addspaceritem(); @@ -52,16 +54,20 @@ private: QWidget *m_exteriorwidget; QWidget *m_filletwidget; QWidget *m_accentcolorwidget; + QWidget *m_transparencywidget; + QWidget *m_windowfilletwidget; QVBoxLayout *m_previewlayout; QString m_wallpaperpath = ":/resource/background/background-light.png"; QString m_coverpath = ":/resource/background/background-glazing.png"; QWidget *m_viewportwidget; QScrollArea *m_scrollArea; QSlider *m_filletslider; + QSlider *m_transparencyslider; QHBoxLayout *m_globalthemelayout; QWidget *m_rightwidget; HistoryInfo m_info; QComboBox *m_combobox; + QComboBox *m_filletcombobox; QPushButton *m_coverbtn; QPushButton *wallpaperbtn; QWidget *m_previewwidget;