This commit is contained in:
朱子楚\zhuzi 2024-04-03 11:09:35 +08:00
parent 7d1666597f
commit bf5bedc9ed
11 changed files with 71 additions and 73 deletions

View File

@ -194,7 +194,6 @@
<file>res/image/ic_crash.png</file> <file>res/image/ic_crash.png</file>
<file>qml/window/CrashWindow.qml</file> <file>qml/window/CrashWindow.qml</file>
<file>qml/page/T_SplitLayout.qml</file> <file>qml/page/T_SplitLayout.qml</file>
<file>qml/window/FluentInitalizrWindow.qml</file>
<file>res/template/CMakeLists.txt.in</file> <file>res/template/CMakeLists.txt.in</file>
<file>res/template/src/App.qml.in</file> <file>res/template/src/App.qml.in</file>
<file>res/template/src/CMakeLists.txt.in</file> <file>res/template/src/CMakeLists.txt.in</file>
@ -209,5 +208,6 @@
<file>qml/page/T_Sheet.qml</file> <file>qml/page/T_Sheet.qml</file>
<file>qml/page/T_GroupBox.qml</file> <file>qml/page/T_GroupBox.qml</file>
<file>res/image/bg_scenic.jpg</file> <file>res/image/bg_scenic.jpg</file>
<file>qml/window/FluentInitializrWindow.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -38,35 +38,35 @@
</message> </message>
</context> </context>
<context> <context>
<name>FluentInitalizrWindow</name> <name>FluentInitializrWindow</name>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="11"/> <location filename="qml/window/FluentInitializrWindow.qml" line="11"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="30"/> <location filename="qml/window/FluentInitializrWindow.qml" line="30"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initializr</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="51"/> <location filename="qml/window/FluentInitializrWindow.qml" line="51"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="59"/> <location filename="qml/window/FluentInitializrWindow.qml" line="59"/>
<source>Create In</source> <source>Create In</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="63"/> <location filename="qml/window/FluentInitializrWindow.qml" line="63"/>
<source>Browse</source> <source>Browse</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="93"/> <location filename="qml/window/FluentInitializrWindow.qml" line="93"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="101"/> <location filename="qml/window/FluentInitializrWindow.qml" line="101"/>
<source>Create</source> <source>Create</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -85,24 +85,24 @@
</message> </message>
</context> </context>
<context> <context>
<name>InitalizrHelper</name> <name>InitializrHelper</name>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="77"/> <location filename="src/helper/InitializrHelper.cpp" line="77"/>
<source>The name cannot be empty</source> <source>The name cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="81"/> <location filename="src/helper/InitializrHelper.cpp" line="81"/>
<source>The creation path cannot be empty</source> <source>The creation path cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="86"/> <location filename="src/helper/InitializrHelper.cpp" line="86"/>
<source>The path does not exist</source> <source>The path does not exist</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="92"/> <location filename="src/helper/InitializrHelper.cpp" line="92"/>
<source>%1 folder already exists</source> <source>%1 folder already exists</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1372,7 +1372,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
</message> </message>
<message> <message>
<location filename="qml/page/T_Home.qml" line="32"/> <location filename="qml/page/T_Home.qml" line="32"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initializr</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -38,35 +38,35 @@
</message> </message>
</context> </context>
<context> <context>
<name>FluentInitalizrWindow</name> <name>FluentInitializrWindow</name>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="11"/> <location filename="qml/window/FluentInitializrWindow.qml" line="11"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="30"/> <location filename="qml/window/FluentInitializrWindow.qml" line="30"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initializr</source>
<translation type="unfinished">FluentUI脚手架</translation> <translation type="unfinished">FluentUI脚手架</translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="51"/> <location filename="qml/window/FluentInitializrWindow.qml" line="51"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="59"/> <location filename="qml/window/FluentInitializrWindow.qml" line="59"/>
<source>Create In</source> <source>Create In</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="63"/> <location filename="qml/window/FluentInitializrWindow.qml" line="63"/>
<source>Browse</source> <source>Browse</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="93"/> <location filename="qml/window/FluentInitializrWindow.qml" line="93"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="101"/> <location filename="qml/window/FluentInitializrWindow.qml" line="101"/>
<source>Create</source> <source>Create</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -85,26 +85,26 @@
</message> </message>
</context> </context>
<context> <context>
<name>InitalizrHelper</name> <name>InitializrHelper</name>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="77"/> <location filename="src/helper/InitializrHelper.cpp" line="77"/>
<source>The name cannot be empty</source> <source>The name cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="81"/> <location filename="src/helper/InitializrHelper.cpp" line="81"/>
<source>The creation path cannot be empty</source> <source>The creation path cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="86"/> <location filename="src/helper/InitializrHelper.cpp" line="86"/>
<source>The path does not exist</source> <source>The path does not exist</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="92"/> <location filename="src/helper/InitializrHelper.cpp" line="92"/>
<source>%1 folder already exists</source> <source>%1 folder already exists</source>
<translation type="unfinished"></translation> <translation type="unfinished">%1 </translation>
</message> </message>
</context> </context>
<context> <context>
@ -1403,7 +1403,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
</message> </message>
<message> <message>
<location filename="qml/page/T_Home.qml" line="32"/> <location filename="qml/page/T_Home.qml" line="32"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initializr</source>
<translation type="unfinished">FluentUI脚手架</translation> <translation type="unfinished">FluentUI脚手架</translation>
</message> </message>
<message> <message>

View File

@ -12,8 +12,8 @@ FluScrollablePage{
animationEnabled: false animationEnabled: false
header: Item{} header: Item{}
FluentInitalizrWindow{ FluentInitializrWindow{
id:fluent_initalizr id:fluent_Initializr
} }
ListModel{ ListModel{
@ -29,11 +29,11 @@ FluScrollablePage{
} }
ListElement{ ListElement{
icon: "qrc:/example/res/image/favicon.ico" 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.") 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" url: "https://github.com/zhuzichu520/FluentUI"
clicked: function(model){ clicked: function(model){
fluent_initalizr.showDialog() fluent_Initializr.showDialog()
} }
} }
} }

View File

@ -1,16 +1,16 @@
#include "InitalizrHelper.h" #include "InitializrHelper.h"
#include <QDir> #include <QDir>
#include <QGuiApplication> #include <QGuiApplication>
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 _formDir = fromDir;
QDir _toDir = toDir; QDir _toDir = toDir;
if(!_toDir.exists()) if(!_toDir.exists())
@ -44,7 +44,7 @@ bool InitalizrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool cover
} }
template <typename...Args> template <typename...Args>
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); QFile file(source);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file); 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::copy(source,dest);
QFile::setPermissions(dest, QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther); 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()){ if(name.isEmpty()){
error(tr("The name cannot be empty")); error(tr("The name cannot be empty"));
return; return;

View File

@ -1,26 +1,26 @@
#ifndef INITALIZRHELPER_H #ifndef INITIALIZRHELPER_H
#define INITALIZRHELPER_H #define INITIALIZRHELPER_H
#include <QObject> #include <QObject>
#include <QtQml/qqml.h> #include <QtQml/qqml.h>
#include <QDir> #include <QDir>
#include "src/singleton.h" #include "src/singleton.h"
class InitalizrHelper : public QObject class InitializrHelper : public QObject
{ {
Q_OBJECT Q_OBJECT
private: private:
explicit InitalizrHelper(QObject* parent = nullptr); explicit InitializrHelper(QObject* parent = nullptr);
bool copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists = true); bool copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists = true);
void copyFile(const QString& source,const QString& dest); void copyFile(const QString& source,const QString& dest);
template <typename...Args> template <typename...Args>
void templateToFile(const QString& source,const QString& dest,Args &&...args); void templateToFile(const QString& source,const QString& dest,Args &&...args);
public: public:
SINGLETON(InitalizrHelper) SINGLETON(InitializrHelper)
~InitalizrHelper() override; ~InitializrHelper() override;
Q_INVOKABLE void generate(const QString& name,const QString& path); Q_INVOKABLE void generate(const QString& name,const QString& path);
Q_SIGNAL void error(const QString& message); Q_SIGNAL void error(const QString& message);
Q_SIGNAL void success(const QString& path); Q_SIGNAL void success(const QString& path);
}; };
#endif // INITALIZRHELPER_H #endif // INITIALIZRHELPER_H

View File

@ -15,7 +15,7 @@
#include "src/component/FileWatcher.h" #include "src/component/FileWatcher.h"
#include "src/component/FpsItem.h" #include "src/component/FpsItem.h"
#include "src/helper/SettingsHelper.h" #include "src/helper/SettingsHelper.h"
#include "src/helper/InitalizrHelper.h" #include "src/helper/InitializrHelper.h"
#include "src/helper/TranslateHelper.h" #include "src/helper/TranslateHelper.h"
#include "src/helper/Network.h" #include "src/helper/Network.h"
@ -79,7 +79,7 @@ int main(int argc, char *argv[])
TranslateHelper::getInstance()->init(&engine); TranslateHelper::getInstance()->init(&engine);
engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance()); engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance());
engine.rootContext()->setContextProperty("SettingsHelper",SettingsHelper::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("TranslateHelper",TranslateHelper::getInstance());
engine.rootContext()->setContextProperty("Network",Network::getInstance()); engine.rootContext()->setContextProperty("Network",Network::getInstance());
#ifdef FLUENTUI_BUILD_STATIC_LIB #ifdef FLUENTUI_BUILD_STATIC_LIB

View File

@ -5,16 +5,17 @@ import Qt.labs.qmlmodels 1.0
import FluentUI 1.0 import FluentUI 1.0
Rectangle { 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 columnSource
property var dataSource property var dataSource
property color borderColor: FluTheme.dark ? "#252525" : "#e4e4e4" property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1)
property alias rows: table_view.rows
property alias columns: table_view.columns
property bool horizonalHeaderVisible: true property bool horizonalHeaderVisible: true
property bool verticalHeaderVisible: true property bool verticalHeaderVisible: true
property color selectedBorderColor: FluTheme.primaryColor property color selectedBorderColor: FluTheme.primaryColor
property color selectedColor: FluTools.colorAlpha(FluTheme.primaryColor,0.3) property color selectedColor: FluTools.colorAlpha(FluTheme.primaryColor,0.3)
property alias sourceModel: table_model
id:control id:control
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
onColumnSourceChanged: { onColumnSourceChanged: {
@ -379,7 +380,7 @@ Rectangle {
model: table_sort_model model: table_sort_model
clip: true clip: true
onRowsChanged: { onRowsChanged: {
closeEditor() control.closeEditor()
} }
delegate: com_table_delegate delegate: com_table_delegate
FluLoader{ FluLoader{
@ -492,7 +493,7 @@ Rectangle {
} }
onClicked: onClicked:
(event)=>{ (event)=>{
closeEditor() control.closeEditor()
} }
} }
FluLoader{ FluLoader{
@ -623,7 +624,7 @@ Rectangle {
} }
onClicked: onClicked:
(event)=>{ (event)=>{
closeEditor() control.closeEditor()
} }
} }
MouseArea{ MouseArea{

View File

@ -6,16 +6,17 @@ import Qt.labs.qmlmodels
import FluentUI import FluentUI
Rectangle { 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 columnSource
property var dataSource property var dataSource
property color borderColor: FluTheme.dark ? "#252525" : "#e4e4e4" property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1)
property alias rows: table_view.rows
property alias columns: table_view.columns
property bool horizonalHeaderVisible: true property bool horizonalHeaderVisible: true
property bool verticalHeaderVisible: true property bool verticalHeaderVisible: true
property color selectedBorderColor: FluTheme.primaryColor property color selectedBorderColor: FluTheme.primaryColor
property color selectedColor: FluTools.colorAlpha(FluTheme.primaryColor,0.3) property color selectedColor: FluTools.colorAlpha(FluTheme.primaryColor,0.3)
property alias sourceModel: table_model
id:control id:control
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
onColumnSourceChanged: { onColumnSourceChanged: {

View File

@ -8,12 +8,12 @@ FluButton {
property int hourFormat: FluTimePickerType.H property int hourFormat: FluTimePickerType.H
property int isH: hourFormat === FluTimePickerType.H property int isH: hourFormat === FluTimePickerType.H
property var current property var current
property string amText: "上午" property string amText: qsTr("AM")
property string pmText: "下午" property string pmText: qsTr("PM")
property string hourText: "时" property string hourText: qsTr("Hour")
property string minuteText: "分" property string minuteText: qsTr("Minute")
property string cancelText: "取消" property string cancelText: qsTr("Cancel")
property string okText: "确定" property string okText: qsTr("OK")
signal accepted() signal accepted()
id:control id:control
implicitHeight: 30 implicitHeight: 30

View File

@ -63,10 +63,6 @@
</context> </context>
<context> <context>
<name>FluCalendarPicker</name> <name>FluCalendarPicker</name>
<message>
<source>Please select a date</source>
<translation type="obsolete"></translation>
</message>
<message> <message>
<location filename="Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml" line="13"/> <location filename="Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml" line="13"/>
<location filename="Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml" line="12"/> <location filename="Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml" line="12"/>