From bf5bedc9ed4af3008d0bdc2574ca996eaac1fc58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Wed, 3 Apr 2024 11:09:35 +0800 Subject: [PATCH] update --- example/example.qrc | 2 +- example/example_en_US.ts | 30 ++++++++--------- example/example_zh_CN.ts | 32 +++++++++---------- example/qml/page/T_Home.qml | 8 ++--- ...italizrHelper.cpp => InitializrHelper.cpp} | 14 ++++---- .../{InitalizrHelper.h => InitializrHelper.h} | 14 ++++---- example/src/main.cpp | 4 +-- .../FluentUI/Controls/FluTableView.qml | 15 +++++---- .../FluentUI/Controls/FluTableView.qml | 9 +++--- .../FluentUI/Controls/FluTimePicker.qml | 12 +++---- src/fluentui_zh_CN.ts | 4 --- 11 files changed, 71 insertions(+), 73 deletions(-) rename example/src/helper/{InitalizrHelper.cpp => InitializrHelper.cpp} (87%) rename example/src/helper/{InitalizrHelper.h => InitializrHelper.h} (69%) diff --git a/example/example.qrc b/example/example.qrc index 9a6cd21f..527028cd 100644 --- a/example/example.qrc +++ b/example/example.qrc @@ -194,7 +194,6 @@ res/image/ic_crash.png qml/window/CrashWindow.qml qml/page/T_SplitLayout.qml - qml/window/FluentInitalizrWindow.qml res/template/CMakeLists.txt.in res/template/src/App.qml.in res/template/src/CMakeLists.txt.in @@ -209,5 +208,6 @@ qml/page/T_Sheet.qml qml/page/T_GroupBox.qml res/image/bg_scenic.jpg + qml/window/FluentInitializrWindow.qml diff --git a/example/example_en_US.ts b/example/example_en_US.ts index dfdff1bc..6e263692 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -38,35 +38,35 @@ - FluentInitalizrWindow + FluentInitializrWindow - - - FluentUI Initalizr + + + FluentUI Initializr - + Name - + Create In - + Browse - + Cancel - + Create @@ -85,24 +85,24 @@ - InitalizrHelper + InitializrHelper - + The name cannot be empty - + The creation path cannot be empty - + The path does not exist - + %1 folder already exists @@ -1372,7 +1372,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han. - FluentUI Initalizr + FluentUI Initializr diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 91add544..33fd594e 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -38,35 +38,35 @@ - FluentInitalizrWindow + FluentInitializrWindow - - - FluentUI Initalizr + + + FluentUI Initializr FluentUI脚手架 - + Name 名称 - + Create In 创建路径 - + Browse 浏览 - + Cancel 取消 - + Create 创建 @@ -85,26 +85,26 @@ - InitalizrHelper + InitializrHelper - + The name cannot be empty 名称不能为空 - + The creation path cannot be empty 创建路径不能为空 - + The path does not exist 路径不存在 - + %1 folder already exists - + %1 文件夹已经存在 @@ -1403,7 +1403,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han. - FluentUI Initalizr + FluentUI Initializr FluentUI脚手架 diff --git a/example/qml/page/T_Home.qml b/example/qml/page/T_Home.qml index aba7c4a8..14738a7d 100644 --- a/example/qml/page/T_Home.qml +++ b/example/qml/page/T_Home.qml @@ -12,8 +12,8 @@ FluScrollablePage{ animationEnabled: false header: Item{} - FluentInitalizrWindow{ - id:fluent_initalizr + FluentInitializrWindow{ + id:fluent_Initializr } ListModel{ @@ -29,11 +29,11 @@ FluScrollablePage{ } ListElement{ icon: "qrc:/example/res/image/favicon.ico" - title: qsTr("FluentUI Initalizr") + title: qsTr("FluentUI Initializr") desc: qsTr("FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options.") url: "https://github.com/zhuzichu520/FluentUI" clicked: function(model){ - fluent_initalizr.showDialog() + fluent_Initializr.showDialog() } } } diff --git a/example/src/helper/InitalizrHelper.cpp b/example/src/helper/InitializrHelper.cpp similarity index 87% rename from example/src/helper/InitalizrHelper.cpp rename to example/src/helper/InitializrHelper.cpp index 7ae2a741..4567c81b 100644 --- a/example/src/helper/InitalizrHelper.cpp +++ b/example/src/helper/InitializrHelper.cpp @@ -1,16 +1,16 @@ -#include "InitalizrHelper.h" +#include "InitializrHelper.h" #include #include -InitalizrHelper::InitalizrHelper(QObject *parent) : QObject(parent) +InitializrHelper::InitializrHelper(QObject *parent) : QObject(parent) { } -InitalizrHelper::~InitalizrHelper() = default; +InitializrHelper::~InitializrHelper() = default; -bool InitalizrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists){ +bool InitializrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists){ QDir _formDir = fromDir; QDir _toDir = toDir; if(!_toDir.exists()) @@ -44,7 +44,7 @@ bool InitalizrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool cover } template -void InitalizrHelper::templateToFile(const QString& source,const QString& dest,Args &&...args){ +void InitializrHelper::templateToFile(const QString& source,const QString& dest,Args &&...args){ QFile file(source); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream in(&file); @@ -67,12 +67,12 @@ void InitalizrHelper::templateToFile(const QString& source,const QString& dest,A } } -void InitalizrHelper::copyFile(const QString& source,const QString& dest){ +void InitializrHelper::copyFile(const QString& source,const QString& dest){ QFile::copy(source,dest); QFile::setPermissions(dest, QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther); } -void InitalizrHelper::generate(const QString& name,const QString& path){ +void InitializrHelper::generate(const QString& name,const QString& path){ if(name.isEmpty()){ error(tr("The name cannot be empty")); return; diff --git a/example/src/helper/InitalizrHelper.h b/example/src/helper/InitializrHelper.h similarity index 69% rename from example/src/helper/InitalizrHelper.h rename to example/src/helper/InitializrHelper.h index fbd63995..7daea951 100644 --- a/example/src/helper/InitalizrHelper.h +++ b/example/src/helper/InitializrHelper.h @@ -1,26 +1,26 @@ -#ifndef INITALIZRHELPER_H -#define INITALIZRHELPER_H +#ifndef INITIALIZRHELPER_H +#define INITIALIZRHELPER_H #include #include #include #include "src/singleton.h" -class InitalizrHelper : public QObject +class InitializrHelper : public QObject { Q_OBJECT private: - explicit InitalizrHelper(QObject* parent = nullptr); + explicit InitializrHelper(QObject* parent = nullptr); bool copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists = true); void copyFile(const QString& source,const QString& dest); template void templateToFile(const QString& source,const QString& dest,Args &&...args); public: - SINGLETON(InitalizrHelper) - ~InitalizrHelper() override; + SINGLETON(InitializrHelper) + ~InitializrHelper() override; Q_INVOKABLE void generate(const QString& name,const QString& path); Q_SIGNAL void error(const QString& message); Q_SIGNAL void success(const QString& path); }; -#endif // INITALIZRHELPER_H +#endif // INITIALIZRHELPER_H diff --git a/example/src/main.cpp b/example/src/main.cpp index 43f182f9..ce258e27 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -15,7 +15,7 @@ #include "src/component/FileWatcher.h" #include "src/component/FpsItem.h" #include "src/helper/SettingsHelper.h" -#include "src/helper/InitalizrHelper.h" +#include "src/helper/InitializrHelper.h" #include "src/helper/TranslateHelper.h" #include "src/helper/Network.h" @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) TranslateHelper::getInstance()->init(&engine); engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance()); engine.rootContext()->setContextProperty("SettingsHelper",SettingsHelper::getInstance()); - engine.rootContext()->setContextProperty("InitalizrHelper",InitalizrHelper::getInstance()); + engine.rootContext()->setContextProperty("InitializrHelper",InitializrHelper::getInstance()); engine.rootContext()->setContextProperty("TranslateHelper",TranslateHelper::getInstance()); engine.rootContext()->setContextProperty("Network",Network::getInstance()); #ifdef FLUENTUI_BUILD_STATIC_LIB diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 6b1b63e9..2a625716 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -5,16 +5,17 @@ import Qt.labs.qmlmodels 1.0 import FluentUI 1.0 Rectangle { + readonly property alias rows: table_view.rows + readonly property alias columns: table_view.columns + readonly property alias current: d.current + readonly property alias sourceModel: table_model property var columnSource property var dataSource - property color borderColor: FluTheme.dark ? "#252525" : "#e4e4e4" - property alias rows: table_view.rows - property alias columns: table_view.columns + property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) property bool horizonalHeaderVisible: true property bool verticalHeaderVisible: true property color selectedBorderColor: FluTheme.primaryColor property color selectedColor: FluTools.colorAlpha(FluTheme.primaryColor,0.3) - property alias sourceModel: table_model id:control color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) onColumnSourceChanged: { @@ -379,7 +380,7 @@ Rectangle { model: table_sort_model clip: true onRowsChanged: { - closeEditor() + control.closeEditor() } delegate: com_table_delegate FluLoader{ @@ -492,7 +493,7 @@ Rectangle { } onClicked: (event)=>{ - closeEditor() + control.closeEditor() } } FluLoader{ @@ -623,7 +624,7 @@ Rectangle { } onClicked: (event)=>{ - closeEditor() + control.closeEditor() } } MouseArea{ diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index affa37f1..2d844315 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -6,16 +6,17 @@ import Qt.labs.qmlmodels import FluentUI Rectangle { + readonly property alias rows: table_view.rows + readonly property alias columns: table_view.columns + readonly property alias current: d.current + readonly property alias sourceModel: table_model property var columnSource property var dataSource - property color borderColor: FluTheme.dark ? "#252525" : "#e4e4e4" - property alias rows: table_view.rows - property alias columns: table_view.columns + property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) property bool horizonalHeaderVisible: true property bool verticalHeaderVisible: true property color selectedBorderColor: FluTheme.primaryColor property color selectedColor: FluTools.colorAlpha(FluTheme.primaryColor,0.3) - property alias sourceModel: table_model id:control color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) onColumnSourceChanged: { diff --git a/src/Qt6/imports/FluentUI/Controls/FluTimePicker.qml b/src/Qt6/imports/FluentUI/Controls/FluTimePicker.qml index a821b320..c54a0cae 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTimePicker.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTimePicker.qml @@ -8,12 +8,12 @@ FluButton { property int hourFormat: FluTimePickerType.H property int isH: hourFormat === FluTimePickerType.H property var current - property string amText: "上午" - property string pmText: "下午" - property string hourText: "时" - property string minuteText: "分" - property string cancelText: "取消" - property string okText: "确定" + property string amText: qsTr("AM") + property string pmText: qsTr("PM") + property string hourText: qsTr("Hour") + property string minuteText: qsTr("Minute") + property string cancelText: qsTr("Cancel") + property string okText: qsTr("OK") signal accepted() id:control implicitHeight: 30 diff --git a/src/fluentui_zh_CN.ts b/src/fluentui_zh_CN.ts index 1691047a..d46cba0d 100644 --- a/src/fluentui_zh_CN.ts +++ b/src/fluentui_zh_CN.ts @@ -63,10 +63,6 @@ FluCalendarPicker - - Please select a date - 请选择日期 -