From 6a31e865057e939ddee85a5c020c7a82ef80f14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 9 Apr 2024 20:53:52 +0800 Subject: [PATCH 01/29] update --- CMakeLists.txt | 2 +- example/example_en_US.ts | 39 +- example/example_zh_CN.ts | 47 +- example/qml/global/ItemsOriginal.qml | 6 + example/qml/page/T_TreeView.qml | 281 ++++-- src/FluTreeModel.cpp | 125 +-- src/FluTreeModel.h | 16 +- src/FluWatermark.cpp | 3 + .../imports/FluentUI/Controls/FluAcrylic.qml | 3 +- .../FluentUI/Controls/FluTableView.qml | 9 +- .../imports/FluentUI/Controls/FluTreeView.qml | 876 ++++++++++++------ src/Qt5/imports/FluentUI/plugins.qmltypes | 231 ++++- .../imports/FluentUI/Controls/FluAcrylic.qml | 3 +- .../FluentUI/Controls/FluTableView.qml | 9 +- .../imports/FluentUI/Controls/FluTreeView.qml | 876 ++++++++++++------ 15 files changed, 1711 insertions(+), 815 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d416420..3ef5a1d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ if(MSVC) set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") endif() -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/.cmake/) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake/) include(GetGitRevisionDescription) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index f20047c2..47476754 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -475,46 +475,51 @@ - QRCode + CodeEditor - Tour + QRCode - Timeline + Tour - Captcha + Timeline + Captcha + + + + Network - + Remote Loader - + Hot Loader - + 3D - + Test Crash @@ -2376,13 +2381,23 @@ Some contents... - - Total %1 data, %2 data currently displayed + + Title - - A total of %1 data items are selected + + Avatar + + + + + Address + + + + + Name diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 048a6c55..8ae59fac 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -475,46 +475,51 @@ + CodeEditor + + + + QRCode 二维码 - + Tour 游览 - + Timeline 时间轴 - + Captcha 验证码 - + Network 网络 - + Remote Loader 远程加载 - + Hot Loader 热加载 - + 3D 3D - + Test Crash 测试崩溃 @@ -2459,14 +2464,32 @@ Some contents... - Total %1 data, %2 data currently displayed - 共计%1条数据,当前显示的%2条数据 + 共计%1条数据,当前显示的%2条数据 - A total of %1 data items are selected - 共计选中%1条数据 + 共计选中%1条数据 + + + + Title + 标题 + + + + Address + 地址 + + + + Avatar + 头像 + + + + Name + 名称 diff --git a/example/qml/global/ItemsOriginal.qml b/example/qml/global/ItemsOriginal.qml index 47615f0a..8e96b2e0 100644 --- a/example/qml/global/ItemsOriginal.qml +++ b/example/qml/global/ItemsOriginal.qml @@ -426,6 +426,12 @@ FluObject{ FluPaneItemExpander{ title: qsTr("Other") icon: FluentIcons.Shop + FluPaneItem{ + title: qsTr("CodeEditor") + menuDelegate: paneItemMenu + url: "qrc:/example/qml/page/T_CodeEditor.qml" + onTap: { navigationView.push(url) } + } FluPaneItem{ title: qsTr("QRCode") menuDelegate: paneItemMenu diff --git a/example/qml/page/T_TreeView.qml b/example/qml/page/T_TreeView.qml index df7d47f2..c1ead5f5 100644 --- a/example/qml/page/T_TreeView.qml +++ b/example/qml/page/T_TreeView.qml @@ -9,14 +9,34 @@ FluContentPage { title: qsTr("TreeView") + + function treeData(){ - const dig = (path = '0', level = 4) => { + const names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"] + function getRandomName(){ + var randomIndex = Math.floor(Math.random() * names.length) + return names[randomIndex] + } + const addresses = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"] + function getRandomAddresses(){ + var randomIndex = Math.floor(Math.random() * addresses.length) + return addresses[randomIndex] + } + const avatars = ["qrc:/example/res/svg/avatar_1.svg", "qrc:/example/res/svg/avatar_2.svg", "qrc:/example/res/svg/avatar_3.svg", "qrc:/example/res/svg/avatar_4.svg","qrc:/example/res/svg/avatar_5.svg","qrc:/example/res/svg/avatar_6.svg","qrc:/example/res/svg/avatar_7.svg","qrc:/example/res/svg/avatar_8.svg","qrc:/example/res/svg/avatar_9.svg","qrc:/example/res/svg/avatar_10.svg","qrc:/example/res/svg/avatar_11.svg","qrc:/example/res/svg/avatar_12.svg"] + function getRandomAvatar(){ + var randomIndex = Math.floor(Math.random() * avatars.length); + return avatars[randomIndex]; + } + const dig = (path = '0', level = 5) => { const list = []; - for (let i = 0; i < 6; i += 1) { + for (let i = 0; i < 5; i += 1) { const key = `${path}-${i}`; const treeNode = { title: key, - key, + _key: key, + name: getRandomName(), + avatar:tree_view.customItem(com_avatar,{avatar:getRandomAvatar()}), + address: getRandomAddresses() }; if (level > 0) { treeNode.children = dig(key, level - 1); @@ -28,99 +48,202 @@ FluContentPage { return dig(); } - Column{ - id: layout_column - spacing: 12 - width: 300 - anchors{ - top:parent.top - left: parent.left - leftMargin: 10 - bottom:parent.bottom - bottomMargin: 20 - } + // Row{ + // id: layout_column + // spacing: 12 + // width: 340 + // anchors{ + // top:parent.top + // left: parent.left + // leftMargin: 10 + // bottom:parent.bottom + // bottomMargin: 20 + // } + // RowLayout{ + // spacing: 10 + // FluText{ + // text: "cellHeight:" + // Layout.alignment: Qt.AlignVCenter + // } + // FluSlider{ + // id: slider_cell_height + // value: 30 + // from: 30 + // to:100 + // } + // } + // RowLayout{ + // spacing: 10 + // FluText{ + // text: "depthPadding:" + // Layout.alignment: Qt.AlignVCenter + // } + // FluSlider{ + // id: slider_depth_padding + // value: 15 + // from: 15 + // to:100 + // } + // } + // FluToggleSwitch{ + // id: switch_showline + // text:"showLine" + // checked: false + // } + // FluToggleSwitch{ + // id: switch_checkable + // text:"checkable" + // checked: false + // } + // FluButton{ + // text: "all expand" + // onClicked: { + // tree_view.allExpand() + // } + // } + // FluButton{ + // text: "all collapse" + // onClicked: { + // tree_view.allCollapse() + // } + // } + // } - FluText{ - text: qsTr("Total %1 data, %2 data currently displayed").arg(tree_view.count()).arg(tree_view.visibleCount()) - } - - FluText{ - text: qsTr("A total of %1 data items are selected").arg(tree_view.selectionModel().length) - } - - RowLayout{ - spacing: 10 - FluText{ - text: "cellHeight:" - Layout.alignment: Qt.AlignVCenter - } - FluSlider{ - id: slider_cell_height - value: 30 - from: 30 - to:100 - } - } - RowLayout{ - spacing: 10 - FluText{ - text: "depthPadding:" - Layout.alignment: Qt.AlignVCenter - } - FluSlider{ - id: slider_depth_padding - value: 30 - from: 30 - to:100 - } - } - FluToggleSwitch{ - id: switch_showline - text:"showLine" - checked: false - } - FluToggleSwitch{ - id: switch_draggable - text:"draggable" - checked: false - } - FluToggleSwitch{ - id: switch_checkable - text:"checkable" - checked: false - } - FluButton{ - text: "all expand" - onClicked: { - tree_view.allExpand() - } - } - FluButton{ - text: "all collapse" - onClicked: { - tree_view.allCollapse() + Component{ + id:com_avatar + Item{ + FluClip{ + anchors.centerIn: parent + width: height + height: parent.height/3*2 + radius: [height/2,height/2,height/2,height/2] + Image{ + anchors.fill: parent + source: { + if(options && options.avatar){ + return options.avatar + } + return "" + } + sourceSize: Qt.size(80,80) + } } } } FluFrame{ + id:layout_controls anchors{ - left: layout_column.right + left: parent.left + right: parent.right top: parent.top + topMargin: 10 + } + height: 80 + clip: true + Row{ + spacing: 12 + anchors{ + left: parent.left + leftMargin: 10 + verticalCenter: parent.verticalCenter + } + Column{ + anchors.verticalCenter: parent.verticalCenter + RowLayout{ + spacing: 10 + FluText{ + text: "cellHeight:" + Layout.alignment: Qt.AlignVCenter + } + FluSlider{ + id: slider_cell_height + value: 38 + from: 38 + to:100 + } + } + RowLayout{ + spacing: 10 + FluText{ + text: "depthPadding:" + Layout.alignment: Qt.AlignVCenter + } + FluSlider{ + id: slider_depth_padding + value: 15 + from: 15 + to:100 + } + } + } + Column{ + spacing: 8 + anchors.verticalCenter: parent.verticalCenter + FluToggleSwitch{ + id: switch_showline + text:"showLine" + checked: false + } + FluToggleSwitch{ + id: switch_checkable + text:"checkable" + checked: false + } + } + Column{ + spacing: 8 + anchors.verticalCenter: parent.verticalCenter + FluButton{ + text: "all expand" + onClicked: { + tree_view.allExpand() + } + } + FluButton{ + text: "all collapse" + onClicked: { + tree_view.allCollapse() + } + } + } + + } + } + + FluFrame{ + anchors{ + left: parent.left + top: layout_controls.bottom + topMargin: 10 bottom: parent.bottom right: parent.right - rightMargin: 5 - topMargin: 5 - bottomMargin: 5 } - FluShadow{} FluTreeView{ id:tree_view anchors.fill: parent cellHeight: slider_cell_height.value - draggable:switch_draggable.checked showLine: switch_showline.checked checkable:switch_checkable.checked depthPadding: slider_depth_padding.value + columnSource:[ + { + title: qsTr("Title"), + dataIndex: 'title', + width: 300 + },{ + title: qsTr("Name"), + dataIndex: 'name', + width: 100 + },{ + title: qsTr("Avatar"), + dataIndex: 'avatar', + width: 100 + },{ + title: qsTr("Address"), + dataIndex: 'address', + width: 200 + }, + ] Component.onCompleted: { var data = treeData() dataSource = data diff --git a/src/FluTreeModel.cpp b/src/FluTreeModel.cpp index f53fede8..d2c3b5b9 100644 --- a/src/FluTreeModel.cpp +++ b/src/FluTreeModel.cpp @@ -24,13 +24,15 @@ int FluTreeModel::rowCount(const QModelIndex &parent) const { }; int FluTreeModel::columnCount(const QModelIndex &parent) const { - return 1;; + return this->_columnSource.size(); }; QVariant FluTreeModel::data(const QModelIndex &index, int role) const { switch (role) { - case Qt::DisplayRole: - return QVariant::fromValue(_rows.at(index.row())); + case TreeModelRoles::RowModel: + return QVariant::fromValue(_rows.at(index.row())); + case TreeModelRoles::ColumnModel: + return QVariant::fromValue(_columnSource.at(index.column())); default: break; } @@ -38,7 +40,10 @@ QVariant FluTreeModel::data(const QModelIndex &index, int role) const { }; QHash FluTreeModel::roleNames() const { - return { {Qt::DisplayRole, "dataModel"} }; + return { + {TreeModelRoles::RowModel, "rowModel"}, + {TreeModelRoles::ColumnModel, "columnModel"} + }; }; void FluTreeModel::setData(QList data){ @@ -76,6 +81,11 @@ QObject* FluTreeModel::getRow(int row){ return _rows.at(row); } +void FluTreeModel::setRow(int row,QVariantMap data){ + _rows.at(row)->_data = data; + Q_EMIT dataChanged(index(row,0),index(row,columnCount()-1)); +} + void FluTreeModel::checkRow(int row,bool checked){ auto itemData = _rows.at(row); if(itemData->hasChildren()){ @@ -125,10 +135,9 @@ void FluTreeModel::setDataSource(QList> data){ auto item = data.at(data.count()-1); data.pop_back(); FluTreeNode* node = new FluTreeNode(this); - node->_title = item.value("title").toString(); - node->_key = item.value("key").toString(); node->_depth = item.value("__depth").toInt(); node->_parent = item.value("__parent").value(); + node->_data = item; node->_isExpanded = true; if(node->_parent){ node->_parent->_children.append(node); @@ -201,110 +210,6 @@ void FluTreeModel::expand(int row){ insertRows(row+1,insertData); } -void FluTreeModel::dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea){ - if(dropIndex>_rows.count() || dropIndex<0){ - return; - } - auto dragItem = _rows[dragIndex]; - auto dropItem = _rows[dropIndex]; - int targetIndex; - if(dropIndex > dragIndex){ - if(isDropTopArea){ - targetIndex = dropIndex; - }else{ - targetIndex = dropIndex+1; - } - }else{ - if(isDropTopArea){ - targetIndex = dropIndex; - }else{ - targetIndex = dropIndex+1; - } - } - if (!beginMoveRows(QModelIndex(), dragIndex, dragIndex, QModelIndex(), targetIndex)) { - return; - } - if(dropIndex > dragIndex){ - if(isDropTopArea){ - targetIndex = dropIndex-1; - }else{ - targetIndex = dropIndex; - } - }else{ - if(isDropTopArea){ - targetIndex = dropIndex; - }else{ - targetIndex = dropIndex+1; - } - } - _rows.move(dragIndex,targetIndex); - endMoveRows(); - - Q_EMIT layoutAboutToBeChanged(); - if(dragItem->_parent == dropItem->_parent){ - QList* children = &(dragItem->_parent->_children); - int srcIndex = children->indexOf(dragItem); - int destIndex = children->indexOf(dropItem); - if(dropIndex > dragIndex){ - if(isDropTopArea){ - targetIndex = destIndex-1; - }else{ - targetIndex = destIndex; - } - }else{ - if(isDropTopArea){ - targetIndex = destIndex; - }else{ - targetIndex = destIndex+1; - } - } - children->move(srcIndex,targetIndex); - }else{ - QList* srcChildren = &(dragItem->_parent->_children); - QList* destChildren = &(dropItem->_parent->_children); - int srcIndex = srcChildren->indexOf(dragItem); - int destIndex = destChildren->indexOf(dropItem); - dragItem->_depth = dropItem->_depth; - dragItem->_parent = dropItem->_parent; - if(dragItem->hasChildren()){ - QList stack = dragItem->_children; - foreach (auto node, stack) { - node->_depth = dragItem->_depth+1; - } - std::reverse(stack.begin(), stack.end()); - while (stack.count() > 0) { - auto item = stack.at(stack.count()-1); - stack.pop_back(); - QList children = item->_children; - if(!children.isEmpty()){ - std::reverse(children.begin(), children.end()); - foreach (auto c, children) { - c->_depth = item->_depth+1; - stack.append(c); - } - } - } - } - srcChildren->removeAt(srcIndex); - if(dropIndex > dragIndex){ - if(isDropTopArea){ - targetIndex = destIndex; - }else{ - targetIndex = destIndex + 1; - } - }else{ - if(isDropTopArea){ - targetIndex = destIndex; - }else{ - targetIndex = destIndex + 1; - } - } - destChildren->insert(targetIndex,dragItem); - } - changePersistentIndex(index(qMin(dragIndex,dropIndex),0),index(qMax(dragIndex,dropIndex),0)); - Q_EMIT dataChanged(index(0,0),index(rowCount()-1,0)); -} - bool FluTreeModel::hitHasChildrenExpanded(int row){ auto itemData = _rows.at(row); if(itemData->hasChildren() && itemData->_isExpanded){ diff --git a/src/FluTreeModel.h b/src/FluTreeModel.h index 9b588d3d..a64e1efb 100644 --- a/src/FluTreeModel.h +++ b/src/FluTreeModel.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "stdafx.h" @@ -12,17 +13,15 @@ */ class FluTreeNode : public QObject{ Q_OBJECT - Q_PROPERTY(QString key READ key CONSTANT) - Q_PROPERTY(QString title READ title CONSTANT) + Q_PROPERTY(QVariantMap data READ data CONSTANT) Q_PROPERTY(int depth READ depth CONSTANT) Q_PROPERTY(bool isExpanded READ isExpanded CONSTANT) Q_PROPERTY(bool checked READ checked CONSTANT) public: explicit FluTreeNode(QObject *parent = nullptr); - Q_INVOKABLE QString key(){return _key;}; - Q_INVOKABLE QString title(){return _title;}; Q_INVOKABLE int depth(){return _depth;}; Q_INVOKABLE bool isExpanded(){return _isExpanded;}; + Q_INVOKABLE QVariantMap data(){return _data;}; Q_INVOKABLE bool hasChildren(){ return !_children.isEmpty();}; Q_INVOKABLE bool hasNextNodeByIndex(int index){ FluTreeNode* p = this; @@ -70,11 +69,11 @@ public: return true; } public: - QString _key=""; QString _title=""; int _depth=0; bool _checked = false; bool _isExpanded=true; + QVariantMap _data; QList _children; FluTreeNode* _parent = nullptr; }; @@ -84,9 +83,14 @@ class FluTreeModel : public QAbstractItemModel Q_OBJECT Q_PROPERTY_AUTO(int,dataSourceSize) Q_PROPERTY_AUTO(QList,selectionModel) + Q_PROPERTY_AUTO(QList,columnSource) QML_NAMED_ELEMENT(FluTreeModel) QML_ADDED_IN_MINOR_VERSION(1) public: + enum TreeModelRoles { + RowModel = 0x0101, + ColumnModel = 0x0102 + }; explicit FluTreeModel(QObject *parent = nullptr); int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; @@ -98,11 +102,11 @@ public: Q_INVOKABLE void removeRows(int row,int count); Q_INVOKABLE void insertRows(int row,QList data); Q_INVOKABLE QObject* getRow(int row); + Q_INVOKABLE void setRow(int row,QVariantMap data); Q_INVOKABLE void setData(QList data); Q_INVOKABLE void setDataSource(QList> data); Q_INVOKABLE void collapse(int row); Q_INVOKABLE void expand(int row); - Q_INVOKABLE void dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea); Q_INVOKABLE FluTreeNode* getNode(int row); Q_INVOKABLE void refreshNode(int row); Q_INVOKABLE void checkRow(int row,bool checked); diff --git a/src/FluWatermark.cpp b/src/FluWatermark.cpp index 363de1f5..54f2405e 100644 --- a/src/FluWatermark.cpp +++ b/src/FluWatermark.cpp @@ -1,5 +1,7 @@ #include "FluWatermark.h" +#include "FluTextStyle.h" + FluWatermark::FluWatermark(QQuickItem* parent) : QQuickPaintedItem(parent){ gap(QPoint(100,100)); offset(QPoint(_gap.x()/2,_gap.y()/2)); @@ -17,6 +19,7 @@ FluWatermark::FluWatermark(QQuickItem* parent) : QQuickPaintedItem(parent){ void FluWatermark::paint(QPainter* painter){ QFont font; + font.setFamily(FluTextStyle::getInstance()->family()); font.setPixelSize(_textSize); painter->setFont(font); painter->setPen(_textColor); diff --git a/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml b/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml index 5ee5ddfb..66d06fb1 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml @@ -10,8 +10,7 @@ Item { property real noiseOpacity: 0.02 property alias target: effect_source.sourceItem property int blurRadius: 32 - property rect targetRect: Qt.rect(control.x, control.y, control.width, - control.height) + property rect targetRect: Qt.rect(control.x, control.y, control.width,control.height) ShaderEffectSource { id: effect_source anchors.fill: parent diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 68891d97..3a6d429c 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -90,7 +90,7 @@ Rectangle { if(!readOnly){ editTextChaged(text_box.text) } - tableView.closeEditor() + control.closeEditor() } } } @@ -119,7 +119,7 @@ Rectangle { if(!readOnly){ editTextChaged(text_box.text) } - tableView.closeEditor() + control.closeEditor() } } } @@ -258,7 +258,7 @@ Rectangle { anchors.fill: parent acceptedButtons: Qt.LeftButton onPressed:{ - closeEditor() + control.closeEditor() } onCanceled: { } @@ -275,7 +275,7 @@ Rectangle { onClicked: (event)=>{ d.current = rowObject - closeEditor() + control.closeEditor() event.accepted = true } } @@ -381,6 +381,7 @@ Rectangle { clip: true onRowsChanged: { control.closeEditor() + table_view.flick(0,1) } delegate: com_table_delegate FluLoader{ diff --git a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml index 59e33919..6fb81008 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml @@ -5,283 +5,186 @@ import QtQuick.Controls 2.15 import Qt.labs.qmlmodels 1.0 import FluentUI 1.0 -Item { - property int currentIndex : -1 +Rectangle { property var dataSource + property var columnSource : [] property bool showLine: true - property bool draggable: false property int cellHeight: 30 - property int depthPadding: 30 + property int depthPadding: 15 property bool checkable: false - property color lineColor: FluTheme.dark ? Qt.rgba(111/255,111/255,111/255,1) : Qt.rgba(217/255,217/255,217/255,1) + property color lineColor: FluTheme.dividerColor + property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) + property color selectedBorderColor: FluTheme.primaryColor + property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3) + readonly property alias current: d.current id:control - QtObject { - id:d - property int dy - property var current - property int dropIndex: -1 - property bool isDropTopArea: false - property int dragIndex: -1 - property color hitColor: FluTheme.primaryColor - } + color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) onDataSourceChanged: { tree_model.setDataSource(dataSource) } + onColumnSourceChanged: { + var columns= [] + var headerRow = {} + columnSource.forEach(function(item){ + var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',control); + column.display = item.dataIndex + columns.push(column) + headerRow[item.dataIndex] = item.title + }) + header_column_model.columns = columns + header_column_model.rows = [headerRow] + } FluTreeModel{ id:tree_model + columnSource: control.columnSource } - ListView{ - id:table_view - ScrollBar.horizontal: FluScrollBar{} - ScrollBar.vertical: FluScrollBar{} - boundsBehavior: Flickable.StopAtBounds - model: tree_model - anchors.fill: parent - clip: true - flickableDirection: Flickable.HorizontalAndVerticalFlick - contentWidth: contentItem.childrenRect.width - reuseItems: true - removeDisplaced : Transition{ - ParallelAnimation{ - NumberAnimation { - properties: "y" - duration: 167 - from: d.dy + table_view.height - easing.type: Easing.OutCubic - } - NumberAnimation { - properties: "opacity" - duration: 83 - from: 0 - to: 1 - } - } + onDepthPaddingChanged: { + table_view.forceLayout() + } + onCellHeightChanged: { + table_view.forceLayout() + } + onCheckableChanged: { + delay_force_layout.restart() + } + Timer{ + id:delay_force_layout + interval: 30 + onTriggered: { + table_view.forceLayout() } - move: Transition { - NumberAnimation { property: "y"; duration: 200 } - } - add: Transition{ - ParallelAnimation{ - NumberAnimation { - properties: "y" - duration: 167 - from: d.dy - control.cellHeight - easing.type: Easing.OutCubic - } - NumberAnimation { - properties: "opacity" - duration: 83 - from: 0 - to: 1 - } + } + QtObject { + id:d + property var current + property int defaultItemWidth: 100 + property int rowHoverIndex: -1 + property var editDelegate + property var editPosition + function getEditDelegate(column){ + var obj = control.columnSource[column].editDelegate + if(obj){ + return obj } - } - delegate: Item { - id:item_control - implicitWidth: item_loader_container.width - implicitHeight: item_loader_container.height - ListView.onReused: { - item_loader_container.item.reused() + if(control.columnSource[column].editMultiline === true){ + return com_edit_multiline } - ListView.onPooled: { - item_loader_container.item.pooled() - } - FluLoader{ - property var itemControl: item_control - property var itemModel: dataModel - property int rowIndex: index - property bool isItemLoader: true - id:item_loader_container - sourceComponent: com_item_container - } - } - FluLoader{ - id:loader_container - property var itemControl - property var itemModel - property bool isItemLoader: false + return com_edit } } Component{ - id:com_item_container + id:com_edit + FluTextBox{ + id:text_box + text: String(display) + readOnly: true === control.columnSource[column].readOnly + Component.onCompleted: { + forceActiveFocus() + selectAll() + } + onCommit: { + if(!readOnly){ + editTextChaged(text_box.text) + } + control.closeEditor() + } + } + } + Component{ + id:com_edit_multiline Item{ - signal reused - signal pooled - onReused: { - - } - onPooled: { - } - property bool isCurrent: d.current === itemModel - id:item_container - width: { - var w = 46 + item_loader_cell.width + control.depthPadding*itemModel.depth - if(control.width>w){ - return control.width - } - return w - } - height: control.cellHeight - implicitWidth: width - implicitHeight: height - function toggle(){ - var pos = FluTools.cursorPos() - var viewPos = table_view.mapToGlobal(0,0) - d.dy = table_view.contentY + pos.y-viewPos.y - if(itemModel.isExpanded){ - tree_model.collapse(rowIndex) - }else{ - tree_model.expand(rowIndex) + anchors.fill: parent + Flickable{ + id:item_scroll + clip: true + anchors.fill: parent + ScrollBar.vertical: multiline_text_srcoll_bar + boundsBehavior: Flickable.StopAtBounds + TextArea.flickable: FluMultilineTextBox { + id:text_box + text: String(display) + readOnly: true === control.columnSource[column].readOnly + verticalAlignment: TextInput.AlignVCenter + isCtrlEnterForNewline: true + Component.onCompleted: { + forceActiveFocus() + selectAll() + } + rightPadding: 34 + onCommit: { + if(!readOnly){ + editTextChaged(text_box.text) + } + control.closeEditor() + } } } - Rectangle{ - width: 3 - height: 18 - radius: 1.5 - color: FluTheme.primaryColor - visible: isCurrent + FluIconButton{ + iconSource:FluentIcons.ChromeClose + iconSize: 10 + width: 20 + height: 20 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 + visible: { + if(text_box.readOnly) + return false + return text_box.text !== "" + } anchors{ - left: parent.left - leftMargin: 6 verticalCenter: parent.verticalCenter + right: parent.right + rightMargin: 15 } + onClicked:{ + text_box.text = "" + } + } + FluScrollBar{ + id:multiline_text_srcoll_bar + anchors{ + right: parent.right + rightMargin: 5 + top: parent.top + bottom: parent.bottom + topMargin: 3 + bottomMargin: 3 + } + } + } + } + Component{ + id:com_column + Item{ + id:item_container + clip: true + function toggle(){ + if(rowModel.isExpanded){ + tree_model.collapse(row) + }else{ + tree_model.expand(row) + } + delay_force_layout.restart() } MouseArea{ id:item_mouse property point clickPos: Qt.point(0,0) anchors.fill: parent - drag.target:control.draggable ? loader_container : undefined - hoverEnabled: true - drag.onActiveChanged: { - if(drag.active){ - if(itemModel.isExpanded && itemModel.hasChildren()){ - tree_model.collapse(rowIndex) - } - d.dragIndex = rowIndex - loader_container.sourceComponent = com_item_container - } - } - onPressed: - (mouse)=>{ - clickPos = Qt.point(mouse.x,mouse.y) - loader_container.itemControl = itemControl - loader_container.itemModel = itemModel - var cellPosition = item_container.mapToItem(table_view, 0, 0) - loader_container.width = item_container.width - loader_container.height = item_container.height - loader_container.x = 0 - loader_container.y = cellPosition.y - } onClicked: { - d.current = itemModel + d.current = rowModel } onDoubleClicked: { - if(itemModel.hasChildren()){ + if(rowModel.hasChildren()){ item_container.toggle() } } - onPositionChanged: - (mouse)=> { - if(!drag.active){ - return - } - var cellPosition = item_container.mapToItem(table_view, 0, 0) - if(mouse.y+cellPosition.y<0 || mouse.y+cellPosition.y>table_view.height){ - d.dropIndex = -1 - return - } - if((mouse.x-table_view.contentX)>table_view.width || (mouse.x-table_view.contentX)<0){ - d.dropIndex = -1 - return - } - var pos = FluTools.cursorPos() - var viewPos = table_view.mapToGlobal(0,0) - var y = table_view.contentY + pos.y-viewPos.y - var index = Math.floor(y/control.cellHeight) - if(index<0 || index>table_view.count-1){ - d.dropIndex = -1 - return - } - if(tree_model.hitHasChildrenExpanded(index) && y>index*control.cellHeight+control.cellHeight/2){ - d.dropIndex = index + 1 - d.isDropTopArea = true - }else{ - d.dropIndex = index - if(y>index*control.cellHeight+control.cellHeight/2){ - d.isDropTopArea = false - }else{ - d.isDropTopArea = true - } - } - } - onCanceled: { - loader_container.sourceComponent = undefined - loader_container.x = 0 - loader_container.y = 0 - d.dropIndex = -1 - d.dragIndex = -1 - } - onReleased: { - loader_container.sourceComponent = undefined - if(d.dropIndex !== -1){ - tree_model.dragAndDrop(d.dragIndex,d.dropIndex,d.isDropTopArea) - } - d.dropIndex = -1 - d.dragIndex = -1 - loader_container.x = 0 - loader_container.y = 0 - } - } - Drag.active: item_mouse.drag.active - Rectangle{ - id:item_line_drop_tip - anchors{ - left: layout_row.left - leftMargin: 26 - right: parent.right - rightMargin: 10 - bottom: parent.bottom - bottomMargin: -1.5 - top: undefined - } - states: [ - State { - when:d.isDropTopArea - AnchorChanges { - target: item_line_drop_tip - anchors.top: item_container.top - anchors.bottom: undefined - } - PropertyChanges { - target: item_line_drop_tip - anchors.topMargin: -1.5 - } - } - ] - height: 3 - radius: 1.5 - color: d.hitColor - visible: d.dropIndex === rowIndex - Rectangle{ - width: 10 - height: 10 - radius: 5 - border.width: 3 - border.color: d.hitColor - color: FluTheme.dark ? FluColors.Black : FluColors.White - anchors{ - top: parent.top - left: parent.left - topMargin: -3 - leftMargin: -5 - } - } } FluRectangle{ width: 1 color: control.lineColor - visible: control.showLine && isItemLoader && itemModel.depth !== 0 && !itemModel.hasChildren() - height: itemModel.hideLineFooter() ? parent.height/2 : parent.height + visible: control.showLine && rowModel.depth !== 0 && !rowModel.hasChildren() + height: rowModel.hideLineFooter() ? parent.height/2 : parent.height anchors{ top: parent.top left: item_line_h.left @@ -291,7 +194,7 @@ Item { id:item_line_h height: 1 color: control.lineColor - visible: control.showLine && isItemLoader && itemModel.depth !== 0 && !itemModel.hasChildren() + visible: control.showLine && rowModel.depth !== 0 && !rowModel.hasChildren() width: depthPadding - 10 anchors{ right: layout_row.left @@ -300,12 +203,12 @@ Item { } } Repeater{ - model: Math.max(itemModel.depth-1,0) + model: Math.max(rowModel.depth-1,0) delegate: FluRectangle{ required property int index width: 1 color: control.lineColor - visible: control.showLine && isItemLoader && itemModel.depth !== 0 && itemModel.hasNextNodeByIndex(index) + visible: control.showLine && rowModel.depth !== 0 && rowModel.hasNextNodeByIndex(index) anchors{ top:parent.top bottom: parent.bottom @@ -314,57 +217,34 @@ Item { } } } - Rectangle{ - anchors.fill: parent - radius: 4 - anchors.leftMargin: 6 - anchors.rightMargin: 6 - border.color: d.hitColor - border.width: d.dragIndex === rowIndex ? 1 : 0 - color: { - if(isCurrent){ - return FluTheme.itemCheckColor - } - if(item_mouse.containsMouse || item_check_box.hovered){ - return FluTheme.itemHoverColor - } - if(item_loader_expand.item && item_loader_expand.item.hovered){ - return FluTheme.itemHoverColor - } - return FluTheme.itemNormalColor - } - } RowLayout{ id:layout_row height: parent.height - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left + anchors.fill: parent spacing: 0 - anchors.leftMargin: 14 + control.depthPadding*itemModel.depth + anchors.leftMargin: 14 + control.depthPadding*rowModel.depth Component{ id:com_icon_btn FluIconButton{ - opacity: itemModel.hasChildren() + opacity: rowModel.hasChildren() onClicked: { item_container.toggle() } contentItem:FluIcon{ - rotation: itemModel.isExpanded?0:-90 + rotation: rowModel.isExpanded?0:-90 iconSource:FluentIcons.ChevronDown iconSize: 16 anchors.centerIn: parent } } } - FluLoader{ id:item_loader_expand Layout.preferredWidth: 20 Layout.preferredHeight: 20 - sourceComponent: itemModel.hasChildren() ? com_icon_btn : undefined + sourceComponent: rowModel.hasChildren() ? com_icon_btn : undefined Layout.alignment: Qt.AlignVCenter } - FluCheckBox{ id:item_check_box Layout.preferredWidth: 18 @@ -372,39 +252,453 @@ Item { Layout.leftMargin: 5 horizontalPadding:0 verticalPadding: 0 - checked: itemModel.checked + checked: rowModel.checked animationEnabled:false visible: control.checkable padding: 0 clickListener: function(){ - tree_model.checkRow(rowIndex,!itemModel.checked) + tree_model.checkRow(row,!rowModel.checked) } Layout.alignment: Qt.AlignVCenter } - FluLoader{ - property var dataModel: itemModel - property var itemMouse: item_mouse - id:item_loader_cell - Layout.leftMargin: 10 - Layout.preferredWidth: { - if(item){ - return item.width - } - return 0 - } + Item{ Layout.fillHeight: true - sourceComponent:com_item_text + Layout.fillWidth: true + Layout.leftMargin: 6 + FluText { + id:item_text + text: String(display) + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + anchors.fill: parent + MouseArea{ + acceptedButtons: Qt.NoButton + id: hover_handler + hoverEnabled: true + anchors.fill: parent + } + FluTooltip{ + text: item_text.text + delay: 500 + visible: item_text.contentWidth < item_text.implicitWidth && hover_handler.containsMouse + } + } } + } } } + Component{ + id:com_other + FluText { + id:item_text + text: String(display) + elide: Text.ElideRight + wrapMode: Text.WrapAnywhere + anchors{ + fill: parent + leftMargin: 11 + rightMargin: 11 + topMargin: 6 + bottomMargin: 6 + } + verticalAlignment: Text.AlignVCenter + MouseArea{ + acceptedButtons: Qt.NoButton + id: hover_handler + hoverEnabled: true + anchors.fill: parent + } + FluTooltip{ + text: item_text.text + delay: 500 + visible: item_text.contentWidth < item_text.implicitWidth && item_text.contentHeight < item_text.implicitHeight && hover_handler.containsMouse + } + } + } + TableView{ + id:table_view + ScrollBar.horizontal: FluScrollBar{} + ScrollBar.vertical: FluScrollBar{} + boundsBehavior: Flickable.StopAtBounds + model: tree_model + anchors{ + top: header_horizontal.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + clip: true + columnWidthProvider: function(column) { + var columnObject = control.columnSource[column] + var width = columnObject.width + if(width){ + return width + } + var minimumWidth = columnObject.minimumWidth + if(minimumWidth){ + return minimumWidth + } + return d.defaultItemWidth + } + rowHeightProvider: function(row) { + return control.cellHeight + } + delegate: MouseArea{ + property var rowObject : rowModel.data + property alias isRowSelected: item_table_loader.isRowSelected + property var display: rowModel.data[columnModel.dataIndex] + property bool isObject: typeof(item_table.display) == "object" + property bool editVisible: { + if(rowObject && d.editPosition && d.editPosition._key === rowObject._key && d.editPosition.column === column){ + return true + } + return false + } + implicitHeight: 30 + implicitWidth: 30 + id: item_table + hoverEnabled: true + onEntered: { + d.rowHoverIndex = row + } + onWidthChanged: { + if(editVisible){ + updateEditPosition() + } + } + onHeightChanged: { + if(editVisible){ + updateEditPosition() + } + } + onXChanged: { + if(editVisible){ + updateEditPosition() + } + } + onYChanged: { + if(editVisible){ + updateEditPosition() + } + } + function updateEditPosition(){ + var obj = {} + obj._key = rowObject._key + obj.column = column + obj.row = row + obj.x = item_table.x + obj.y = item_table.y + 1 + obj.width = item_table.width + obj.height = item_table.height - 2 + d.editPosition = obj + } + onDoubleClicked:{ + if(typeof(display) == "object"){ + return + } + d.editDelegate = d.getEditDelegate(column) + updateEditPosition() + loader_edit.display = display + } + onClicked: + (event)=>{ + d.current = rowModel + event.accepted = true + } + Rectangle{ + anchors.fill: parent + color:{ + if(item_table.isRowSelected){ + return control.selectedColor + } + if(d.rowHoverIndex === row || item_table.isRowSelected){ + return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06) + } + return (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.015) : Qt.rgba(0,0,0,0.015)) + } + Item{ + anchors.fill: parent + visible: item_table.isRowSelected + Rectangle{ + width: 1 + height: parent.height + anchors.left: parent.left + color: control.selectedBorderColor + visible: column === 0 + } + Rectangle{ + width: 1 + height: parent.height + anchors.right: parent.right + color: control.selectedBorderColor + visible: column === control.columnSource.length-1 + } + Rectangle{ + width: parent.width + height: 1 + anchors.top: parent.top + color: control.selectedBorderColor + } + Rectangle{ + width: parent.width + height: 1 + anchors.bottom: parent.bottom + color: control.selectedBorderColor + } + } + } + FluLoader{ + anchors.fill: parent + id:item_table_loader + property var rowModel : model.rowModel + property var columnModel : model.columnModel + property int row : model.row + property int column: model.column + property var display: item_table.display + property bool isRowSelected: d.current === rowModel + property var options: { + if(isObject){ + return display.options + } + return {} + } + sourceComponent: { + if(column === 0) + return com_column + if(item_table.isObject){ + return item_table.display.comId + } + return com_other + } + } + } + FluLoader{ + id:loader_edit + property var tableView: control + property var display + property int column: { + if(d.editPosition){ + return d.editPosition.column + } + return 0 + } + property int row: { + if(d.editPosition){ + return d.editPosition.row + } + return 0 + } + signal editTextChaged(string text) + sourceComponent: d.editPosition ? d.editDelegate : undefined + onEditTextChaged: + (text)=>{ + const obj = tree_model.getRow(row).data + obj[control.columnSource[column].dataIndex] = text + tree_model.setRow(row,obj) + } + width: { + if(d.editPosition){ + return d.editPosition.width + } + return 0 + } + height: { + if(d.editPosition){ + return d.editPosition.height + } + return 0 + } + x:{ + if(d.editPosition){ + return d.editPosition.x + } + return 0 + } + y:{ + if(d.editPosition){ + return d.editPosition.y + } + return 0 + } + z:999 + } + } + TableModel{ + id:header_column_model + TableModelColumn {} + } + Component{ + id:com_column_text + FluText { + id: column_text + text: modelData + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + Component{ + id:com_column_header_delegate + Rectangle{ + id:column_item_control + readonly property real cellPadding: 8 + property bool canceled: false + property int columnIndex: column + property var columnObject : control.columnSource[column] + implicitWidth: { + return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2) + } + implicitHeight: Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2)) + color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) + Rectangle{ + border.color: control.borderColor + width: parent.width + height: 1 + anchors.top: parent.top + color:"#00000000" + } + Rectangle{ + border.color: control.borderColor + width: parent.width + height: 1 + anchors.bottom: parent.bottom + color:"#00000000" + } + Rectangle{ + border.color: control.borderColor + width: 1 + height: parent.height + anchors.left: parent.left + color:"#00000000" + } + Rectangle{ + border.color: control.borderColor + width: 1 + height: parent.height + anchors.right: parent.right + color:"#00000000" + visible: column === table_view.columns - 1 + } + MouseArea{ + id:column_item_control_mouse + anchors.fill: parent + anchors.rightMargin: 6 + hoverEnabled: true + onCanceled: { + column_item_control.canceled = true + } + onContainsMouseChanged: { + if(!containsMouse){ + column_item_control.canceled = false + } + } + onClicked: + (event)=>{ + + } + } + FluLoader{ + id:item_column_loader + property var itemModel: model + property var modelData: model.display + property var tableView: table_view + property var options:{ + if(typeof(modelData) == "object"){ + return modelData.options + } + return {} + } + property int column: column_item_control.columnIndex + width: parent.width + height: parent.height + sourceComponent: { + if(typeof(modelData) == "object"){ + return modelData.comId + } + return com_column_text + } + } + MouseArea{ + property point clickPos: "0,0" + height: parent.height + width: 6 + anchors.right: parent.right + acceptedButtons: Qt.LeftButton + hoverEnabled: true + visible: !(columnObject.width === columnObject.minimumWidth && columnObject.width === columnObject.maximumWidth && columnObject.width) + cursorShape: Qt.SplitHCursor + preventStealing: true + onPressed : + (mouse)=>{ + FluTools.setOverrideCursor(Qt.SplitHCursor) + clickPos = Qt.point(mouse.x, mouse.y) + } + onReleased:{ + FluTools.restoreOverrideCursor() + } + onCanceled: { + FluTools.restoreOverrideCursor() + } + onPositionChanged: + (mouse)=>{ + if(!pressed){ + return + } + var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) + var minimumWidth = columnObject.minimumWidth + var maximumWidth = columnObject.maximumWidth + var w = columnObject.width + if(!w){ + w = d.defaultItemWidth + } + if(!minimumWidth){ + minimumWidth = d.defaultItemWidth + } + if(!maximumWidth){ + maximumWidth = 65535 + } + columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth) + table_view.forceLayout() + } + } + } + } + + TableView { + id: header_horizontal + model: header_column_model + anchors{ + left: table_view.left + right: table_view.right + top: parent.top + } + height: Math.max(1, contentHeight) + boundsBehavior: Flickable.StopAtBounds + clip: true + syncDirection: Qt.Horizontal + columnWidthProvider: table_view.columnWidthProvider + syncView: table_view.rows === 0 ? null : table_view + onContentXChanged:{ + timer_horizontal_force_layout.restart() + } + Timer{ + id:timer_horizontal_force_layout + interval: 50 + onTriggered: { + header_horizontal.forceLayout() + } + } + delegate: com_column_header_delegate + } + Component{ id:com_item_text Item{ width: item_text.width FluText { id:item_text - text: dataModel.title + text: model.title rightPadding: 14 anchors.centerIn: parent color:{ @@ -423,7 +717,7 @@ Item { return tree_model.dataSourceSize } function visibleCount(){ - return table_view.count + return table_view.rows } function collapse(rowIndex){ tree_model.collapse(rowIndex) @@ -437,4 +731,14 @@ Item { function allCollapse(){ tree_model.allCollapse() } + function customItem(comId,options={}){ + var o = {} + o.comId = comId + o.options = options + return o + } + function closeEditor(){ + d.editPosition = undefined + d.editDelegate = undefined + } } diff --git a/src/Qt5/imports/FluentUI/plugins.qmltypes b/src/Qt5/imports/FluentUI/plugins.qmltypes index c1bda21d..365b380d 100644 --- a/src/Qt5/imports/FluentUI/plugins.qmltypes +++ b/src/Qt5/imports/FluentUI/plugins.qmltypes @@ -21,6 +21,24 @@ Module { Property { name: "lighter"; type: "QColor" } Property { name: "lightest"; type: "QColor" } } + Component { + name: "FluApp" + prototype: "QObject" + exports: ["FluentUI/FluApp 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "useSystemAppBar"; type: "bool" } + Property { name: "windowIcon"; type: "string" } + Property { name: "locale"; type: "QLocale" } + Method { + name: "init" + Parameter { name: "target"; type: "QObject"; isPointer: true } + Parameter { name: "locale"; type: "QLocale" } + } + Method { + name: "init" + Parameter { name: "target"; type: "QObject"; isPointer: true } + } + } Component { name: "FluCalendarViewType" exports: ["FluentUI/FluCalendarViewType 1.0"] @@ -50,6 +68,50 @@ Module { Parameter { name: "code"; type: "string" } } } + Component { + name: "FluColors" + prototype: "QObject" + exports: ["FluentUI/FluColors 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "Transparent"; type: "QColor" } + Property { name: "Black"; type: "QColor" } + Property { name: "White"; type: "QColor" } + Property { name: "Grey10"; type: "QColor" } + Property { name: "Grey20"; type: "QColor" } + Property { name: "Grey30"; type: "QColor" } + Property { name: "Grey40"; type: "QColor" } + Property { name: "Grey50"; type: "QColor" } + Property { name: "Grey60"; type: "QColor" } + Property { name: "Grey70"; type: "QColor" } + Property { name: "Grey80"; type: "QColor" } + Property { name: "Grey90"; type: "QColor" } + Property { name: "Grey100"; type: "QColor" } + Property { name: "Grey110"; type: "QColor" } + Property { name: "Grey120"; type: "QColor" } + Property { name: "Grey130"; type: "QColor" } + Property { name: "Grey140"; type: "QColor" } + Property { name: "Grey150"; type: "QColor" } + Property { name: "Grey160"; type: "QColor" } + Property { name: "Grey170"; type: "QColor" } + Property { name: "Grey180"; type: "QColor" } + Property { name: "Grey190"; type: "QColor" } + Property { name: "Grey200"; type: "QColor" } + Property { name: "Grey210"; type: "QColor" } + Property { name: "Grey220"; type: "QColor" } + Property { name: "Yellow"; type: "FluAccentColor"; isPointer: true } + Property { name: "Orange"; type: "FluAccentColor"; isPointer: true } + Property { name: "Red"; type: "FluAccentColor"; isPointer: true } + Property { name: "Magenta"; type: "FluAccentColor"; isPointer: true } + Property { name: "Purple"; type: "FluAccentColor"; isPointer: true } + Property { name: "Blue"; type: "FluAccentColor"; isPointer: true } + Property { name: "Teal"; type: "FluAccentColor"; isPointer: true } + Property { name: "Green"; type: "FluAccentColor"; isPointer: true } + Method { + name: "createAccentColor" + type: "FluAccentColor*" + Parameter { name: "primaryColor"; type: "QColor" } + } + } Component { name: "FluContentDialogType" exports: ["FluentUI/FluContentDialogType 1.0"] @@ -226,6 +288,49 @@ Module { Parameter { name: "filter"; type: "QJSValue" } } } + Component { + name: "FluTextStyle" + prototype: "QObject" + exports: ["FluentUI/FluTextStyle 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "family"; type: "string" } + Property { name: "Caption"; type: "QFont" } + Property { name: "Body"; type: "QFont" } + Property { name: "BodyStrong"; type: "QFont" } + Property { name: "Subtitle"; type: "QFont" } + Property { name: "Title"; type: "QFont" } + Property { name: "TitleLarge"; type: "QFont" } + Property { name: "Display"; type: "QFont" } + } + Component { + name: "FluTheme" + prototype: "QObject" + exports: ["FluentUI/FluTheme 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "dark"; type: "bool"; isReadonly: true } + Property { name: "accentColor"; type: "FluAccentColor"; isPointer: true } + Property { name: "primaryColor"; type: "QColor" } + Property { name: "backgroundColor"; type: "QColor" } + Property { name: "dividerColor"; type: "QColor" } + Property { name: "windowBackgroundColor"; type: "QColor" } + Property { name: "windowActiveBackgroundColor"; type: "QColor" } + Property { name: "fontPrimaryColor"; type: "QColor" } + Property { name: "fontSecondaryColor"; type: "QColor" } + Property { name: "fontTertiaryColor"; type: "QColor" } + Property { name: "itemNormalColor"; type: "QColor" } + Property { name: "itemHoverColor"; type: "QColor" } + Property { name: "itemPressColor"; type: "QColor" } + Property { name: "itemCheckColor"; type: "QColor" } + Property { name: "darkMode"; type: "int" } + Property { name: "nativeText"; type: "bool" } + Property { name: "animationEnabled"; type: "bool" } + Method { + name: "awesomeList" + type: "QJsonArray" + Parameter { name: "keyword"; type: "string" } + } + Method { name: "awesomeList"; type: "QJsonArray" } + } Component { name: "FluThemeType" exports: ["FluentUI/FluThemeType 1.0"] @@ -267,6 +372,115 @@ Module { } } } + Component { + name: "FluTools" + prototype: "QObject" + exports: ["FluentUI/FluTools 1.0"] + exportMetaObjectRevisions: [0] + Method { name: "qtMajor"; type: "int" } + Method { name: "qtMinor"; type: "int" } + Method { name: "isMacos"; type: "bool" } + Method { name: "isLinux"; type: "bool" } + Method { name: "isWin"; type: "bool" } + Method { + name: "clipText" + Parameter { name: "text"; type: "string" } + } + Method { name: "uuid"; type: "string" } + Method { + name: "readFile" + type: "string" + Parameter { name: "fileName"; type: "string" } + } + Method { + name: "setQuitOnLastWindowClosed" + Parameter { name: "val"; type: "bool" } + } + Method { + name: "setOverrideCursor" + Parameter { name: "shape"; type: "Qt::CursorShape" } + } + Method { name: "restoreOverrideCursor" } + Method { + name: "html2PlantText" + type: "string" + Parameter { name: "html"; type: "string" } + } + Method { + name: "toLocalPath" + type: "string" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "deleteLater" + Parameter { name: "p"; type: "QObject"; isPointer: true } + } + Method { + name: "getFileNameByUrl" + type: "string" + Parameter { name: "url"; type: "QUrl" } + } + Method { name: "getVirtualGeometry"; type: "QRect" } + Method { name: "getApplicationDirPath"; type: "string" } + Method { + name: "getUrlByFilePath" + type: "QUrl" + Parameter { name: "path"; type: "string" } + } + Method { + name: "withOpacity" + type: "QColor" + Parameter { type: "QColor" } + Parameter { name: "alpha"; type: "double" } + } + Method { + name: "md5" + type: "string" + Parameter { name: "text"; type: "string" } + } + Method { + name: "sha256" + type: "string" + Parameter { name: "text"; type: "string" } + } + Method { + name: "toBase64" + type: "string" + Parameter { name: "text"; type: "string" } + } + Method { + name: "fromBase64" + type: "string" + Parameter { name: "text"; type: "string" } + } + Method { + name: "removeDir" + type: "bool" + Parameter { name: "dirPath"; type: "string" } + } + Method { + name: "removeFile" + type: "bool" + Parameter { name: "filePath"; type: "string" } + } + Method { + name: "showFileInFolder" + Parameter { name: "path"; type: "string" } + } + Method { name: "isSoftware"; type: "bool" } + Method { name: "currentTimestamp"; type: "qlonglong" } + Method { name: "cursorPos"; type: "QPoint" } + Method { name: "windowIcon"; type: "QIcon" } + Method { name: "cursorScreenIndex"; type: "int" } + Method { name: "windowBuildNumber"; type: "int" } + Method { name: "isWindows11OrGreater"; type: "bool" } + Method { name: "isWindows10OrGreater"; type: "bool" } + Method { + name: "desktopAvailableGeometry" + type: "QRect" + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + } Component { name: "FluTreeModel" prototype: "QAbstractItemModel" @@ -274,6 +488,7 @@ Module { exportMetaObjectRevisions: [0] Property { name: "dataSourceSize"; type: "int" } Property { name: "selectionModel"; type: "QList" } + Property { name: "columnSource"; type: "QList" } Method { name: "removeRows" Parameter { name: "row"; type: "int" } @@ -305,12 +520,6 @@ Module { name: "expand" Parameter { name: "row"; type: "int" } } - Method { - name: "dragAndDrop" - Parameter { name: "dragIndex"; type: "int" } - Parameter { name: "dropIndex"; type: "int" } - Parameter { name: "isDropTopArea"; type: "bool" } - } Method { name: "getNode" type: "FluTreeNode*" @@ -2242,7 +2451,7 @@ Module { } Property { name: "layoutMacosButtons" - type: "FluLoader_QMLTYPE_13" + type: "FluLoader_QMLTYPE_12" isReadonly: true isPointer: true } @@ -2932,15 +3141,15 @@ Module { defaultProperty: "data" Property { name: "logo"; type: "QUrl" } Property { name: "title"; type: "string" } - Property { name: "items"; type: "FluObject_QMLTYPE_137"; isPointer: true } - Property { name: "footerItems"; type: "FluObject_QMLTYPE_137"; isPointer: true } + Property { name: "items"; type: "FluObject_QMLTYPE_172"; isPointer: true } + Property { name: "footerItems"; type: "FluObject_QMLTYPE_172"; isPointer: true } Property { name: "displayMode"; type: "int" } Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true } Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true } Property { name: "topPadding"; type: "int" } Property { name: "pageMode"; type: "int" } - Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_38"; isPointer: true } - Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_38"; isPointer: true } + Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_42"; isPointer: true } + Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_42"; isPointer: true } Property { name: "navCompactWidth"; type: "int" } Property { name: "navTopMargin"; type: "int" } Property { name: "cellHeight"; type: "int" } diff --git a/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml b/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml index 035fe423..7a76e91f 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml @@ -10,8 +10,7 @@ Item { property real noiseOpacity: 0.02 property alias target: effect_source.sourceItem property int blurRadius: 32 - property rect targetRect: Qt.rect(control.x, control.y, control.width, - control.height) + property rect targetRect: Qt.rect(control.x, control.y, control.width,control.height) ShaderEffectSource { id: effect_source anchors.fill: parent diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index 4ff45c9e..a8634eb6 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -91,7 +91,7 @@ Rectangle { if(!readOnly){ editTextChaged(text_box.text) } - tableView.closeEditor() + control.closeEditor() } } } @@ -120,7 +120,7 @@ Rectangle { if(!readOnly){ editTextChaged(text_box.text) } - tableView.closeEditor() + control.closeEditor() } } } @@ -259,7 +259,7 @@ Rectangle { anchors.fill: parent acceptedButtons: Qt.LeftButton onPressed:{ - closeEditor() + control.closeEditor() } onCanceled: { } @@ -276,7 +276,7 @@ Rectangle { onClicked: (event)=>{ d.current = rowObject - closeEditor() + control.closeEditor() event.accepted = true } } @@ -382,6 +382,7 @@ Rectangle { clip: true onRowsChanged: { control.closeEditor() + table_view.flick(0,1) } delegate: com_table_delegate FluLoader{ diff --git a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml index e08e5dbd..d698deea 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml @@ -5,283 +5,186 @@ import QtQuick.Controls import Qt.labs.qmlmodels import FluentUI -Item { - property int currentIndex : -1 +Rectangle { property var dataSource + property var columnSource : [] property bool showLine: true - property bool draggable: false property int cellHeight: 30 - property int depthPadding: 30 + property int depthPadding: 15 property bool checkable: false - property color lineColor: FluTheme.dark ? Qt.rgba(111/255,111/255,111/255,1) : Qt.rgba(217/255,217/255,217/255,1) + property color lineColor: FluTheme.dividerColor + property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) + property color selectedBorderColor: FluTheme.primaryColor + property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3) + readonly property alias current: d.current id:control - QtObject { - id:d - property int dy - property var current - property int dropIndex: -1 - property bool isDropTopArea: false - property int dragIndex: -1 - property color hitColor: FluTheme.primaryColor - } + color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) onDataSourceChanged: { tree_model.setDataSource(dataSource) } + onColumnSourceChanged: { + var columns= [] + var headerRow = {} + columnSource.forEach(function(item){ + var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',control); + column.display = item.dataIndex + columns.push(column) + headerRow[item.dataIndex] = item.title + }) + header_column_model.columns = columns + header_column_model.rows = [headerRow] + } FluTreeModel{ id:tree_model + columnSource: control.columnSource } - ListView{ - id:table_view - ScrollBar.horizontal: FluScrollBar{} - ScrollBar.vertical: FluScrollBar{} - boundsBehavior: Flickable.StopAtBounds - model: tree_model - anchors.fill: parent - clip: true - flickableDirection: Flickable.HorizontalAndVerticalFlick - contentWidth: contentItem.childrenRect.width - reuseItems: true - removeDisplaced : Transition{ - ParallelAnimation{ - NumberAnimation { - properties: "y" - duration: 167 - from: d.dy + table_view.height - easing.type: Easing.OutCubic - } - NumberAnimation { - properties: "opacity" - duration: 83 - from: 0 - to: 1 - } - } + onDepthPaddingChanged: { + table_view.forceLayout() + } + onCellHeightChanged: { + table_view.forceLayout() + } + onCheckableChanged: { + delay_force_layout.restart() + } + Timer{ + id:delay_force_layout + interval: 30 + onTriggered: { + table_view.forceLayout() } - move: Transition { - NumberAnimation { property: "y"; duration: 200 } - } - add: Transition{ - ParallelAnimation{ - NumberAnimation { - properties: "y" - duration: 167 - from: d.dy - control.cellHeight - easing.type: Easing.OutCubic - } - NumberAnimation { - properties: "opacity" - duration: 83 - from: 0 - to: 1 - } + } + QtObject { + id:d + property var current + property int defaultItemWidth: 100 + property int rowHoverIndex: -1 + property var editDelegate + property var editPosition + function getEditDelegate(column){ + var obj = control.columnSource[column].editDelegate + if(obj){ + return obj } - } - delegate: Item { - id:item_control - implicitWidth: item_loader_container.width - implicitHeight: item_loader_container.height - ListView.onReused: { - item_loader_container.item.reused() + if(control.columnSource[column].editMultiline === true){ + return com_edit_multiline } - ListView.onPooled: { - item_loader_container.item.pooled() - } - FluLoader{ - property var itemControl: item_control - property var itemModel: dataModel - property int rowIndex: index - property bool isItemLoader: true - id:item_loader_container - sourceComponent: com_item_container - } - } - FluLoader{ - id:loader_container - property var itemControl - property var itemModel - property bool isItemLoader: false + return com_edit } } Component{ - id:com_item_container + id:com_edit + FluTextBox{ + id:text_box + text: String(display) + readOnly: true === control.columnSource[column].readOnly + Component.onCompleted: { + forceActiveFocus() + selectAll() + } + onCommit: { + if(!readOnly){ + editTextChaged(text_box.text) + } + control.closeEditor() + } + } + } + Component{ + id:com_edit_multiline Item{ - signal reused - signal pooled - onReused: { - - } - onPooled: { - } - property bool isCurrent: d.current === itemModel - id:item_container - width: { - var w = 46 + item_loader_cell.width + control.depthPadding*itemModel.depth - if(control.width>w){ - return control.width - } - return w - } - height: control.cellHeight - implicitWidth: width - implicitHeight: height - function toggle(){ - var pos = FluTools.cursorPos() - var viewPos = table_view.mapToGlobal(0,0) - d.dy = table_view.contentY + pos.y-viewPos.y - if(itemModel.isExpanded){ - tree_model.collapse(rowIndex) - }else{ - tree_model.expand(rowIndex) + anchors.fill: parent + Flickable{ + id:item_scroll + clip: true + anchors.fill: parent + ScrollBar.vertical: multiline_text_srcoll_bar + boundsBehavior: Flickable.StopAtBounds + TextArea.flickable: FluMultilineTextBox { + id:text_box + text: String(display) + readOnly: true === control.columnSource[column].readOnly + verticalAlignment: TextInput.AlignVCenter + isCtrlEnterForNewline: true + Component.onCompleted: { + forceActiveFocus() + selectAll() + } + rightPadding: 34 + onCommit: { + if(!readOnly){ + editTextChaged(text_box.text) + } + control.closeEditor() + } } } - Rectangle{ - width: 3 - height: 18 - radius: 1.5 - color: FluTheme.primaryColor - visible: isCurrent + FluIconButton{ + iconSource:FluentIcons.ChromeClose + iconSize: 10 + width: 20 + height: 20 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 + visible: { + if(text_box.readOnly) + return false + return text_box.text !== "" + } anchors{ - left: parent.left - leftMargin: 6 verticalCenter: parent.verticalCenter + right: parent.right + rightMargin: 15 } + onClicked:{ + text_box.text = "" + } + } + FluScrollBar{ + id:multiline_text_srcoll_bar + anchors{ + right: parent.right + rightMargin: 5 + top: parent.top + bottom: parent.bottom + topMargin: 3 + bottomMargin: 3 + } + } + } + } + Component{ + id:com_column + Item{ + id:item_container + clip: true + function toggle(){ + if(rowModel.isExpanded){ + tree_model.collapse(row) + }else{ + tree_model.expand(row) + } + delay_force_layout.restart() } MouseArea{ id:item_mouse property point clickPos: Qt.point(0,0) anchors.fill: parent - drag.target:control.draggable ? loader_container : undefined - hoverEnabled: true - drag.onActiveChanged: { - if(drag.active){ - if(itemModel.isExpanded && itemModel.hasChildren()){ - tree_model.collapse(rowIndex) - } - d.dragIndex = rowIndex - loader_container.sourceComponent = com_item_container - } - } - onPressed: - (mouse)=>{ - clickPos = Qt.point(mouse.x,mouse.y) - loader_container.itemControl = itemControl - loader_container.itemModel = itemModel - var cellPosition = item_container.mapToItem(table_view, 0, 0) - loader_container.width = item_container.width - loader_container.height = item_container.height - loader_container.x = 0 - loader_container.y = cellPosition.y - } onClicked: { - d.current = itemModel + d.current = rowModel } onDoubleClicked: { - if(itemModel.hasChildren()){ + if(rowModel.hasChildren()){ item_container.toggle() } } - onPositionChanged: - (mouse)=> { - if(!drag.active){ - return - } - var cellPosition = item_container.mapToItem(table_view, 0, 0) - if(mouse.y+cellPosition.y<0 || mouse.y+cellPosition.y>table_view.height){ - d.dropIndex = -1 - return - } - if((mouse.x-table_view.contentX)>table_view.width || (mouse.x-table_view.contentX)<0){ - d.dropIndex = -1 - return - } - var pos = FluTools.cursorPos() - var viewPos = table_view.mapToGlobal(0,0) - var y = table_view.contentY + pos.y-viewPos.y - var index = Math.floor(y/control.cellHeight) - if(index<0 || index>table_view.count-1){ - d.dropIndex = -1 - return - } - if(tree_model.hitHasChildrenExpanded(index) && y>index*control.cellHeight+control.cellHeight/2){ - d.dropIndex = index + 1 - d.isDropTopArea = true - }else{ - d.dropIndex = index - if(y>index*control.cellHeight+control.cellHeight/2){ - d.isDropTopArea = false - }else{ - d.isDropTopArea = true - } - } - } - onCanceled: { - loader_container.sourceComponent = undefined - loader_container.x = 0 - loader_container.y = 0 - d.dropIndex = -1 - d.dragIndex = -1 - } - onReleased: { - loader_container.sourceComponent = undefined - if(d.dropIndex !== -1){ - tree_model.dragAndDrop(d.dragIndex,d.dropIndex,d.isDropTopArea) - } - d.dropIndex = -1 - d.dragIndex = -1 - loader_container.x = 0 - loader_container.y = 0 - } - } - Drag.active: item_mouse.drag.active - Rectangle{ - id:item_line_drop_tip - anchors{ - left: layout_row.left - leftMargin: 26 - right: parent.right - rightMargin: 10 - bottom: parent.bottom - bottomMargin: -1.5 - top: undefined - } - states: [ - State { - when:d.isDropTopArea - AnchorChanges { - target: item_line_drop_tip - anchors.top: item_container.top - anchors.bottom: undefined - } - PropertyChanges { - target: item_line_drop_tip - anchors.topMargin: -1.5 - } - } - ] - height: 3 - radius: 1.5 - color: d.hitColor - visible: d.dropIndex === rowIndex - Rectangle{ - width: 10 - height: 10 - radius: 5 - border.width: 3 - border.color: d.hitColor - color: FluTheme.dark ? FluColors.Black : FluColors.White - anchors{ - top: parent.top - left: parent.left - topMargin: -3 - leftMargin: -5 - } - } } FluRectangle{ width: 1 color: control.lineColor - visible: control.showLine && isItemLoader && itemModel.depth !== 0 && !itemModel.hasChildren() - height: itemModel.hideLineFooter() ? parent.height/2 : parent.height + visible: control.showLine && rowModel.depth !== 0 && !rowModel.hasChildren() + height: rowModel.hideLineFooter() ? parent.height/2 : parent.height anchors{ top: parent.top left: item_line_h.left @@ -291,7 +194,7 @@ Item { id:item_line_h height: 1 color: control.lineColor - visible: control.showLine && isItemLoader && itemModel.depth !== 0 && !itemModel.hasChildren() + visible: control.showLine && rowModel.depth !== 0 && !rowModel.hasChildren() width: depthPadding - 10 anchors{ right: layout_row.left @@ -300,12 +203,12 @@ Item { } } Repeater{ - model: Math.max(itemModel.depth-1,0) + model: Math.max(rowModel.depth-1,0) delegate: FluRectangle{ required property int index width: 1 color: control.lineColor - visible: control.showLine && isItemLoader && itemModel.depth !== 0 && itemModel.hasNextNodeByIndex(index) + visible: control.showLine && rowModel.depth !== 0 && rowModel.hasNextNodeByIndex(index) anchors{ top:parent.top bottom: parent.bottom @@ -314,57 +217,34 @@ Item { } } } - Rectangle{ - anchors.fill: parent - radius: 4 - anchors.leftMargin: 6 - anchors.rightMargin: 6 - border.color: d.hitColor - border.width: d.dragIndex === rowIndex ? 1 : 0 - color: { - if(isCurrent){ - return FluTheme.itemCheckColor - } - if(item_mouse.containsMouse || item_check_box.hovered){ - return FluTheme.itemHoverColor - } - if(item_loader_expand.item && item_loader_expand.item.hovered){ - return FluTheme.itemHoverColor - } - return FluTheme.itemNormalColor - } - } RowLayout{ id:layout_row height: parent.height - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left + anchors.fill: parent spacing: 0 - anchors.leftMargin: 14 + control.depthPadding*itemModel.depth + anchors.leftMargin: 14 + control.depthPadding*rowModel.depth Component{ id:com_icon_btn FluIconButton{ - opacity: itemModel.hasChildren() + opacity: rowModel.hasChildren() onClicked: { item_container.toggle() } contentItem:FluIcon{ - rotation: itemModel.isExpanded?0:-90 + rotation: rowModel.isExpanded?0:-90 iconSource:FluentIcons.ChevronDown iconSize: 16 anchors.centerIn: parent } } } - FluLoader{ id:item_loader_expand Layout.preferredWidth: 20 Layout.preferredHeight: 20 - sourceComponent: itemModel.hasChildren() ? com_icon_btn : undefined + sourceComponent: rowModel.hasChildren() ? com_icon_btn : undefined Layout.alignment: Qt.AlignVCenter } - FluCheckBox{ id:item_check_box Layout.preferredWidth: 18 @@ -372,39 +252,453 @@ Item { Layout.leftMargin: 5 horizontalPadding:0 verticalPadding: 0 - checked: itemModel.checked + checked: rowModel.checked animationEnabled:false visible: control.checkable padding: 0 clickListener: function(){ - tree_model.checkRow(rowIndex,!itemModel.checked) + tree_model.checkRow(row,!rowModel.checked) } Layout.alignment: Qt.AlignVCenter } - FluLoader{ - property var dataModel: itemModel - property var itemMouse: item_mouse - id:item_loader_cell - Layout.leftMargin: 10 - Layout.preferredWidth: { - if(item){ - return item.width - } - return 0 - } + Item{ Layout.fillHeight: true - sourceComponent:com_item_text + Layout.fillWidth: true + Layout.leftMargin: 6 + FluText { + id:item_text + text: String(display) + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + anchors.fill: parent + MouseArea{ + acceptedButtons: Qt.NoButton + id: hover_handler + hoverEnabled: true + anchors.fill: parent + } + FluTooltip{ + text: item_text.text + delay: 500 + visible: item_text.contentWidth < item_text.implicitWidth && hover_handler.containsMouse + } + } } + } } } + Component{ + id:com_other + FluText { + id:item_text + text: String(display) + elide: Text.ElideRight + wrapMode: Text.WrapAnywhere + anchors{ + fill: parent + leftMargin: 11 + rightMargin: 11 + topMargin: 6 + bottomMargin: 6 + } + verticalAlignment: Text.AlignVCenter + MouseArea{ + acceptedButtons: Qt.NoButton + id: hover_handler + hoverEnabled: true + anchors.fill: parent + } + FluTooltip{ + text: item_text.text + delay: 500 + visible: item_text.contentWidth < item_text.implicitWidth && item_text.contentHeight < item_text.implicitHeight && hover_handler.containsMouse + } + } + } + TableView{ + id:table_view + ScrollBar.horizontal: FluScrollBar{} + ScrollBar.vertical: FluScrollBar{} + boundsBehavior: Flickable.StopAtBounds + model: tree_model + anchors{ + top: header_horizontal.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + clip: true + columnWidthProvider: function(column) { + var columnObject = control.columnSource[column] + var width = columnObject.width + if(width){ + return width + } + var minimumWidth = columnObject.minimumWidth + if(minimumWidth){ + return minimumWidth + } + return d.defaultItemWidth + } + rowHeightProvider: function(row) { + return control.cellHeight + } + delegate: MouseArea{ + property var rowObject : rowModel.data + property alias isRowSelected: item_table_loader.isRowSelected + property var display: rowModel.data[columnModel.dataIndex] + property bool isObject: typeof(item_table.display) == "object" + property bool editVisible: { + if(rowObject && d.editPosition && d.editPosition._key === rowObject._key && d.editPosition.column === column){ + return true + } + return false + } + implicitHeight: 30 + implicitWidth: 30 + id: item_table + hoverEnabled: true + onEntered: { + d.rowHoverIndex = row + } + onWidthChanged: { + if(editVisible){ + updateEditPosition() + } + } + onHeightChanged: { + if(editVisible){ + updateEditPosition() + } + } + onXChanged: { + if(editVisible){ + updateEditPosition() + } + } + onYChanged: { + if(editVisible){ + updateEditPosition() + } + } + function updateEditPosition(){ + var obj = {} + obj._key = rowObject._key + obj.column = column + obj.row = row + obj.x = item_table.x + obj.y = item_table.y + 1 + obj.width = item_table.width + obj.height = item_table.height - 2 + d.editPosition = obj + } + onDoubleClicked:{ + if(typeof(display) == "object"){ + return + } + d.editDelegate = d.getEditDelegate(column) + updateEditPosition() + loader_edit.display = display + } + onClicked: + (event)=>{ + d.current = rowModel + event.accepted = true + } + Rectangle{ + anchors.fill: parent + color:{ + if(item_table.isRowSelected){ + return control.selectedColor + } + if(d.rowHoverIndex === row || item_table.isRowSelected){ + return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06) + } + return (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.015) : Qt.rgba(0,0,0,0.015)) + } + Item{ + anchors.fill: parent + visible: item_table.isRowSelected + Rectangle{ + width: 1 + height: parent.height + anchors.left: parent.left + color: control.selectedBorderColor + visible: column === 0 + } + Rectangle{ + width: 1 + height: parent.height + anchors.right: parent.right + color: control.selectedBorderColor + visible: column === control.columnSource.length-1 + } + Rectangle{ + width: parent.width + height: 1 + anchors.top: parent.top + color: control.selectedBorderColor + } + Rectangle{ + width: parent.width + height: 1 + anchors.bottom: parent.bottom + color: control.selectedBorderColor + } + } + } + FluLoader{ + anchors.fill: parent + id:item_table_loader + property var rowModel : model.rowModel + property var columnModel : model.columnModel + property int row : model.row + property int column: model.column + property var display: item_table.display + property bool isRowSelected: d.current === rowModel + property var options: { + if(isObject){ + return display.options + } + return {} + } + sourceComponent: { + if(column === 0) + return com_column + if(item_table.isObject){ + return item_table.display.comId + } + return com_other + } + } + } + FluLoader{ + id:loader_edit + property var tableView: control + property var display + property int column: { + if(d.editPosition){ + return d.editPosition.column + } + return 0 + } + property int row: { + if(d.editPosition){ + return d.editPosition.row + } + return 0 + } + signal editTextChaged(string text) + sourceComponent: d.editPosition ? d.editDelegate : undefined + onEditTextChaged: + (text)=>{ + const obj = tree_model.getRow(row).data + obj[control.columnSource[column].dataIndex] = text + tree_model.setRow(row,obj) + } + width: { + if(d.editPosition){ + return d.editPosition.width + } + return 0 + } + height: { + if(d.editPosition){ + return d.editPosition.height + } + return 0 + } + x:{ + if(d.editPosition){ + return d.editPosition.x + } + return 0 + } + y:{ + if(d.editPosition){ + return d.editPosition.y + } + return 0 + } + z:999 + } + } + TableModel{ + id:header_column_model + TableModelColumn {} + } + Component{ + id:com_column_text + FluText { + id: column_text + text: modelData + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + Component{ + id:com_column_header_delegate + Rectangle{ + id:column_item_control + readonly property real cellPadding: 8 + property bool canceled: false + property int columnIndex: column + property var columnObject : control.columnSource[column] + implicitWidth: { + return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2) + } + implicitHeight: Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2)) + color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) + Rectangle{ + border.color: control.borderColor + width: parent.width + height: 1 + anchors.top: parent.top + color:"#00000000" + } + Rectangle{ + border.color: control.borderColor + width: parent.width + height: 1 + anchors.bottom: parent.bottom + color:"#00000000" + } + Rectangle{ + border.color: control.borderColor + width: 1 + height: parent.height + anchors.left: parent.left + color:"#00000000" + } + Rectangle{ + border.color: control.borderColor + width: 1 + height: parent.height + anchors.right: parent.right + color:"#00000000" + visible: column === table_view.columns - 1 + } + MouseArea{ + id:column_item_control_mouse + anchors.fill: parent + anchors.rightMargin: 6 + hoverEnabled: true + onCanceled: { + column_item_control.canceled = true + } + onContainsMouseChanged: { + if(!containsMouse){ + column_item_control.canceled = false + } + } + onClicked: + (event)=>{ + + } + } + FluLoader{ + id:item_column_loader + property var itemModel: model + property var modelData: model.display + property var tableView: table_view + property var options:{ + if(typeof(modelData) == "object"){ + return modelData.options + } + return {} + } + property int column: column_item_control.columnIndex + width: parent.width + height: parent.height + sourceComponent: { + if(typeof(modelData) == "object"){ + return modelData.comId + } + return com_column_text + } + } + MouseArea{ + property point clickPos: "0,0" + height: parent.height + width: 6 + anchors.right: parent.right + acceptedButtons: Qt.LeftButton + hoverEnabled: true + visible: !(columnObject.width === columnObject.minimumWidth && columnObject.width === columnObject.maximumWidth && columnObject.width) + cursorShape: Qt.SplitHCursor + preventStealing: true + onPressed : + (mouse)=>{ + FluTools.setOverrideCursor(Qt.SplitHCursor) + clickPos = Qt.point(mouse.x, mouse.y) + } + onReleased:{ + FluTools.restoreOverrideCursor() + } + onCanceled: { + FluTools.restoreOverrideCursor() + } + onPositionChanged: + (mouse)=>{ + if(!pressed){ + return + } + var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) + var minimumWidth = columnObject.minimumWidth + var maximumWidth = columnObject.maximumWidth + var w = columnObject.width + if(!w){ + w = d.defaultItemWidth + } + if(!minimumWidth){ + minimumWidth = d.defaultItemWidth + } + if(!maximumWidth){ + maximumWidth = 65535 + } + columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth) + table_view.forceLayout() + } + } + } + } + + TableView { + id: header_horizontal + model: header_column_model + anchors{ + left: table_view.left + right: table_view.right + top: parent.top + } + height: Math.max(1, contentHeight) + boundsBehavior: Flickable.StopAtBounds + clip: true + syncDirection: Qt.Horizontal + columnWidthProvider: table_view.columnWidthProvider + syncView: table_view.rows === 0 ? null : table_view + onContentXChanged:{ + timer_horizontal_force_layout.restart() + } + Timer{ + id:timer_horizontal_force_layout + interval: 50 + onTriggered: { + header_horizontal.forceLayout() + } + } + delegate: com_column_header_delegate + } + Component{ id:com_item_text Item{ width: item_text.width FluText { id:item_text - text: dataModel.title + text: model.title rightPadding: 14 anchors.centerIn: parent color:{ @@ -423,7 +717,7 @@ Item { return tree_model.dataSourceSize } function visibleCount(){ - return table_view.count + return table_view.rows } function collapse(rowIndex){ tree_model.collapse(rowIndex) @@ -437,4 +731,14 @@ Item { function allCollapse(){ tree_model.allCollapse() } + function customItem(comId,options={}){ + var o = {} + o.comId = comId + o.options = options + return o + } + function closeEditor(){ + d.editPosition = undefined + d.editDelegate = undefined + } } From a3f375c9efdc8271c02dc0f1ad7c43e99a73a959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Thu, 11 Apr 2024 14:51:43 +0800 Subject: [PATCH 02/29] update --- CMakeLists.txt | 8 +- example/CMakeLists.txt | 151 +- example/example.qrc | 2 + example/example_en_US.ts | 28 +- example/example_zh_CN.ts | 18 +- example/qml/global/ItemsOriginal.qml | 4 +- example/src/AppInfo.cpp | 6 +- example/src/AppInfo.h | 20 +- example/src/app_dmp.h | 73 +- example/src/component/CircularReveal.cpp | 24 +- example/src/component/CircularReveal.h | 32 +- example/src/component/FileWatcher.cpp | 17 +- example/src/component/FileWatcher.h | 17 +- example/src/component/FpsItem.cpp | 14 +- example/src/component/FpsItem.h | 14 +- example/src/helper/InitializrHelper.cpp | 86 +- example/src/helper/InitializrHelper.h | 38 +- example/src/helper/Log.cpp | 121 +- example/src/helper/Log.h | 12 +- example/src/helper/Network.cpp | 648 +++-- example/src/helper/Network.h | 234 +- example/src/helper/SettingsHelper.cpp | 15 +- example/src/helper/SettingsHelper.h | 45 +- example/src/helper/TranslateHelper.cpp | 15 +- example/src/helper/TranslateHelper.h | 34 +- example/src/main.cpp | 4 + example/src/singleton.h | 15 +- example/src/stdafx.h | 61 +- src/CMakeLists.txt | 136 +- src/Def.cpp | 1 - src/Def.h | 3071 +++++++++++----------- src/FluAccentColor.cpp | 3 +- src/FluAccentColor.h | 25 +- src/FluApp.cpp | 14 +- src/FluApp.h | 39 +- src/FluCaptcha.cpp | 74 +- src/FluCaptcha.h | 26 +- src/FluColors.cpp | 101 +- src/FluColors.h | 89 +- src/FluFrameless.cpp | 330 +-- src/FluFrameless.h | 65 +- src/FluQrCodeItem.cpp | 44 +- src/FluQrCodeItem.h | 22 +- src/FluRectangle.cpp | 14 +- src/FluRectangle.h | 17 +- src/FluTableSortProxyModel.cpp | 52 +- src/FluTableSortProxyModel.h | 33 +- src/FluTextStyle.cpp | 2 +- src/FluTextStyle.h | 35 +- src/FluTheme.cpp | 83 +- src/FluTheme.h | 57 +- src/FluTools.cpp | 115 +- src/FluTools.h | 84 +- src/FluTreeModel.cpp | 228 +- src/FluTreeModel.h | 134 +- src/FluWatermark.cpp | 40 +- src/FluWatermark.h | 25 +- src/FluentUI.cpp | 257 +- src/FluentUI.h | 33 +- src/fluentuiplugin.cpp | 14 +- src/fluentuiplugin.h | 17 +- src/singleton.h | 15 +- src/stdafx.h | 61 +- 63 files changed, 3666 insertions(+), 3446 deletions(-) delete mode 100644 src/Def.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ef5a1d8..9863d2ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.20) project(FluentUI VERSION 1.0) -if(MSVC) +if (MSVC) #让Release也生成pdb文件 set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") -endif() +endif () list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake/) @@ -22,8 +22,8 @@ add_subdirectory(src) #Release也支持日志打印代码位置 target_compile_definitions(fluentuiplugin - PRIVATE - QT_MESSAGELOGCONTEXT + PRIVATE + QT_MESSAGELOGCONTEXT ) if (FLUENTUI_BUILD_EXAMPLES) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index c1e8f99a..b4b028bf 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -10,18 +10,18 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) #判断FluentUI库类型 -if(FLUENTUI_BUILD_STATIC_LIB) +if (FLUENTUI_BUILD_STATIC_LIB) add_definitions(-DFLUENTUI_BUILD_STATIC_LIB) -endif() +endif () #设置可执行文件输出目录 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}) -if(APPLE) +if (APPLE) set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS) -else() +else () set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -endif() +endif () #导入Qt相关依赖包 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick Svg Network) @@ -32,46 +32,46 @@ find_program(QT_LUPDATE NAMES lupdate) find_program(QT_LRELEASE NAMES lrelease) file(GLOB TS_FILE_PATHS ${CMAKE_CURRENT_LIST_DIR}/ *.ts) add_custom_target(Script-UpdateTranslations - COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${APPLICATION_DIR_PATH}/i18n - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_NAME}_en_US.qm ${PROJECT_NAME}_zh_CN.qm ${APPLICATION_DIR_PATH}/i18n - SOURCES ${TS_FILE_PATHS} + COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${APPLICATION_DIR_PATH}/i18n + COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_NAME}_en_US.qm ${PROJECT_NAME}_zh_CN.qm ${APPLICATION_DIR_PATH}/i18n + SOURCES ${TS_FILE_PATHS} ) ##生成版本信息头文件 set(HEADER_FILE_VERSION_PATH ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/Version.h) configure_file( - ${CMAKE_SOURCE_DIR}/.cmake/Version.h.in - ${HEADER_FILE_VERSION_PATH} + ${CMAKE_SOURCE_DIR}/.cmake/Version.h.in + ${HEADER_FILE_VERSION_PATH} ) #遍历所有Cpp文件 file(GLOB_RECURSE CPP_FILES *.cpp *.h) -foreach(filepath ${CPP_FILES}) +foreach (filepath ${CPP_FILES}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath}) list(APPEND sources_files ${filename}) -endforeach(filepath) +endforeach (filepath) -if(WIN32) +if (WIN32) list(APPEND sources_files "src/app_dmp.h") -endif() +endif () #如果是Windows平台,则生成rc文件,还有inno setup脚本文件 set(EXAMPLE_VERSION_RC_PATH "") -if(WIN32) +if (WIN32) set(EXAMPLE_VERSION_RC_PATH ${CMAKE_CURRENT_BINARY_DIR}/version_${PROJECT_NAME}.rc) configure_file( - ${CMAKE_SOURCE_DIR}/.cmake/version_exe.rc.in - ${EXAMPLE_VERSION_RC_PATH} + ${CMAKE_SOURCE_DIR}/.cmake/version_exe.rc.in + ${EXAMPLE_VERSION_RC_PATH} ) -configure_file( - ${CMAKE_SOURCE_DIR}/.cmake/InstallerScript.iss.in - ${CMAKE_SOURCE_DIR}/action-cli/InstallerScript.iss -) -endif() + configure_file( + ${CMAKE_SOURCE_DIR}/.cmake/InstallerScript.iss.in + ${CMAKE_SOURCE_DIR}/action-cli/InstallerScript.iss + ) +endif () #加快qrc编译 qt_add_big_resources(QRC_RESOURCES ${PROJECT_NAME}.qrc) @@ -80,34 +80,34 @@ set_property(SOURCE ${PROJECT_NAME}.qrc PROPERTY SKIP_AUTORCC ON) list(APPEND sources_files ${QRC_RESOURCES}) #添加可执行文件 -if(WIN32) +if (WIN32) list(APPEND sources_files ${EXAMPLE_VERSION_RC_PATH}) -endif() -if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) +endif () +if (${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(${PROJECT_NAME} - MANUAL_FINALIZATION - ${sources_files} + MANUAL_FINALIZATION + ${sources_files} ) -else() +else () add_executable(${PROJECT_NAME} - ${sources_files} + ${sources_files} ) -endif() +endif () add_dependencies(${PROJECT_NAME} Script-UpdateTranslations) #复制程序运行所需要的动态库 -if(WIN32) - if(MSVC) - if(CMAKE_SIZEOF_VOID_P EQUAL 4) +if (WIN32) + if (MSVC) + if (CMAKE_SIZEOF_VOID_P EQUAL 4) file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/msvc/x86/*.dll) - elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/msvc/x64/*.dll) - endif() - elseif(MINGW) + endif () + elseif (MINGW) file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll) - endif() + endif () file(COPY ${3RDPARTY_DLL_DIR} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -endif() +endif () #复制FluentUI源码到运行目录下,用于脚手架生成 file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/source/) @@ -115,37 +115,37 @@ file(COPY ${CMAKE_SOURCE_DIR}/src/ DESTINATION ${APPLICATION_DIR_PATH}/source/) #导入component头文件,不然通过QML_NAMED_ELEMENT生成的c++类会找不到头文件报错 target_include_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src/component + ${CMAKE_CURRENT_SOURCE_DIR}/src/component ) #如果是静态库则需要手动注册插件,导入FluentUI.h头文件 -if(FLUENTUI_BUILD_STATIC_LIB) +if (FLUENTUI_BUILD_STATIC_LIB) target_include_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src ) -endif() +endif () #设置属性 set_target_properties(${PROJECT_NAME} PROPERTIES - MACOSX_BUNDLE_GUI_IDENTIFIER my.${PROJECT_NAME}.com - MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} - MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} - MACOSX_BUNDLE TRUE - WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE_GUI_IDENTIFIER my.${PROJECT_NAME}.com + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE ) #Release也支持日志打印代码位置 target_compile_definitions(${PROJECT_NAME} - PRIVATE - QT_MESSAGELOGCONTEXT + PRIVATE + QT_MESSAGELOGCONTEXT ) #目标文件链接库 target_link_libraries(${PROJECT_NAME} PRIVATE - Qt${QT_VERSION_MAJOR}::Quick - Qt${QT_VERSION_MAJOR}::Svg - Qt${QT_VERSION_MAJOR}::Network - fluentuiplugin + Qt${QT_VERSION_MAJOR}::Quick + Qt${QT_VERSION_MAJOR}::Svg + Qt${QT_VERSION_MAJOR}::Network + fluentuiplugin ) #添加部署脚本 @@ -153,23 +153,28 @@ if (CMAKE_BUILD_TYPE MATCHES "Release") if (APPLE) find_program(QT_DEPLOY_QT NAMES macdeployqt) add_custom_target(Script-DeployRelease - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist - COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.app -qmldir=${CMAKE_CURRENT_LIST_DIR} - COMMENT "MacOs Deploying Qt Dependencies After Build........." - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist + COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.app -qmldir=${CMAKE_CURRENT_LIST_DIR} + COMMENT "MacOs Deploying Qt Dependencies After Build........." + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) - endif() - if(WIN32) + endif () + if (WIN32) find_program(QT_DEPLOY_QT NAMES windeployqt) add_custom_target(Script-DeployRelease - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist - COMMAND ${QT_DEPLOY_QT} --qmldir=${CMAKE_CURRENT_LIST_DIR} --plugindir ${CMAKE_SOURCE_DIR}/dist/plugins --no-translations --compiler-runtime ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.exe - COMMENT "Windows Deploying Qt Dependencies After Build........." - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist + COMMAND ${QT_DEPLOY_QT} --qmldir=${CMAKE_CURRENT_LIST_DIR} --plugindir ${CMAKE_SOURCE_DIR}/dist/plugins --no-translations --compiler-runtime ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.exe + COMMENT "Windows Deploying Qt Dependencies After Build........." + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -endif() -endif() + + target_sources(Script-DeployRelease + PRIVATE + src/component/OpenGLItem.h src/component/OpenGLItem.cpp + ) + endif () +endif () diff --git a/example/example.qrc b/example/example.qrc index 527028cd..646ef145 100644 --- a/example/example.qrc +++ b/example/example.qrc @@ -209,5 +209,7 @@ qml/page/T_GroupBox.qml res/image/bg_scenic.jpg qml/window/FluentInitializrWindow.qml + qml/page/T_OpenGL.qml + diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 47476754..b3d08a52 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -87,22 +87,22 @@ InitializrHelper - + The name cannot be empty - + The creation path cannot be empty - + The path does not exist - + %1 folder already exists @@ -475,7 +475,7 @@ - CodeEditor + OpenGL @@ -550,11 +550,6 @@ MainWindow - - - Dark Mode - - @@ -617,6 +612,11 @@ Previous + + + Dark Mode + + Here you can switch to night mode. @@ -1626,6 +1626,14 @@ My only desire is to be permitted to drive out the traitors and restore the Han. + + T_OpenGL + + + OpenGL + + + T_Pagination diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 8ae59fac..7ecd333f 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -87,22 +87,22 @@ InitializrHelper - + The name cannot be empty 名称不能为空 - + The creation path cannot be empty 创建路径不能为空 - + The path does not exist 路径不存在 - + %1 folder already exists %1 文件夹已经存在 @@ -475,7 +475,7 @@ - CodeEditor + OpenGL @@ -1665,6 +1665,14 @@ My only desire is to be permitted to drive out the traitors and restore the Han. 网络 + + T_OpenGL + + + OpenGL + + + T_Pagination diff --git a/example/qml/global/ItemsOriginal.qml b/example/qml/global/ItemsOriginal.qml index 8e96b2e0..cbd84e99 100644 --- a/example/qml/global/ItemsOriginal.qml +++ b/example/qml/global/ItemsOriginal.qml @@ -427,9 +427,9 @@ FluObject{ title: qsTr("Other") icon: FluentIcons.Shop FluPaneItem{ - title: qsTr("CodeEditor") + title: qsTr("OpenGL") menuDelegate: paneItemMenu - url: "qrc:/example/qml/page/T_CodeEditor.qml" + url: "qrc:/example/qml/page/T_OpenGL.qml" onTap: { navigationView.push(url) } } FluPaneItem{ diff --git a/example/src/AppInfo.cpp b/example/src/AppInfo.cpp index 8668e5bc..57e39130 100644 --- a/example/src/AppInfo.cpp +++ b/example/src/AppInfo.cpp @@ -1,17 +1,15 @@ #include "AppInfo.h" #include -#include #include #include "Version.h" AppInfo::AppInfo(QObject *parent) - : QObject{parent} -{ + : QObject{parent} { version(APPLICATION_VERSION); } -void AppInfo::testCrash(){ +[[maybe_unused]] void AppInfo::testCrash() { auto *crash = reinterpret_cast(0); *crash = 0; } diff --git a/example/src/AppInfo.h b/example/src/AppInfo.h index 541d7a4c..f8bb0719 100644 --- a/example/src/AppInfo.h +++ b/example/src/AppInfo.h @@ -1,20 +1,18 @@ -#ifndef APPINFO_H -#define APPINFO_H +#pragma once #include #include #include "stdafx.h" #include "singleton.h" -class AppInfo : public QObject -{ - Q_OBJECT - Q_PROPERTY_AUTO(QString,version) +class AppInfo : public QObject { +Q_OBJECT +Q_PROPERTY_AUTO(QString, version) private: explicit AppInfo(QObject *parent = nullptr); -public: - SINGLETON(AppInfo) - Q_INVOKABLE void testCrash(); -}; -#endif // APPINFO_H +public: +SINGLETON(AppInfo) + + Q_INVOKABLE [[maybe_unused]] void testCrash(); +}; diff --git a/example/src/app_dmp.h b/example/src/app_dmp.h index 1ca52ae4..9fee040f 100644 --- a/example/src/app_dmp.h +++ b/example/src/app_dmp.h @@ -1,5 +1,6 @@ -#ifndef APP_DUMP_H -#define APP_DUMP_H +#pragma once +#pragma clang diagnostic push +#pragma ide diagnostic ignored "misc-misplaced-const" #include #include @@ -12,71 +13,71 @@ #pragma comment(lib, "Dbghelp.lib") -static void miniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam){ - typedef HRESULT (WINAPI* MiniDumpWriteDumpPtr)(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam); +static void +miniDumpWriteDump(HANDLE hProcess, DWORD ProcessId, HANDLE hFile, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam) { + typedef HRESULT (WINAPI *MiniDumpWriteDumpPtr)(HANDLE hProcess, DWORD ProcessId, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, + CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam); HMODULE module = LoadLibraryW(L"Dbghelp.dll"); - if (module) - { + if (module) { MiniDumpWriteDumpPtr mini_dump_write_dump; - mini_dump_write_dump= reinterpret_cast(GetProcAddress(module, "MiniDumpWriteDump")); - if (mini_dump_write_dump) - { - mini_dump_write_dump(hProcess,ProcessId,hFile,DumpType,ExceptionParam,UserStreamParam,CallbackParam); + mini_dump_write_dump = reinterpret_cast(GetProcAddress(module, "MiniDumpWriteDump")); + if (mini_dump_write_dump) { + mini_dump_write_dump(hProcess, ProcessId, hFile, static_cast(80), ExceptionParam, nullptr, CallbackParam); } } } BOOL CALLBACK MyMiniDumpCallback(PVOID, const PMINIDUMP_CALLBACK_INPUT input, PMINIDUMP_CALLBACK_OUTPUT output) { - if (input == NULL || output == NULL) + if (input == nullptr || output == nullptr) return FALSE; BOOL ret = FALSE; switch (input->CallbackType) { - case IncludeModuleCallback: - case IncludeThreadCallback: - case ThreadCallback: - case ThreadExCallback: - ret = TRUE; - break; - case ModuleCallback: { - if (!(output->ModuleWriteFlags & ModuleReferencedByMemory)) { - output->ModuleWriteFlags &= ~ModuleWriteModule; + case IncludeModuleCallback: + case IncludeThreadCallback: + case ThreadCallback: + case ThreadExCallback: + ret = TRUE; + break; + case ModuleCallback: { + if (!(output->ModuleWriteFlags & ModuleReferencedByMemory)) { + output->ModuleWriteFlags &= ~ModuleWriteModule; + } + ret = TRUE; } - ret = TRUE; - } break; - default: - break; + break; + default: + break; } return ret; } -void WriteDump(EXCEPTION_POINTERS* exp, const std::wstring& path) { - HANDLE h = ::CreateFileW(path.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); +void WriteDump(EXCEPTION_POINTERS *exp, const std::wstring &path) { + HANDLE h = ::CreateFileW(path.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); MINIDUMP_EXCEPTION_INFORMATION info; info.ThreadId = ::GetCurrentThreadId(); info.ExceptionPointers = exp; info.ClientPointers = FALSE; MINIDUMP_CALLBACK_INFORMATION mci; - mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)MyMiniDumpCallback; - mci.CallbackParam = 0; - MINIDUMP_TYPE mdt = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory); - miniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, mdt, &info, NULL, &mci); + mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE) MyMiniDumpCallback; + mci.CallbackParam = nullptr; + miniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, &info, &mci); ::CloseHandle(h); } -LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS* exp) { - const QString dumpFileName = QString("%1_%2.dmp").arg("crash",QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss")); - const QString dumpDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)+"/dmp"; +LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS *exp) { + const QString dumpFileName = QString("%1_%2.dmp").arg("crash", QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss")); + const QString dumpDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/dmp"; const QDir dumpDir(dumpDirPath); - if(!dumpDir.exists()){ + if (!dumpDir.exists()) { dumpDir.mkpath(dumpDirPath); } QString dumpFilePath = dumpDir.filePath(dumpFileName); WriteDump(exp, dumpFilePath.toStdWString()); QStringList arguments; arguments << "-crashed=" + dumpFilePath; - QProcess::startDetached(qApp->applicationFilePath(), arguments); + QProcess::startDetached(QGuiApplication::applicationFilePath(), arguments); return EXCEPTION_EXECUTE_HANDLER; } -#endif // APP_DUMP_H +#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/component/CircularReveal.cpp b/example/src/component/CircularReveal.cpp index 7b5d60da..ada137b0 100644 --- a/example/src/component/CircularReveal.cpp +++ b/example/src/component/CircularReveal.cpp @@ -3,43 +3,43 @@ #include #include -CircularReveal::CircularReveal(QQuickItem* parent) : QQuickPaintedItem(parent) -{ +CircularReveal::CircularReveal(QQuickItem *parent) : QQuickPaintedItem(parent) { + _target = nullptr; + _radius = 0; _anim = new QPropertyAnimation(this, "radius", this); - setVisible(false); _anim->setDuration(333); _anim->setEasingCurve(QEasingCurve::OutCubic); - connect(_anim, &QPropertyAnimation::finished,this,[=](){ + setVisible(false); + connect(_anim, &QPropertyAnimation::finished, this, [=]() { update(); setVisible(false); Q_EMIT animationFinished(); }); - connect(this,&CircularReveal::radiusChanged,this,[=](){ + connect(this, &CircularReveal::radiusChanged, this, [=]() { update(); }); } -void CircularReveal::paint(QPainter* painter) -{ +void CircularReveal::paint(QPainter *painter) { painter->save(); painter->drawImage(QRect(0, 0, static_cast(width()), static_cast(height())), _source); QPainterPath path; - path.moveTo(_center.x(),_center.y()); - path.addEllipse(QPointF(_center.x(),_center.y()), _radius, _radius); + path.moveTo(_center.x(), _center.y()); + path.addEllipse(QPointF(_center.x(), _center.y()), _radius, _radius); painter->setCompositionMode(QPainter::CompositionMode_Clear); painter->fillPath(path, Qt::black); painter->restore(); } -void CircularReveal::start(int w,int h,const QPoint& center,int radius){ +[[maybe_unused]] void CircularReveal::start(int w, int h, const QPoint ¢er, int radius) { _anim->setStartValue(0); _anim->setEndValue(radius); _center = center; - _grabResult = _target->grabToImage(QSize(w,h)); + _grabResult = _target->grabToImage(QSize(w, h)); connect(_grabResult.data(), &QQuickItemGrabResult::ready, this, &CircularReveal::handleGrabResult); } -void CircularReveal::handleGrabResult(){ +void CircularReveal::handleGrabResult() { _grabResult.data()->image().swap(_source); update(); setVisible(true); diff --git a/example/src/component/CircularReveal.h b/example/src/component/CircularReveal.h index 589205fa..540d4876 100644 --- a/example/src/component/CircularReveal.h +++ b/example/src/component/CircularReveal.h @@ -1,5 +1,6 @@ -#ifndef CIRCULARREVEAL_H -#define CIRCULARREVEAL_H +#pragma once +#pragma clang diagnostic push +#pragma ide diagnostic ignored "NotImplementedFunctions" #include #include @@ -7,23 +8,28 @@ #include #include "src/stdafx.h" -class CircularReveal : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY_AUTO(QQuickItem*,target) - Q_PROPERTY_AUTO(int,radius) +class CircularReveal : public QQuickPaintedItem { +Q_OBJECT +Q_PROPERTY_AUTO_P(QQuickItem*, target) +Q_PROPERTY_AUTO(int, radius) public: - CircularReveal(QQuickItem* parent = nullptr); - void paint(QPainter* painter) override; - Q_INVOKABLE void start(int w,int h,const QPoint& center,int radius); + explicit CircularReveal(QQuickItem *parent = nullptr); + + void paint(QPainter *painter) override; + + Q_INVOKABLE [[maybe_unused]] void start(int w, int h, const QPoint ¢er, int radius); + Q_SIGNAL void imageChanged(); + Q_SIGNAL void animationFinished(); + Q_SLOT void handleGrabResult(); + private: - QPropertyAnimation* _anim = nullptr; + QPropertyAnimation *_anim = nullptr; QImage _source; QPoint _center; - QSharedPointer _grabResult; + QSharedPointer _grabResult; }; -#endif // CIRCULARREVEAL_H +#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/component/FileWatcher.cpp b/example/src/component/FileWatcher.cpp index a7a664a0..8b13cd27 100644 --- a/example/src/component/FileWatcher.cpp +++ b/example/src/component/FileWatcher.cpp @@ -1,24 +1,23 @@ #include "FileWatcher.h" -FileWatcher::FileWatcher(QObject *parent) - : QObject{parent} -{ - connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path){ +FileWatcher::FileWatcher(QObject *parent) : QObject{parent} { + connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path) { Q_EMIT fileChanged(); clean(); _watcher.addPath(_path); }); - connect(this,&FileWatcher::pathChanged,this,[=](){ + connect(this, &FileWatcher::pathChanged, this, [=]() { clean(); - _watcher.addPath(_path.replace("file:///","")); + _watcher.addPath(_path.replace("file:///", "")); }); - if(!_path.isEmpty()){ + if (!_path.isEmpty()) { _watcher.addPath(_path); } } -void FileWatcher::clean(){ - foreach (const QString &item, _watcher.files()) { +void FileWatcher::clean() { + for (int i = 0; i <= _watcher.files().size() - 1; ++i) { + auto item = _watcher.files().at(i); _watcher.removePath(item); } } diff --git a/example/src/component/FileWatcher.h b/example/src/component/FileWatcher.h index d3bb95cc..14f40fb5 100644 --- a/example/src/component/FileWatcher.h +++ b/example/src/component/FileWatcher.h @@ -1,22 +1,25 @@ -#ifndef FILEWATCHER_H -#define FILEWATCHER_H +#pragma once +#pragma clang diagnostic push +#pragma ide diagnostic ignored "NotImplementedFunctions" #include #include #include #include "src/stdafx.h" -class FileWatcher : public QObject -{ - Q_OBJECT - Q_PROPERTY_AUTO(QString,path); +class FileWatcher : public QObject { +Q_OBJECT +Q_PROPERTY_AUTO(QString, path); public: explicit FileWatcher(QObject *parent = nullptr); + Q_SIGNAL void fileChanged(); + private: void clean(); + private: QFileSystemWatcher _watcher; }; -#endif // FILEWATCHER_H +#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/component/FpsItem.cpp b/example/src/component/FpsItem.cpp index 23ceb37a..84a5fd66 100644 --- a/example/src/component/FpsItem.cpp +++ b/example/src/component/FpsItem.cpp @@ -3,16 +3,16 @@ #include #include -FpsItem::FpsItem() -{ - QTimer *timer = new QTimer(this); - connect(timer, &QTimer::timeout, this, [this]{ +FpsItem::FpsItem() { + _fps = 0; + auto *timer = new QTimer(this); + connect(timer, &QTimer::timeout, this, [this] { fps(_frameCount); _frameCount = 0; }); - connect(this, &QQuickItem::windowChanged, this, [this]{ - if (window()){ - connect(window(), &QQuickWindow::afterRendering, this, [this]{ _frameCount++; }, Qt::DirectConnection); + connect(this, &QQuickItem::windowChanged, this, [this] { + if (window()) { + connect(window(), &QQuickWindow::afterRendering, this, [this] { _frameCount++; }, Qt::DirectConnection); } }); timer->start(1000); diff --git a/example/src/component/FpsItem.h b/example/src/component/FpsItem.h index 4b51cdaf..e30f63bc 100644 --- a/example/src/component/FpsItem.h +++ b/example/src/component/FpsItem.h @@ -1,19 +1,15 @@ -#ifndef FPSITEM_H -#define FPSITEM_H +#pragma once #include #include "src/stdafx.h" -class FpsItem : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY_AUTO(int,fps) +class FpsItem : public QQuickItem { +Q_OBJECT +Q_PROPERTY_AUTO(int, fps) public: FpsItem(); private: int _frameCount = 0; -}; - -#endif // FPSITEM_H +}; \ No newline at end of file diff --git a/example/src/helper/InitializrHelper.cpp b/example/src/helper/InitializrHelper.cpp index 4567c81b..59904bbd 100644 --- a/example/src/helper/InitializrHelper.cpp +++ b/example/src/helper/InitializrHelper.cpp @@ -3,55 +3,47 @@ #include #include -InitializrHelper::InitializrHelper(QObject *parent) : QObject(parent) -{ +[[maybe_unused]] InitializrHelper::InitializrHelper(QObject *parent) : QObject(parent) { } InitializrHelper::~InitializrHelper() = default; -bool InitializrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists){ - QDir _formDir = fromDir; +bool InitializrHelper::copyDir(const QDir &fromDir, const QDir &toDir, bool coverIfFileExists) { + const QDir &_formDir = fromDir; QDir _toDir = toDir; - if(!_toDir.exists()) - { - if(!_toDir.mkdir(toDir.absolutePath())) + if (!_toDir.exists()) { + if (!_toDir.mkdir(toDir.absolutePath())) return false; } QFileInfoList fileInfoList = _formDir.entryInfoList(); - foreach(QFileInfo fileInfo, fileInfoList) - { - if(fileInfo.fileName() == "." || fileInfo.fileName() == "..") - continue; - if(fileInfo.isDir()) - { - if(!copyDir(fileInfo.filePath(), _toDir.filePath(fileInfo.fileName()),true)) - return false; - } - else - { - if(coverIfFileExists && _toDir.exists(fileInfo.fileName())) - { - _toDir.remove(fileInfo.fileName()); - } - if(!QFile::copy(fileInfo.filePath(), _toDir.filePath(fileInfo.fileName()))) - { - return false; + foreach(QFileInfo fileInfo, fileInfoList) { + if (fileInfo.fileName() == "." || fileInfo.fileName() == "..") + continue; + if (fileInfo.isDir()) { + if (!copyDir(fileInfo.filePath(), _toDir.filePath(fileInfo.fileName()), true)) + return false; + } else { + if (coverIfFileExists && _toDir.exists(fileInfo.fileName())) { + _toDir.remove(fileInfo.fileName()); + } + if (!QFile::copy(fileInfo.filePath(), _toDir.filePath(fileInfo.fileName()))) { + return false; + } } } - } return true; } -template -void InitializrHelper::templateToFile(const QString& source,const QString& dest,Args &&...args){ +template +void InitializrHelper::templateToFile(const QString &source, const QString &dest, Args &&...args) { QFile file(source); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream in(&file); QString content = in.readAll().arg(std::forward(args)...); file.close(); QDir outputDir = QFileInfo(dest).absoluteDir(); - if(!outputDir.exists()){ + if (!outputDir.exists()) { outputDir.mkpath(outputDir.absolutePath()); } QFile outputFile(dest); @@ -67,43 +59,43 @@ void InitializrHelper::templateToFile(const QString& source,const QString& dest, } } -void InitializrHelper::copyFile(const QString& source,const QString& dest){ - QFile::copy(source,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 InitializrHelper::generate(const QString& name,const QString& path){ - if(name.isEmpty()){ +[[maybe_unused]] void InitializrHelper::generate(const QString &name, const QString &path) { + if (name.isEmpty()) { error(tr("The name cannot be empty")); return; } - if(path.isEmpty()){ + if (path.isEmpty()) { error(tr("The creation path cannot be empty")); return; } QDir projectRootDir(path); - if(!projectRootDir.exists()){ + if (!projectRootDir.exists()) { error(tr("The path does not exist")); return; } QString projectPath = projectRootDir.filePath(name); QDir projectDir(projectPath); - if(projectDir.exists()){ + if (projectDir.exists()) { error(tr("%1 folder already exists").arg(name)); return; } projectDir.mkpath(projectPath); QDir fluentDir(projectDir.filePath("FluentUI")); - copyDir(QDir(QGuiApplication::applicationDirPath()+"/source"),fluentDir); - templateToFile(":/example/res/template/CMakeLists.txt.in",projectDir.filePath("CMakeLists.txt"),name); - templateToFile(":/example/res/template/src/CMakeLists.txt.in",projectDir.filePath("src/CMakeLists.txt"),name); - templateToFile(":/example/res/template/src/main.cpp.in",projectDir.filePath("src/main.cpp"),name); - templateToFile(":/example/res/template/src/main.qml.in",projectDir.filePath("src/main.qml"),name); - templateToFile(":/example/res/template/src/en_US.ts.in",projectDir.filePath("src/"+name+"_en_US.ts"),name); - templateToFile(":/example/res/template/src/zh_CN.ts.in",projectDir.filePath("src/"+name+"_zh_CN.ts"),name); - copyFile(":/example/res/template/src/App.qml.in",projectDir.filePath("src/App.qml")); - copyFile(":/example/res/template/src/qml.qrc.in",projectDir.filePath("src/qml.qrc")); - copyFile(":/example/res/template/src/logo.ico.in",projectDir.filePath("src/logo.ico")); - copyFile(":/example/res/template/src/README.md.in",projectDir.filePath("src/README.md")); + copyDir(QDir(QGuiApplication::applicationDirPath() + "/source"), fluentDir); + templateToFile(":/example/res/template/CMakeLists.txt.in", projectDir.filePath("CMakeLists.txt"), name); + templateToFile(":/example/res/template/src/CMakeLists.txt.in", projectDir.filePath("src/CMakeLists.txt"), name); + templateToFile(":/example/res/template/src/main.cpp.in", projectDir.filePath("src/main.cpp"), name); + templateToFile(":/example/res/template/src/main.qml.in", projectDir.filePath("src/main.qml"), name); + templateToFile(":/example/res/template/src/en_US.ts.in", projectDir.filePath("src/" + name + "_en_US.ts"), name); + templateToFile(":/example/res/template/src/zh_CN.ts.in", projectDir.filePath("src/" + name + "_zh_CN.ts"), name); + copyFile(":/example/res/template/src/App.qml.in", projectDir.filePath("src/App.qml")); + copyFile(":/example/res/template/src/qml.qrc.in", projectDir.filePath("src/qml.qrc")); + copyFile(":/example/res/template/src/logo.ico.in", projectDir.filePath("src/logo.ico")); + copyFile(":/example/res/template/src/README.md.in", projectDir.filePath("src/README.md")); return this->success(projectPath); } diff --git a/example/src/helper/InitializrHelper.h b/example/src/helper/InitializrHelper.h index 7daea951..2a9c250d 100644 --- a/example/src/helper/InitializrHelper.h +++ b/example/src/helper/InitializrHelper.h @@ -1,26 +1,34 @@ -#ifndef INITIALIZRHELPER_H -#define INITIALIZRHELPER_H +#pragma clang diagnostic push +#pragma ide diagnostic ignored "NotImplementedFunctions" +#pragma once #include #include #include #include "src/singleton.h" -class InitializrHelper : public QObject -{ - Q_OBJECT +class InitializrHelper : public QObject { +Q_OBJECT private: - 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); + [[maybe_unused]] explicit InitializrHelper(QObject *parent = nullptr); + + bool copyDir(const QDir &fromDir, const QDir &toDir, bool coverIfFileExists = true); + + static void copyFile(const QString &source, const QString &dest); + + template + void templateToFile(const QString &source, const QString &dest, Args &&...args); + public: - SINGLETON(InitializrHelper) +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); + + Q_INVOKABLE [[maybe_unused]] void generate(const QString &name, const QString &path); + + Q_SIGNAL void error(const QString &message); + + Q_SIGNAL void success(const QString &path); }; -#endif // INITIALIZRHELPER_H +#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/Log.cpp b/example/src/helper/Log.cpp index 688db453..3f9ddd66 100644 --- a/example/src/helper/Log.cpp +++ b/example/src/helper/Log.cpp @@ -11,8 +11,11 @@ #include #include #include "Version.h" + #ifdef WIN32 + #include + #else #include #endif @@ -26,7 +29,7 @@ #endif static QString g_app = {}; -static QString g_file_path= {}; +static QString g_file_path = {}; static bool g_logError = false; static std::unique_ptr g_logFile = nullptr; @@ -35,15 +38,14 @@ static std::unique_ptr g_logStream = nullptr; static int g_logLevel = 4; std::map logLevelMap = { - {QtFatalMsg,0}, - {QtCriticalMsg,1}, - {QtWarningMsg,2}, - {QtInfoMsg,3}, - {QtDebugMsg,4} + {QtFatalMsg, 0}, + {QtCriticalMsg, 1}, + {QtWarningMsg, 2}, + {QtInfoMsg, 3}, + {QtDebugMsg, 4} }; -QString Log::prettyProductInfoWrapper() -{ +QString Log::prettyProductInfoWrapper() { auto productName = QSysInfo::prettyProductName(); #if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) #if defined(Q_OS_MACOS) @@ -70,20 +72,17 @@ QString Log::prettyProductInfoWrapper() #endif #endif #if defined(Q_OS_WIN) - QSettings regKey {QString::fromUtf8("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), QSettings::NativeFormat}; + QSettings regKey{QString::fromUtf8(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion)"), QSettings::NativeFormat}; if (regKey.contains(QString::fromUtf8("CurrentBuildNumber"))) { auto buildNumber = regKey.value(QString::fromUtf8("CurrentBuildNumber")).toInt(); if (buildNumber > 0) { if (buildNumber < 9200) { productName = QString::fromUtf8("Windows 7 build %1").arg(buildNumber); - } - else if (buildNumber < 10240) { + } else if (buildNumber < 10240) { productName = QString::fromUtf8("Windows 8 build %1").arg(buildNumber); - } - else if (buildNumber < 22000) { + } else if (buildNumber < 22000) { productName = QString::fromUtf8("Windows 10 build %1").arg(buildNumber); - } - else { + } else { productName = QString::fromUtf8("Windows 11 build %1").arg(buildNumber); } } @@ -92,56 +91,55 @@ QString Log::prettyProductInfoWrapper() return productName; } -static inline void messageHandler(const QtMsgType type, const QMessageLogContext &context, const QString &message) -{ - if(message == "Could not get the INetworkConnection instance for the adapter GUID."){ +static inline void messageHandler(const QtMsgType type, const QMessageLogContext &context, const QString &message) { + if (message == "Could not get the INetworkConnection instance for the adapter GUID.") { return; } - if(logLevelMap[type]>g_logLevel){ + if (logLevelMap[type] > g_logLevel) { return; } if (!message.isEmpty()) { QString levelName; switch (type) { - case QtDebugMsg: - levelName = QStringLiteral("Debug"); - break; - case QtInfoMsg: - levelName = QStringLiteral("Info"); - break; - case QtWarningMsg: - levelName = QStringLiteral("Warning"); - break; - case QtCriticalMsg: - levelName = QStringLiteral("Critical"); - break; - case QtFatalMsg: - levelName = QStringLiteral("Fatal"); - break; + case QtDebugMsg: + levelName = QStringLiteral("Debug"); + break; + case QtInfoMsg: + levelName = QStringLiteral("Info"); + break; + case QtWarningMsg: + levelName = QStringLiteral("Warning"); + break; + case QtCriticalMsg: + levelName = QStringLiteral("Critical"); + break; + case QtFatalMsg: + levelName = QStringLiteral("Fatal"); + break; } QString fileAndLineLogStr; - if(context.file){ + if (context.file) { std::string strFileTmp = context.file; - const char* ptr = strrchr(strFileTmp.c_str(), '/'); + const char *ptr = strrchr(strFileTmp.c_str(), '/'); if (nullptr != ptr) { char fn[512] = {0}; sprintf(fn, "%s", ptr + 1); strFileTmp = fn; } - const char* ptrTmp = strrchr(strFileTmp.c_str(), '\\'); + const char *ptrTmp = strrchr(strFileTmp.c_str(), '\\'); if (nullptr != ptrTmp) { char fn[512] = {0}; sprintf(fn, "%s", ptrTmp + 1); strFileTmp = fn; } - fileAndLineLogStr = QString::fromStdString("[%1:%2]").arg(QString::fromStdString(strFileTmp),QString::number(context.line)); + fileAndLineLogStr = QString::fromStdString("[%1:%2]").arg(QString::fromStdString(strFileTmp), QString::number(context.line)); } const QString finalMessage = QString::fromStdString("%1[%2]%3[%4]:%5").arg( - QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss.zzz"), - levelName, - fileAndLineLogStr, - QString::number(reinterpret_cast(QThread::currentThreadId())), - message); + QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss.zzz"), + levelName, + fileAndLineLogStr, + QString::number(reinterpret_cast(QThread::currentThreadId())), + message); if ((type == QtInfoMsg) || (type == QtDebugMsg)) { std::cout << qPrintable(finalMessage) << std::endl; } else { @@ -168,8 +166,7 @@ static inline void messageHandler(const QtMsgType type, const QMessageLogContext } } -void Log::setup(char *argv[],const QString &app,int level) -{ +void Log::setup(char *argv[], const QString &app, int level) { Q_ASSERT(!app.isEmpty()); if (app.isEmpty()) { return; @@ -182,30 +179,30 @@ void Log::setup(char *argv[],const QString &app,int level) QString applicationPath = QString::fromStdString(argv[0]); once = true; g_app = app; - const QString logFileName = QString("%1_%2.log").arg(g_app,QDateTime::currentDateTime().toString("yyyyMMdd")); - const QString logDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)+"/log"; + const QString logFileName = QString("%1_%2.log").arg(g_app, QDateTime::currentDateTime().toString("yyyyMMdd")); + const QString logDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/log"; const QDir logDir(logDirPath); - if(!logDir.exists()){ + if (!logDir.exists()) { logDir.mkpath(logDirPath); } g_file_path = logDir.filePath(logFileName); qInstallMessageHandler(messageHandler); - qInfo()<<"==================================================="; - qInfo()<<"[AppName]"< -namespace Log -{ +namespace Log { QString prettyProductInfoWrapper(); - void setup(char *argv[], const QString &app,int level = 4); -} -#endif // LOG_H + void setup(char *argv[], const QString &app, int level = 4); +} \ No newline at end of file diff --git a/example/src/helper/Network.cpp b/example/src/helper/Network.cpp index 5d345fc9..7f2ebc04 100644 --- a/example/src/helper/Network.cpp +++ b/example/src/helper/Network.cpp @@ -1,3 +1,7 @@ +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnusedParameter" +#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" + #include "Network.h" #include @@ -17,175 +21,174 @@ #include #include #include +#include -NetworkCallable::NetworkCallable(QObject *parent):QObject{parent}{ + +NetworkCallable::NetworkCallable(QObject *parent) : QObject{parent} { } -QString NetworkParams::method2String(){ +QString NetworkParams::method2String() const { switch (_method) { - case METHOD_GET: - return "GET"; - case METHOD_HEAD: - return "HEAD"; - case METHOD_POST: - return "POST"; - case METHOD_PUT: - return "PUT"; - case METHOD_PATCH: - return "PATCH"; - case METHOD_DELETE: - return "DELETE"; - default: - return ""; + case METHOD_GET: + return "GET"; + case METHOD_HEAD: + return "HEAD"; + case METHOD_POST: + return "POST"; + case METHOD_PUT: + return "PUT"; + case METHOD_PATCH: + return "PATCH"; + case METHOD_DELETE: + return "DELETE"; + default: + return ""; } } -int NetworkParams::getTimeout(){ - if(_timeout != -1){ +int NetworkParams::getTimeout() const { + if (_timeout != -1) { return _timeout; } return Network::getInstance()->timeout(); } -int NetworkParams::getRetry(){ - if(_retry != -1){ +int NetworkParams::getRetry() const { + if (_retry != -1) { return _retry; } return Network::getInstance()->retry(); } -bool NetworkParams::getOpenLog(){ - if(!_openLog.isNull()){ +bool NetworkParams::getOpenLog() const { + if (!_openLog.isNull()) { return _openLog.toBool(); } return Network::getInstance()->openLog(); } FluDownloadParam::FluDownloadParam(QObject *parent) - : QObject{parent} -{ + : QObject{parent} { } -FluDownloadParam::FluDownloadParam(QString destPath,bool append,QObject *parent) - : QObject{parent} -{ - this->_destPath = destPath; +FluDownloadParam::FluDownloadParam(QString destPath, bool append, QObject *parent) + : QObject{parent} { + this->_destPath = std::move(destPath); this->_append = append; } -NetworkParams::NetworkParams(QObject *parent) - : QObject{parent} -{ +NetworkParams::NetworkParams(QObject *parent) : QObject{parent} { + _method = NetworkParams::Method::METHOD_GET; + _type = NetworkParams::Type::TYPE_BODY; } -NetworkParams::NetworkParams(QString url,Type type,Method method,QObject *parent) - : QObject{parent} -{ +NetworkParams::NetworkParams(QString url, Type type, Method method, QObject *parent) + : QObject{parent} { this->_method = method; - this->_url = url; + this->_url = std::move(url); this->_type = type; } -NetworkParams* NetworkParams::add(QString key,QVariant val){ - _paramMap.insert(key,val); +NetworkParams *NetworkParams::add(const QString &key, const QVariant &val) { + _paramMap.insert(key, val); return this; } -NetworkParams* NetworkParams::addFile(QString key,QVariant val){ - _fileMap.insert(key,val); +NetworkParams *NetworkParams::addFile(const QString &key, const QVariant &val) { + _fileMap.insert(key, val); return this; } -NetworkParams* NetworkParams::addHeader(QString key,QVariant val){ - _headerMap.insert(key,val); +NetworkParams *NetworkParams::addHeader(const QString &key, const QVariant &val) { + _headerMap.insert(key, val); return this; } -NetworkParams* NetworkParams::addQuery(QString key,QVariant val){ - _queryMap.insert(key,val); +NetworkParams *NetworkParams::addQuery(const QString &key, const QVariant &val) { + _queryMap.insert(key, val); return this; } -NetworkParams* NetworkParams::setBody(QString val){ - _body = val; +NetworkParams *NetworkParams::setBody(QString val) { + _body = std::move(val); return this; } -NetworkParams* NetworkParams::setTimeout(int val){ +NetworkParams *NetworkParams::setTimeout(int val) { _timeout = val; return this; } -NetworkParams* NetworkParams::setRetry(int val){ +NetworkParams *NetworkParams::setRetry(int val) { _retry = val; return this; } -NetworkParams* NetworkParams::setCacheMode(int val){ +NetworkParams *NetworkParams::setCacheMode(int val) { _cacheMode = val; return this; } -NetworkParams* NetworkParams::toDownload(QString destPath,bool append){ - _downloadParam = new FluDownloadParam(destPath,append,this); +NetworkParams *NetworkParams::toDownload(QString destPath, bool append) { + _downloadParam = new FluDownloadParam(std::move(destPath), append, this); return this; } -NetworkParams* NetworkParams::bind(QObject* target){ +NetworkParams *NetworkParams::bind(QObject *target) { _target = target; return this; } -NetworkParams* NetworkParams::openLog(QVariant val){ - _openLog = val; +NetworkParams *NetworkParams::openLog(QVariant val) { + _openLog = std::move(val); return this; } -QString NetworkParams::buildCacheKey(){ +QString NetworkParams::buildCacheKey() const { QJsonObject obj; - obj.insert("url",_url); - obj.insert("method",method2String()); - obj.insert("body",_body); - obj.insert("query",QJsonDocument::fromVariant(_queryMap).object()); - obj.insert("param",QJsonDocument::fromVariant(_paramMap).object()); - obj.insert("header",QJsonDocument::fromVariant(_headerMap).object()); - obj.insert("file",QJsonDocument::fromVariant(_fileMap).object()); - if(_downloadParam){ + obj.insert("url", _url); + obj.insert("method", method2String()); + obj.insert("body", _body); + obj.insert("query", QJsonDocument::fromVariant(_queryMap).object()); + obj.insert("param", QJsonDocument::fromVariant(_paramMap).object()); + obj.insert("header", QJsonDocument::fromVariant(_headerMap).object()); + obj.insert("file", QJsonDocument::fromVariant(_fileMap).object()); + if (_downloadParam) { QJsonObject downObj; - downObj.insert("destPath",_downloadParam->_destPath); - downObj.insert("append",_downloadParam->_append); - obj.insert("download",downObj); + downObj.insert("destPath", _downloadParam->_destPath); + downObj.insert("append", _downloadParam->_append); + obj.insert("download", downObj); } QByteArray data = QJsonDocument(obj).toJson(QJsonDocument::Compact); return QCryptographicHash::hash(data, QCryptographicHash::Sha256).toHex(); } -void NetworkParams::go(NetworkCallable* callable){ +void NetworkParams::go(NetworkCallable *callable) { QJSValueList data; - data<newQObject(this); + data << qjsEngine(callable)->newQObject(this); Network::getInstance()->_interceptor.call(data); - if(_downloadParam){ - Network::getInstance()->handleDownload(this,callable); - }else{ - Network::getInstance()->handle(this,callable); + if (_downloadParam) { + Network::getInstance()->handleDownload(this, callable); + } else { + Network::getInstance()->handle(this, callable); } } -void Network::handle(NetworkParams* params,NetworkCallable* c){ +void Network::handle(NetworkParams *params, NetworkCallable *c) { QPointer callable(c); - QThreadPool::globalInstance()->start([=](){ - if(!callable.isNull()){ + QThreadPool::globalInstance()->start([=]() { + if (!callable.isNull()) { callable->start(); } QString cacheKey = params->buildCacheKey(); - if(params->_cacheMode == NetworkType::CacheMode::FirstCacheThenRequest && cacheExists(cacheKey)){ - if(!callable.isNull()){ + if (params->_cacheMode == NetworkType::CacheMode::FirstCacheThenRequest && cacheExists(cacheKey)) { + if (!callable.isNull()) { callable->cache(readCache(cacheKey)); } } - if(params->_cacheMode == NetworkType::CacheMode::IfNoneCacheRequest && cacheExists(cacheKey)){ - if(!callable.isNull()){ + if (params->_cacheMode == NetworkType::CacheMode::IfNoneCacheRequest && cacheExists(cacheKey)) { + if (!callable.isNull()) { callable->cache(readCache(cacheKey)); callable->finish(); params->deleteLater(); @@ -195,131 +198,130 @@ void Network::handle(NetworkParams* params,NetworkCallable* c){ QNetworkAccessManager manager; manager.setTransferTimeout(params->getTimeout()); QEventLoop loop; - connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();}); - for (int i = 0; i < params->getRetry(); ++i) { + connect(&manager, &QNetworkAccessManager::finished, &manager, [&loop](QNetworkReply *reply) { loop.quit(); }); + for (int i = 0; i <= params->getRetry() - 1; ++i) { QUrl url(params->_url); - addQueryParam(&url,params->_queryMap); + addQueryParam(&url, params->_queryMap); QNetworkRequest request(url); - addHeaders(&request,params->_headerMap); - QNetworkReply* reply; - sendRequest(&manager,request,params,reply,i==0,callable); - if(!QPointer(qApp)){ + addHeaders(&request, params->_headerMap); + QNetworkReply *reply; + sendRequest(&manager, request, params, reply, i == 0, callable); + if (!QPointer(QGuiApplication::instance())) { reply->deleteLater(); reply = nullptr; return; } - auto abortCallable = [&loop,reply,&i,params]{ - if(reply){ + auto abortCallable = [reply, &i, params] { + if (reply) { i = params->getRetry(); reply->abort(); } }; QMetaObject::Connection conn_destroyed = {}; QMetaObject::Connection conn_quit = {}; - if(params->_target){ - conn_destroyed = connect(params->_target,&QObject::destroyed,&manager,abortCallable); + if (params->_target) { + conn_destroyed = connect(params->_target, &QObject::destroyed, &manager, abortCallable); } - conn_quit = connect(qApp,&QGuiApplication::aboutToQuit,&manager, abortCallable); + conn_quit = connect(QGuiApplication::instance(), &QGuiApplication::aboutToQuit, &manager, abortCallable); loop.exec(); - if(conn_destroyed){ + if (conn_destroyed) { disconnect(conn_destroyed); } - if(conn_quit){ + if (conn_quit) { disconnect(conn_quit); } QString response; - if(params->_method == NetworkParams::METHOD_HEAD){ + if (params->_method == NetworkParams::METHOD_HEAD) { response = headerList2String(reply->rawHeaderPairs()); - }else{ - if(reply->isOpen()){ + } else { + if (reply->isOpen()) { response = QString::fromUtf8(reply->readAll()); } } int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - if(httpStatus == 200){ - if(!callable.isNull()){ - if(params->_cacheMode != NetworkType::CacheMode::NoCache){ - saveResponse(cacheKey,response); + if (httpStatus == 200) { + if (!callable.isNull()) { + if (params->_cacheMode != NetworkType::CacheMode::NoCache) { + saveResponse(cacheKey, response); } callable->success(response); } - printRequestEndLog(request,params,reply,response); + printRequestEndLog(request, params, reply, response); break; - }else{ - if(i == params->getRetry()-1){ - if(!callable.isNull()){ - if(params->_cacheMode == NetworkType::CacheMode::RequestFailedReadCache && cacheExists(cacheKey)){ - if(!callable.isNull()){ + } else { + if (i == params->getRetry() - 1) { + if (!callable.isNull()) { + if (params->_cacheMode == NetworkType::CacheMode::RequestFailedReadCache && cacheExists(cacheKey)) { + if (!callable.isNull()) { callable->cache(readCache(cacheKey)); } } - callable->error(httpStatus,reply->errorString(),response); + callable->error(httpStatus, reply->errorString(), response); } - printRequestEndLog(request,params,reply,response); + printRequestEndLog(request, params, reply, response); } } reply->deleteLater(); } params->deleteLater(); - if(!callable.isNull()){ + if (!callable.isNull()) { callable->finish(); } }); } -void Network::handleDownload(NetworkParams* params,NetworkCallable* c){ +void Network::handleDownload(NetworkParams *params, NetworkCallable *c) { QPointer callable(c); - QThreadPool::globalInstance()->start([=](){ - if(!callable.isNull()){ + QThreadPool::globalInstance()->start([=]() { + if (!callable.isNull()) { callable->start(); } QString cacheKey = params->buildCacheKey(); QUrl url(params->_url); QNetworkAccessManager manager; manager.setTransferTimeout(params->getTimeout()); - addQueryParam(&url,params->_queryMap); + addQueryParam(&url, params->_queryMap); QNetworkRequest request(url); - addHeaders(&request,params->_headerMap); + addHeaders(&request, params->_headerMap); QString cachePath = getCacheFilePath(cacheKey); QString destPath = params->_downloadParam->_destPath; - QFile* destFile = new QFile(destPath); - QFile* cacheFile = new QFile(cachePath); - bool isOpen = false; - qint64 seek = 0; - if(cacheFile->exists() && destFile->exists() && params->_downloadParam->_append){ + auto *destFile = new QFile(destPath); + auto *cacheFile = new QFile(cachePath); + bool isOpen; + qint64 seek; + if (cacheFile->exists() && destFile->exists() && params->_downloadParam->_append) { QJsonObject cacheInfo = QJsonDocument::fromJson(readCache(cacheKey).toUtf8()).object(); - qint64 fileSize = cacheInfo.value("fileSize").toDouble(); - qint64 contentLength = cacheInfo.value("contentLength").toDouble(); - if(fileSize == contentLength && destFile->size() == contentLength){ - if(!callable.isNull()){ - callable->downloadProgress(fileSize,contentLength); + qint64 fileSize = qRound(cacheInfo.value("fileSize").toDouble()); + qint64 contentLength = qRound(cacheInfo.value("contentLength").toDouble()); + if (fileSize == contentLength && destFile->size() == contentLength) { + if (!callable.isNull()) { + callable->downloadProgress(fileSize, contentLength); callable->success(destPath); callable->finish(); } return; } - if(fileSize==destFile->size()){ + if (fileSize == destFile->size()) { request.setRawHeader("Range", QString("bytes=%1-").arg(fileSize).toUtf8()); seek = fileSize; - isOpen = destFile->open(QIODevice::WriteOnly|QIODevice::Append); - }else{ - isOpen = destFile->open(QIODevice::WriteOnly|QIODevice::Truncate); + isOpen = destFile->open(QIODevice::WriteOnly | QIODevice::Append); + } else { + isOpen = destFile->open(QIODevice::WriteOnly | QIODevice::Truncate); } - }else{ - isOpen = destFile->open(QIODevice::WriteOnly|QIODevice::Truncate); + } else { + isOpen = destFile->open(QIODevice::WriteOnly | QIODevice::Truncate); } - if(!isOpen){ - if(!callable.isNull()){ - callable->error(-1,"device not open",""); + if (!isOpen) { + if (!callable.isNull()) { + callable->error(-1, "device not open", ""); callable->finish(); } return; } - if(params->_downloadParam->_append){ - if (!cacheFile->open(QIODevice::WriteOnly|QIODevice::Truncate)) - { - if(!callable.isNull()){ - callable->error(-1,"cache file device not open",""); + if (params->_downloadParam->_append) { + if (!cacheFile->open(QIODevice::WriteOnly | QIODevice::Truncate)) { + if (!callable.isNull()) { + callable->error(-1, "cache file device not open", ""); callable->finish(); } return; @@ -329,73 +331,72 @@ void Network::handleDownload(NetworkParams* params,NetworkCallable* c){ QNetworkReply *reply = manager.get(request); destFile->setParent(reply); cacheFile->setParent(reply); - auto abortCallable = [&loop,reply,params]{ - if(reply){ + auto abortCallable = [reply] { + if (reply) { reply->abort(); } }; - connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();}); - connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();}); + connect(&manager, &QNetworkAccessManager::finished, &manager, [&loop](QNetworkReply *reply) { loop.quit(); }); + connect(QGuiApplication::instance(), &QGuiApplication::aboutToQuit, &manager, [&loop, reply]() { reply->abort(), loop.quit(); }); QMetaObject::Connection conn_destroyed = {}; QMetaObject::Connection conn_quit = {}; - if(params->_target){ - conn_destroyed = connect(params->_target,&QObject::destroyed,&manager,abortCallable); + if (params->_target) { + conn_destroyed = connect(params->_target, &QObject::destroyed, &manager, abortCallable); } - conn_quit = connect(qApp,&QGuiApplication::aboutToQuit,&manager, abortCallable); - connect(reply,&QNetworkReply::readyRead,reply,[reply,seek,destFile,cacheFile,callable]{ - if (!reply || !destFile || reply->error() != QNetworkReply::NoError) - { + conn_quit = connect(QGuiApplication::instance(), &QGuiApplication::aboutToQuit, &manager, abortCallable); + connect(reply, &QNetworkReply::readyRead, reply, [reply, seek, destFile, cacheFile, callable] { + if (!reply || !destFile || reply->error() != QNetworkReply::NoError) { return; } QMap downInfo; - qint64 contentLength = reply->header(QNetworkRequest::ContentLengthHeader).toLongLong()+seek; - downInfo.insert("contentLength",contentLength); + qint64 contentLength = reply->header(QNetworkRequest::ContentLengthHeader).toLongLong() + seek; + downInfo.insert("contentLength", contentLength); QString eTag = reply->header(QNetworkRequest::ETagHeader).toString(); - downInfo.insert("eTag",eTag); + downInfo.insert("eTag", eTag); destFile->write(reply->readAll()); destFile->flush(); - downInfo.insert("fileSize",destFile->size()); - if(cacheFile->isOpen()){ + downInfo.insert("fileSize", destFile->size()); + if (cacheFile->isOpen()) { cacheFile->resize(0); cacheFile->write(QJsonDocument::fromVariant(QVariant(downInfo)).toJson().toBase64()); cacheFile->flush(); } - if(!callable.isNull()){ - callable->downloadProgress(destFile->size(),contentLength); + if (!callable.isNull()) { + callable->downloadProgress(destFile->size(), contentLength); } }); loop.exec(); int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - if(httpStatus == 200){ - if(!callable.isNull()){ + if (httpStatus == 200) { + if (!callable.isNull()) { callable->success(destPath); } - printRequestEndLog(request,params,reply,destPath); - }else{ - if(!callable.isNull()){ - callable->error(httpStatus,reply->errorString(),destPath); + printRequestEndLog(request, params, reply, destPath); + } else { + if (!callable.isNull()) { + callable->error(httpStatus, reply->errorString(), destPath); } - printRequestEndLog(request,params,reply,destPath); + printRequestEndLog(request, params, reply, destPath); } - if(conn_destroyed){ + if (conn_destroyed) { disconnect(conn_destroyed); } - if(conn_quit){ + if (conn_quit) { disconnect(conn_quit); } params->deleteLater(); reply->deleteLater(); - if(!callable.isNull()){ + if (!callable.isNull()) { callable->finish(); } }); } -QString Network::readCache(const QString& key){ +QString Network::readCache(const QString &key) { auto filePath = getCacheFilePath(key); QString result; QFile file(filePath); - if(!file.exists()){ + if (!file.exists()) { return result; } if (file.open(QIODevice::ReadOnly)) { @@ -405,27 +406,27 @@ QString Network::readCache(const QString& key){ return result; } -bool Network::cacheExists(const QString& key){ +bool Network::cacheExists(const QString &key) { return QFile(getCacheFilePath(key)).exists(); } -QString Network::getCacheFilePath(const QString& key){ +QString Network::getCacheFilePath(const QString &key) { QDir cacheDir(_cacheDir); - if(!cacheDir.exists()){ + if (!cacheDir.exists()) { cacheDir.mkpath(_cacheDir); } return cacheDir.absoluteFilePath(key); } -QString Network::headerList2String(const QList& data){ +QString Network::headerList2String(const QList &data) { QJsonObject object; for (auto it = data.constBegin(); it != data.constEnd(); ++it) { - object.insert(QString(it->first),QString(it->second)); + object.insert(QString(it->first), QString(it->second)); } return QJsonDocument(object).toJson(QJsonDocument::Compact); } -QString Network::map2String(const QMap& map){ +QString Network::map2String(const QMap &map) { QStringList parameters; for (auto it = map.constBegin(); it != map.constEnd(); ++it) { parameters << QString("%1=%2").arg(it.key(), it.value().toString()); @@ -433,244 +434,237 @@ QString Network::map2String(const QMap& map){ return parameters.join(" "); } -void Network::sendRequest(QNetworkAccessManager* manager,QNetworkRequest request,NetworkParams* params,QNetworkReply*& reply,bool isFirst,QPointer callable){ +void Network::sendRequest(QNetworkAccessManager *manager, QNetworkRequest request, NetworkParams *params, QNetworkReply *&reply, bool isFirst, const QPointer &callable) { QByteArray verb = params->method2String().toUtf8(); switch (params->_type) { - case NetworkParams::TYPE_FORM:{ - bool isFormData = !params->_fileMap.isEmpty(); - if(isFormData){ - QHttpMultiPart *multiPart = new QHttpMultiPart(); - multiPart->setContentType(QHttpMultiPart::FormDataType); - for (const auto& each : params->_paramMap.toStdMap()) - { - QHttpPart part; - part.setHeader(QNetworkRequest::ContentDispositionHeader, QString("form-data; name=\"%1\"").arg(each.first)); - part.setBody(each.second.toByteArray()); - multiPart->append(part); - } - for (const auto& each : params->_fileMap.toStdMap()) - { - QString filePath = each.second.toString(); - QString name = each.first; - QFile *file = new QFile(filePath); - QString fileName = QFileInfo(filePath).fileName(); - file->open(QIODevice::ReadOnly); - file->setParent(multiPart); - QHttpPart part; - part.setHeader(QNetworkRequest::ContentDispositionHeader, QString("form-data; name=\"%1\"; filename=\"%2\"").arg(name,fileName)); - part.setBodyDevice(file); - multiPart->append(part); - } - reply = manager->sendCustomRequest(request,verb,multiPart); - multiPart->setParent(reply); - connect(reply,&QNetworkReply::uploadProgress,reply,[callable](qint64 bytesSent, qint64 bytesTotal){ - if(!callable.isNull() && bytesSent!=0 && bytesTotal!=0){ - Q_EMIT callable->uploadProgress(bytesSent,bytesTotal); + case NetworkParams::TYPE_FORM: { + bool isFormData = !params->_fileMap.isEmpty(); + if (isFormData) { + auto *multiPart = new QHttpMultiPart(); + multiPart->setContentType(QHttpMultiPart::FormDataType); + for (const auto &each: params->_paramMap.toStdMap()) { + QHttpPart part; + part.setHeader(QNetworkRequest::ContentDispositionHeader, QString("form-data; name=\"%1\"").arg(each.first)); + part.setBody(each.second.toByteArray()); + multiPart->append(part); } - }); - }else{ - request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/x-www-form-urlencoded")); - QString value; - for (const auto& each : params->_paramMap.toStdMap()) - { - value += QString("%1=%2").arg(each.first,each.second.toString()); - value += "&"; + for (const auto &each: params->_fileMap.toStdMap()) { + QString filePath = each.second.toString(); + QString name = each.first; + auto *file = new QFile(filePath); + QString fileName = QFileInfo(filePath).fileName(); + file->open(QIODevice::ReadOnly); + file->setParent(multiPart); + QHttpPart part; + part.setHeader(QNetworkRequest::ContentDispositionHeader, QString(R"(form-data; name="%1"; filename="%2")").arg(name, fileName)); + part.setBodyDevice(file); + multiPart->append(part); + } + reply = manager->sendCustomRequest(request, verb, multiPart); + multiPart->setParent(reply); + connect(reply, &QNetworkReply::uploadProgress, reply, [callable](qint64 bytesSent, qint64 bytesTotal) { + if (!callable.isNull() && bytesSent != 0 && bytesTotal != 0) { + Q_EMIT callable->uploadProgress(bytesSent, bytesTotal); + } + }); + } else { + request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/x-www-form-urlencoded")); + QString value; + for (const auto &each: params->_paramMap.toStdMap()) { + value += QString("%1=%2").arg(each.first, each.second.toString()); + value += "&"; + } + if (!params->_paramMap.isEmpty()) { + value.chop(1); + } + QByteArray data = value.toUtf8(); + reply = manager->sendCustomRequest(request, verb, data); } - if(!params->_paramMap.isEmpty()){ - value.chop(1); - } - QByteArray data = value.toUtf8(); - reply = manager->sendCustomRequest(request,verb,data); + break; } - break; - } - case NetworkParams::TYPE_JSON:{ - request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json;charset=utf-8")); - QJsonObject json; - for (const auto& each : params->_paramMap.toStdMap()) - { - json.insert(each.first,each.second.toJsonValue()); - } - QByteArray data = QJsonDocument(json).toJson(QJsonDocument::Compact); - reply = manager->sendCustomRequest(request,verb,data); - break; - } - case NetworkParams::TYPE_JSONARRAY:{ - request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json;charset=utf-8")); - QJsonArray jsonArray; - for (const auto& each : params->_paramMap.toStdMap()) - { + case NetworkParams::TYPE_JSON: { + request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json;charset=utf-8")); QJsonObject json; - json.insert(each.first,each.second.toJsonValue()); - jsonArray.append(json); + for (const auto &each: params->_paramMap.toStdMap()) { + json.insert(each.first, each.second.toJsonValue()); + } + QByteArray data = QJsonDocument(json).toJson(QJsonDocument::Compact); + reply = manager->sendCustomRequest(request, verb, data); + break; } - QByteArray data = QJsonDocument(jsonArray).toJson(QJsonDocument::Compact); - reply = manager->sendCustomRequest(request,params->method2String().toUtf8(),data); - break; + case NetworkParams::TYPE_JSONARRAY: { + request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json;charset=utf-8")); + QJsonArray jsonArray; + for (const auto &each: params->_paramMap.toStdMap()) { + QJsonObject json; + json.insert(each.first, each.second.toJsonValue()); + jsonArray.append(json); + } + QByteArray data = QJsonDocument(jsonArray).toJson(QJsonDocument::Compact); + reply = manager->sendCustomRequest(request, params->method2String().toUtf8(), data); + break; + } + case NetworkParams::TYPE_BODY: { + request.setHeader(QNetworkRequest::ContentTypeHeader, QString("text/plain;charset=utf-8")); + QByteArray data = params->_body.toUtf8(); + reply = manager->sendCustomRequest(request, verb, data); + break; + } + default: + reply = manager->sendCustomRequest(request, verb); + break; } - case NetworkParams::TYPE_BODY:{ - request.setHeader(QNetworkRequest::ContentTypeHeader, QString("text/plain;charset=utf-8")); - QByteArray data = params->_body.toUtf8(); - reply = manager->sendCustomRequest(request,verb,data); - break; - } - default: - reply = manager->sendCustomRequest(request,verb); - break; - } - if(isFirst){ - printRequestStartLog(request,params); + if (isFirst) { + printRequestStartLog(request, params); } } -void Network::printRequestStartLog(QNetworkRequest request,NetworkParams* params){ - if(!params->getOpenLog()){ +void Network::printRequestStartLog(const QNetworkRequest &request, NetworkParams *params) { + if (!params->getOpenLog()) { return; } - qDebug()<<"<------"<"; - qDebug()<").arg(params->method2String()))<_url); + qDebug() << "<------" << qUtf8Printable(request.header(QNetworkRequest::UserAgentHeader).toString()) << "Request Start ------>"; + qDebug() << qUtf8Printable(QString::fromStdString("<%1>").arg(params->method2String())) << qUtf8Printable(params->_url); auto contentType = request.header(QNetworkRequest::ContentTypeHeader).toString(); - if(!contentType.isEmpty()){ - qDebug()< %1=%2").arg("Content-Type",contentType)); + if (!contentType.isEmpty()) { + qDebug() << qUtf8Printable(QString::fromStdString("
%1=%2").arg("Content-Type", contentType)); } QList headers = request.rawHeaderList(); - for(const QByteArray& header:headers){ - qDebug()< %1=%2").arg(header,request.rawHeader(header))); + for (const QByteArray &header: headers) { + qDebug() << qUtf8Printable(QString::fromStdString("
%1=%2").arg(header, request.rawHeader(header))); } - if(!params->_queryMap.isEmpty()){ - qDebug()<<""<_queryMap)); + if (!params->_queryMap.isEmpty()) { + qDebug() << "" << qUtf8Printable(map2String(params->_queryMap)); } - if(!params->_paramMap.isEmpty()){ - qDebug()<<""<_paramMap)); + if (!params->_paramMap.isEmpty()) { + qDebug() << "" << qUtf8Printable(map2String(params->_paramMap)); } - if(!params->_fileMap.isEmpty()){ - qDebug()<<""<_fileMap)); + if (!params->_fileMap.isEmpty()) { + qDebug() << "" << qUtf8Printable(map2String(params->_fileMap)); } - if(!params->_body.isEmpty()){ - qDebug()<<""<_body); + if (!params->_body.isEmpty()) { + qDebug() << "" << qUtf8Printable(params->_body); } } -void Network::printRequestEndLog(QNetworkRequest request,NetworkParams* params,QNetworkReply*& reply,const QString& response){ - if(!params->getOpenLog()){ +void Network::printRequestEndLog(const QNetworkRequest &request, NetworkParams *params, QNetworkReply *&reply, const QString &response) { + if (!params->getOpenLog()) { return; } - qDebug()<<"<------"<"; - qDebug()<").arg(params->method2String()))<_url); - qDebug()<<""<"; + qDebug() << qUtf8Printable(QString::fromStdString("<%1>").arg(params->method2String())) << qUtf8Printable(params->_url); + qDebug() << "" << qUtf8Printable(response); } -void Network::saveResponse(QString key,QString response){ +void Network::saveResponse(const QString &key, const QString &response) { QSharedPointer file(new QFile(getCacheFilePath(key))); - QIODevice::OpenMode mode = QIODevice::WriteOnly|QIODevice::Truncate; - if (!file->open(mode)) - { + QIODevice::OpenMode mode = QIODevice::WriteOnly | QIODevice::Truncate; + if (!file->open(mode)) { return; } file->write(response.toUtf8().toBase64()); } -void Network::addHeaders(QNetworkRequest* request,const QMap& headers){ - request->setHeader(QNetworkRequest::UserAgentHeader,QString::fromStdString("Mozilla/5.0 %1/%2").arg(QGuiApplication::applicationName(),QGuiApplication::applicationVersion())); +void Network::addHeaders(QNetworkRequest *request, const QMap &headers) { + request->setHeader(QNetworkRequest::UserAgentHeader, QString::fromStdString("Mozilla/5.0 %1/%2").arg(QGuiApplication::applicationName(), QGuiApplication::applicationVersion())); QMapIterator iter(headers); - while (iter.hasNext()) - { + while (iter.hasNext()) { iter.next(); request->setRawHeader(iter.key().toUtf8(), iter.value().toString().toUtf8()); } } -void Network::addQueryParam(QUrl* url,const QMap& params){ +void Network::addQueryParam(QUrl *url, const QMap ¶ms) { QMapIterator iter(params); QUrlQuery urlQuery(*url); - while (iter.hasNext()) - { + while (iter.hasNext()) { iter.next(); urlQuery.addQueryItem(iter.key(), iter.value().toString()); } url->setQuery(urlQuery); } -Network::Network(QObject *parent): QObject{parent} -{ - timeout(5000); - retry(3); - openLog(false); - cacheDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation).append(QDir::separator()).append("network")); +Network::Network(QObject *parent) : QObject{parent} { + _timeout = 5000; + _retry = 3; + _openLog = false; + _cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation).append(QDir::separator()).append("network"); } -NetworkParams* Network::get(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_NONE,NetworkParams::METHOD_GET,this); +NetworkParams *Network::get(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_NONE, NetworkParams::METHOD_GET, this); } -NetworkParams* Network::head(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_NONE,NetworkParams::METHOD_HEAD,this); +NetworkParams *Network::head(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_NONE, NetworkParams::METHOD_HEAD, this); } -NetworkParams* Network::postBody(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_BODY,NetworkParams::METHOD_POST,this); +NetworkParams *Network::postBody(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_BODY, NetworkParams::METHOD_POST, this); } -NetworkParams* Network::putBody(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_BODY,NetworkParams::METHOD_PUT,this); +NetworkParams *Network::putBody(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_BODY, NetworkParams::METHOD_PUT, this); } -NetworkParams* Network::patchBody(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_BODY,NetworkParams::METHOD_PATCH,this); +NetworkParams *Network::patchBody(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_BODY, NetworkParams::METHOD_PATCH, this); } -NetworkParams* Network::deleteBody(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_BODY,NetworkParams::METHOD_DELETE,this); +NetworkParams *Network::deleteBody(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_BODY, NetworkParams::METHOD_DELETE, this); } -NetworkParams* Network::postForm(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_FORM,NetworkParams::METHOD_POST,this); +NetworkParams *Network::postForm(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_FORM, NetworkParams::METHOD_POST, this); } -NetworkParams* Network::putForm(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_FORM,NetworkParams::METHOD_PUT,this); +NetworkParams *Network::putForm(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_FORM, NetworkParams::METHOD_PUT, this); } -NetworkParams* Network::patchForm(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_FORM,NetworkParams::METHOD_PATCH,this); +NetworkParams *Network::patchForm(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_FORM, NetworkParams::METHOD_PATCH, this); } -NetworkParams* Network::deleteForm(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_FORM,NetworkParams::METHOD_DELETE,this); +NetworkParams *Network::deleteForm(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_FORM, NetworkParams::METHOD_DELETE, this); } -NetworkParams* Network::postJson(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_JSON,NetworkParams::METHOD_POST,this); +NetworkParams *Network::postJson(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_JSON, NetworkParams::METHOD_POST, this); } -NetworkParams* Network::putJson(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_JSON,NetworkParams::METHOD_PUT,this); +NetworkParams *Network::putJson(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_JSON, NetworkParams::METHOD_PUT, this); } -NetworkParams* Network::patchJson(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_JSON,NetworkParams::METHOD_PATCH,this); +NetworkParams *Network::patchJson(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_JSON, NetworkParams::METHOD_PATCH, this); } -NetworkParams* Network::deleteJson(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_JSON,NetworkParams::METHOD_DELETE,this); +NetworkParams *Network::deleteJson(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_JSON, NetworkParams::METHOD_DELETE, this); } -NetworkParams* Network::postJsonArray(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_JSONARRAY,NetworkParams::METHOD_POST,this); +NetworkParams *Network::postJsonArray(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_JSONARRAY, NetworkParams::METHOD_POST, this); } -NetworkParams* Network::putJsonArray(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_JSONARRAY,NetworkParams::METHOD_PUT,this); +NetworkParams *Network::putJsonArray(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_JSONARRAY, NetworkParams::METHOD_PUT, this); } -NetworkParams* Network::patchJsonArray(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_JSONARRAY,NetworkParams::METHOD_PATCH,this); +NetworkParams *Network::patchJsonArray(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_JSONARRAY, NetworkParams::METHOD_PATCH, this); } -NetworkParams* Network::deleteJsonArray(const QString& url){ - return new NetworkParams(url,NetworkParams::TYPE_JSONARRAY,NetworkParams::METHOD_DELETE,this); +NetworkParams *Network::deleteJsonArray(const QString &url) { + return new NetworkParams(url, NetworkParams::TYPE_JSONARRAY, NetworkParams::METHOD_DELETE, this); } -void Network::setInterceptor(QJSValue interceptor){ - this->_interceptor = interceptor; +void Network::setInterceptor(QJSValue interceptor) { + this->_interceptor = std::move(interceptor); } + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/Network.h b/example/src/helper/Network.h index 7b00a151..1e37707c 100644 --- a/example/src/helper/Network.h +++ b/example/src/helper/Network.h @@ -1,5 +1,6 @@ -#ifndef NETWORK_H -#define NETWORK_H +#pragma once +#pragma clang diagnostic push +#pragma ide diagnostic ignored "NotImplementedFunctions" #include #include @@ -12,56 +13,66 @@ #include "src/singleton.h" namespace NetworkType { -Q_NAMESPACE -enum CacheMode { - NoCache = 0x0000, - RequestFailedReadCache = 0x0001, - IfNoneCacheRequest = 0x0002, - FirstCacheThenRequest = 0x0004, -}; -Q_ENUM_NS(CacheMode) -QML_NAMED_ELEMENT(NetworkType) + Q_NAMESPACE + enum CacheMode { + NoCache = 0x0000, + RequestFailedReadCache = 0x0001, + IfNoneCacheRequest = 0x0002, + FirstCacheThenRequest = 0x0004, + }; + + Q_ENUM_NS(CacheMode) + + QML_NAMED_ELEMENT(NetworkType) } /** * @brief The NetworkCallable class */ -class NetworkCallable : public QObject{ - Q_OBJECT +class NetworkCallable : public QObject { +Q_OBJECT QML_NAMED_ELEMENT(NetworkCallable) public: explicit NetworkCallable(QObject *parent = nullptr); + Q_SIGNAL void start(); + Q_SIGNAL void finish(); - Q_SIGNAL void error(int status,QString errorString,QString result); + + Q_SIGNAL void error(int status, QString errorString, QString result); + Q_SIGNAL void success(QString result); + Q_SIGNAL void cache(QString result); + Q_SIGNAL void uploadProgress(qint64 sent, qint64 total); + Q_SIGNAL void downloadProgress(qint64 recv, qint64 total); }; /** * @brief The FluDownloadParam class */ -class FluDownloadParam : public QObject{ - Q_OBJECT +class FluDownloadParam : public QObject { +Q_OBJECT public: explicit FluDownloadParam(QObject *parent = nullptr); - FluDownloadParam(QString destPath,bool append,QObject *parent = nullptr); + + FluDownloadParam(QString destPath, bool append, QObject *parent = nullptr); + public: QString _destPath; - bool _append; + bool _append{}; }; /** * @brief The NetworkParams class */ -class NetworkParams : public QObject -{ - Q_OBJECT +class NetworkParams : public QObject { +Q_OBJECT QML_NAMED_ELEMENT(NetworkParams) public: - enum Method{ + enum Method { METHOD_GET, METHOD_HEAD, METHOD_POST, @@ -69,35 +80,55 @@ public: METHOD_PATCH, METHOD_DELETE }; - enum Type{ + enum Type { TYPE_NONE, TYPE_FORM, TYPE_JSON, TYPE_JSONARRAY, TYPE_BODY }; + explicit NetworkParams(QObject *parent = nullptr); - NetworkParams(QString url,Type type,Method method,QObject *parent = nullptr); - Q_INVOKABLE NetworkParams* addQuery(QString key,QVariant val); - Q_INVOKABLE NetworkParams* addHeader(QString key,QVariant val); - Q_INVOKABLE NetworkParams* add(QString key,QVariant val); - Q_INVOKABLE NetworkParams* addFile(QString key,QVariant val); - Q_INVOKABLE NetworkParams* setBody(QString val); - Q_INVOKABLE NetworkParams* setTimeout(int val); - Q_INVOKABLE NetworkParams* setRetry(int val); - Q_INVOKABLE NetworkParams* setCacheMode(int val); - Q_INVOKABLE NetworkParams* toDownload(QString destPath,bool append = false); - Q_INVOKABLE NetworkParams* bind(QObject* target); - Q_INVOKABLE NetworkParams* openLog(QVariant val); - Q_INVOKABLE void go(NetworkCallable* result); - QString buildCacheKey(); - QString method2String(); - int getTimeout(); - int getRetry(); - bool getOpenLog(); + + NetworkParams(QString url, Type type, Method method, QObject *parent = nullptr); + + Q_INVOKABLE NetworkParams *addQuery(const QString &key, const QVariant &val); + + Q_INVOKABLE NetworkParams *addHeader(const QString &key, const QVariant &val); + + Q_INVOKABLE NetworkParams *add(const QString &key, const QVariant &val); + + Q_INVOKABLE NetworkParams *addFile(const QString &key, const QVariant &val); + + Q_INVOKABLE NetworkParams *setBody(QString val); + + Q_INVOKABLE NetworkParams *setTimeout(int val); + + Q_INVOKABLE NetworkParams *setRetry(int val); + + Q_INVOKABLE NetworkParams *setCacheMode(int val); + + Q_INVOKABLE NetworkParams *toDownload(QString destPath, bool append = false); + + Q_INVOKABLE NetworkParams *bind(QObject *target); + + Q_INVOKABLE NetworkParams *openLog(QVariant val); + + Q_INVOKABLE void go(NetworkCallable *result); + + QString buildCacheKey() const; + + QString method2String() const; + + int getTimeout() const; + + int getRetry() const; + + bool getOpenLog() const; + public: - FluDownloadParam* _downloadParam = nullptr; - QObject* _target = nullptr; + FluDownloadParam *_downloadParam = nullptr; + QObject *_target = nullptr; Method _method; Type _type; QString _url; @@ -115,55 +146,90 @@ public: /** * @brief The Network class */ -class Network : public QObject -{ - Q_OBJECT - Q_PROPERTY_AUTO(int,timeout) - Q_PROPERTY_AUTO(int,retry) - Q_PROPERTY_AUTO(QString,cacheDir) - Q_PROPERTY_AUTO(bool,openLog) +class Network : public QObject { +Q_OBJECT +Q_PROPERTY_AUTO(int, timeout) +Q_PROPERTY_AUTO(int, retry) +Q_PROPERTY_AUTO(QString, cacheDir) +Q_PROPERTY_AUTO(bool, openLog) QML_NAMED_ELEMENT(Network) QML_SINGLETON + private: explicit Network(QObject *parent = nullptr); + public: - SINGLETON(Network) - static Network *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();} - Q_INVOKABLE NetworkParams* get(const QString& url); - Q_INVOKABLE NetworkParams* head(const QString& url); - Q_INVOKABLE NetworkParams* postBody(const QString& url); - Q_INVOKABLE NetworkParams* putBody(const QString& url); - Q_INVOKABLE NetworkParams* patchBody(const QString& url); - Q_INVOKABLE NetworkParams* deleteBody(const QString& url); - Q_INVOKABLE NetworkParams* postForm(const QString& url); - Q_INVOKABLE NetworkParams* putForm(const QString& url); - Q_INVOKABLE NetworkParams* patchForm(const QString& url); - Q_INVOKABLE NetworkParams* deleteForm(const QString& url); - Q_INVOKABLE NetworkParams* postJson(const QString& url); - Q_INVOKABLE NetworkParams* putJson(const QString& url); - Q_INVOKABLE NetworkParams* patchJson(const QString& url); - Q_INVOKABLE NetworkParams* deleteJson(const QString& url); - Q_INVOKABLE NetworkParams* postJsonArray(const QString& url); - Q_INVOKABLE NetworkParams* putJsonArray(const QString& url); - Q_INVOKABLE NetworkParams* patchJsonArray(const QString& url); - Q_INVOKABLE NetworkParams* deleteJsonArray(const QString& url); +SINGLETON(Network) + + static Network *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine) { return getInstance(); } + + Q_INVOKABLE NetworkParams *get(const QString &url); + + Q_INVOKABLE NetworkParams *head(const QString &url); + + Q_INVOKABLE NetworkParams *postBody(const QString &url); + + Q_INVOKABLE NetworkParams *putBody(const QString &url); + + Q_INVOKABLE NetworkParams *patchBody(const QString &url); + + Q_INVOKABLE NetworkParams *deleteBody(const QString &url); + + Q_INVOKABLE NetworkParams *postForm(const QString &url); + + Q_INVOKABLE NetworkParams *putForm(const QString &url); + + Q_INVOKABLE NetworkParams *patchForm(const QString &url); + + Q_INVOKABLE NetworkParams *deleteForm(const QString &url); + + Q_INVOKABLE NetworkParams *postJson(const QString &url); + + Q_INVOKABLE NetworkParams *putJson(const QString &url); + + Q_INVOKABLE NetworkParams *patchJson(const QString &url); + + Q_INVOKABLE NetworkParams *deleteJson(const QString &url); + + Q_INVOKABLE NetworkParams *postJsonArray(const QString &url); + + Q_INVOKABLE NetworkParams *putJsonArray(const QString &url); + + Q_INVOKABLE NetworkParams *patchJsonArray(const QString &url); + + Q_INVOKABLE NetworkParams *deleteJsonArray(const QString &url); + Q_INVOKABLE void setInterceptor(QJSValue interceptor); - void handle(NetworkParams* params,NetworkCallable* result); - void handleDownload(NetworkParams* params,NetworkCallable* result); + + void handle(NetworkParams *params, NetworkCallable *result); + + void handleDownload(NetworkParams *params, NetworkCallable *result); + private: - void sendRequest(QNetworkAccessManager* manager,QNetworkRequest request,NetworkParams* params,QNetworkReply*& reply,bool isFirst,QPointer callable); - void addQueryParam(QUrl* url,const QMap& params); - void addHeaders(QNetworkRequest* request,const QMap& headers); - void saveResponse(QString key,QString response); - QString readCache(const QString& key); - bool cacheExists(const QString& key); - QString getCacheFilePath(const QString& key); - QString map2String(const QMap& map); - QString headerList2String(const QList& data); - void printRequestStartLog(QNetworkRequest request,NetworkParams* params); - void printRequestEndLog(QNetworkRequest request,NetworkParams* params,QNetworkReply*& reply,const QString& response); + static void sendRequest(QNetworkAccessManager *manager, QNetworkRequest request, NetworkParams *params, QNetworkReply *&reply, bool isFirst, const QPointer& callable); + + static void addQueryParam(QUrl *url, const QMap ¶ms); + + static void addHeaders(QNetworkRequest *request, const QMap &headers); + + void saveResponse(const QString& key, const QString& response); + + QString readCache(const QString &key); + + bool cacheExists(const QString &key); + + QString getCacheFilePath(const QString &key); + + static QString headerList2String(const QList &data); + + static void printRequestStartLog(const QNetworkRequest& request, NetworkParams *params); + + static void printRequestEndLog(const QNetworkRequest& request, NetworkParams *params, QNetworkReply *&reply, const QString &response); + + static QString map2String(const QMap &map); + public: QJSValue _interceptor; }; -#endif // Network_H +#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/SettingsHelper.cpp b/example/src/helper/SettingsHelper.cpp index 1f5afdc9..af77d709 100644 --- a/example/src/helper/SettingsHelper.cpp +++ b/example/src/helper/SettingsHelper.cpp @@ -1,21 +1,22 @@ +#pragma clang diagnostic push +#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" + #include "SettingsHelper.h" #include #include -SettingsHelper::SettingsHelper(QObject *parent) : QObject(parent) -{ +SettingsHelper::SettingsHelper(QObject *parent) : QObject(parent) { } SettingsHelper::~SettingsHelper() = default; -void SettingsHelper::save(const QString& key,QVariant val) -{ +void SettingsHelper::save(const QString &key, QVariant val) { m_settings->setValue(key, val); } -QVariant SettingsHelper::get(const QString& key,QVariant def){ +QVariant SettingsHelper::get(const QString &key, QVariant def) { QVariant data = m_settings->value(key); if (!data.isNull() && data.isValid()) { return data; @@ -23,10 +24,12 @@ QVariant SettingsHelper::get(const QString& key,QVariant def){ return def; } -void SettingsHelper::init(char *argv[]){ +void SettingsHelper::init(char *argv[]) { QString applicationPath = QString::fromStdString(argv[0]); const QFileInfo fileInfo(applicationPath); const QString iniFileName = fileInfo.completeBaseName() + ".ini"; const QString iniFilePath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + iniFileName; m_settings.reset(new QSettings(iniFilePath, QSettings::IniFormat)); } + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/SettingsHelper.h b/example/src/helper/SettingsHelper.h index a8c0b8e9..ab49a49d 100644 --- a/example/src/helper/SettingsHelper.h +++ b/example/src/helper/SettingsHelper.h @@ -1,5 +1,6 @@ -#ifndef SETTINGSHELPER_H -#define SETTINGSHELPER_H +#pragma clang diagnostic push +#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" +#pragma once #include #include @@ -10,26 +11,36 @@ #include #include "src/singleton.h" -class SettingsHelper : public QObject -{ - Q_OBJECT +class SettingsHelper : public QObject { +Q_OBJECT private: - explicit SettingsHelper(QObject* parent = nullptr); + explicit SettingsHelper(QObject *parent = nullptr); + public: - SINGLETON(SettingsHelper) +SINGLETON(SettingsHelper) + ~SettingsHelper() override; + void init(char *argv[]); - Q_INVOKABLE void saveDarkMode(int darkModel){save("darkMode",darkModel);} - Q_INVOKABLE int getDarkMode(){return get("darkMode",QVariant(0)).toInt();} - Q_INVOKABLE void saveUseSystemAppBar(bool useSystemAppBar){save("useSystemAppBar",useSystemAppBar);} - Q_INVOKABLE bool getUseSystemAppBar(){return get("useSystemAppBar",QVariant(false)).toBool();} - Q_INVOKABLE void saveLanguage(QString language){save("language",language);} - Q_INVOKABLE QString getLanguage(){return get("language",QVariant("en_US")).toString();} + + Q_INVOKABLE void saveDarkMode(int darkModel) { save("darkMode", darkModel); } + + Q_INVOKABLE int getDarkMode() { return get("darkMode", QVariant(0)).toInt(); } + + Q_INVOKABLE void saveUseSystemAppBar(bool useSystemAppBar) { save("useSystemAppBar", useSystemAppBar); } + + Q_INVOKABLE bool getUseSystemAppBar() { return get("useSystemAppBar", QVariant(false)).toBool(); } + + Q_INVOKABLE void saveLanguage(const QString &language) { save("language", language); } + + Q_INVOKABLE QString getLanguage() { return get("language", QVariant("en_US")).toString(); } + private: - void save(const QString& key,QVariant val); - QVariant get(const QString& key,QVariant def={}); + void save(const QString &key, QVariant val); + + QVariant get(const QString &key, QVariant def = {}); + private: QScopedPointer m_settings; }; - -#endif // SETTINGSHELPER_H +#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/TranslateHelper.cpp b/example/src/helper/TranslateHelper.cpp index 178b9416..5ac3bf09 100644 --- a/example/src/helper/TranslateHelper.cpp +++ b/example/src/helper/TranslateHelper.cpp @@ -5,21 +5,20 @@ #include "SettingsHelper.h" -TranslateHelper::TranslateHelper(QObject *parent) : QObject(parent) -{ - _languages<<"en_US"; - _languages<<"zh_CN"; +[[maybe_unused]] TranslateHelper::TranslateHelper(QObject *parent) : QObject(parent) { + _languages << "en_US"; + _languages << "zh_CN"; _current = SettingsHelper::getInstance()->getLanguage(); } TranslateHelper::~TranslateHelper() = default; -void TranslateHelper::init(QQmlEngine* engine){ +void TranslateHelper::init(QQmlEngine *engine) { _engine = engine; _translator = new QTranslator(this); - qApp->installTranslator(_translator); - QString translatorPath = QGuiApplication::applicationDirPath()+"/i18n"; - if(_translator->load(QString::fromStdString("%1/example_%2.qm").arg(translatorPath,_current))){ + QGuiApplication::installTranslator(_translator); + QString translatorPath = QGuiApplication::applicationDirPath() + "/i18n"; + if (_translator->load(QString::fromStdString("%1/example_%2.qm").arg(translatorPath, _current))) { _engine->retranslate(); } } diff --git a/example/src/helper/TranslateHelper.h b/example/src/helper/TranslateHelper.h index 93e1a4cc..1476871a 100644 --- a/example/src/helper/TranslateHelper.h +++ b/example/src/helper/TranslateHelper.h @@ -1,5 +1,4 @@ -#ifndef TRANSLATEHELPER_H -#define TRANSLATEHELPER_H +#pragma once #include #include @@ -7,20 +6,21 @@ #include "src/singleton.h" #include "src/stdafx.h" -class TranslateHelper : public QObject -{ - Q_OBJECT - Q_PROPERTY_AUTO(QString,current) - Q_PROPERTY_READONLY_AUTO(QStringList,languages) +class TranslateHelper : public QObject { +Q_OBJECT +Q_PROPERTY_AUTO(QString, current) +Q_PROPERTY_READONLY_AUTO(QStringList, languages) private: - explicit TranslateHelper(QObject* parent = nullptr); -public: - SINGLETON(TranslateHelper) - ~TranslateHelper() override; - void init(QQmlEngine* engine); -private: - QQmlEngine* _engine = nullptr; - QTranslator* _translator = nullptr; -}; + [[maybe_unused]] explicit TranslateHelper(QObject *parent = nullptr); -#endif // TRANSLATEHELPER_H +public: +SINGLETON(TranslateHelper) + + ~TranslateHelper() override; + + void init(QQmlEngine *engine); + +private: + QQmlEngine *_engine = nullptr; + QTranslator *_translator = nullptr; +}; \ No newline at end of file diff --git a/example/src/main.cpp b/example/src/main.cpp index be38a0b5..e652ac85 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -14,6 +14,7 @@ #include "src/component/CircularReveal.h" #include "src/component/FileWatcher.h" #include "src/component/FpsItem.h" +#include "src/component/OpenGLItem.h" #include "src/helper/SettingsHelper.h" #include "src/helper/InitializrHelper.h" #include "src/helper/TranslateHelper.h" @@ -75,6 +76,9 @@ int main(int argc, char *argv[]) qmlRegisterType(uri, major, minor, "FpsItem"); qmlRegisterType(uri,major,minor,"NetworkCallable"); qmlRegisterType(uri,major,minor,"NetworkParams"); + qmlRegisterType(uri,major,minor,"OpenGLItem"); + qmlRegisterUncreatableMetaObject(NetworkType::staticMetaObject, uri, major, minor, "NetworkType", "Access to enums & flags only"); + QQmlApplicationEngine engine; TranslateHelper::getInstance()->init(&engine); engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance()); diff --git a/example/src/singleton.h b/example/src/singleton.h index 8d6c10e6..9583c687 100644 --- a/example/src/singleton.h +++ b/example/src/singleton.h @@ -1,18 +1,17 @@ -#ifndef SINGLETON_H -#define SINGLETON_H +#pragma once /** * @brief The Singleton class */ -template +template class Singleton { public: - static T* getInstance(); + static T *getInstance(); }; -template -T* Singleton::getInstance() { - static T* instance = new T(); +template +T *Singleton::getInstance() { + static T *instance = new T(); return instance; } @@ -23,5 +22,3 @@ private: \ static Class* getInstance() { \ return Singleton::getInstance(); \ } - -#endif // SINGLETON_H diff --git a/example/src/stdafx.h b/example/src/stdafx.h index 4b4d821c..b411a82a 100644 --- a/example/src/stdafx.h +++ b/example/src/stdafx.h @@ -1,37 +1,50 @@ -#ifndef STDAFX_H -#define STDAFX_H +#pragma once -#define Q_PROPERTY_AUTO(TYPE, M) \ +#define Q_PROPERTY_AUTO_P(TYPE, M) \ Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ - public: \ - Q_SIGNAL void M##Changed(); \ - void M(TYPE in_##M) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(TYPE in_##M) \ { \ - _##M = in_##M; \ - Q_EMIT M##Changed(); \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ } \ - TYPE M() \ + TYPE M() \ { \ - return _##M; \ + return _##M; \ } \ - private: \ - TYPE _##M; \ + private: \ + TYPE _##M; \ + +#define Q_PROPERTY_AUTO(TYPE, M) \ +Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(const TYPE& in_##M) \ +{ \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ +} \ + TYPE M() \ +{ \ + return _##M; \ +} \ + private: \ + TYPE _##M; \ -#define Q_PROPERTY_READONLY_AUTO(TYPE, M) \ +#define Q_PROPERTY_READONLY_AUTO(TYPE, M) \ Q_PROPERTY(TYPE M READ M NOTIFY M##Changed FINAL) \ - public: \ - Q_SIGNAL void M##Changed(); \ - void M(TYPE in_##M) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(const TYPE& in_##M) \ { \ - _##M = in_##M; \ - Q_EMIT M##Changed(); \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ } \ - TYPE M() \ + TYPE M() \ { \ - return _##M; \ + return _##M; \ } \ - private: \ - TYPE _##M; \ - -#endif // STDAFX_H + private: \ + TYPE _##M; \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f4439bd9..bb916ab9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.20) if (FLUENTUI_BUILD_STATIC_LIB AND (QT_VERSION VERSION_GREATER_EQUAL "6.2")) project(fluentui VERSION 1.0) -else() +else () project(fluentuiplugin VERSION 1.0) -endif() +endif () list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/) @@ -17,31 +17,31 @@ add_definitions(-DFLUENTUI_VERSION=1,7,4,0) if (FLUENTUI_BUILD_STATIC_LIB) add_definitions(-DFLUENTUI_BUILD_STATIC_LIB) -endif() +endif () #编译参数设置 option(FLUENTUI_BUILD_STATIC_LIB "Build static library." OFF) #导入Qt相关依赖包 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick Qml) -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Qml) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick) set(QT_SDK_DIR "${Qt${QT_VERSION_MAJOR}_DIR}/../../..") cmake_path(SET QT_SDK_DIR NORMALIZE ${QT_SDK_DIR}) #设置QML插件输出目录,可以通过外部设置,如果外部没有设置就默认到\qml\FluentUI目录下 set(FLUENTUI_QML_PLUGIN_DIRECTORY "" CACHE PATH "Path to FluentUI plugin") -if(NOT FLUENTUI_QML_PLUGIN_DIRECTORY) +if (NOT FLUENTUI_QML_PLUGIN_DIRECTORY) set(FLUENTUI_QML_PLUGIN_DIRECTORY ${QT_SDK_DIR}/qml/FluentUI) -endif() +endif () -if(QT_VERSION VERSION_GREATER_EQUAL "6.3") +if (QT_VERSION VERSION_GREATER_EQUAL "6.3") qt_standard_project_setup() -else() +else () set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -endif() +endif () #国际化 find_program(QT_LUPDATE NAMES lupdate) @@ -59,90 +59,90 @@ file(GLOB QM_FILE_PATHS ${CMAKE_CURRENT_LIST_DIR}/ *.qm) file(COPY ${QM_FILE_PATHS} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/Qt${QT_VERSION_MAJOR}/imports/FluentUI/i18n") #遍历所有Cpp文件 -file(GLOB_RECURSE CPP_FILES *.cpp *.h) -foreach(filepath ${CPP_FILES}) +file(GLOB_RECURSE CPP_FILES *.cpp *.h *.cxx) +foreach (filepath ${CPP_FILES}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath}) list(APPEND sources_files ${filename}) -endforeach(filepath) +endforeach (filepath) -if(QT_VERSION VERSION_GREATER_EQUAL "6.2") +if (QT_VERSION VERSION_GREATER_EQUAL "6.2") #删除fluentuiplugin.cpp与fluentuiplugin.h,这些只要Qt5使用,Qt6不需要 list(REMOVE_ITEM sources_files fluentuiplugin.h fluentuiplugin.cpp) if (NOT FLUENTUI_BUILD_STATIC_LIB) list(REMOVE_ITEM sources_files FluentUI.h FluentUI.cpp) - endif() + endif () #遍历所有qml文件 file(GLOB_RECURSE QML_PATHS *.qml qmldir) - foreach(filepath ${QML_PATHS}) - if(${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/") + foreach (filepath ${QML_PATHS}) + if (${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/") string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath}) - if(${filename} MATCHES "qmldir") + if (${filename} MATCHES "qmldir") list(APPEND resource_files ${filename}) - else() + else () list(APPEND qml_files ${filename}) - endif() - endif() - endforeach(filepath) + endif () + endif () + endforeach (filepath) #遍历所有资源文件 file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.js *.qm) - foreach(filepath ${RES_PATHS}) - if(${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/") + foreach (filepath ${RES_PATHS}) + if (${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/") string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath}) list(APPEND resource_files ${filename}) - endif() - endforeach(filepath) + endif () + endforeach (filepath) #修改资源文件导出路径 - foreach(filepath IN LISTS qml_files resource_files) + foreach (filepath IN LISTS qml_files resource_files) string(REPLACE "Qt${QT_VERSION_MAJOR}/imports/FluentUI/" "" filename ${filepath}) set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename}) - endforeach() -endif() + endforeach () +endif () if (FLUENTUI_BUILD_STATIC_LIB) set(LIB_TYPE "STATIC") -else() +else () set(LIB_TYPE "SHARED") -endif() +endif () if (FLUENTUI_BUILD_STATIC_LIB) set(PLUGIN_TARGET_NAME "") -else() +else () #如果是动态库,则使用插件目标作为其自己的支持目标来定义 QML 模块,在这种情况下,模块必须在运行时动态加载,并且不能由其他目标直接链接到 set(PLUGIN_TARGET_NAME ${PROJECT_NAME}) -endif() +endif () #如果是Windows平台,则生成rc文件 set(FLUENTUI_VERSION_RC_PATH "") -if(WIN32) +if (WIN32) set(FLUENTUI_VERSION_RC_PATH ${CMAKE_CURRENT_BINARY_DIR}/version_${PROJECT_NAME}.rc) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/version_dll.rc.in - ${FLUENTUI_VERSION_RC_PATH} + ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/version_dll.rc.in + ${FLUENTUI_VERSION_RC_PATH} ) -endif() +endif () -if(QT_VERSION VERSION_GREATER_EQUAL "6.2") +if (QT_VERSION VERSION_GREATER_EQUAL "6.2") #如果是Qt6.2版本以上,则使用qt_add_library,qt_add_qml_module函数添加资源文件 - if(FLUENTUI_BUILD_STATIC_LIB) + if (FLUENTUI_BUILD_STATIC_LIB) set(FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/FluentUI) - endif() + endif () qt_add_library(${PROJECT_NAME} ${LIB_TYPE}) qt_add_qml_module(${PROJECT_NAME} - PLUGIN_TARGET ${PLUGIN_TARGET_NAME} - OUTPUT_DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY} - VERSION 1.0 - URI "FluentUI" - #修改qmltypes文件名称。默认fluentuiplugin.qmltypes,使用默认名称有时候import FluentUI 1.0会爆红,所以修改成plugins.qmltypes - TYPEINFO "plugins.qmltypes" - SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH} - QML_FILES ${qml_files} - RESOURCES ${resource_files} - RESOURCE_PREFIX "/qt/qml" + PLUGIN_TARGET ${PLUGIN_TARGET_NAME} + OUTPUT_DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY} + VERSION 1.0 + URI "FluentUI" + #修改qmltypes文件名称。默认fluentuiplugin.qmltypes,使用默认名称有时候import FluentUI 1.0会爆红,所以修改成plugins.qmltypes + TYPEINFO "plugins.qmltypes" + SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH} + QML_FILES ${qml_files} + RESOURCES ${resource_files} + RESOURCE_PREFIX "/qt/qml" ) -else() +else () #加快qrc编译 set(QRC_FILE Qt5/imports/fluentui.qrc) qt_add_big_resources(QRC_RESOURCES ${QRC_FILE}) @@ -151,37 +151,37 @@ else() #如果是Qt6.2版本以下,则使用add_qmlplugin函数添加资源文件,这是个自定义的函数,详情见.cmake/QmlPlugin.cmake include(QmlPlugin) add_qmlplugin(${PROJECT_NAME} - URI "FluentUI" - VERSION 1.0 - SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH} ${QRC_RESOURCES} - QMLFILES ${qml_files} - QMLDIR imports/FluentUI - BINARY_DIR ${FLUENTUI_QML_PLUGIN_DIRECTORY} - LIBTYPE ${LIB_TYPE} + URI "FluentUI" + VERSION 1.0 + SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH} ${QRC_RESOURCES} + QMLFILES ${qml_files} + QMLDIR imports/FluentUI + BINARY_DIR ${FLUENTUI_QML_PLUGIN_DIRECTORY} + LIBTYPE ${LIB_TYPE} ) -endif() +endif () target_compile_definitions(${PROJECT_NAME} - PRIVATE - #导入qrcode配置文件 - HAVE_CONFIG_H + PRIVATE + #导入qrcode配置文件 + HAVE_CONFIG_H ) #去掉mingw生成的动态库libxxx前缀lib,不去掉前缀会导致 module "FluentUI" plugin "fluentuiplugin" not found -if(MINGW) +if (MINGW) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") -endif() +endif () #MSVC Debug 添加后缀d,与Qt插件风格保持一致 -if(MSVC) +if (MSVC) set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "d") -endif() +endif () #链接库 target_link_libraries(${PROJECT_NAME} PUBLIC - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Quick - Qt${QT_VERSION_MAJOR}::Qml + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Quick + Qt${QT_VERSION_MAJOR}::Qml ) #安装 diff --git a/src/Def.cpp b/src/Def.cpp deleted file mode 100644 index 7d0fc38e..00000000 --- a/src/Def.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Def.h" diff --git a/src/Def.h b/src/Def.h index 12a2f371..5f2a5b19 100644 --- a/src/Def.h +++ b/src/Def.h @@ -1,1564 +1,1591 @@ -#ifndef DEF_H -#define DEF_H +#pragma once #include #include namespace FluSheetType { -Q_NAMESPACE -enum Position { - Left = 0x0000, - Top = 0x0001, - Right = 0x0002, - Bottom = 0x0004, -}; -Q_ENUM_NS(Position) -QML_NAMED_ELEMENT(FluSheetType) + Q_NAMESPACE + enum Position { + Left = 0x0000, + Top = 0x0001, + Right = 0x0002, + Bottom = 0x0004, + }; + + Q_ENUM_NS(Position) + + QML_NAMED_ELEMENT(FluSheetType) } namespace FluThemeType { -Q_NAMESPACE -enum DarkMode { - System = 0x0000, - Light = 0x0001, - Dark = 0x0002, -}; -Q_ENUM_NS(DarkMode) -QML_NAMED_ELEMENT(FluThemeType) + Q_NAMESPACE + enum DarkMode { + System = 0x0000, + Light = 0x0001, + Dark = 0x0002, + }; + + Q_ENUM_NS(DarkMode) + + QML_NAMED_ELEMENT(FluThemeType) } namespace FluTimelineType { -Q_NAMESPACE -enum Mode { - Left = 0x0000, - Right = 0x0001, - Alternate = 0x0002, -}; -Q_ENUM_NS(Mode) -QML_NAMED_ELEMENT(FluTimelineType) + Q_NAMESPACE + enum Mode { + Left = 0x0000, + Right = 0x0001, + Alternate = 0x0002, + }; + + Q_ENUM_NS(Mode) + + QML_NAMED_ELEMENT(FluTimelineType) } namespace FluPageType { -Q_NAMESPACE -enum LaunchMode { - Standard = 0x0000, - SingleTask = 0x0001, - SingleTop = 0x0002, - SingleInstance = 0x0004 -}; -Q_ENUM_NS(LaunchMode) -QML_NAMED_ELEMENT(FluPageType) + Q_NAMESPACE + enum LaunchMode { + Standard = 0x0000, + SingleTask = 0x0001, + SingleTop = 0x0002, + SingleInstance = 0x0004 + }; + + Q_ENUM_NS(LaunchMode) + + QML_NAMED_ELEMENT(FluPageType) } namespace FluWindowType { -Q_NAMESPACE -enum LaunchMode { - Standard = 0x0000, - SingleTask = 0x0001, - SingleInstance = 0x0002 -}; -Q_ENUM_NS(LaunchMode) -QML_NAMED_ELEMENT(FluWindowType) + Q_NAMESPACE + enum LaunchMode { + Standard = 0x0000, + SingleTask = 0x0001, + SingleInstance = 0x0002 + }; + + Q_ENUM_NS(LaunchMode) + + QML_NAMED_ELEMENT(FluWindowType) } namespace FluTreeViewType { -Q_NAMESPACE -enum SelectionMode { - None = 0x0000, - Single = 0x0001, - Multiple = 0x0002 -}; -Q_ENUM_NS(SelectionMode) -QML_NAMED_ELEMENT(FluTreeViewType) + Q_NAMESPACE + enum SelectionMode { + None = 0x0000, + Single = 0x0001, + Multiple = 0x0002 + }; + + Q_ENUM_NS(SelectionMode) + + QML_NAMED_ELEMENT(FluTreeViewType) } namespace FluStatusLayoutType { -Q_NAMESPACE -enum StatusMode { - Loading = 0x0000, - Empty = 0x0001, - Error = 0x0002, - Success = 0x0004 -}; -Q_ENUM_NS(StatusMode) -QML_NAMED_ELEMENT(FluStatusLayoutType) + Q_NAMESPACE + enum StatusMode { + Loading = 0x0000, + Empty = 0x0001, + Error = 0x0002, + Success = 0x0004 + }; + + Q_ENUM_NS(StatusMode) + + QML_NAMED_ELEMENT(FluStatusLayoutType) } namespace FluContentDialogType { -Q_NAMESPACE -enum ButtonFlag { - NeutralButton = 0x0001, - NegativeButton = 0x0002, - PositiveButton = 0x0004 -}; -Q_ENUM_NS(ButtonFlag) -QML_NAMED_ELEMENT(FluContentDialogType) + Q_NAMESPACE + enum ButtonFlag { + NeutralButton = 0x0001, + NegativeButton = 0x0002, + PositiveButton = 0x0004 + }; + + Q_ENUM_NS(ButtonFlag) + + QML_NAMED_ELEMENT(FluContentDialogType) } namespace FluTimePickerType { -Q_NAMESPACE -enum HourFormat { - H = 0x0000, - HH = 0x0001 -}; -Q_ENUM_NS(HourFormat) -QML_NAMED_ELEMENT(FluTimePickerType) + Q_NAMESPACE + enum HourFormat { + H = 0x0000, + HH = 0x0001 + }; + + Q_ENUM_NS(HourFormat) + + QML_NAMED_ELEMENT(FluTimePickerType) } namespace FluCalendarViewType { -Q_NAMESPACE -enum DisplayMode { - Month = 0x0000, - Year = 0x0001, - Decade = 0x0002 -}; -Q_ENUM_NS(DisplayMode) -QML_NAMED_ELEMENT(FluCalendarViewType) + Q_NAMESPACE + enum DisplayMode { + Month = 0x0000, + Year = 0x0001, + Decade = 0x0002 + }; + + Q_ENUM_NS(DisplayMode) + + QML_NAMED_ELEMENT(FluCalendarViewType) } namespace FluTabViewType { -Q_NAMESPACE -enum TabWidthBehavior { - Equal = 0x0000, - SizeToContent = 0x0001, - Compact = 0x0002 -}; -Q_ENUM_NS(TabWidthBehavior) -enum CloseButtonVisibility { - Never = 0x0000, - Always = 0x0001, - OnHover = 0x0002 -}; -Q_ENUM_NS(CloseButtonVisibility) -QML_NAMED_ELEMENT(FluTabViewType) + Q_NAMESPACE + enum TabWidthBehavior { + Equal = 0x0000, + SizeToContent = 0x0001, + Compact = 0x0002 + }; + + Q_ENUM_NS(TabWidthBehavior) + + enum CloseButtonVisibility { + Never = 0x0000, + Always = 0x0001, + OnHover = 0x0002 + }; + + Q_ENUM_NS(CloseButtonVisibility) + + QML_NAMED_ELEMENT(FluTabViewType) } namespace FluNavigationViewType { -Q_NAMESPACE -enum DisplayMode { - Open = 0x0000, - Compact = 0x0001, - Minimal = 0x0002, - Auto = 0x0004 -}; -Q_ENUM_NS(DisplayMode) -enum PageMode { - Stack = 0x0000, - NoStack = 0x0001 -}; -Q_ENUM_NS(PageMode) -QML_NAMED_ELEMENT(FluNavigationViewType) + Q_NAMESPACE + enum DisplayMode { + Open = 0x0000, + Compact = 0x0001, + Minimal = 0x0002, + Auto = 0x0004 + }; + + Q_ENUM_NS(DisplayMode) + + enum PageMode { + Stack = 0x0000, + NoStack = 0x0001 + }; + + Q_ENUM_NS(PageMode) + + QML_NAMED_ELEMENT(FluNavigationViewType) } namespace Fluent_Awesome { -Q_NAMESPACE -enum class Fluent_AwesomeType { - GlobalNavButton=0xe700, - Wifi=0xe701, - Bluetooth=0xe702, - Connect=0xe703, - InternetSharing=0xe704, - VPN=0xe705, - Brightness=0xe706, - MapPin=0xe707, - QuietHours=0xe708, - Airplane=0xe709, - Tablet=0xe70a, - QuickNote=0xe70b, - RememberedDevice=0xe70c, - ChevronDown=0xe70d, - ChevronUp=0xe70e, - Edit=0xe70f, - Add=0xe710, - Cancel=0xe711, - More=0xe712, - Settings=0xe713, - Video=0xe714, - Mail=0xe715, - People=0xe716, - Phone=0xe717, - Pin=0xe718, - Shop=0xe719, - Stop=0xe71a, - Link=0xe71b, - Filter=0xe71c, - AllApps=0xe71d, - Zoom=0xe71e, - ZoomOut=0xe71f, - Microphone=0xe720, - Search=0xe721, - Camera=0xe722, - Attach=0xe723, - Send=0xe724, - SendFill=0xe725, - WalkSolid=0xe726, - InPrivate=0xe727, - FavoriteList=0xe728, - PageSolid=0xe729, - Forward=0xe72a, - Back=0xe72b, - Refresh=0xe72c, - Share=0xe72d, - Lock=0xe72e, - ReportHacked=0xe730, - EMI=0xe731, - FavoriteStar=0xe734, - FavoriteStarFill=0xe735, - ReadingMode=0xe736, - Favicon=0xe737, - Remove=0xe738, - Checkbox=0xe739, - CheckboxComposite=0xe73a, - CheckboxFill=0xe73b, - CheckboxIndeterminate=0xe73c, - CheckboxCompositeReversed=0xe73d, - CheckMark=0xe73e, - BackToWindow=0xe73f, - FullScreen=0xe740, - ResizeTouchLarger=0xe741, - ResizeTouchSmaller=0xe742, - ResizeMouseSmall=0xe743, - ResizeMouseMedium=0xe744, - ResizeMouseWide=0xe745, - ResizeMouseTall=0xe746, - ResizeMouseLarge=0xe747, - SwitchUser=0xe748, - Print=0xe749, - Up=0xe74a, - Down=0xe74b, - OEM=0xe74c, - Delete=0xe74d, - Save=0xe74e, - Mute=0xe74f, - BackSpaceQWERTY=0xe750, - ReturnKey=0xe751, - UpArrowShiftKey=0xe752, - Cloud=0xe753, - Flashlight=0xe754, - RotationLock=0xe755, - CommandPrompt=0xe756, - SIPMove=0xe759, - SIPUndock=0xe75a, - SIPRedock=0xe75b, - EraseTool=0xe75c, - UnderscoreSpace=0xe75d, - GripperTool=0xe75e, - Dialpad=0xe75f, - PageLeft=0xe760, - PageRight=0xe761, - MultiSelect=0xe762, - KeyboardLeftHanded=0xe763, - KeyboardRightHanded=0xe764, - KeyboardClassic=0xe765, - KeyboardSplit=0xe766, - Volume=0xe767, - Play=0xe768, - Pause=0xe769, - ChevronLeft=0xe76b, - ChevronRight=0xe76c, - InkingTool=0xe76d, - Emoji2=0xe76e, - GripperBarHorizontal=0xe76f, - System=0xe770, - Personalize=0xe771, - Devices=0xe772, - SearchAndApps=0xe773, - Globe=0xe774, - TimeLanguage=0xe775, - EaseOfAccess=0xe776, - UpdateRestore=0xe777, - HangUp=0xe778, - ContactInfo=0xe779, - Unpin=0xe77a, - Contact=0xe77b, - Memo=0xe77c, - IncomingCall=0xe77e, - Paste=0xe77f, - PhoneBook=0xe780, - LEDLight=0xe781, - Error=0xe783, - GripperBarVertical=0xe784, - Unlock=0xe785, - Slideshow=0xe786, - Calendar=0xe787, - GripperResize=0xe788, - Megaphone=0xe789, - Trim=0xe78a, - NewWindow=0xe78b, - SaveLocal=0xe78c, - Color=0xe790, - DataSense=0xe791, - SaveAs=0xe792, - Light=0xe793, - AspectRatio=0xe799, - DataSenseBar=0xe7a5, - Redo=0xe7a6, - Undo=0xe7a7, - Crop=0xe7a8, - OpenWith=0xe7ac, - Rotate=0xe7ad, - RedEye=0xe7b3, - SetlockScreen=0xe7b5, - MapPin2=0xe7b7, - Package=0xe7b8, - Warning=0xe7ba, - ReadingList=0xe7bc, - Education=0xe7be, - ShoppingCart=0xe7bf, - Train=0xe7c0, - Flag=0xe7c1, - Move=0xe7c2, - Page=0xe7c3, - TaskView=0xe7c4, - BrowsePhotos=0xe7c5, - HalfStarLeft=0xe7c6, - HalfStarRight=0xe7c7, - Record=0xe7c8, - TouchPointer=0xe7c9, - LangJPN=0xe7de, - Ferry=0xe7e3, - Highlight=0xe7e6, - ActionCenterNotification=0xe7e7, - PowerButton=0xe7e8, - ResizeTouchNarrower=0xe7ea, - ResizeTouchShorter=0xe7eb, - DrivingMode=0xe7ec, - RingerSilent=0xe7ed, - OtherUser=0xe7ee, - Admin=0xe7ef, - CC=0xe7f0, - SDCard=0xe7f1, - CallForwarding=0xe7f2, - SettingsDisplaySound=0xe7f3, - TVMonitor=0xe7f4, - Speakers=0xe7f5, - Headphone=0xe7f6, - DeviceLaptopPic=0xe7f7, - DeviceLaptopNoPic=0xe7f8, - DeviceMonitorRightPic=0xe7f9, - DeviceMonitorLeftPic=0xe7fa, - DeviceMonitorNoPic=0xe7fb, - Game=0xe7fc, - HorizontalTabKey=0xe7fd, - StreetsideSplitMinimize=0xe802, - StreetsideSplitExpand=0xe803, - Car=0xe804, - Walk=0xe805, - Bus=0xe806, - TiltUp=0xe809, - TiltDown=0xe80a, - CallControl=0xe80b, - RotateMapRight=0xe80c, - RotateMapLeft=0xe80d, - Home=0xe80f, - ParkingLocation=0xe811, - MapCompassTop=0xe812, - MapCompassBottom=0xe813, - IncidentTriangle=0xe814, - Touch=0xe815, - MapDirections=0xe816, - StartPoint=0xe819, - StopPoint=0xe81a, - EndPoint=0xe81b, - History=0xe81c, - Location=0xe81d, - MapLayers=0xe81e, - Accident=0xe81f, - Work=0xe821, - Construction=0xe822, - Recent=0xe823, - Bank=0xe825, - DownloadMap=0xe826, - InkingToolFill2=0xe829, - HighlightFill2=0xe82a, - EraseToolFill=0xe82b, - EraseToolFill2=0xe82c, - Dictionary=0xe82d, - DictionaryAdd=0xe82e, - ToolTip=0xe82f, - ChromeBack=0xe830, - ProvisioningPackage=0xe835, - AddRemoteDevice=0xe836, - FolderOpen=0xe838, - Ethernet=0xe839, - ShareBroadband=0xe83a, - DirectAccess=0xe83b, - DialUp=0xe83c, - DefenderApp=0xe83d, - BatteryCharging9=0xe83e, - Battery10=0xe83f, - Pinned=0xe840, - PinFill=0xe841, - PinnedFill=0xe842, - PeriodKey=0xe843, - PuncKey=0xe844, - RevToggleKey=0xe845, - RightArrowKeyTime1=0xe846, - RightArrowKeyTime2=0xe847, - LeftQuote=0xe848, - RightQuote=0xe849, - DownShiftKey=0xe84a, - UpShiftKey=0xe84b, - PuncKey0=0xe84c, - PuncKeyLeftBottom=0xe84d, - RightArrowKeyTime3=0xe84e, - RightArrowKeyTime4=0xe84f, - Battery0=0xe850, - Battery1=0xe851, - Battery2=0xe852, - Battery3=0xe853, - Battery4=0xe854, - Battery5=0xe855, - Battery6=0xe856, - Battery7=0xe857, - Battery8=0xe858, - Battery9=0xe859, - BatteryCharging0=0xe85a, - BatteryCharging1=0xe85b, - BatteryCharging2=0xe85c, - BatteryCharging3=0xe85d, - BatteryCharging4=0xe85e, - BatteryCharging5=0xe85f, - BatteryCharging6=0xe860, - BatteryCharging7=0xe861, - BatteryCharging8=0xe862, - BatterySaver0=0xe863, - BatterySaver1=0xe864, - BatterySaver2=0xe865, - BatterySaver3=0xe866, - BatterySaver4=0xe867, - BatterySaver5=0xe868, - BatterySaver6=0xe869, - BatterySaver7=0xe86a, - BatterySaver8=0xe86b, - SignalBars1=0xe86c, - SignalBars2=0xe86d, - SignalBars3=0xe86e, - SignalBars4=0xe86f, - SignalBars5=0xe870, - SignalNotConnected=0xe871, - Wifi1=0xe872, - Wifi2=0xe873, - Wifi3=0xe874, - MobSIMLock=0xe875, - MobSIMMissing=0xe876, - Vibrate=0xe877, - RoamingInternational=0xe878, - RoamingDomestic=0xe879, - CallForwardInternational=0xe87a, - CallForwardRoaming=0xe87b, - JpnRomanji=0xe87c, - JpnRomanjiLock=0xe87d, - JpnRomanjiShift=0xe87e, - JpnRomanjiShiftLock=0xe87f, - StatusDataTransfer=0xe880, - StatusDataTransferVPN=0xe881, - StatusDualSIM2=0xe882, - StatusDualSIM2VPN=0xe883, - StatusDualSIM1=0xe884, - StatusDualSIM1VPN=0xe885, - StatusSGLTE=0xe886, - StatusSGLTECell=0xe887, - StatusSGLTEDataVPN=0xe888, - StatusVPN=0xe889, - WifiHotspot=0xe88a, - LanguageKor=0xe88b, - LanguageCht=0xe88c, - LanguageChs=0xe88d, - USB=0xe88e, - InkingToolFill=0xe88f, - View=0xe890, - HighlightFill=0xe891, - Previous=0xe892, - Next=0xe893, - Clear=0xe894, - Sync=0xe895, - Download=0xe896, - Help=0xe897, - Upload=0xe898, - Emoji=0xe899, - TwoPage=0xe89a, - LeaveChat=0xe89b, - MailForward=0xe89c, - RotateCamera=0xe89e, - ClosePane=0xe89f, - OpenPane=0xe8a0, - PreviewLink=0xe8a1, - AttachCamera=0xe8a2, - ZoomIn=0xe8a3, - Bookmarks=0xe8a4, - Document=0xe8a5, - ProtectedDocument=0xe8a6, - OpenInNewWindow=0xe8a7, - MailFill=0xe8a8, - ViewAll=0xe8a9, - VideoChat=0xe8aa, - Switch=0xe8ab, - Rename=0xe8ac, - Go=0xe8ad, - SurfaceHub=0xe8ae, - Remote=0xe8af, - Click=0xe8b0, - Shuffle=0xe8b1, - Movies=0xe8b2, - SelectAll=0xe8b3, - Orientation=0xe8b4, - Import=0xe8b5, - ImportAll=0xe8b6, - Folder=0xe8b7, - Webcam=0xe8b8, - Picture=0xe8b9, - Caption=0xe8ba, - ChromeClose=0xe8bb, - ShowResults=0xe8bc, - Message=0xe8bd, - Leaf=0xe8be, - CalendarDay=0xe8bf, - CalendarWeek=0xe8c0, - Characters=0xe8c1, - MailReplyAll=0xe8c2, - Read=0xe8c3, - ShowBcc=0xe8c4, - HideBcc=0xe8c5, - Cut=0xe8c6, - PaymentCard=0xe8c7, - Copy=0xe8c8, - Important=0xe8c9, - MailReply=0xe8ca, - Sort=0xe8cb, - MobileTablet=0xe8cc, - DisconnectDrive=0xe8cd, - MapDrive=0xe8ce, - ContactPresence=0xe8cf, - Priority=0xe8d0, - GotoToday=0xe8d1, - Font=0xe8d2, - FontColor=0xe8d3, - Contact2=0xe8d4, - FolderFill=0xe8d5, - Audio=0xe8d6, - Permissions=0xe8d7, - DisableUpdates=0xe8d8, - Unfavorite=0xe8d9, - OpenLocal=0xe8da, - Italic=0xe8db, - Underline=0xe8dc, - Bold=0xe8dd, - MoveToFolder=0xe8de, - LikeDislike=0xe8df, - Dislike=0xe8e0, - Like=0xe8e1, - AlignRight=0xe8e2, - AlignCenter=0xe8e3, - AlignLeft=0xe8e4, - OpenFile=0xe8e5, - ClearSelection=0xe8e6, - FontDecrease=0xe8e7, - FontIncrease=0xe8e8, - FontSize=0xe8e9, - CellPhone=0xe8ea, - Reshare=0xe8eb, - Tag=0xe8ec, - RepeatOne=0xe8ed, - RepeatAll=0xe8ee, - Calculator=0xe8ef, - Directions=0xe8f0, - Library=0xe8f1, - ChatBubbles=0xe8f2, - PostUpdate=0xe8f3, - NewFolder=0xe8f4, - CalendarReply=0xe8f5, - UnsyncFolder=0xe8f6, - SyncFolder=0xe8f7, - BlockContact=0xe8f8, - SwitchApps=0xe8f9, - AddFriend=0xe8fa, - Accept=0xe8fb, - GoToStart=0xe8fc, - BulletedList=0xe8fd, - Scan=0xe8fe, - Preview=0xe8ff, - Group=0xe902, - ZeroBars=0xe904, - OneBar=0xe905, - TwoBars=0xe906, - ThreeBars=0xe907, - FourBars=0xe908, - World=0xe909, - Comment=0xe90a, - MusicInfo=0xe90b, - DockLeft=0xe90c, - DockRight=0xe90d, - DockBottom=0xe90e, - Repair=0xe90f, - Accounts=0xe910, - DullSound=0xe911, - Manage=0xe912, - Street=0xe913, - Printer3D=0xe914, - RadioBullet=0xe915, - Stopwatch=0xe916, - Photo=0xe91b, - ActionCenter=0xe91c, - FullCircleMask=0xe91f, - ChromeMinimize=0xe921, - ChromeMaximize=0xe922, - ChromeRestore=0xe923, - Annotation=0xe924, - BackSpaceQWERTYSm=0xe925, - BackSpaceQWERTYMd=0xe926, - Swipe=0xe927, - Fingerprint=0xe928, - Handwriting=0xe929, - ChromeBackToWindow=0xe92c, - ChromeFullScreen=0xe92d, - KeyboardStandard=0xe92e, - KeyboardDismiss=0xe92f, - Completed=0xe930, - ChromeAnnotate=0xe931, - Label=0xe932, - IBeam=0xe933, - IBeamOutline=0xe934, - FlickDown=0xe935, - FlickUp=0xe936, - FlickLeft=0xe937, - FlickRight=0xe938, - FeedbackApp=0xe939, - MusicAlbum=0xe93c, - Streaming=0xe93e, - Code=0xe943, - ReturnToWindow=0xe944, - LightningBolt=0xe945, - Info=0xe946, - CalculatorMultiply=0xe947, - CalculatorAddition=0xe948, - CalculatorSubtract=0xe949, - CalculatorDivide=0xe94a, - CalculatorSquareroot=0xe94b, - CalculatorPercentage=0xe94c, - CalculatorNegate=0xe94d, - CalculatorEqualTo=0xe94e, - CalculatorBackspace=0xe94f, - Component=0xe950, - DMC=0xe951, - Dock=0xe952, - MultimediaDMS=0xe953, - MultimediaDVR=0xe954, - MultimediaPMP=0xe955, - PrintfaxPrinterFile=0xe956, - Sensor=0xe957, - StorageOptical=0xe958, - Communications=0xe95a, - Headset=0xe95b, - Projector=0xe95d, - Health=0xe95e, - Wire=0xe95f, - Webcam2=0xe960, - Input=0xe961, - Mouse=0xe962, - Smartcard=0xe963, - SmartcardVirtual=0xe964, - MediaStorageTower=0xe965, - ReturnKeySm=0xe966, - GameConsole=0xe967, - Network=0xe968, - StorageNetworkWireless=0xe969, - StorageTape=0xe96a, - ChevronUpSmall=0xe96d, - ChevronDownSmall=0xe96e, - ChevronLeftSmall=0xe96f, - ChevronRightSmall=0xe970, - ChevronUpMed=0xe971, - ChevronDownMed=0xe972, - ChevronLeftMed=0xe973, - ChevronRightMed=0xe974, - Devices2=0xe975, - ExpandTile=0xe976, - PC1=0xe977, - PresenceChicklet=0xe978, - PresenceChickletVideo=0xe979, - Reply=0xe97a, - SetTile=0xe97b, - Type=0xe97c, - Korean=0xe97d, - HalfAlpha=0xe97e, - FullAlpha=0xe97f, - Key12On=0xe980, - ChineseChangjie=0xe981, - QWERTYOn=0xe982, - QWERTYOff=0xe983, - ChineseQuick=0xe984, - Japanese=0xe985, - FullHiragana=0xe986, - FullKatakana=0xe987, - HalfKatakana=0xe988, - ChineseBoPoMoFo=0xe989, - ChinesePinyin=0xe98a, - ConstructionCone=0xe98f, - XboxOneConsole=0xe990, - Volume0=0xe992, - Volume1=0xe993, - Volume2=0xe994, - Volume3=0xe995, - BatteryUnknown=0xe996, - WifiAttentionOverlay=0xe998, - Robot=0xe99a, - TapAndSend=0xe9a1, - FitPage=0xe9a6, - PasswordKeyShow=0xe9a8, - PasswordKeyHide=0xe9a9, - BidiLtr=0xe9aa, - BidiRtl=0xe9ab, - ForwardSm=0xe9ac, - CommaKey=0xe9ad, - DashKey=0xe9ae, - DullSoundKey=0xe9af, - HalfDullSound=0xe9b0, - RightDoubleQuote=0xe9b1, - LeftDoubleQuote=0xe9b2, - PuncKeyRightBottom=0xe9b3, - PuncKey1=0xe9b4, - PuncKey2=0xe9b5, - PuncKey3=0xe9b6, - PuncKey4=0xe9b7, - PuncKey5=0xe9b8, - PuncKey6=0xe9b9, - PuncKey9=0xe9ba, - PuncKey7=0xe9bb, - PuncKey8=0xe9bc, - Frigid=0xe9ca, - Unknown=0xe9ce, - AreaChart=0xe9d2, - CheckList=0xe9d5, - Diagnostic=0xe9d9, - Equalizer=0xe9e9, - Process=0xe9f3, - Processing=0xe9f5, - ReportDocument=0xe9f9, - VideoSolid=0xea0c, - MixedMediaBadge=0xea0d, - DisconnectDisplay=0xea14, - Shield=0xea18, - Info2=0xea1f, - ActionCenterAsterisk=0xea21, - Beta=0xea24, - SaveCopy=0xea35, - List=0xea37, - Asterisk=0xea38, - ErrorBadge=0xea39, - CircleRing=0xea3a, - CircleFill=0xea3b, - MergeCall=0xea3c, - PrivateCall=0xea3d, - Record2=0xea3f, - AllAppsMirrored=0xea40, - BookmarksMirrored=0xea41, - BulletedListMirrored=0xea42, - CallForwardInternationalMirrored=0xea43, - CallForwardRoamingMirrored=0xea44, - ChromeBackMirrored=0xea47, - ClearSelectionMirrored=0xea48, - ClosePaneMirrored=0xea49, - ContactInfoMirrored=0xea4a, - DockRightMirrored=0xea4b, - DockLeftMirrored=0xea4c, - ExpandTileMirrored=0xea4e, - GoMirrored=0xea4f, - GripperResizeMirrored=0xea50, - HelpMirrored=0xea51, - ImportMirrored=0xea52, - ImportAllMirrored=0xea53, - LeaveChatMirrored=0xea54, - ListMirrored=0xea55, - MailForwardMirrored=0xea56, - MailReplyMirrored=0xea57, - MailReplyAllMirrored=0xea58, - OpenPaneMirrored=0xea5b, - OpenWithMirrored=0xea5c, - ParkingLocationMirrored=0xea5e, - ResizeMouseMediumMirrored=0xea5f, - ResizeMouseSmallMirrored=0xea60, - ResizeMouseTallMirrored=0xea61, - ResizeTouchNarrowerMirrored=0xea62, - SendMirrored=0xea63, - SendFillMirrored=0xea64, - ShowResultsMirrored=0xea65, - Media=0xea69, - SyncError=0xea6a, - Devices3=0xea6c, - SlowMotionOn=0xea79, - Lightbulb=0xea80, - StatusCircle=0xea81, - StatusTriangle=0xea82, - StatusError=0xea83, - StatusWarning=0xea84, - Puzzle=0xea86, - CalendarSolid=0xea89, - HomeSolid=0xea8a, - ParkingLocationSolid=0xea8b, - ContactSolid=0xea8c, - ConstructionSolid=0xea8d, - AccidentSolid=0xea8e, - Ringer=0xea8f, - PDF=0xea90, - ThoughtBubble=0xea91, - HeartBroken=0xea92, - BatteryCharging10=0xea93, - BatterySaver9=0xea94, - BatterySaver10=0xea95, - CallForwardingMirrored=0xea97, - MultiSelectMirrored=0xea98, - Broom=0xea99, - ForwardCall=0xeac2, - Trackers=0xeadf, - Market=0xeafc, - PieSingle=0xeb05, - StockUp=0xeb0f, - StockDown=0xeb11, - Design=0xeb3c, - Website=0xeb41, - Drop=0xeb42, - Radar=0xeb44, - BusSolid=0xeb47, - FerrySolid=0xeb48, - StartPointSolid=0xeb49, - StopPointSolid=0xeb4a, - EndPointSolid=0xeb4b, - AirplaneSolid=0xeb4c, - TrainSolid=0xeb4d, - WorkSolid=0xeb4e, - ReminderFill=0xeb4f, - Reminder=0xeb50, - Heart=0xeb51, - HeartFill=0xeb52, - EthernetError=0xeb55, - EthernetWarning=0xeb56, - StatusConnecting1=0xeb57, - StatusConnecting2=0xeb58, - StatusUnsecure=0xeb59, - WifiError0=0xeb5a, - WifiError1=0xeb5b, - WifiError2=0xeb5c, - WifiError3=0xeb5d, - WifiError4=0xeb5e, - WifiWarning0=0xeb5f, - WifiWarning1=0xeb60, - WifiWarning2=0xeb61, - WifiWarning3=0xeb62, - WifiWarning4=0xeb63, - Devices4=0xeb66, - NUIIris=0xeb67, - NUIFace=0xeb68, - GatewayRouter=0xeb77, - EditMirrored=0xeb7e, - NUIFPStartSlideHand=0xeb82, - NUIFPStartSlideAction=0xeb83, - NUIFPContinueSlideHand=0xeb84, - NUIFPContinueSlideAction=0xeb85, - NUIFPRollRightHand=0xeb86, - NUIFPRollRightHandAction=0xeb87, - NUIFPRollLeftHand=0xeb88, - NUIFPRollLeftAction=0xeb89, - NUIFPPressHand=0xeb8a, - NUIFPPressAction=0xeb8b, - NUIFPPressRepeatHand=0xeb8c, - NUIFPPressRepeatAction=0xeb8d, - StatusErrorFull=0xeb90, - TaskViewExpanded=0xeb91, - Certificate=0xeb95, - BackSpaceQWERTYLg=0xeb96, - ReturnKeyLg=0xeb97, - FastForward=0xeb9d, - Rewind=0xeb9e, - Photo2=0xeb9f, - MobBattery0=0xeba0, - MobBattery1=0xeba1, - MobBattery2=0xeba2, - MobBattery3=0xeba3, - MobBattery4=0xeba4, - MobBattery5=0xeba5, - MobBattery6=0xeba6, - MobBattery7=0xeba7, - MobBattery8=0xeba8, - MobBattery9=0xeba9, - MobBattery10=0xebaa, - MobBatteryCharging0=0xebab, - MobBatteryCharging1=0xebac, - MobBatteryCharging2=0xebad, - MobBatteryCharging3=0xebae, - MobBatteryCharging4=0xebaf, - MobBatteryCharging5=0xebb0, - MobBatteryCharging6=0xebb1, - MobBatteryCharging7=0xebb2, - MobBatteryCharging8=0xebb3, - MobBatteryCharging9=0xebb4, - MobBatteryCharging10=0xebb5, - MobBatterySaver0=0xebb6, - MobBatterySaver1=0xebb7, - MobBatterySaver2=0xebb8, - MobBatterySaver3=0xebb9, - MobBatterySaver4=0xebba, - MobBatterySaver5=0xebbb, - MobBatterySaver6=0xebbc, - MobBatterySaver7=0xebbd, - MobBatterySaver8=0xebbe, - MobBatterySaver9=0xebbf, - MobBatterySaver10=0xebc0, - DictionaryCloud=0xebc3, - ResetDrive=0xebc4, - VolumeBars=0xebc5, - Project=0xebc6, - AdjustHologram=0xebd2, - CloudDownload=0xebd3, - MobWifiCallBars=0xebd4, - MobWifiCall0=0xebd5, - MobWifiCall1=0xebd6, - MobWifiCall2=0xebd7, - MobWifiCall3=0xebd8, - MobWifiCall4=0xebd9, - Family=0xebda, - LockFeedback=0xebdb, - DeviceDiscovery=0xebde, - WindDirection=0xebe6, - RightArrowKeyTime0=0xebe7, - Bug=0xebe8, - TabletMode=0xebfc, - StatusCircleLeft=0xebfd, - StatusTriangleLeft=0xebfe, - StatusErrorLeft=0xebff, - StatusWarningLeft=0xec00, - MobBatteryUnknown=0xec02, - NetworkTower=0xec05, - CityNext=0xec06, - CityNext2=0xec07, - Courthouse=0xec08, - Groceries=0xec09, - Sustainable=0xec0a, - BuildingEnergy=0xec0b, - ToggleFilled=0xec11, - ToggleBorder=0xec12, - SliderThumb=0xec13, - ToggleThumb=0xec14, - MiracastLogoSmall=0xec15, - MiracastLogoLarge=0xec16, - PLAP=0xec19, - Badge=0xec1b, - SignalRoaming=0xec1e, - MobileLocked=0xec20, - InsiderHubApp=0xec24, - PersonalFolder=0xec25, - HomeGroup=0xec26, - MyNetwork=0xec27, - KeyboardFull=0xec31, - Cafe=0xec32, - MobSignal1=0xec37, - MobSignal2=0xec38, - MobSignal3=0xec39, - MobSignal4=0xec3a, - MobSignal5=0xec3b, - MobWifi1=0xec3c, - MobWifi2=0xec3d, - MobWifi3=0xec3e, - MobWifi4=0xec3f, - MobAirplane=0xec40, - MobBluetooth=0xec41, - MobActionCenter=0xec42, - MobLocation=0xec43, - MobWifiHotspot=0xec44, - LanguageJpn=0xec45, - MobQuietHours=0xec46, - MobDrivingMode=0xec47, - SpeedOff=0xec48, - SpeedMedium=0xec49, - SpeedHigh=0xec4a, - ThisPC=0xec4e, - MusicNote=0xec4f, - FileExplorer=0xec50, - FileExplorerApp=0xec51, - LeftArrowKeyTime0=0xec52, - MicOff=0xec54, - MicSleep=0xec55, - MicError=0xec56, - PlaybackRate1x=0xec57, - PlaybackRateOther=0xec58, - CashDrawer=0xec59, - BarcodeScanner=0xec5a, - ReceiptPrinter=0xec5b, - MagStripeReader=0xec5c, - CompletedSolid=0xec61, - CompanionApp=0xec64, - Favicon2=0xec6c, - SwipeRevealArt=0xec6d, - MicOn=0xec71, - MicClipping=0xec72, - TabletSelected=0xec74, - MobileSelected=0xec75, - LaptopSelected=0xec76, - TVMonitorSelected=0xec77, - DeveloperTools=0xec7a, - MobCallForwarding=0xec7e, - MobCallForwardingMirrored=0xec7f, - BodyCam=0xec80, - PoliceCar=0xec81, - Draw=0xec87, - DrawSolid=0xec88, - LowerBrightness=0xec8a, - ScrollUpDown=0xec8f, - DateTime=0xec92, - HoloLens=0xec94, - Tiles=0xeca5, - PartyLeader=0xeca7, - AppIconDefault=0xecaa, - Calories=0xecad, - POI=0xecaf, - BandBattery0=0xecb9, - BandBattery1=0xecba, - BandBattery2=0xecbb, - BandBattery3=0xecbc, - BandBattery4=0xecbd, - BandBattery5=0xecbe, - BandBattery6=0xecbf, - AddSurfaceHub=0xecc4, - DevUpdate=0xecc5, - Unit=0xecc6, - AddTo=0xecc8, - RemoveFrom=0xecc9, - RadioBtnOff=0xecca, - RadioBtnOn=0xeccb, - RadioBullet2=0xeccc, - ExploreContent=0xeccd, - Blocked2=0xece4, - ScrollMode=0xece7, - ZoomMode=0xece8, - PanMode=0xece9, - WiredUSB=0xecf0, - WirelessUSB=0xecf1, - USBSafeConnect=0xecf3, - ActionCenterNotificationMirrored=0xed0c, - ActionCenterMirrored=0xed0d, - SubscriptionAdd=0xed0e, - ResetDevice=0xed10, - SubscriptionAddMirrored=0xed11, - QRCode=0xed14, - Feedback=0xed15, - Hide=0xed1a, - Subtitles=0xed1e, - SubtitlesAudio=0xed1f, - OpenFolderHorizontal=0xed25, - CalendarMirrored=0xed28, - MobeSIM=0xed2a, - MobeSIMNoProfile=0xed2b, - MobeSIMLocked=0xed2c, - MobeSIMBusy=0xed2d, - SignalError=0xed2e, - StreamingEnterprise=0xed2f, - Headphone0=0xed30, - Headphone1=0xed31, - Headphone2=0xed32, - Headphone3=0xed33, - Apps=0xed35, - KeyboardBrightness=0xed39, - KeyboardLowerBrightness=0xed3a, - SkipBack10=0xed3c, - SkipForward30=0xed3d, - TreeFolderFolder=0xed41, - TreeFolderFolderFill=0xed42, - TreeFolderFolderOpen=0xed43, - TreeFolderFolderOpenFill=0xed44, - MultimediaDMP=0xed47, - KeyboardOneHanded=0xed4c, - Narrator=0xed4d, - EmojiTabPeople=0xed53, - EmojiTabSmilesAnimals=0xed54, - EmojiTabCelebrationObjects=0xed55, - EmojiTabFoodPlants=0xed56, - EmojiTabTransitPlaces=0xed57, - EmojiTabSymbols=0xed58, - EmojiTabTextSmiles=0xed59, - EmojiTabFavorites=0xed5a, - EmojiSwatch=0xed5b, - ConnectApp=0xed5c, - CompanionDeviceFramework=0xed5d, - Ruler=0xed5e, - FingerInking=0xed5f, - StrokeErase=0xed60, - PointErase=0xed61, - ClearAllInk=0xed62, - Pencil=0xed63, - Marker=0xed64, - InkingCaret=0xed65, - InkingColorOutline=0xed66, - InkingColorFill=0xed67, - HardDrive=0xeda2, - NetworkAdapter=0xeda3, - Touchscreen=0xeda4, - NetworkPrinter=0xeda5, - CloudPrinter=0xeda6, - KeyboardShortcut=0xeda7, - BrushSize=0xeda8, - NarratorForward=0xeda9, - NarratorForwardMirrored=0xedaa, - SyncBadge12=0xedab, - RingerBadge12=0xedac, - AsteriskBadge12=0xedad, - ErrorBadge12=0xedae, - CircleRingBadge12=0xedaf, - CircleFillBadge12=0xedb0, - ImportantBadge12=0xedb1, - MailBadge12=0xedb3, - PauseBadge12=0xedb4, - PlayBadge12=0xedb5, - PenWorkspace=0xedc6, - CaretLeft8=0xedd5, - CaretRight8=0xedd6, - CaretUp8=0xedd7, - CaretDown8=0xedd8, - CaretLeftSolid8=0xedd9, - CaretRightSolid8=0xedda, - CaretUpSolid8=0xeddb, - CaretDownSolid8=0xeddc, - Strikethrough=0xede0, - Export=0xede1, - ExportMirrored=0xede2, - ButtonMenu=0xede3, - CloudSearch=0xede4, - PinyinIMELogo=0xede5, - CalligraphyPen=0xedfb, - ReplyMirrored=0xee35, - LockscreenDesktop=0xee3f, - TaskViewSettings=0xee40, - MiniExpand2Mirrored=0xee47, - MiniContract2Mirrored=0xee49, - Play36=0xee4a, - PenPalette=0xee56, - GuestUser=0xee57, - SettingsBattery=0xee63, - TaskbarPhone=0xee64, - LockScreenGlance=0xee65, - GenericScan=0xee6f, - ImageExport=0xee71, - WifiEthernet=0xee77, - ActionCenterQuiet=0xee79, - ActionCenterQuietNotification=0xee7a, - TrackersMirrored=0xee92, - DateTimeMirrored=0xee93, - Wheel=0xee94, - VirtualMachineGroup=0xeea3, - ButtonView2=0xeeca, - PenWorkspaceMirrored=0xef15, - PenPaletteMirrored=0xef16, - StrokeEraseMirrored=0xef17, - PointEraseMirrored=0xef18, - ClearAllInkMirrored=0xef19, - BackgroundToggle=0xef1f, - Marquee=0xef20, - ChromeCloseContrast=0xef2c, - ChromeMinimizeContrast=0xef2d, - ChromeMaximizeContrast=0xef2e, - ChromeRestoreContrast=0xef2f, - TrafficLight=0xef31, - Replay=0xef3b, - Eyedropper=0xef3c, - LineDisplay=0xef3d, - PINPad=0xef3e, - SignatureCapture=0xef3f, - ChipCardCreditCardReader=0xef40, - MarketDown=0xef42, - PlayerSettings=0xef58, - LandscapeOrientation=0xef6b, - Flow=0xef90, - Touchpad=0xefa5, - Speech=0xefa9, - KnowledgeArticle=0xf000, - Relationship=0xf003, - ZipFolder=0xf012, - DefaultAPN=0xf080, - UserAPN=0xf081, - DoublePinyin=0xf085, - BlueLight=0xf08c, - CaretSolidLeft=0xf08d, - CaretSolidDown=0xf08e, - CaretSolidRight=0xf08f, - CaretSolidUp=0xf090, - ButtonA=0xf093, - ButtonB=0xf094, - ButtonY=0xf095, - ButtonX=0xf096, - ArrowUp8=0xf0ad, - ArrowDown8=0xf0ae, - ArrowRight8=0xf0af, - ArrowLeft8=0xf0b0, - QuarentinedItems=0xf0b2, - QuarentinedItemsMirrored=0xf0b3, - Protractor=0xf0b4, - ChecklistMirrored=0xf0b5, - StatusCircle7=0xf0b6, - StatusCheckmark7=0xf0b7, - StatusErrorCircle7=0xf0b8, - Connected=0xf0b9, - PencilFill=0xf0c6, - CalligraphyFill=0xf0c7, - QuarterStarLeft=0xf0ca, - QuarterStarRight=0xf0cb, - ThreeQuarterStarLeft=0xf0cc, - ThreeQuarterStarRight=0xf0cd, - QuietHoursBadge12=0xf0ce, - BackMirrored=0xf0d2, - ForwardMirrored=0xf0d3, - ChromeBackContrast=0xf0d5, - ChromeBackContrastMirrored=0xf0d6, - ChromeBackToWindowContrast=0xf0d7, - ChromeFullScreenContrast=0xf0d8, - GridView=0xf0e2, - ClipboardList=0xf0e3, - ClipboardListMirrored=0xf0e4, - OutlineQuarterStarLeft=0xf0e5, - OutlineQuarterStarRight=0xf0e6, - OutlineHalfStarLeft=0xf0e7, - OutlineHalfStarRight=0xf0e8, - OutlineThreeQuarterStarLeft=0xf0e9, - OutlineThreeQuarterStarRight=0xf0ea, - SpatialVolume0=0xf0eb, - SpatialVolume1=0xf0ec, - SpatialVolume2=0xf0ed, - SpatialVolume3=0xf0ee, - ApplicationGuard=0xf0ef, - OutlineStarLeftHalf=0xf0f7, - OutlineStarRightHalf=0xf0f8, - ChromeAnnotateContrast=0xf0f9, - DefenderBadge12=0xf0fb, - DetachablePC=0xf103, - LeftStick=0xf108, - RightStick=0xf109, - TriggerLeft=0xf10a, - TriggerRight=0xf10b, - BumperLeft=0xf10c, - BumperRight=0xf10d, - Dpad=0xf10e, - EnglishPunctuation=0xf110, - ChinesePunctuation=0xf111, - HMD=0xf119, - CtrlSpatialRight=0xf11b, - PaginationDotOutline10=0xf126, - PaginationDotSolid10=0xf127, - StrokeErase2=0xf128, - SmallErase=0xf129, - LargeErase=0xf12a, - FolderHorizontal=0xf12b, - MicrophoneListening=0xf12e, - StatusExclamationCircle7=0xf12f, - Video360=0xf131, - GiftboxOpen=0xf133, - StatusCircleOuter=0xf136, - StatusCircleInner=0xf137, - StatusCircleRing=0xf138, - StatusTriangleOuter=0xf139, - StatusTriangleInner=0xf13a, - StatusTriangleExclamation=0xf13b, - StatusCircleExclamation=0xf13c, - StatusCircleErrorX=0xf13d, - StatusCircleCheckmark=0xf13e, - StatusCircleInfo=0xf13f, - StatusCircleBlock=0xf140, - StatusCircleBlock2=0xf141, - StatusCircleQuestionMark=0xf142, - StatusCircleSync=0xf143, - Dial1=0xf146, - Dial2=0xf147, - Dial3=0xf148, - Dial4=0xf149, - Dial5=0xf14a, - Dial6=0xf14b, - Dial7=0xf14c, - Dial8=0xf14d, - Dial9=0xf14e, - Dial10=0xf14f, - Dial11=0xf150, - Dial12=0xf151, - Dial13=0xf152, - Dial14=0xf153, - Dial15=0xf154, - Dial16=0xf155, - DialShape1=0xf156, - DialShape2=0xf157, - DialShape3=0xf158, - DialShape4=0xf159, - ClosedCaptionsInternational=0xf15f, - TollSolid=0xf161, - TrafficCongestionSolid=0xf163, - ExploreContentSingle=0xf164, - CollapseContent=0xf165, - CollapseContentSingle=0xf166, - InfoSolid=0xf167, - GroupList=0xf168, - CaretBottomRightSolidCenter8=0xf169, - ProgressRingDots=0xf16a, - Checkbox14=0xf16b, - CheckboxComposite14=0xf16c, - CheckboxIndeterminateCombo14=0xf16d, - CheckboxIndeterminateCombo=0xf16e, - StatusPause7=0xf175, - CharacterAppearance=0xf17f, - Lexicon=0xf180, - ScreenTime=0xf182, - HeadlessDevice=0xf191, - NetworkSharing=0xf193, - EyeGaze=0xf19d, - ToggleLeft=0xf19e, - ToggleRight=0xf19f, - WindowsInsider=0xf1ad, - ChromeSwitch=0xf1cb, - ChromeSwitchContast=0xf1cc, - StatusCheckmark=0xf1d8, - StatusCheckmarkLeft=0xf1d9, - KeyboardLeftAligned=0xf20c, - KeyboardRightAligned=0xf20d, - KeyboardSettings=0xf210, - NetworkPhysical=0xf211, - IOT=0xf22c, - UnknownMirrored=0xf22e, - ViewDashboard=0xf246, - ExploitProtectionSettings=0xf259, - KeyboardNarrow=0xf260, - Keyboard12Key=0xf261, - KeyboardDock=0xf26b, - KeyboardUndock=0xf26c, - KeyboardLeftDock=0xf26d, - KeyboardRightDock=0xf26e, - Ear=0xf270, - PointerHand=0xf271, - Bullseye=0xf272, - DocumentApproval=0xf28b, - LocaleLanguage=0xf2b7, - PassiveAuthentication=0xf32a, - ColorSolid=0xf354, - NetworkOffline=0xf384, - NetworkConnected=0xf385, - NetworkConnectedCheckmark=0xf386, - SignOut=0xf3b1, - StatusInfo=0xf3cc, - StatusInfoLeft=0xf3cd, - NearbySharing=0xf3e2, - CtrlSpatialLeft=0xf3e7, - InteractiveDashboard=0xf404, - DeclineCall=0xf405, - ClippingTool=0xf406, - RectangularClipping=0xf407, - FreeFormClipping=0xf408, - CopyTo=0xf413, - IDBadge=0xf427, - DynamicLock=0xf439, - PenTips=0xf45e, - PenTipsMirrored=0xf45f, - HWPJoin=0xf460, - HWPInsert=0xf461, - HWPStrikeThrough=0xf462, - HWPScratchOut=0xf463, - HWPSplit=0xf464, - HWPNewLine=0xf465, - HWPOverwrite=0xf466, - MobWifiWarning1=0xf473, - MobWifiWarning2=0xf474, - MobWifiWarning3=0xf475, - MobWifiWarning4=0xf476, - MicLocationCombo=0xf47f, - Globe2=0xf49a, - SpecialEffectSize=0xf4a5, - GIF=0xf4a9, - Sticker2=0xf4aa, - SurfaceHubSelected=0xf4be, - HoloLensSelected=0xf4bf, - Earbud=0xf4c0, - MixVolumes=0xf4c3, - Safe=0xf540, - LaptopSecure=0xf552, - PrintDefault=0xf56d, - PageMirrored=0xf56e, - LandscapeOrientationMirrored=0xf56f, - ColorOff=0xf570, - PrintAllPages=0xf571, - PrintCustomRange=0xf572, - PageMarginPortraitNarrow=0xf573, - PageMarginPortraitNormal=0xf574, - PageMarginPortraitModerate=0xf575, - PageMarginPortraitWide=0xf576, - PageMarginLandscapeNarrow=0xf577, - PageMarginLandscapeNormal=0xf578, - PageMarginLandscapeModerate=0xf579, - PageMarginLandscapeWide=0xf57a, - CollateLandscape=0xf57b, - CollatePortrait=0xf57c, - CollatePortraitSeparated=0xf57d, - DuplexLandscapeOneSided=0xf57e, - DuplexLandscapeOneSidedMirrored=0xf57f, - DuplexLandscapeTwoSidedLongEdge=0xf580, - DuplexLandscapeTwoSidedLongEdgeMirrored=0xf581, - DuplexLandscapeTwoSidedShortEdge=0xf582, - DuplexLandscapeTwoSidedShortEdgeMirrored=0xf583, - DuplexPortraitOneSided=0xf584, - DuplexPortraitOneSidedMirrored=0xf585, - DuplexPortraitTwoSidedLongEdge=0xf586, - DuplexPortraitTwoSidedLongEdgeMirrored=0xf587, - DuplexPortraitTwoSidedShortEdge=0xf588, - DuplexPortraitTwoSidedShortEdgeMirrored=0xf589, - PPSOneLandscape=0xf58a, - PPSTwoLandscape=0xf58b, - PPSTwoPortrait=0xf58c, - PPSFourLandscape=0xf58d, - PPSFourPortrait=0xf58e, - HolePunchOff=0xf58f, - HolePunchPortraitLeft=0xf590, - HolePunchPortraitRight=0xf591, - HolePunchPortraitTop=0xf592, - HolePunchPortraitBottom=0xf593, - HolePunchLandscapeLeft=0xf594, - HolePunchLandscapeRight=0xf595, - HolePunchLandscapeTop=0xf596, - HolePunchLandscapeBottom=0xf597, - StaplingOff=0xf598, - StaplingPortraitTopLeft=0xf599, - StaplingPortraitTopRight=0xf59a, - StaplingPortraitBottomRight=0xf59b, - StaplingPortraitTwoLeft=0xf59c, - StaplingPortraitTwoRight=0xf59d, - StaplingPortraitTwoTop=0xf59e, - StaplingPortraitTwoBottom=0xf59f, - StaplingPortraitBookBinding=0xf5a0, - StaplingLandscapeTopLeft=0xf5a1, - StaplingLandscapeTopRight=0xf5a2, - StaplingLandscapeBottomLeft=0xf5a3, - StaplingLandscapeBottomRight=0xf5a4, - StaplingLandscapeTwoLeft=0xf5a5, - StaplingLandscapeTwoRight=0xf5a6, - StaplingLandscapeTwoTop=0xf5a7, - StaplingLandscapeTwoBottom=0xf5a8, - StaplingLandscapeBookBinding=0xf5a9, - StatusDataTransferRoaming=0xf5aa, - MobSIMError=0xf5ab, - CollateLandscapeSeparated=0xf5ac, - PPSOnePortrait=0xf5ad, - StaplingPortraitBottomLeft=0xf5ae, - PlaySolid=0xf5b0, - RepeatOff=0xf5e7, - Set=0xf5ed, - SetSolid=0xf5ee, - FuzzyReading=0xf5ef, - VerticalBattery0=0xf5f2, - VerticalBattery1=0xf5f3, - VerticalBattery2=0xf5f4, - VerticalBattery3=0xf5f5, - VerticalBattery4=0xf5f6, - VerticalBattery5=0xf5f7, - VerticalBattery6=0xf5f8, - VerticalBattery7=0xf5f9, - VerticalBattery8=0xf5fa, - VerticalBattery9=0xf5fb, - VerticalBattery10=0xf5fc, - VerticalBatteryCharging0=0xf5fd, - VerticalBatteryCharging1=0xf5fe, - VerticalBatteryCharging2=0xf5ff, - VerticalBatteryCharging3=0xf600, - VerticalBatteryCharging4=0xf601, - VerticalBatteryCharging5=0xf602, - VerticalBatteryCharging6=0xf603, - VerticalBatteryCharging7=0xf604, - VerticalBatteryCharging8=0xf605, - VerticalBatteryCharging9=0xf606, - VerticalBatteryCharging10=0xf607, - VerticalBatteryUnknown=0xf608, - SIMError=0xf618, - SIMMissing=0xf619, - SIMLock=0xf61a, - eSIM=0xf61b, - eSIMNoProfile=0xf61c, - eSIMLocked=0xf61d, - eSIMBusy=0xf61e, - NoiseCancelation=0xf61f, - NoiseCancelationOff=0xf620, - MusicSharing=0xf623, - MusicSharingOff=0xf624, - CircleShapeSolid=0xf63c, - WifiCallBars=0xf657, - WifiCall0=0xf658, - WifiCall1=0xf659, - WifiCall2=0xf65a, - WifiCall3=0xf65b, - WifiCall4=0xf65c, - CHTLanguageBar=0xf69e, - ComposeMode=0xf6a9, - ExpressiveInputEntry=0xf6b8, - EmojiTabMoreSymbols=0xf6ba, - WebSearch=0xf6fa, - Kiosk=0xf712, - RTTLogo=0xf714, - VoiceCall=0xf715, - GoToMessage=0xf716, - ReturnToCall=0xf71a, - StartPresenting=0xf71c, - StopPresenting=0xf71d, - ProductivityMode=0xf71e, - SetHistoryStatus=0xf738, - SetHistoryStatus2=0xf739, - Keyboardsettings20=0xf73d, - OneHandedRight20=0xf73e, - OneHandedLeft20=0xf73f, - Split20=0xf740, - Full20=0xf741, - Handwriting20=0xf742, - ChevronLeft20=0xf743, - ChevronLeft32=0xf744, - ChevronRight20=0xf745, - ChevronRight32=0xf746, - Event12=0xf763, - MicOff2=0xf781, - DeliveryOptimization=0xf785, - CancelMedium=0xf78a, - SearchMedium=0xf78b, - AcceptMedium=0xf78c, - RevealPasswordMedium=0xf78d, - DeleteWord=0xf7ad, - DeleteWordFill=0xf7ae, - DeleteLines=0xf7af, - DeleteLinesFill=0xf7b0, - InstertWords=0xf7b1, - InstertWordsFill=0xf7b2, - JoinWords=0xf7b3, - JoinWordsFill=0xf7b4, - OverwriteWords=0xf7b5, - OverwriteWordsFill=0xf7b6, - AddNewLine=0xf7b7, - AddNewLineFill=0xf7b8, - OverwriteWordsKorean=0xf7b9, - OverwriteWordsFillKorean=0xf7ba, - EducationIcon=0xf7bb, - WindowSnipping=0xf7ed, - VideoCapture=0xf7ee, - StatusSecured=0xf809, - NarratorApp=0xf83b, - PowerButtonUpdate=0xf83d, - RestartUpdate=0xf83e, - UpdateStatusDot=0xf83f, - Eject=0xf847, - Spelling=0xf87b, - SpellingKorean=0xf87c, - SpellingSerbian=0xf87d, - SpellingChinese=0xf87e, - FolderSelect=0xf89a, - SmartScreen=0xf8a5, - ExploitProtection=0xf8a6, - AddBold=0xf8aa, - SubtractBold=0xf8ab, - BackSolidBold=0xf8ac, - ForwardSolidBold=0xf8ad, - PauseBold=0xf8ae, - ClickSolid=0xf8af, - SettingsSolid=0xf8b0, - MicrophoneSolidBold=0xf8b1, - SpeechSolidBold=0xf8b2, - ClickedOutLoudSolidBold=0xf8b3, -}; -Q_ENUM_NS(Fluent_AwesomeType) -QML_NAMED_ELEMENT(FluentIcons) -} + Q_NAMESPACE + enum class Fluent_AwesomeType { + GlobalNavButton = 0xe700, + Wifi = 0xe701, + Bluetooth = 0xe702, + Connect = 0xe703, + InternetSharing = 0xe704, + VPN = 0xe705, + Brightness = 0xe706, + MapPin = 0xe707, + QuietHours = 0xe708, + Airplane = 0xe709, + Tablet = 0xe70a, + QuickNote = 0xe70b, + RememberedDevice = 0xe70c, + ChevronDown = 0xe70d, + ChevronUp = 0xe70e, + Edit = 0xe70f, + Add = 0xe710, + Cancel = 0xe711, + More = 0xe712, + Settings = 0xe713, + Video = 0xe714, + Mail = 0xe715, + People = 0xe716, + Phone = 0xe717, + Pin = 0xe718, + Shop = 0xe719, + Stop = 0xe71a, + Link = 0xe71b, + Filter = 0xe71c, + AllApps = 0xe71d, + Zoom = 0xe71e, + ZoomOut = 0xe71f, + Microphone = 0xe720, + Search = 0xe721, + Camera = 0xe722, + Attach = 0xe723, + Send = 0xe724, + SendFill = 0xe725, + WalkSolid = 0xe726, + InPrivate = 0xe727, + FavoriteList = 0xe728, + PageSolid = 0xe729, + Forward = 0xe72a, + Back = 0xe72b, + Refresh = 0xe72c, + Share = 0xe72d, + Lock = 0xe72e, + ReportHacked = 0xe730, + EMI = 0xe731, + FavoriteStar = 0xe734, + FavoriteStarFill = 0xe735, + ReadingMode = 0xe736, + Favicon = 0xe737, + Remove = 0xe738, + Checkbox = 0xe739, + CheckboxComposite = 0xe73a, + CheckboxFill = 0xe73b, + CheckboxIndeterminate = 0xe73c, + CheckboxCompositeReversed = 0xe73d, + CheckMark = 0xe73e, + BackToWindow = 0xe73f, + FullScreen = 0xe740, + ResizeTouchLarger = 0xe741, + ResizeTouchSmaller = 0xe742, + ResizeMouseSmall = 0xe743, + ResizeMouseMedium = 0xe744, + ResizeMouseWide = 0xe745, + ResizeMouseTall = 0xe746, + ResizeMouseLarge = 0xe747, + SwitchUser = 0xe748, + Print = 0xe749, + Up = 0xe74a, + Down = 0xe74b, + OEM = 0xe74c, + Delete = 0xe74d, + Save = 0xe74e, + Mute = 0xe74f, + BackSpaceQWERTY = 0xe750, + ReturnKey = 0xe751, + UpArrowShiftKey = 0xe752, + Cloud = 0xe753, + Flashlight = 0xe754, + RotationLock = 0xe755, + CommandPrompt = 0xe756, + SIPMove = 0xe759, + SIPUndock = 0xe75a, + SIPRedock = 0xe75b, + EraseTool = 0xe75c, + UnderscoreSpace = 0xe75d, + GripperTool = 0xe75e, + Dialpad = 0xe75f, + PageLeft = 0xe760, + PageRight = 0xe761, + MultiSelect = 0xe762, + KeyboardLeftHanded = 0xe763, + KeyboardRightHanded = 0xe764, + KeyboardClassic = 0xe765, + KeyboardSplit = 0xe766, + Volume = 0xe767, + Play = 0xe768, + Pause = 0xe769, + ChevronLeft = 0xe76b, + ChevronRight = 0xe76c, + InkingTool = 0xe76d, + Emoji2 = 0xe76e, + GripperBarHorizontal = 0xe76f, + System = 0xe770, + Personalize = 0xe771, + Devices = 0xe772, + SearchAndApps = 0xe773, + Globe = 0xe774, + TimeLanguage = 0xe775, + EaseOfAccess = 0xe776, + UpdateRestore = 0xe777, + HangUp = 0xe778, + ContactInfo = 0xe779, + Unpin = 0xe77a, + Contact = 0xe77b, + Memo = 0xe77c, + IncomingCall = 0xe77e, + Paste = 0xe77f, + PhoneBook = 0xe780, + LEDLight = 0xe781, + Error = 0xe783, + GripperBarVertical = 0xe784, + Unlock = 0xe785, + Slideshow = 0xe786, + Calendar = 0xe787, + GripperResize = 0xe788, + Megaphone = 0xe789, + Trim = 0xe78a, + NewWindow = 0xe78b, + SaveLocal = 0xe78c, + Color = 0xe790, + DataSense = 0xe791, + SaveAs = 0xe792, + Light = 0xe793, + AspectRatio = 0xe799, + DataSenseBar = 0xe7a5, + Redo = 0xe7a6, + Undo = 0xe7a7, + Crop = 0xe7a8, + OpenWith = 0xe7ac, + Rotate = 0xe7ad, + RedEye = 0xe7b3, + SetlockScreen = 0xe7b5, + MapPin2 = 0xe7b7, + Package = 0xe7b8, + Warning = 0xe7ba, + ReadingList = 0xe7bc, + Education = 0xe7be, + ShoppingCart = 0xe7bf, + Train = 0xe7c0, + Flag = 0xe7c1, + Move = 0xe7c2, + Page = 0xe7c3, + TaskView = 0xe7c4, + BrowsePhotos = 0xe7c5, + HalfStarLeft = 0xe7c6, + HalfStarRight = 0xe7c7, + Record = 0xe7c8, + TouchPointer = 0xe7c9, + LangJPN = 0xe7de, + Ferry = 0xe7e3, + Highlight = 0xe7e6, + ActionCenterNotification = 0xe7e7, + PowerButton = 0xe7e8, + ResizeTouchNarrower = 0xe7ea, + ResizeTouchShorter = 0xe7eb, + DrivingMode = 0xe7ec, + RingerSilent = 0xe7ed, + OtherUser = 0xe7ee, + Admin = 0xe7ef, + CC = 0xe7f0, + SDCard = 0xe7f1, + CallForwarding = 0xe7f2, + SettingsDisplaySound = 0xe7f3, + TVMonitor = 0xe7f4, + Speakers = 0xe7f5, + Headphone = 0xe7f6, + DeviceLaptopPic = 0xe7f7, + DeviceLaptopNoPic = 0xe7f8, + DeviceMonitorRightPic = 0xe7f9, + DeviceMonitorLeftPic = 0xe7fa, + DeviceMonitorNoPic = 0xe7fb, + Game = 0xe7fc, + HorizontalTabKey = 0xe7fd, + StreetsideSplitMinimize = 0xe802, + StreetsideSplitExpand = 0xe803, + Car = 0xe804, + Walk = 0xe805, + Bus = 0xe806, + TiltUp = 0xe809, + TiltDown = 0xe80a, + CallControl = 0xe80b, + RotateMapRight = 0xe80c, + RotateMapLeft = 0xe80d, + Home = 0xe80f, + ParkingLocation = 0xe811, + MapCompassTop = 0xe812, + MapCompassBottom = 0xe813, + IncidentTriangle = 0xe814, + Touch = 0xe815, + MapDirections = 0xe816, + StartPoint = 0xe819, + StopPoint = 0xe81a, + EndPoint = 0xe81b, + History = 0xe81c, + Location = 0xe81d, + MapLayers = 0xe81e, + Accident = 0xe81f, + Work = 0xe821, + Construction = 0xe822, + Recent = 0xe823, + Bank = 0xe825, + DownloadMap = 0xe826, + InkingToolFill2 = 0xe829, + HighlightFill2 = 0xe82a, + EraseToolFill = 0xe82b, + EraseToolFill2 = 0xe82c, + Dictionary = 0xe82d, + DictionaryAdd = 0xe82e, + ToolTip = 0xe82f, + ChromeBack = 0xe830, + ProvisioningPackage = 0xe835, + AddRemoteDevice = 0xe836, + FolderOpen = 0xe838, + Ethernet = 0xe839, + ShareBroadband = 0xe83a, + DirectAccess = 0xe83b, + DialUp = 0xe83c, + DefenderApp = 0xe83d, + BatteryCharging9 = 0xe83e, + Battery10 = 0xe83f, + Pinned = 0xe840, + PinFill = 0xe841, + PinnedFill = 0xe842, + PeriodKey = 0xe843, + PuncKey = 0xe844, + RevToggleKey = 0xe845, + RightArrowKeyTime1 = 0xe846, + RightArrowKeyTime2 = 0xe847, + LeftQuote = 0xe848, + RightQuote = 0xe849, + DownShiftKey = 0xe84a, + UpShiftKey = 0xe84b, + PuncKey0 = 0xe84c, + PuncKeyLeftBottom = 0xe84d, + RightArrowKeyTime3 = 0xe84e, + RightArrowKeyTime4 = 0xe84f, + Battery0 = 0xe850, + Battery1 = 0xe851, + Battery2 = 0xe852, + Battery3 = 0xe853, + Battery4 = 0xe854, + Battery5 = 0xe855, + Battery6 = 0xe856, + Battery7 = 0xe857, + Battery8 = 0xe858, + Battery9 = 0xe859, + BatteryCharging0 = 0xe85a, + BatteryCharging1 = 0xe85b, + BatteryCharging2 = 0xe85c, + BatteryCharging3 = 0xe85d, + BatteryCharging4 = 0xe85e, + BatteryCharging5 = 0xe85f, + BatteryCharging6 = 0xe860, + BatteryCharging7 = 0xe861, + BatteryCharging8 = 0xe862, + BatterySaver0 = 0xe863, + BatterySaver1 = 0xe864, + BatterySaver2 = 0xe865, + BatterySaver3 = 0xe866, + BatterySaver4 = 0xe867, + BatterySaver5 = 0xe868, + BatterySaver6 = 0xe869, + BatterySaver7 = 0xe86a, + BatterySaver8 = 0xe86b, + SignalBars1 = 0xe86c, + SignalBars2 = 0xe86d, + SignalBars3 = 0xe86e, + SignalBars4 = 0xe86f, + SignalBars5 = 0xe870, + SignalNotConnected = 0xe871, + Wifi1 = 0xe872, + Wifi2 = 0xe873, + Wifi3 = 0xe874, + MobSIMLock = 0xe875, + MobSIMMissing = 0xe876, + Vibrate = 0xe877, + RoamingInternational = 0xe878, + RoamingDomestic = 0xe879, + CallForwardInternational = 0xe87a, + CallForwardRoaming = 0xe87b, + JpnRomanji = 0xe87c, + JpnRomanjiLock = 0xe87d, + JpnRomanjiShift = 0xe87e, + JpnRomanjiShiftLock = 0xe87f, + StatusDataTransfer = 0xe880, + StatusDataTransferVPN = 0xe881, + StatusDualSIM2 = 0xe882, + StatusDualSIM2VPN = 0xe883, + StatusDualSIM1 = 0xe884, + StatusDualSIM1VPN = 0xe885, + StatusSGLTE = 0xe886, + StatusSGLTECell = 0xe887, + StatusSGLTEDataVPN = 0xe888, + StatusVPN = 0xe889, + WifiHotspot = 0xe88a, + LanguageKor = 0xe88b, + LanguageCht = 0xe88c, + LanguageChs = 0xe88d, + USB = 0xe88e, + InkingToolFill = 0xe88f, + View = 0xe890, + HighlightFill = 0xe891, + Previous = 0xe892, + Next = 0xe893, + Clear = 0xe894, + Sync = 0xe895, + Download = 0xe896, + Help = 0xe897, + Upload = 0xe898, + Emoji = 0xe899, + TwoPage = 0xe89a, + LeaveChat = 0xe89b, + MailForward = 0xe89c, + RotateCamera = 0xe89e, + ClosePane = 0xe89f, + OpenPane = 0xe8a0, + PreviewLink = 0xe8a1, + AttachCamera = 0xe8a2, + ZoomIn = 0xe8a3, + Bookmarks = 0xe8a4, + Document = 0xe8a5, + ProtectedDocument = 0xe8a6, + OpenInNewWindow = 0xe8a7, + MailFill = 0xe8a8, + ViewAll = 0xe8a9, + VideoChat = 0xe8aa, + Switch = 0xe8ab, + Rename = 0xe8ac, + Go = 0xe8ad, + SurfaceHub = 0xe8ae, + Remote = 0xe8af, + Click = 0xe8b0, + Shuffle = 0xe8b1, + Movies = 0xe8b2, + SelectAll = 0xe8b3, + Orientation = 0xe8b4, + Import = 0xe8b5, + ImportAll = 0xe8b6, + Folder = 0xe8b7, + Webcam = 0xe8b8, + Picture = 0xe8b9, + Caption = 0xe8ba, + ChromeClose = 0xe8bb, + ShowResults = 0xe8bc, + Message = 0xe8bd, + Leaf = 0xe8be, + CalendarDay = 0xe8bf, + CalendarWeek = 0xe8c0, + Characters = 0xe8c1, + MailReplyAll = 0xe8c2, + Read = 0xe8c3, + ShowBcc = 0xe8c4, + HideBcc = 0xe8c5, + Cut = 0xe8c6, + PaymentCard = 0xe8c7, + Copy = 0xe8c8, + Important = 0xe8c9, + MailReply = 0xe8ca, + Sort = 0xe8cb, + MobileTablet = 0xe8cc, + DisconnectDrive = 0xe8cd, + MapDrive = 0xe8ce, + ContactPresence = 0xe8cf, + Priority = 0xe8d0, + GotoToday = 0xe8d1, + Font = 0xe8d2, + FontColor = 0xe8d3, + Contact2 = 0xe8d4, + FolderFill = 0xe8d5, + Audio = 0xe8d6, + Permissions = 0xe8d7, + DisableUpdates = 0xe8d8, + Unfavorite = 0xe8d9, + OpenLocal = 0xe8da, + Italic = 0xe8db, + Underline = 0xe8dc, + Bold = 0xe8dd, + MoveToFolder = 0xe8de, + LikeDislike = 0xe8df, + Dislike = 0xe8e0, + Like = 0xe8e1, + AlignRight = 0xe8e2, + AlignCenter = 0xe8e3, + AlignLeft = 0xe8e4, + OpenFile = 0xe8e5, + ClearSelection = 0xe8e6, + FontDecrease = 0xe8e7, + FontIncrease = 0xe8e8, + FontSize = 0xe8e9, + CellPhone = 0xe8ea, + Reshare = 0xe8eb, + Tag = 0xe8ec, + RepeatOne = 0xe8ed, + RepeatAll = 0xe8ee, + Calculator = 0xe8ef, + Directions = 0xe8f0, + Library = 0xe8f1, + ChatBubbles = 0xe8f2, + PostUpdate = 0xe8f3, + NewFolder = 0xe8f4, + CalendarReply = 0xe8f5, + UnsyncFolder = 0xe8f6, + SyncFolder = 0xe8f7, + BlockContact = 0xe8f8, + SwitchApps = 0xe8f9, + AddFriend = 0xe8fa, + Accept = 0xe8fb, + GoToStart = 0xe8fc, + BulletedList = 0xe8fd, + Scan = 0xe8fe, + Preview = 0xe8ff, + Group = 0xe902, + ZeroBars = 0xe904, + OneBar = 0xe905, + TwoBars = 0xe906, + ThreeBars = 0xe907, + FourBars = 0xe908, + World = 0xe909, + Comment = 0xe90a, + MusicInfo = 0xe90b, + DockLeft = 0xe90c, + DockRight = 0xe90d, + DockBottom = 0xe90e, + Repair = 0xe90f, + Accounts = 0xe910, + DullSound = 0xe911, + Manage = 0xe912, + Street = 0xe913, + Printer3D = 0xe914, + RadioBullet = 0xe915, + Stopwatch = 0xe916, + Photo = 0xe91b, + ActionCenter = 0xe91c, + FullCircleMask = 0xe91f, + ChromeMinimize = 0xe921, + ChromeMaximize = 0xe922, + ChromeRestore = 0xe923, + Annotation = 0xe924, + BackSpaceQWERTYSm = 0xe925, + BackSpaceQWERTYMd = 0xe926, + Swipe = 0xe927, + Fingerprint = 0xe928, + Handwriting = 0xe929, + ChromeBackToWindow = 0xe92c, + ChromeFullScreen = 0xe92d, + KeyboardStandard = 0xe92e, + KeyboardDismiss = 0xe92f, + Completed = 0xe930, + ChromeAnnotate = 0xe931, + Label = 0xe932, + IBeam = 0xe933, + IBeamOutline = 0xe934, + FlickDown = 0xe935, + FlickUp = 0xe936, + FlickLeft = 0xe937, + FlickRight = 0xe938, + FeedbackApp = 0xe939, + MusicAlbum = 0xe93c, + Streaming = 0xe93e, + Code = 0xe943, + ReturnToWindow = 0xe944, + LightningBolt = 0xe945, + Info = 0xe946, + CalculatorMultiply = 0xe947, + CalculatorAddition = 0xe948, + CalculatorSubtract = 0xe949, + CalculatorDivide = 0xe94a, + CalculatorSquareroot = 0xe94b, + CalculatorPercentage = 0xe94c, + CalculatorNegate = 0xe94d, + CalculatorEqualTo = 0xe94e, + CalculatorBackspace = 0xe94f, + Component = 0xe950, + DMC = 0xe951, + Dock = 0xe952, + MultimediaDMS = 0xe953, + MultimediaDVR = 0xe954, + MultimediaPMP = 0xe955, + PrintfaxPrinterFile = 0xe956, + Sensor = 0xe957, + StorageOptical = 0xe958, + Communications = 0xe95a, + Headset = 0xe95b, + Projector = 0xe95d, + Health = 0xe95e, + Wire = 0xe95f, + Webcam2 = 0xe960, + Input = 0xe961, + Mouse = 0xe962, + Smartcard = 0xe963, + SmartcardVirtual = 0xe964, + MediaStorageTower = 0xe965, + ReturnKeySm = 0xe966, + GameConsole = 0xe967, + Network = 0xe968, + StorageNetworkWireless = 0xe969, + StorageTape = 0xe96a, + ChevronUpSmall = 0xe96d, + ChevronDownSmall = 0xe96e, + ChevronLeftSmall = 0xe96f, + ChevronRightSmall = 0xe970, + ChevronUpMed = 0xe971, + ChevronDownMed = 0xe972, + ChevronLeftMed = 0xe973, + ChevronRightMed = 0xe974, + Devices2 = 0xe975, + ExpandTile = 0xe976, + PC1 = 0xe977, + PresenceChicklet = 0xe978, + PresenceChickletVideo = 0xe979, + Reply = 0xe97a, + SetTile = 0xe97b, + Type = 0xe97c, + Korean = 0xe97d, + HalfAlpha = 0xe97e, + FullAlpha = 0xe97f, + Key12On = 0xe980, + ChineseChangjie = 0xe981, + QWERTYOn = 0xe982, + QWERTYOff = 0xe983, + ChineseQuick = 0xe984, + Japanese = 0xe985, + FullHiragana = 0xe986, + FullKatakana = 0xe987, + HalfKatakana = 0xe988, + ChineseBoPoMoFo = 0xe989, + ChinesePinyin = 0xe98a, + ConstructionCone = 0xe98f, + XboxOneConsole = 0xe990, + Volume0 = 0xe992, + Volume1 = 0xe993, + Volume2 = 0xe994, + Volume3 = 0xe995, + BatteryUnknown = 0xe996, + WifiAttentionOverlay = 0xe998, + Robot = 0xe99a, + TapAndSend = 0xe9a1, + FitPage = 0xe9a6, + PasswordKeyShow = 0xe9a8, + PasswordKeyHide = 0xe9a9, + BidiLtr = 0xe9aa, + BidiRtl = 0xe9ab, + ForwardSm = 0xe9ac, + CommaKey = 0xe9ad, + DashKey = 0xe9ae, + DullSoundKey = 0xe9af, + HalfDullSound = 0xe9b0, + RightDoubleQuote = 0xe9b1, + LeftDoubleQuote = 0xe9b2, + PuncKeyRightBottom = 0xe9b3, + PuncKey1 = 0xe9b4, + PuncKey2 = 0xe9b5, + PuncKey3 = 0xe9b6, + PuncKey4 = 0xe9b7, + PuncKey5 = 0xe9b8, + PuncKey6 = 0xe9b9, + PuncKey9 = 0xe9ba, + PuncKey7 = 0xe9bb, + PuncKey8 = 0xe9bc, + Frigid = 0xe9ca, + Unknown = 0xe9ce, + AreaChart = 0xe9d2, + CheckList = 0xe9d5, + Diagnostic = 0xe9d9, + Equalizer = 0xe9e9, + Process = 0xe9f3, + Processing = 0xe9f5, + ReportDocument = 0xe9f9, + VideoSolid = 0xea0c, + MixedMediaBadge = 0xea0d, + DisconnectDisplay = 0xea14, + Shield = 0xea18, + Info2 = 0xea1f, + ActionCenterAsterisk = 0xea21, + Beta = 0xea24, + SaveCopy = 0xea35, + List = 0xea37, + Asterisk = 0xea38, + ErrorBadge = 0xea39, + CircleRing = 0xea3a, + CircleFill = 0xea3b, + MergeCall = 0xea3c, + PrivateCall = 0xea3d, + Record2 = 0xea3f, + AllAppsMirrored = 0xea40, + BookmarksMirrored = 0xea41, + BulletedListMirrored = 0xea42, + CallForwardInternationalMirrored = 0xea43, + CallForwardRoamingMirrored = 0xea44, + ChromeBackMirrored = 0xea47, + ClearSelectionMirrored = 0xea48, + ClosePaneMirrored = 0xea49, + ContactInfoMirrored = 0xea4a, + DockRightMirrored = 0xea4b, + DockLeftMirrored = 0xea4c, + ExpandTileMirrored = 0xea4e, + GoMirrored = 0xea4f, + GripperResizeMirrored = 0xea50, + HelpMirrored = 0xea51, + ImportMirrored = 0xea52, + ImportAllMirrored = 0xea53, + LeaveChatMirrored = 0xea54, + ListMirrored = 0xea55, + MailForwardMirrored = 0xea56, + MailReplyMirrored = 0xea57, + MailReplyAllMirrored = 0xea58, + OpenPaneMirrored = 0xea5b, + OpenWithMirrored = 0xea5c, + ParkingLocationMirrored = 0xea5e, + ResizeMouseMediumMirrored = 0xea5f, + ResizeMouseSmallMirrored = 0xea60, + ResizeMouseTallMirrored = 0xea61, + ResizeTouchNarrowerMirrored = 0xea62, + SendMirrored = 0xea63, + SendFillMirrored = 0xea64, + ShowResultsMirrored = 0xea65, + Media = 0xea69, + SyncError = 0xea6a, + Devices3 = 0xea6c, + SlowMotionOn = 0xea79, + Lightbulb = 0xea80, + StatusCircle = 0xea81, + StatusTriangle = 0xea82, + StatusError = 0xea83, + StatusWarning = 0xea84, + Puzzle = 0xea86, + CalendarSolid = 0xea89, + HomeSolid = 0xea8a, + ParkingLocationSolid = 0xea8b, + ContactSolid = 0xea8c, + ConstructionSolid = 0xea8d, + AccidentSolid = 0xea8e, + Ringer = 0xea8f, + PDF = 0xea90, + ThoughtBubble = 0xea91, + HeartBroken = 0xea92, + BatteryCharging10 = 0xea93, + BatterySaver9 = 0xea94, + BatterySaver10 = 0xea95, + CallForwardingMirrored = 0xea97, + MultiSelectMirrored = 0xea98, + Broom = 0xea99, + ForwardCall = 0xeac2, + Trackers = 0xeadf, + Market = 0xeafc, + PieSingle = 0xeb05, + StockUp = 0xeb0f, + StockDown = 0xeb11, + Design = 0xeb3c, + Website = 0xeb41, + Drop = 0xeb42, + Radar = 0xeb44, + BusSolid = 0xeb47, + FerrySolid = 0xeb48, + StartPointSolid = 0xeb49, + StopPointSolid = 0xeb4a, + EndPointSolid = 0xeb4b, + AirplaneSolid = 0xeb4c, + TrainSolid = 0xeb4d, + WorkSolid = 0xeb4e, + ReminderFill = 0xeb4f, + Reminder = 0xeb50, + Heart = 0xeb51, + HeartFill = 0xeb52, + EthernetError = 0xeb55, + EthernetWarning = 0xeb56, + StatusConnecting1 = 0xeb57, + StatusConnecting2 = 0xeb58, + StatusUnsecure = 0xeb59, + WifiError0 = 0xeb5a, + WifiError1 = 0xeb5b, + WifiError2 = 0xeb5c, + WifiError3 = 0xeb5d, + WifiError4 = 0xeb5e, + WifiWarning0 = 0xeb5f, + WifiWarning1 = 0xeb60, + WifiWarning2 = 0xeb61, + WifiWarning3 = 0xeb62, + WifiWarning4 = 0xeb63, + Devices4 = 0xeb66, + NUIIris = 0xeb67, + NUIFace = 0xeb68, + GatewayRouter = 0xeb77, + EditMirrored = 0xeb7e, + NUIFPStartSlideHand = 0xeb82, + NUIFPStartSlideAction = 0xeb83, + NUIFPContinueSlideHand = 0xeb84, + NUIFPContinueSlideAction = 0xeb85, + NUIFPRollRightHand = 0xeb86, + NUIFPRollRightHandAction = 0xeb87, + NUIFPRollLeftHand = 0xeb88, + NUIFPRollLeftAction = 0xeb89, + NUIFPPressHand = 0xeb8a, + NUIFPPressAction = 0xeb8b, + NUIFPPressRepeatHand = 0xeb8c, + NUIFPPressRepeatAction = 0xeb8d, + StatusErrorFull = 0xeb90, + TaskViewExpanded = 0xeb91, + Certificate = 0xeb95, + BackSpaceQWERTYLg = 0xeb96, + ReturnKeyLg = 0xeb97, + FastForward = 0xeb9d, + Rewind = 0xeb9e, + Photo2 = 0xeb9f, + MobBattery0 = 0xeba0, + MobBattery1 = 0xeba1, + MobBattery2 = 0xeba2, + MobBattery3 = 0xeba3, + MobBattery4 = 0xeba4, + MobBattery5 = 0xeba5, + MobBattery6 = 0xeba6, + MobBattery7 = 0xeba7, + MobBattery8 = 0xeba8, + MobBattery9 = 0xeba9, + MobBattery10 = 0xebaa, + MobBatteryCharging0 = 0xebab, + MobBatteryCharging1 = 0xebac, + MobBatteryCharging2 = 0xebad, + MobBatteryCharging3 = 0xebae, + MobBatteryCharging4 = 0xebaf, + MobBatteryCharging5 = 0xebb0, + MobBatteryCharging6 = 0xebb1, + MobBatteryCharging7 = 0xebb2, + MobBatteryCharging8 = 0xebb3, + MobBatteryCharging9 = 0xebb4, + MobBatteryCharging10 = 0xebb5, + MobBatterySaver0 = 0xebb6, + MobBatterySaver1 = 0xebb7, + MobBatterySaver2 = 0xebb8, + MobBatterySaver3 = 0xebb9, + MobBatterySaver4 = 0xebba, + MobBatterySaver5 = 0xebbb, + MobBatterySaver6 = 0xebbc, + MobBatterySaver7 = 0xebbd, + MobBatterySaver8 = 0xebbe, + MobBatterySaver9 = 0xebbf, + MobBatterySaver10 = 0xebc0, + DictionaryCloud = 0xebc3, + ResetDrive = 0xebc4, + VolumeBars = 0xebc5, + Project = 0xebc6, + AdjustHologram = 0xebd2, + CloudDownload = 0xebd3, + MobWifiCallBars = 0xebd4, + MobWifiCall0 = 0xebd5, + MobWifiCall1 = 0xebd6, + MobWifiCall2 = 0xebd7, + MobWifiCall3 = 0xebd8, + MobWifiCall4 = 0xebd9, + Family = 0xebda, + LockFeedback = 0xebdb, + DeviceDiscovery = 0xebde, + WindDirection = 0xebe6, + RightArrowKeyTime0 = 0xebe7, + Bug = 0xebe8, + TabletMode = 0xebfc, + StatusCircleLeft = 0xebfd, + StatusTriangleLeft = 0xebfe, + StatusErrorLeft = 0xebff, + StatusWarningLeft = 0xec00, + MobBatteryUnknown = 0xec02, + NetworkTower = 0xec05, + CityNext = 0xec06, + CityNext2 = 0xec07, + Courthouse = 0xec08, + Groceries = 0xec09, + Sustainable = 0xec0a, + BuildingEnergy = 0xec0b, + ToggleFilled = 0xec11, + ToggleBorder = 0xec12, + SliderThumb = 0xec13, + ToggleThumb = 0xec14, + MiracastLogoSmall = 0xec15, + MiracastLogoLarge = 0xec16, + PLAP = 0xec19, + Badge = 0xec1b, + SignalRoaming = 0xec1e, + MobileLocked = 0xec20, + InsiderHubApp = 0xec24, + PersonalFolder = 0xec25, + HomeGroup = 0xec26, + MyNetwork = 0xec27, + KeyboardFull = 0xec31, + Cafe = 0xec32, + MobSignal1 = 0xec37, + MobSignal2 = 0xec38, + MobSignal3 = 0xec39, + MobSignal4 = 0xec3a, + MobSignal5 = 0xec3b, + MobWifi1 = 0xec3c, + MobWifi2 = 0xec3d, + MobWifi3 = 0xec3e, + MobWifi4 = 0xec3f, + MobAirplane = 0xec40, + MobBluetooth = 0xec41, + MobActionCenter = 0xec42, + MobLocation = 0xec43, + MobWifiHotspot = 0xec44, + LanguageJpn = 0xec45, + MobQuietHours = 0xec46, + MobDrivingMode = 0xec47, + SpeedOff = 0xec48, + SpeedMedium = 0xec49, + SpeedHigh = 0xec4a, + ThisPC = 0xec4e, + MusicNote = 0xec4f, + FileExplorer = 0xec50, + FileExplorerApp = 0xec51, + LeftArrowKeyTime0 = 0xec52, + MicOff = 0xec54, + MicSleep = 0xec55, + MicError = 0xec56, + PlaybackRate1x = 0xec57, + PlaybackRateOther = 0xec58, + CashDrawer = 0xec59, + BarcodeScanner = 0xec5a, + ReceiptPrinter = 0xec5b, + MagStripeReader = 0xec5c, + CompletedSolid = 0xec61, + CompanionApp = 0xec64, + Favicon2 = 0xec6c, + SwipeRevealArt = 0xec6d, + MicOn = 0xec71, + MicClipping = 0xec72, + TabletSelected = 0xec74, + MobileSelected = 0xec75, + LaptopSelected = 0xec76, + TVMonitorSelected = 0xec77, + DeveloperTools = 0xec7a, + MobCallForwarding = 0xec7e, + MobCallForwardingMirrored = 0xec7f, + BodyCam = 0xec80, + PoliceCar = 0xec81, + Draw = 0xec87, + DrawSolid = 0xec88, + LowerBrightness = 0xec8a, + ScrollUpDown = 0xec8f, + DateTime = 0xec92, + HoloLens = 0xec94, + Tiles = 0xeca5, + PartyLeader = 0xeca7, + AppIconDefault = 0xecaa, + Calories = 0xecad, + POI = 0xecaf, + BandBattery0 = 0xecb9, + BandBattery1 = 0xecba, + BandBattery2 = 0xecbb, + BandBattery3 = 0xecbc, + BandBattery4 = 0xecbd, + BandBattery5 = 0xecbe, + BandBattery6 = 0xecbf, + AddSurfaceHub = 0xecc4, + DevUpdate = 0xecc5, + Unit = 0xecc6, + AddTo = 0xecc8, + RemoveFrom = 0xecc9, + RadioBtnOff = 0xecca, + RadioBtnOn = 0xeccb, + RadioBullet2 = 0xeccc, + ExploreContent = 0xeccd, + Blocked2 = 0xece4, + ScrollMode = 0xece7, + ZoomMode = 0xece8, + PanMode = 0xece9, + WiredUSB = 0xecf0, + WirelessUSB = 0xecf1, + USBSafeConnect = 0xecf3, + ActionCenterNotificationMirrored = 0xed0c, + ActionCenterMirrored = 0xed0d, + SubscriptionAdd = 0xed0e, + ResetDevice = 0xed10, + SubscriptionAddMirrored = 0xed11, + QRCode = 0xed14, + Feedback = 0xed15, + Hide = 0xed1a, + Subtitles = 0xed1e, + SubtitlesAudio = 0xed1f, + OpenFolderHorizontal = 0xed25, + CalendarMirrored = 0xed28, + MobeSIM = 0xed2a, + MobeSIMNoProfile = 0xed2b, + MobeSIMLocked = 0xed2c, + MobeSIMBusy = 0xed2d, + SignalError = 0xed2e, + StreamingEnterprise = 0xed2f, + Headphone0 = 0xed30, + Headphone1 = 0xed31, + Headphone2 = 0xed32, + Headphone3 = 0xed33, + Apps = 0xed35, + KeyboardBrightness = 0xed39, + KeyboardLowerBrightness = 0xed3a, + SkipBack10 = 0xed3c, + SkipForward30 = 0xed3d, + TreeFolderFolder = 0xed41, + TreeFolderFolderFill = 0xed42, + TreeFolderFolderOpen = 0xed43, + TreeFolderFolderOpenFill = 0xed44, + MultimediaDMP = 0xed47, + KeyboardOneHanded = 0xed4c, + Narrator = 0xed4d, + EmojiTabPeople = 0xed53, + EmojiTabSmilesAnimals = 0xed54, + EmojiTabCelebrationObjects = 0xed55, + EmojiTabFoodPlants = 0xed56, + EmojiTabTransitPlaces = 0xed57, + EmojiTabSymbols = 0xed58, + EmojiTabTextSmiles = 0xed59, + EmojiTabFavorites = 0xed5a, + EmojiSwatch = 0xed5b, + ConnectApp = 0xed5c, + CompanionDeviceFramework = 0xed5d, + Ruler = 0xed5e, + FingerInking = 0xed5f, + StrokeErase = 0xed60, + PointErase = 0xed61, + ClearAllInk = 0xed62, + Pencil = 0xed63, + Marker = 0xed64, + InkingCaret = 0xed65, + InkingColorOutline = 0xed66, + InkingColorFill = 0xed67, + HardDrive = 0xeda2, + NetworkAdapter = 0xeda3, + Touchscreen = 0xeda4, + NetworkPrinter = 0xeda5, + CloudPrinter = 0xeda6, + KeyboardShortcut = 0xeda7, + BrushSize = 0xeda8, + NarratorForward = 0xeda9, + NarratorForwardMirrored = 0xedaa, + SyncBadge12 = 0xedab, + RingerBadge12 = 0xedac, + AsteriskBadge12 = 0xedad, + ErrorBadge12 = 0xedae, + CircleRingBadge12 = 0xedaf, + CircleFillBadge12 = 0xedb0, + ImportantBadge12 = 0xedb1, + MailBadge12 = 0xedb3, + PauseBadge12 = 0xedb4, + PlayBadge12 = 0xedb5, + PenWorkspace = 0xedc6, + CaretLeft8 = 0xedd5, + CaretRight8 = 0xedd6, + CaretUp8 = 0xedd7, + CaretDown8 = 0xedd8, + CaretLeftSolid8 = 0xedd9, + CaretRightSolid8 = 0xedda, + CaretUpSolid8 = 0xeddb, + CaretDownSolid8 = 0xeddc, + Strikethrough = 0xede0, + Export = 0xede1, + ExportMirrored = 0xede2, + ButtonMenu = 0xede3, + CloudSearch = 0xede4, + PinyinIMELogo = 0xede5, + CalligraphyPen = 0xedfb, + ReplyMirrored = 0xee35, + LockscreenDesktop = 0xee3f, + TaskViewSettings = 0xee40, + MiniExpand2Mirrored = 0xee47, + MiniContract2Mirrored = 0xee49, + Play36 = 0xee4a, + PenPalette = 0xee56, + GuestUser = 0xee57, + SettingsBattery = 0xee63, + TaskbarPhone = 0xee64, + LockScreenGlance = 0xee65, + GenericScan = 0xee6f, + ImageExport = 0xee71, + WifiEthernet = 0xee77, + ActionCenterQuiet = 0xee79, + ActionCenterQuietNotification = 0xee7a, + TrackersMirrored = 0xee92, + DateTimeMirrored = 0xee93, + Wheel = 0xee94, + VirtualMachineGroup = 0xeea3, + ButtonView2 = 0xeeca, + PenWorkspaceMirrored = 0xef15, + PenPaletteMirrored = 0xef16, + StrokeEraseMirrored = 0xef17, + PointEraseMirrored = 0xef18, + ClearAllInkMirrored = 0xef19, + BackgroundToggle = 0xef1f, + Marquee = 0xef20, + ChromeCloseContrast = 0xef2c, + ChromeMinimizeContrast = 0xef2d, + ChromeMaximizeContrast = 0xef2e, + ChromeRestoreContrast = 0xef2f, + TrafficLight = 0xef31, + Replay = 0xef3b, + Eyedropper = 0xef3c, + LineDisplay = 0xef3d, + PINPad = 0xef3e, + SignatureCapture = 0xef3f, + ChipCardCreditCardReader = 0xef40, + MarketDown = 0xef42, + PlayerSettings = 0xef58, + LandscapeOrientation = 0xef6b, + Flow = 0xef90, + Touchpad = 0xefa5, + Speech = 0xefa9, + KnowledgeArticle = 0xf000, + Relationship = 0xf003, + ZipFolder = 0xf012, + DefaultAPN = 0xf080, + UserAPN = 0xf081, + DoublePinyin = 0xf085, + BlueLight = 0xf08c, + CaretSolidLeft = 0xf08d, + CaretSolidDown = 0xf08e, + CaretSolidRight = 0xf08f, + CaretSolidUp = 0xf090, + ButtonA = 0xf093, + ButtonB = 0xf094, + ButtonY = 0xf095, + ButtonX = 0xf096, + ArrowUp8 = 0xf0ad, + ArrowDown8 = 0xf0ae, + ArrowRight8 = 0xf0af, + ArrowLeft8 = 0xf0b0, + QuarentinedItems = 0xf0b2, + QuarentinedItemsMirrored = 0xf0b3, + Protractor = 0xf0b4, + ChecklistMirrored = 0xf0b5, + StatusCircle7 = 0xf0b6, + StatusCheckmark7 = 0xf0b7, + StatusErrorCircle7 = 0xf0b8, + Connected = 0xf0b9, + PencilFill = 0xf0c6, + CalligraphyFill = 0xf0c7, + QuarterStarLeft = 0xf0ca, + QuarterStarRight = 0xf0cb, + ThreeQuarterStarLeft = 0xf0cc, + ThreeQuarterStarRight = 0xf0cd, + QuietHoursBadge12 = 0xf0ce, + BackMirrored = 0xf0d2, + ForwardMirrored = 0xf0d3, + ChromeBackContrast = 0xf0d5, + ChromeBackContrastMirrored = 0xf0d6, + ChromeBackToWindowContrast = 0xf0d7, + ChromeFullScreenContrast = 0xf0d8, + GridView = 0xf0e2, + ClipboardList = 0xf0e3, + ClipboardListMirrored = 0xf0e4, + OutlineQuarterStarLeft = 0xf0e5, + OutlineQuarterStarRight = 0xf0e6, + OutlineHalfStarLeft = 0xf0e7, + OutlineHalfStarRight = 0xf0e8, + OutlineThreeQuarterStarLeft = 0xf0e9, + OutlineThreeQuarterStarRight = 0xf0ea, + SpatialVolume0 = 0xf0eb, + SpatialVolume1 = 0xf0ec, + SpatialVolume2 = 0xf0ed, + SpatialVolume3 = 0xf0ee, + ApplicationGuard = 0xf0ef, + OutlineStarLeftHalf = 0xf0f7, + OutlineStarRightHalf = 0xf0f8, + ChromeAnnotateContrast = 0xf0f9, + DefenderBadge12 = 0xf0fb, + DetachablePC = 0xf103, + LeftStick = 0xf108, + RightStick = 0xf109, + TriggerLeft = 0xf10a, + TriggerRight = 0xf10b, + BumperLeft = 0xf10c, + BumperRight = 0xf10d, + Dpad = 0xf10e, + EnglishPunctuation = 0xf110, + ChinesePunctuation = 0xf111, + HMD = 0xf119, + CtrlSpatialRight = 0xf11b, + PaginationDotOutline10 = 0xf126, + PaginationDotSolid10 = 0xf127, + StrokeErase2 = 0xf128, + SmallErase = 0xf129, + LargeErase = 0xf12a, + FolderHorizontal = 0xf12b, + MicrophoneListening = 0xf12e, + StatusExclamationCircle7 = 0xf12f, + Video360 = 0xf131, + GiftboxOpen = 0xf133, + StatusCircleOuter = 0xf136, + StatusCircleInner = 0xf137, + StatusCircleRing = 0xf138, + StatusTriangleOuter = 0xf139, + StatusTriangleInner = 0xf13a, + StatusTriangleExclamation = 0xf13b, + StatusCircleExclamation = 0xf13c, + StatusCircleErrorX = 0xf13d, + StatusCircleCheckmark = 0xf13e, + StatusCircleInfo = 0xf13f, + StatusCircleBlock = 0xf140, + StatusCircleBlock2 = 0xf141, + StatusCircleQuestionMark = 0xf142, + StatusCircleSync = 0xf143, + Dial1 = 0xf146, + Dial2 = 0xf147, + Dial3 = 0xf148, + Dial4 = 0xf149, + Dial5 = 0xf14a, + Dial6 = 0xf14b, + Dial7 = 0xf14c, + Dial8 = 0xf14d, + Dial9 = 0xf14e, + Dial10 = 0xf14f, + Dial11 = 0xf150, + Dial12 = 0xf151, + Dial13 = 0xf152, + Dial14 = 0xf153, + Dial15 = 0xf154, + Dial16 = 0xf155, + DialShape1 = 0xf156, + DialShape2 = 0xf157, + DialShape3 = 0xf158, + DialShape4 = 0xf159, + ClosedCaptionsInternational = 0xf15f, + TollSolid = 0xf161, + TrafficCongestionSolid = 0xf163, + ExploreContentSingle = 0xf164, + CollapseContent = 0xf165, + CollapseContentSingle = 0xf166, + InfoSolid = 0xf167, + GroupList = 0xf168, + CaretBottomRightSolidCenter8 = 0xf169, + ProgressRingDots = 0xf16a, + Checkbox14 = 0xf16b, + CheckboxComposite14 = 0xf16c, + CheckboxIndeterminateCombo14 = 0xf16d, + CheckboxIndeterminateCombo = 0xf16e, + StatusPause7 = 0xf175, + CharacterAppearance = 0xf17f, + Lexicon = 0xf180, + ScreenTime = 0xf182, + HeadlessDevice = 0xf191, + NetworkSharing = 0xf193, + EyeGaze = 0xf19d, + ToggleLeft = 0xf19e, + ToggleRight = 0xf19f, + WindowsInsider = 0xf1ad, + ChromeSwitch = 0xf1cb, + ChromeSwitchContast = 0xf1cc, + StatusCheckmark = 0xf1d8, + StatusCheckmarkLeft = 0xf1d9, + KeyboardLeftAligned = 0xf20c, + KeyboardRightAligned = 0xf20d, + KeyboardSettings = 0xf210, + NetworkPhysical = 0xf211, + IOT = 0xf22c, + UnknownMirrored = 0xf22e, + ViewDashboard = 0xf246, + ExploitProtectionSettings = 0xf259, + KeyboardNarrow = 0xf260, + Keyboard12Key = 0xf261, + KeyboardDock = 0xf26b, + KeyboardUndock = 0xf26c, + KeyboardLeftDock = 0xf26d, + KeyboardRightDock = 0xf26e, + Ear = 0xf270, + PointerHand = 0xf271, + Bullseye = 0xf272, + DocumentApproval = 0xf28b, + LocaleLanguage = 0xf2b7, + PassiveAuthentication = 0xf32a, + ColorSolid = 0xf354, + NetworkOffline = 0xf384, + NetworkConnected = 0xf385, + NetworkConnectedCheckmark = 0xf386, + SignOut = 0xf3b1, + StatusInfo = 0xf3cc, + StatusInfoLeft = 0xf3cd, + NearbySharing = 0xf3e2, + CtrlSpatialLeft = 0xf3e7, + InteractiveDashboard = 0xf404, + DeclineCall = 0xf405, + ClippingTool = 0xf406, + RectangularClipping = 0xf407, + FreeFormClipping = 0xf408, + CopyTo = 0xf413, + IDBadge = 0xf427, + DynamicLock = 0xf439, + PenTips = 0xf45e, + PenTipsMirrored = 0xf45f, + HWPJoin = 0xf460, + HWPInsert = 0xf461, + HWPStrikeThrough = 0xf462, + HWPScratchOut = 0xf463, + HWPSplit = 0xf464, + HWPNewLine = 0xf465, + HWPOverwrite = 0xf466, + MobWifiWarning1 = 0xf473, + MobWifiWarning2 = 0xf474, + MobWifiWarning3 = 0xf475, + MobWifiWarning4 = 0xf476, + MicLocationCombo = 0xf47f, + Globe2 = 0xf49a, + SpecialEffectSize = 0xf4a5, + GIF = 0xf4a9, + Sticker2 = 0xf4aa, + SurfaceHubSelected = 0xf4be, + HoloLensSelected = 0xf4bf, + Earbud = 0xf4c0, + MixVolumes = 0xf4c3, + Safe = 0xf540, + LaptopSecure = 0xf552, + PrintDefault = 0xf56d, + PageMirrored = 0xf56e, + LandscapeOrientationMirrored = 0xf56f, + ColorOff = 0xf570, + PrintAllPages = 0xf571, + PrintCustomRange = 0xf572, + PageMarginPortraitNarrow = 0xf573, + PageMarginPortraitNormal = 0xf574, + PageMarginPortraitModerate = 0xf575, + PageMarginPortraitWide = 0xf576, + PageMarginLandscapeNarrow = 0xf577, + PageMarginLandscapeNormal = 0xf578, + PageMarginLandscapeModerate = 0xf579, + PageMarginLandscapeWide = 0xf57a, + CollateLandscape = 0xf57b, + CollatePortrait = 0xf57c, + CollatePortraitSeparated = 0xf57d, + DuplexLandscapeOneSided = 0xf57e, + DuplexLandscapeOneSidedMirrored = 0xf57f, + DuplexLandscapeTwoSidedLongEdge = 0xf580, + DuplexLandscapeTwoSidedLongEdgeMirrored = 0xf581, + DuplexLandscapeTwoSidedShortEdge = 0xf582, + DuplexLandscapeTwoSidedShortEdgeMirrored = 0xf583, + DuplexPortraitOneSided = 0xf584, + DuplexPortraitOneSidedMirrored = 0xf585, + DuplexPortraitTwoSidedLongEdge = 0xf586, + DuplexPortraitTwoSidedLongEdgeMirrored = 0xf587, + DuplexPortraitTwoSidedShortEdge = 0xf588, + DuplexPortraitTwoSidedShortEdgeMirrored = 0xf589, + PPSOneLandscape = 0xf58a, + PPSTwoLandscape = 0xf58b, + PPSTwoPortrait = 0xf58c, + PPSFourLandscape = 0xf58d, + PPSFourPortrait = 0xf58e, + HolePunchOff = 0xf58f, + HolePunchPortraitLeft = 0xf590, + HolePunchPortraitRight = 0xf591, + HolePunchPortraitTop = 0xf592, + HolePunchPortraitBottom = 0xf593, + HolePunchLandscapeLeft = 0xf594, + HolePunchLandscapeRight = 0xf595, + HolePunchLandscapeTop = 0xf596, + HolePunchLandscapeBottom = 0xf597, + StaplingOff = 0xf598, + StaplingPortraitTopLeft = 0xf599, + StaplingPortraitTopRight = 0xf59a, + StaplingPortraitBottomRight = 0xf59b, + StaplingPortraitTwoLeft = 0xf59c, + StaplingPortraitTwoRight = 0xf59d, + StaplingPortraitTwoTop = 0xf59e, + StaplingPortraitTwoBottom = 0xf59f, + StaplingPortraitBookBinding = 0xf5a0, + StaplingLandscapeTopLeft = 0xf5a1, + StaplingLandscapeTopRight = 0xf5a2, + StaplingLandscapeBottomLeft = 0xf5a3, + StaplingLandscapeBottomRight = 0xf5a4, + StaplingLandscapeTwoLeft = 0xf5a5, + StaplingLandscapeTwoRight = 0xf5a6, + StaplingLandscapeTwoTop = 0xf5a7, + StaplingLandscapeTwoBottom = 0xf5a8, + StaplingLandscapeBookBinding = 0xf5a9, + StatusDataTransferRoaming = 0xf5aa, + MobSIMError = 0xf5ab, + CollateLandscapeSeparated = 0xf5ac, + PPSOnePortrait = 0xf5ad, + StaplingPortraitBottomLeft = 0xf5ae, + PlaySolid = 0xf5b0, + RepeatOff = 0xf5e7, + Set = 0xf5ed, + SetSolid = 0xf5ee, + FuzzyReading = 0xf5ef, + VerticalBattery0 = 0xf5f2, + VerticalBattery1 = 0xf5f3, + VerticalBattery2 = 0xf5f4, + VerticalBattery3 = 0xf5f5, + VerticalBattery4 = 0xf5f6, + VerticalBattery5 = 0xf5f7, + VerticalBattery6 = 0xf5f8, + VerticalBattery7 = 0xf5f9, + VerticalBattery8 = 0xf5fa, + VerticalBattery9 = 0xf5fb, + VerticalBattery10 = 0xf5fc, + VerticalBatteryCharging0 = 0xf5fd, + VerticalBatteryCharging1 = 0xf5fe, + VerticalBatteryCharging2 = 0xf5ff, + VerticalBatteryCharging3 = 0xf600, + VerticalBatteryCharging4 = 0xf601, + VerticalBatteryCharging5 = 0xf602, + VerticalBatteryCharging6 = 0xf603, + VerticalBatteryCharging7 = 0xf604, + VerticalBatteryCharging8 = 0xf605, + VerticalBatteryCharging9 = 0xf606, + VerticalBatteryCharging10 = 0xf607, + VerticalBatteryUnknown = 0xf608, + SIMError = 0xf618, + SIMMissing = 0xf619, + SIMLock = 0xf61a, + eSIM = 0xf61b, + eSIMNoProfile = 0xf61c, + eSIMLocked = 0xf61d, + eSIMBusy = 0xf61e, + NoiseCancelation = 0xf61f, + NoiseCancelationOff = 0xf620, + MusicSharing = 0xf623, + MusicSharingOff = 0xf624, + CircleShapeSolid = 0xf63c, + WifiCallBars = 0xf657, + WifiCall0 = 0xf658, + WifiCall1 = 0xf659, + WifiCall2 = 0xf65a, + WifiCall3 = 0xf65b, + WifiCall4 = 0xf65c, + CHTLanguageBar = 0xf69e, + ComposeMode = 0xf6a9, + ExpressiveInputEntry = 0xf6b8, + EmojiTabMoreSymbols = 0xf6ba, + WebSearch = 0xf6fa, + Kiosk = 0xf712, + RTTLogo = 0xf714, + VoiceCall = 0xf715, + GoToMessage = 0xf716, + ReturnToCall = 0xf71a, + StartPresenting = 0xf71c, + StopPresenting = 0xf71d, + ProductivityMode = 0xf71e, + SetHistoryStatus = 0xf738, + SetHistoryStatus2 = 0xf739, + Keyboardsettings20 = 0xf73d, + OneHandedRight20 = 0xf73e, + OneHandedLeft20 = 0xf73f, + Split20 = 0xf740, + Full20 = 0xf741, + Handwriting20 = 0xf742, + ChevronLeft20 = 0xf743, + ChevronLeft32 = 0xf744, + ChevronRight20 = 0xf745, + ChevronRight32 = 0xf746, + Event12 = 0xf763, + MicOff2 = 0xf781, + DeliveryOptimization = 0xf785, + CancelMedium = 0xf78a, + SearchMedium = 0xf78b, + AcceptMedium = 0xf78c, + RevealPasswordMedium = 0xf78d, + DeleteWord = 0xf7ad, + DeleteWordFill = 0xf7ae, + DeleteLines = 0xf7af, + DeleteLinesFill = 0xf7b0, + InstertWords = 0xf7b1, + InstertWordsFill = 0xf7b2, + JoinWords = 0xf7b3, + JoinWordsFill = 0xf7b4, + OverwriteWords = 0xf7b5, + OverwriteWordsFill = 0xf7b6, + AddNewLine = 0xf7b7, + AddNewLineFill = 0xf7b8, + OverwriteWordsKorean = 0xf7b9, + OverwriteWordsFillKorean = 0xf7ba, + EducationIcon = 0xf7bb, + WindowSnipping = 0xf7ed, + VideoCapture = 0xf7ee, + StatusSecured = 0xf809, + NarratorApp = 0xf83b, + PowerButtonUpdate = 0xf83d, + RestartUpdate = 0xf83e, + UpdateStatusDot = 0xf83f, + Eject = 0xf847, + Spelling = 0xf87b, + SpellingKorean = 0xf87c, + SpellingSerbian = 0xf87d, + SpellingChinese = 0xf87e, + FolderSelect = 0xf89a, + SmartScreen = 0xf8a5, + ExploitProtection = 0xf8a6, + AddBold = 0xf8aa, + SubtractBold = 0xf8ab, + BackSolidBold = 0xf8ac, + ForwardSolidBold = 0xf8ad, + PauseBold = 0xf8ae, + ClickSolid = 0xf8af, + SettingsSolid = 0xf8b0, + MicrophoneSolidBold = 0xf8b1, + SpeechSolidBold = 0xf8b2, + ClickedOutLoudSolidBold = 0xf8b3, + }; -#endif // DEF_H + Q_ENUM_NS(Fluent_AwesomeType) + + QML_NAMED_ELEMENT(FluentIcons) +} \ No newline at end of file diff --git a/src/FluAccentColor.cpp b/src/FluAccentColor.cpp index 976b7912..0d789f00 100644 --- a/src/FluAccentColor.cpp +++ b/src/FluAccentColor.cpp @@ -1,4 +1,5 @@ #include "FluAccentColor.h" -FluAccentColor::FluAccentColor(QObject *parent):QObject{parent}{ +FluAccentColor::FluAccentColor(QObject *parent) : QObject{parent} { + } diff --git a/src/FluAccentColor.h b/src/FluAccentColor.h index 7ad043ea..f8c2edda 100644 --- a/src/FluAccentColor.h +++ b/src/FluAccentColor.h @@ -1,5 +1,4 @@ -#ifndef FLUACCENTCOLOR_H -#define FLUACCENTCOLOR_H +#pragma once #include #include @@ -9,19 +8,17 @@ /** * @brief The FluAccentColor class */ -class FluAccentColor : public QObject -{ - Q_OBJECT - Q_PROPERTY_AUTO(QColor,darkest) - Q_PROPERTY_AUTO(QColor,darker) - Q_PROPERTY_AUTO(QColor,dark) - Q_PROPERTY_AUTO(QColor,normal) - Q_PROPERTY_AUTO(QColor,light) - Q_PROPERTY_AUTO(QColor,lighter) - Q_PROPERTY_AUTO(QColor,lightest) +class FluAccentColor : public QObject { +Q_OBJECT + +Q_PROPERTY_AUTO(QColor, darkest) +Q_PROPERTY_AUTO(QColor, darker) +Q_PROPERTY_AUTO(QColor, dark) +Q_PROPERTY_AUTO(QColor, normal) +Q_PROPERTY_AUTO(QColor, light) +Q_PROPERTY_AUTO(QColor, lighter) +Q_PROPERTY_AUTO(QColor, lightest) QML_NAMED_ELEMENT(FluAccentColor) public: explicit FluAccentColor(QObject *parent = nullptr); }; - -#endif // FLUACCENTCOLOR_H diff --git a/src/FluApp.cpp b/src/FluApp.cpp index 0c5c5b41..13bf6df7 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -10,22 +9,21 @@ #include #include -FluApp::FluApp(QObject *parent):QObject{parent}{ - useSystemAppBar(false); +FluApp::FluApp(QObject *parent) : QObject{parent} { + _useSystemAppBar = false; } -FluApp::~FluApp(){ -} +FluApp::~FluApp() = default; -void FluApp::init(QObject *target,QLocale locale){ +void FluApp::init(QObject *target, QLocale locale) { _locale = locale; _engine = qmlEngine(target); _translator = new QTranslator(this); qApp->installTranslator(_translator); const QStringList uiLanguages = _locale.uiLanguages(); - for (const QString &name : uiLanguages) { + for (const QString &name: uiLanguages) { const QString baseName = "fluentui_" + QLocale(name).name(); - if (_translator->load(":/qt/qml/FluentUI/i18n/"+ baseName)) { + if (_translator->load(":/qt/qml/FluentUI/i18n/" + baseName)) { _engine->retranslate(); break; } diff --git a/src/FluApp.h b/src/FluApp.h index 3af53db1..c291dbfc 100644 --- a/src/FluApp.h +++ b/src/FluApp.h @@ -1,5 +1,4 @@ -#ifndef FLUAPP_H -#define FLUAPP_H +#pragma once #include #include @@ -15,24 +14,28 @@ /** * @brief The FluApp class */ -class FluApp : public QObject -{ - Q_OBJECT - Q_PROPERTY_AUTO(bool,useSystemAppBar); - Q_PROPERTY_AUTO(QString,windowIcon); - Q_PROPERTY_AUTO(QLocale,locale); +class FluApp : public QObject { +Q_OBJECT + +Q_PROPERTY_AUTO(bool, useSystemAppBar) +Q_PROPERTY_AUTO(QString, windowIcon) +Q_PROPERTY_AUTO(QLocale, locale) QML_NAMED_ELEMENT(FluApp) QML_SINGLETON + private: explicit FluApp(QObject *parent = nullptr); - ~FluApp(); -public: - SINGLETON(FluApp) - static FluApp *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();} - Q_INVOKABLE void init(QObject *target,QLocale locale = QLocale::system()); -private: - QQmlEngine *_engine; - QTranslator* _translator = nullptr; -}; -#endif // FLUAPP_H + ~FluApp() override; + +public: +SINGLETON(FluApp) + + static FluApp *create(QQmlEngine *, QJSEngine *) { return getInstance(); } + + Q_INVOKABLE void init(QObject *target, QLocale locale = QLocale::system()); + +private: + QQmlEngine *_engine{}; + QTranslator *_translator = nullptr; +}; \ No newline at end of file diff --git a/src/FluCaptcha.cpp b/src/FluCaptcha.cpp index 7969010b..bc849009 100644 --- a/src/FluCaptcha.cpp +++ b/src/FluCaptcha.cpp @@ -3,74 +3,64 @@ #include #include #include -#include -FluCaptcha::FluCaptcha(QQuickItem *parent):QQuickPaintedItem(parent){ - ignoreCase(true); - QFont fontStype; - fontStype.setPixelSize(28); - fontStype.setBold(true); - font(fontStype); +int generaNumber(int number) { + return QRandomGenerator::global()->bounded(0, number); +} + +FluCaptcha::FluCaptcha(QQuickItem *parent) : QQuickPaintedItem(parent) { + _ignoreCase = false; + QFont fontStyle; + fontStyle.setPixelSize(28); + fontStyle.setBold(true); + font(fontStyle); setWidth(180); setHeight(80); refresh(); } -void FluCaptcha::paint(QPainter* painter){ +void FluCaptcha::paint(QPainter *painter) { painter->save(); - painter->fillRect(boundingRect().toRect(),QColor(255,255,255,255)); + painter->fillRect(boundingRect().toRect(), QColor(255, 255, 255, 255)); QPen pen; painter->setFont(_font); - for(int i=0;i<100;i++) - { - pen = QPen(QColor(_generaNumber(256),_generaNumber(256),_generaNumber(256))); + for (int i = 0; i < 100; i++) { + pen = QPen(QColor(generaNumber(256), generaNumber(256), generaNumber(256))); painter->setPen(pen); - painter->drawPoint(_generaNumber(180),_generaNumber(80)); + painter->drawPoint(generaNumber(180), generaNumber(80)); } - for(int i=0;i<5;i++) - { - pen = QPen(QColor(_generaNumber(256),_generaNumber(256),_generaNumber(256))); + for (int i = 0; i < 5; i++) { + pen = QPen(QColor(generaNumber(256), generaNumber(256), generaNumber(256))); painter->setPen(pen); - painter->drawLine(_generaNumber(180),_generaNumber(80),_generaNumber(180),_generaNumber(80)); + painter->drawLine(generaNumber(180), generaNumber(80), generaNumber(180), generaNumber(80)); } - for(int i=0;i<4;i++) - { - pen = QPen(QColor(_generaNumber(255),_generaNumber(255),_generaNumber(255))); + for (int i = 0; i < 4; i++) { + pen = QPen(QColor(generaNumber(255), generaNumber(255), generaNumber(255))); painter->setPen(pen); - painter->drawText(15+35*i,10+_generaNumber(15),30,40,Qt::AlignCenter, QString(_code[i])); + painter->drawText(15 + 35 * i, 10 + generaNumber(15), 30, 40, Qt::AlignCenter, QString(_code[i])); } painter->restore(); } -int FluCaptcha::_generaNumber(int number){ - return QRandomGenerator::global()->bounded(0,number); -} - -void FluCaptcha::refresh(){ +void FluCaptcha::refresh() { this->_code.clear(); - for(int i = 0;i < 4;++i) - { - int num = _generaNumber(3); - if(num == 0) - { - this->_code += QString::number(_generaNumber(10)); - } - else if(num == 1) - { + for (int i = 0; i < 4; ++i) { + int num = generaNumber(3); + if (num == 0) { + this->_code += QString::number(generaNumber(10)); + } else if (num == 1) { int temp = 'A'; - this->_code += static_cast(temp + _generaNumber(26)); - } - else if(num == 2) - { + this->_code += static_cast(temp + generaNumber(26)); + } else if (num == 2) { int temp = 'a'; - this->_code += static_cast(temp + _generaNumber(26)); + this->_code += static_cast(temp + generaNumber(26)); } } update(); } -bool FluCaptcha::verify(const QString& code){ - if(_ignoreCase){ +[[maybe_unused]] bool FluCaptcha::verify(const QString &code) { + if (_ignoreCase) { return this->_code.toUpper() == code.toUpper(); } return this->_code == code; diff --git a/src/FluCaptcha.h b/src/FluCaptcha.h index 4a260c5f..ea5b7e73 100644 --- a/src/FluCaptcha.h +++ b/src/FluCaptcha.h @@ -1,5 +1,4 @@ -#ifndef FLUCAPTCHA_H -#define FLUCAPTCHA_H +#pragma once #include #include @@ -9,21 +8,22 @@ /** * @brief The FluCaptcha class */ -class FluCaptcha : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY_AUTO(QFont,font); - Q_PROPERTY_AUTO(bool,ignoreCase); +class FluCaptcha : public QQuickPaintedItem { +Q_OBJECT + +Q_PROPERTY_AUTO(QFont, font); +Q_PROPERTY_AUTO(bool, ignoreCase); QML_NAMED_ELEMENT(FluCaptcha) -private: - int _generaNumber(int number); + public: explicit FluCaptcha(QQuickItem *parent = nullptr); - void paint(QPainter* painter) override; + + void paint(QPainter *painter) override; + Q_INVOKABLE void refresh(); - Q_INVOKABLE bool verify(const QString& code); + + Q_INVOKABLE [[maybe_unused]] bool verify(const QString &code); + private: QString _code; }; - -#endif // FLUCAPTCHA_H diff --git a/src/FluColors.cpp b/src/FluColors.cpp index 1aef487c..b332f9d2 100644 --- a/src/FluColors.cpp +++ b/src/FluColors.cpp @@ -1,35 +1,34 @@ #include "FluColors.h" #include "FluTools.h" -FluColors::FluColors(QObject *parent):QObject{parent}{ - Transparent(QColor(0, 0, 0, 0)); - Black(QColor(0, 0, 0)); - White(QColor(255, 255, 255)); - Grey10(QColor(250, 249, 248)); - Grey20(QColor(243, 242, 241)); - Grey30(QColor(237, 235, 233)); - Grey40(QColor(225, 223, 221)); - Grey50(QColor(210, 208, 206)); - Grey60(QColor(200, 198, 196)); - Grey70(QColor(190, 185, 184)); - Grey80(QColor(179, 176, 173)); - Grey90(QColor(161, 159, 157)); - Grey100(QColor(151, 149, 146)); - Grey110(QColor(138, 136, 134)); - Grey120(QColor(121, 119, 117)); - Grey130(QColor(96, 94, 92)); - Grey140(QColor(72, 70, 68)); - Grey150(QColor(59, 58, 57)); - Grey160(QColor(50, 49, 48)); - Grey170(QColor(41, 40, 39)); - Grey180(QColor(37, 36, 35)); - Grey190(QColor(32, 31, 30)); - Grey200(QColor(27, 26, 25)); - Grey210(QColor(22, 21, 20)); - Grey220(QColor(17, 16, 15)); +FluColors::FluColors(QObject *parent) : QObject{parent} { + _Transparent = QColor(0, 0, 0, 0); + _Black = QColor(0, 0, 0); + _White = QColor(255, 255, 255); + _Grey10 = QColor(250, 249, 248); + _Grey20 = QColor(243, 242, 241); + _Grey30 = QColor(237, 235, 233); + _Grey40 = QColor(225, 223, 221); + _Grey50 = QColor(210, 208, 206); + _Grey60 = QColor(200, 198, 196); + _Grey70 = QColor(190, 185, 184); + _Grey80 = QColor(179, 176, 173); + _Grey90 = QColor(161, 159, 157); + _Grey100 = QColor(151, 149, 146); + _Grey110 = QColor(138, 136, 134); + _Grey120 = QColor(121, 119, 117); + _Grey130 = QColor(96, 94, 92); + _Grey140 = QColor(72, 70, 68); + _Grey150 = QColor(59, 58, 57); + _Grey160 = QColor(50, 49, 48); + _Grey170 = QColor(41, 40, 39); + _Grey180 = QColor(37, 36, 35); + _Grey190 = QColor(32, 31, 30); + _Grey200 = QColor(27, 26, 25); + _Grey210 = QColor(22, 21, 20); + _Grey220 = QColor(17, 16, 15); - - FluAccentColor *yellow = new FluAccentColor(this); + auto yellow = new FluAccentColor(this); yellow->darkest(QColor(249, 168, 37)); yellow->darker(QColor(251, 192, 45)); yellow->dark(QColor(253, 212, 53)); @@ -37,9 +36,9 @@ FluColors::FluColors(QObject *parent):QObject{parent}{ yellow->light(QColor(255, 238, 88)); yellow->lighter(QColor(255, 241, 118)); yellow->lightest(QColor(255, 245, 155)); - Yellow(yellow); + _Yellow = yellow; - FluAccentColor *orange = new FluAccentColor(this); + auto orange = new FluAccentColor(this); orange->darkest(QColor(153, 61, 7)); orange->darker(QColor(172, 68, 8)); orange->dark(QColor(209, 88, 10)); @@ -47,9 +46,9 @@ FluColors::FluColors(QObject *parent):QObject{parent}{ orange->light(QColor(248, 122, 48)); orange->lighter(QColor(249, 145, 84)); orange->lightest(QColor(250, 192, 106)); - Orange(orange); + _Orange = orange; - FluAccentColor *red = new FluAccentColor(this); + auto red = new FluAccentColor(this); red->darkest(QColor(143, 10, 21)); red->darker(QColor(162, 11, 24)); red->dark(QColor(185, 13, 28)); @@ -57,9 +56,9 @@ FluColors::FluColors(QObject *parent):QObject{parent}{ red->light(QColor(236, 64, 79)); red->lighter(QColor(238, 88, 101)); red->lightest(QColor(240, 107, 118)); - Red(red); + _Red = red; - FluAccentColor *magenta = new FluAccentColor(this); + auto magenta = new FluAccentColor(this); magenta->darkest(QColor(111, 0, 79)); magenta->darker(QColor(160, 7, 108)); magenta->dark(QColor(181, 13, 125)); @@ -67,9 +66,9 @@ FluColors::FluColors(QObject *parent):QObject{parent}{ magenta->light(QColor(234, 77, 168)); magenta->lighter(QColor(238, 110, 193)); magenta->lightest(QColor(241, 140, 213)); - Magenta(magenta); + _Magenta = magenta; - FluAccentColor *purple = new FluAccentColor(this); + auto purple = new FluAccentColor(this); purple->darkest(QColor(44, 15, 118)); purple->darker(QColor(61, 15, 153)); purple->dark(QColor(78, 17, 174)); @@ -77,9 +76,9 @@ FluColors::FluColors(QObject *parent):QObject{parent}{ purple->light(QColor(123, 76, 157)); purple->lighter(QColor(141, 110, 189)); purple->lightest(QColor(158, 142, 217)); - Purple(purple); + _Purple = purple; - FluAccentColor *blue = new FluAccentColor(this); + auto blue = new FluAccentColor(this); blue->darkest(QColor(0, 74, 131)); blue->darker(QColor(0, 84, 148)); blue->dark(QColor(0, 102, 180)); @@ -87,9 +86,9 @@ FluColors::FluColors(QObject *parent):QObject{parent}{ blue->light(QColor(38, 140, 220)); blue->lighter(QColor(76, 160, 224)); blue->lightest(QColor(96, 171, 228)); - Blue(blue); + _Blue = blue; - FluAccentColor *teal = new FluAccentColor(this); + auto teal = new FluAccentColor(this); teal->darkest(QColor(0, 110, 91)); teal->darker(QColor(0, 124, 103)); teal->dark(QColor(0, 151, 125)); @@ -97,9 +96,9 @@ FluColors::FluColors(QObject *parent):QObject{parent}{ teal->light(QColor(38, 189, 164)); teal->lighter(QColor(77, 201, 180)); teal->lightest(QColor(96, 207, 188)); - Teal(teal); + _Teal = teal; - FluAccentColor *green = new FluAccentColor(this); + auto green = new FluAccentColor(this); green->darkest(QColor(9, 76, 9)); green->darker(QColor(12, 93, 12)); green->dark(QColor(14, 111, 14)); @@ -107,17 +106,17 @@ FluColors::FluColors(QObject *parent):QObject{parent}{ green->light(QColor(39, 137, 57)); green->lighter(QColor(76, 156, 76)); green->lightest(QColor(106, 173, 106)); - Green(green); + _Green = green; } -FluAccentColor* FluColors::createAccentColor(QColor primaryColor){ - FluAccentColor *accentColor = new FluAccentColor(this); - accentColor->darkest(FluTools::getInstance()->withOpacity(primaryColor,0.7)); - accentColor->darker(FluTools::getInstance()->withOpacity(primaryColor,0.8)); - accentColor->dark(FluTools::getInstance()->withOpacity(primaryColor,0.9)); +[[maybe_unused]] FluAccentColor *FluColors::createAccentColor(QColor primaryColor) { + auto accentColor = new FluAccentColor(this); + accentColor->darkest(FluTools::getInstance()->withOpacity(primaryColor, 0.7)); + accentColor->darker(FluTools::getInstance()->withOpacity(primaryColor, 0.8)); + accentColor->dark(FluTools::getInstance()->withOpacity(primaryColor, 0.9)); accentColor->normal(primaryColor); - accentColor->light(FluTools::getInstance()->withOpacity(primaryColor,0.9)); - accentColor->lighter(FluTools::getInstance()->withOpacity(primaryColor,0.8)); - accentColor->lightest(FluTools::getInstance()->withOpacity(primaryColor,0.7)); + accentColor->light(FluTools::getInstance()->withOpacity(primaryColor, 0.9)); + accentColor->lighter(FluTools::getInstance()->withOpacity(primaryColor, 0.8)); + accentColor->lightest(FluTools::getInstance()->withOpacity(primaryColor, 0.7)); return accentColor; } diff --git a/src/FluColors.h b/src/FluColors.h index 9dc45f23..8568ec5f 100644 --- a/src/FluColors.h +++ b/src/FluColors.h @@ -1,5 +1,4 @@ -#ifndef FLUCOLORS_H -#define FLUCOLORS_H +#pragma once #include #include @@ -11,50 +10,52 @@ /** * @brief The FluColors class */ -class FluColors : public QObject -{ - Q_OBJECT - Q_PROPERTY_AUTO(QColor,Transparent); - Q_PROPERTY_AUTO(QColor,Black); - Q_PROPERTY_AUTO(QColor,White); - Q_PROPERTY_AUTO(QColor,Grey10); - Q_PROPERTY_AUTO(QColor,Grey20); - Q_PROPERTY_AUTO(QColor,Grey30); - Q_PROPERTY_AUTO(QColor,Grey40); - Q_PROPERTY_AUTO(QColor,Grey50); - Q_PROPERTY_AUTO(QColor,Grey60); - Q_PROPERTY_AUTO(QColor,Grey70); - Q_PROPERTY_AUTO(QColor,Grey80); - Q_PROPERTY_AUTO(QColor,Grey90); - Q_PROPERTY_AUTO(QColor,Grey100); - Q_PROPERTY_AUTO(QColor,Grey110); - Q_PROPERTY_AUTO(QColor,Grey120); - Q_PROPERTY_AUTO(QColor,Grey130); - Q_PROPERTY_AUTO(QColor,Grey140); - Q_PROPERTY_AUTO(QColor,Grey150); - Q_PROPERTY_AUTO(QColor,Grey160); - Q_PROPERTY_AUTO(QColor,Grey170); - Q_PROPERTY_AUTO(QColor,Grey180); - Q_PROPERTY_AUTO(QColor,Grey190); - Q_PROPERTY_AUTO(QColor,Grey200); - Q_PROPERTY_AUTO(QColor,Grey210); - Q_PROPERTY_AUTO(QColor,Grey220); - Q_PROPERTY_AUTO(FluAccentColor*,Yellow); - Q_PROPERTY_AUTO(FluAccentColor*,Orange); - Q_PROPERTY_AUTO(FluAccentColor*,Red); - Q_PROPERTY_AUTO(FluAccentColor*,Magenta); - Q_PROPERTY_AUTO(FluAccentColor*,Purple); - Q_PROPERTY_AUTO(FluAccentColor*,Blue); - Q_PROPERTY_AUTO(FluAccentColor*,Teal); - Q_PROPERTY_AUTO(FluAccentColor*,Green); +class FluColors : public QObject { +Q_OBJECT + +Q_PROPERTY_AUTO(QColor, Transparent); +Q_PROPERTY_AUTO(QColor, Black); +Q_PROPERTY_AUTO(QColor, White); +Q_PROPERTY_AUTO(QColor, Grey10); +Q_PROPERTY_AUTO(QColor, Grey20); +Q_PROPERTY_AUTO(QColor, Grey30); +Q_PROPERTY_AUTO(QColor, Grey40); +Q_PROPERTY_AUTO(QColor, Grey50); +Q_PROPERTY_AUTO(QColor, Grey60); +Q_PROPERTY_AUTO(QColor, Grey70); +Q_PROPERTY_AUTO(QColor, Grey80); +Q_PROPERTY_AUTO(QColor, Grey90); +Q_PROPERTY_AUTO(QColor, Grey100); +Q_PROPERTY_AUTO(QColor, Grey110); +Q_PROPERTY_AUTO(QColor, Grey120); +Q_PROPERTY_AUTO(QColor, Grey130); +Q_PROPERTY_AUTO(QColor, Grey140); +Q_PROPERTY_AUTO(QColor, Grey150); +Q_PROPERTY_AUTO(QColor, Grey160); +Q_PROPERTY_AUTO(QColor, Grey170); +Q_PROPERTY_AUTO(QColor, Grey180); +Q_PROPERTY_AUTO(QColor, Grey190); +Q_PROPERTY_AUTO(QColor, Grey200); +Q_PROPERTY_AUTO(QColor, Grey210); +Q_PROPERTY_AUTO(QColor, Grey220); +Q_PROPERTY_AUTO_P(FluAccentColor*, Yellow); +Q_PROPERTY_AUTO_P(FluAccentColor*, Orange); +Q_PROPERTY_AUTO_P(FluAccentColor*, Red); +Q_PROPERTY_AUTO_P(FluAccentColor*, Magenta); +Q_PROPERTY_AUTO_P(FluAccentColor*, Purple); +Q_PROPERTY_AUTO_P(FluAccentColor*, Blue); +Q_PROPERTY_AUTO_P(FluAccentColor*, Teal); +Q_PROPERTY_AUTO_P(FluAccentColor*, Green); QML_NAMED_ELEMENT(FluColors) QML_SINGLETON + private: explicit FluColors(QObject *parent = nullptr); -public: - SINGLETON(FluColors) - Q_INVOKABLE FluAccentColor* createAccentColor(QColor primaryColor); - static FluColors *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();} -}; -#endif // FLUCOLORS_H +public: +SINGLETON(FluColors) + + Q_INVOKABLE [[maybe_unused]] FluAccentColor *createAccentColor(QColor primaryColor); + + static FluColors *create(QQmlEngine *, QJSEngine *) { return getInstance(); } +}; \ No newline at end of file diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index ac0d1e30..7448f8ea 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -6,130 +6,140 @@ #include #ifdef Q_OS_WIN -#pragma comment (lib,"user32.lib") -#pragma comment (lib,"dwmapi.lib") +#pragma comment (lib, "user32.lib") +#pragma comment (lib, "dwmapi.lib") + #include #include #include -static inline QByteArray qtNativeEventType() -{ + +static inline QByteArray qtNativeEventType() { static const auto result = "windows_generic_MSG"; return result; } -static inline bool isCompositionEnabled(){ - typedef HRESULT (WINAPI* DwmIsCompositionEnabledPtr)(BOOL *pfEnabled); + +static inline bool isCompositionEnabled() { + typedef HRESULT (WINAPI *DwmIsCompositionEnabledPtr)(BOOL *pfEnabled); HMODULE module = ::LoadLibraryW(L"dwmapi.dll"); - if (module) - { + if (module) { BOOL composition_enabled = false; DwmIsCompositionEnabledPtr dwm_is_composition_enabled; - dwm_is_composition_enabled= reinterpret_cast(::GetProcAddress(module, "DwmIsCompositionEnabled")); - if (dwm_is_composition_enabled) - { + dwm_is_composition_enabled = reinterpret_cast(::GetProcAddress(module, "DwmIsCompositionEnabled")); + if (dwm_is_composition_enabled) { dwm_is_composition_enabled(&composition_enabled); } return composition_enabled; } return false; } + #endif -FluFrameless::FluFrameless(QQuickItem *parent) - : QQuickItem{parent} -{ - appbar(nullptr); - maximizeButton(nullptr); - minimizedButton(nullptr); - closeButton(nullptr); - topmost(false); - disabled(false); +bool containsCursorToItem(QQuickItem *item) { + if (!item || !item->isVisible()) { + return false; + } + auto point = QCursor::pos(); + auto rect = QRectF(item->mapToGlobal(QPoint(0, 0)), item->size()); + if (point.x() > rect.x() && point.x() < (rect.x() + rect.width()) && point.y() > rect.y() && point.y() < (rect.y() + rect.height())) { + return true; + } + return false; } -FluFrameless::~FluFrameless(){ +FluFrameless::FluFrameless(QQuickItem *parent) : QQuickItem{parent} { + _fixSize = false; + _appbar = nullptr; + _maximizeButton = nullptr; + _minimizedButton = nullptr; + _closeButton = nullptr; + _topmost = false; + _disabled = false; } -void FluFrameless::onDestruction(){ - qApp->removeNativeEventFilter(this); +FluFrameless::~FluFrameless() = default; + +[[maybe_unused]] void FluFrameless::onDestruction() { + QGuiApplication::instance()->removeNativeEventFilter(this); } -void FluFrameless::componentComplete(){ - if(_disabled){ +void FluFrameless::componentComplete() { + if (_disabled) { return; } _current = window()->winId(); - window()->setFlags(( window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint); -#if QT_VERSION < QT_VERSION_CHECK(6,0,0) - if(QQuickWindow::sceneGraphBackend() == "software"){ - window()->setFlag(Qt::FramelessWindowHint,false); + window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + if (QQuickWindow::sceneGraphBackend() == "software") { + window()->setFlag(Qt::FramelessWindowHint, false); } #endif - if(!_fixSize){ + if (!_fixSize) { window()->setFlag(Qt::WindowMaximizeButtonHint); } window()->installEventFilter(this); - qApp->installNativeEventFilter(this); - if(_maximizeButton){ + QGuiApplication::instance()->installNativeEventFilter(this); + if (_maximizeButton) { setHitTestVisible(_maximizeButton); } - if(_minimizedButton){ + if (_minimizedButton) { setHitTestVisible(_minimizedButton); } - if(_closeButton){ + if (_closeButton) { setHitTestVisible(_closeButton); } #ifdef Q_OS_WIN HWND hwnd = reinterpret_cast(window()->winId()); DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE); - if(_fixSize){ + if (_fixSize) { ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME); - for (int i = 0; i < qApp->screens().count(); ++i) { - connect( qApp->screens().at(i),&QScreen::logicalDotsPerInchChanged,this,[=]{ - SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED); + for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) { + connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] { + SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED); }); } - }else{ + } else { ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME); } - SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - connect(window(),&QQuickWindow::screenChanged,this,[hwnd]{ - ::SetWindowPos(hwnd,0,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOOWNERZORDER); - ::RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + connect(window(), &QQuickWindow::screenChanged, this, [hwnd] { + ::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOOWNERZORDER); + ::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); }); #endif - connect(this,&FluFrameless::topmostChanged,this,[this]{ + connect(this, &FluFrameless::topmostChanged, this, [this] { _setWindowTopmost(topmost()); }); _setWindowTopmost(topmost()); } -bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message, QT_NATIVE_EVENT_RESULT_TYPE *result){ +[[maybe_unused]] bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message, QT_NATIVE_EVENT_RESULT_TYPE *result) { #ifdef Q_OS_WIN if ((eventType != qtNativeEventType()) || !message) { return false; } const auto msg = static_cast(message); - const HWND hwnd = msg->hwnd; - if (!hwnd || !msg) { + auto hwnd = msg->hwnd; + if (!hwnd) { return false; } - const qint64 wid = reinterpret_cast(hwnd); - if(wid != _current){ + const quint64 wid = reinterpret_cast(hwnd); + if (wid != _current) { return false; } - const UINT uMsg = msg->message; - const WPARAM wParam = msg->wParam; - const LPARAM lParam = msg->lParam; + const auto uMsg = msg->message; + const auto wParam = msg->wParam; + const auto lParam = msg->lParam; static QPoint offsetXY; - if(uMsg == WM_WINDOWPOSCHANGING){ - WINDOWPOS* wp = reinterpret_cast(lParam); - if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) - { + if (uMsg == WM_WINDOWPOSCHANGING) { + auto *wp = reinterpret_cast(lParam); + if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) { wp->flags |= SWP_NOCOPYBITS; *result = ::DefWindowProcW(hwnd, uMsg, wParam, lParam); return true; } return false; - }else if(uMsg == WM_NCCALCSIZE){ + } else if (uMsg == WM_NCCALCSIZE) { const auto clientRect = ((wParam == FALSE) ? reinterpret_cast(lParam) : &(reinterpret_cast(lParam))->rgrc[0]); const LONG originalTop = clientRect->top; const LONG originalLeft = clientRect->left; @@ -140,28 +150,35 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message, *result = hitTestResult; return true; } - int offsetSize = 0; + int offsetSize; bool isMaximum = ::IsZoomed(hwnd); - offsetXY = QPoint(abs(clientRect->left - originalLeft),abs(clientRect->top - originalTop)); - if(isMaximum || _isFullScreen()){ + offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop)); + if (isMaximum || _isFullScreen()) { offsetSize = 0; - }else{ + } else { offsetSize = 1; } - if(!isCompositionEnabled()){ + if (!isCompositionEnabled()) { offsetSize = 0; } - if (!isMaximum || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + if (!isMaximum) { clientRect->top = originalTop + offsetSize; clientRect->bottom = originalBottom - offsetSize; clientRect->left = originalLeft + offsetSize; clientRect->right = originalRight - offsetSize; } +#else + clientRect->top = originalTop + offsetSize; + clientRect->bottom = originalBottom - offsetSize; + clientRect->left = originalLeft + offsetSize; + clientRect->right = originalRight - offsetSize; +#endif _setMaximizeHovered(false); *result = WVR_REDRAW; return true; - }else if(uMsg == WM_NCHITTEST){ - if(_hitMaximizeButton()){ + } else if (uMsg == WM_NCHITTEST) { + if (_hitMaximizeButton()) { if (*result == HTNOWHERE) { *result = HTZOOM; } @@ -176,8 +193,8 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message, ::ScreenToClient(hwnd, &nativeLocalPos); RECT clientRect{0, 0, 0, 0}; ::GetClientRect(hwnd, &clientRect); - auto clientWidth = clientRect.right-clientRect.left; - auto clientHeight = clientRect.bottom-clientRect.top; + auto clientWidth = clientRect.right - clientRect.left; + auto clientHeight = clientRect.bottom - clientRect.top; bool left = nativeLocalPos.x < _margins; bool right = nativeLocalPos.x > clientWidth - _margins; bool top = nativeLocalPos.y < _margins; @@ -205,59 +222,59 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message, if (0 != *result) { return true; } - if(_hitAppBar()){ + if (_hitAppBar()) { *result = HTCAPTION; return true; } *result = HTCLIENT; return true; - }else if(uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN){ - if(_hitMaximizeButton()){ + } else if (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN) { + if (_hitMaximizeButton()) { QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - QGuiApplication::sendEvent(_maximizeButton,&event); + QGuiApplication::sendEvent(_maximizeButton, &event); _setMaximizePressed(true); return true; } - }else if(uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP){ - if(_hitMaximizeButton()){ + } else if (uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP) { + if (_hitMaximizeButton()) { QMouseEvent event = QMouseEvent(QEvent::MouseButtonRelease, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - QGuiApplication::sendEvent(_maximizeButton,&event); + QGuiApplication::sendEvent(_maximizeButton, &event); _setMaximizePressed(false); return true; } - }else if(uMsg == WM_NCPAINT){ + } else if (uMsg == WM_NCPAINT) { *result = FALSE; return true; - }else if(uMsg == WM_NCACTIVATE){ + } else if (uMsg == WM_NCACTIVATE) { *result = ::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1); return true; - }else if(uMsg == WM_GETMINMAXINFO){ - MINMAXINFO* minmaxInfo = reinterpret_cast(lParam); + } else if (uMsg == WM_GETMINMAXINFO) { + auto *minmaxInfo = reinterpret_cast(lParam); auto pixelRatio = window()->devicePixelRatio(); auto geometry = window()->screen()->availableGeometry(); RECT rect; SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); minmaxInfo->ptMaxPosition.x = rect.left - offsetXY.x(); minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x(); - minmaxInfo->ptMaxSize.x = geometry.width()*pixelRatio + offsetXY.x() * 2; - minmaxInfo->ptMaxSize.y = geometry.height()*pixelRatio + offsetXY.y() * 2; + minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2; + minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio) + offsetXY.y() * 2; return false; - }else if(uMsg == WM_NCRBUTTONDOWN){ + } else if (uMsg == WM_NCRBUTTONDOWN) { if (wParam == HTCAPTION) { _showSystemMenu(QCursor::pos()); } - }else if(uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN){ + } else if (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN) { const bool altPressed = ((wParam == VK_MENU) || (::GetKeyState(VK_MENU) < 0)); const bool spacePressed = ((wParam == VK_SPACE) || (::GetKeyState(VK_SPACE) < 0)); if (altPressed && spacePressed) { auto pos = window()->position(); - _showSystemMenu(QPoint(pos.x(),pos.y()+_appbar->height())); + _showSystemMenu(QPoint(pos.x(), qRound(pos.y() + _appbar->height()))); } - }else if(uMsg == WM_SYSCOMMAND){ - if(wParam == SC_MINIMIZE){ - if(window()->transientParent()){ + } else if (uMsg == WM_SYSCOMMAND) { + if (wParam == SC_MINIMIZE) { + if (window()->transientParent()) { window()->transientParent()->showMinimized(); - }else{ + } else { window()->showMinimized(); } return true; @@ -265,143 +282,136 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message, return false; } return false; -#endif +#else return false; +#endif } -bool FluFrameless::_isMaximized(){ +bool FluFrameless::_isMaximized() { return window()->visibility() == QWindow::Maximized; } -bool FluFrameless::_isFullScreen(){ +bool FluFrameless::_isFullScreen() { return window()->visibility() == QWindow::FullScreen; } -void FluFrameless::_showSystemMenu(QPoint point){ +void FluFrameless::_showSystemMenu(QPoint point) { #ifdef Q_OS_WIN HWND hwnd = reinterpret_cast(window()->winId()); - DWORD style = ::GetWindowLongPtr(hwnd,GWL_STYLE); + DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE); ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_SYSMENU); - const HMENU hMenu = ::GetSystemMenu(hwnd, FALSE); - if(_isMaximized() || _isFullScreen()){ - ::EnableMenuItem(hMenu,SC_MOVE,MFS_DISABLED); - ::EnableMenuItem(hMenu,SC_RESTORE,MFS_ENABLED); - }else{ - ::EnableMenuItem(hMenu,SC_MOVE,MFS_ENABLED); - ::EnableMenuItem(hMenu,SC_RESTORE,MFS_DISABLED); + auto hMenu = ::GetSystemMenu(hwnd, FALSE); + if (_isMaximized() || _isFullScreen()) { + ::EnableMenuItem(hMenu, SC_MOVE, MFS_DISABLED); + ::EnableMenuItem(hMenu, SC_RESTORE, MFS_ENABLED); + } else { + ::EnableMenuItem(hMenu, SC_MOVE, MFS_ENABLED); + ::EnableMenuItem(hMenu, SC_RESTORE, MFS_DISABLED); } - if(!_fixSize && !_isMaximized() && !_isFullScreen()){ - ::EnableMenuItem(hMenu,SC_SIZE,MFS_ENABLED); - ::EnableMenuItem(hMenu,SC_MAXIMIZE,MFS_ENABLED); - }else{ - ::EnableMenuItem(hMenu,SC_SIZE,MFS_DISABLED); - ::EnableMenuItem(hMenu,SC_MAXIMIZE,MFS_DISABLED); + if (!_fixSize && !_isMaximized() && !_isFullScreen()) { + ::EnableMenuItem(hMenu, SC_SIZE, MFS_ENABLED); + ::EnableMenuItem(hMenu, SC_MAXIMIZE, MFS_ENABLED); + } else { + ::EnableMenuItem(hMenu, SC_SIZE, MFS_DISABLED); + ::EnableMenuItem(hMenu, SC_MAXIMIZE, MFS_DISABLED); } - const int result = ::TrackPopupMenu(hMenu, (TPM_RETURNCMD | (QGuiApplication::isRightToLeft() ? TPM_RIGHTALIGN : TPM_LEFTALIGN)), point.x()*window()->devicePixelRatio(), point.y()*window()->devicePixelRatio(), 0, hwnd, nullptr); + const int result = ::TrackPopupMenu(hMenu, (TPM_RETURNCMD | (QGuiApplication::isRightToLeft() ? TPM_RIGHTALIGN : TPM_LEFTALIGN)), qRound(point.x() * window()->devicePixelRatio()), + qRound(point.y() * window()->devicePixelRatio()), 0, hwnd, nullptr); if (result != FALSE) { ::PostMessageW(hwnd, WM_SYSCOMMAND, result, 0); } - ::SetWindowLongPtr(hwnd, GWL_STYLE, style &~ WS_SYSMENU); + ::SetWindowLongPtr(hwnd, GWL_STYLE, style & ~WS_SYSMENU); #endif } -bool FluFrameless::_containsCursorToItem(QQuickItem* item){ - if(!item || !item->isVisible()){ - return false; - } - auto point = QCursor::pos(); - auto rect = QRectF(item->mapToGlobal(QPoint(0,0)),item->size()); - if(point.x()>rect.x() && point.x()<(rect.x()+rect.width()) && point.y()>rect.y() && point.y()<(rect.y()+rect.height())){ - return true; - } - return false; -} - -bool FluFrameless::_hitAppBar(){ - foreach (auto item, _hitTestList) { - if(_containsCursorToItem(item)){ +bool FluFrameless::_hitAppBar() { + for (int i = 0; i <= _hitTestList.size() - 1; ++i) { + auto item = _hitTestList.at(i); + if (containsCursorToItem(item)) { return false; } } - if(_containsCursorToItem(_appbar)){ + if (containsCursorToItem(_appbar)) { return true; } return false; } -bool FluFrameless::_hitMaximizeButton(){ - if(_containsCursorToItem(_maximizeButton)){ +bool FluFrameless::_hitMaximizeButton() { + if (containsCursorToItem(_maximizeButton)) { return true; } return false; } -void FluFrameless::_setMaximizePressed(bool val){ - _maximizeButton->setProperty("down",val); +void FluFrameless::_setMaximizePressed(bool val) { + _maximizeButton->setProperty("down", val); } -void FluFrameless::_setMaximizeHovered(bool val){ - _maximizeButton->setProperty("hover",val); +void FluFrameless::_setMaximizeHovered(bool val) { + _maximizeButton->setProperty("hover", val); } -void FluFrameless::_updateCursor(int edges){ +void FluFrameless::_updateCursor(int edges) { switch (edges) { - case 0: - window()->setCursor(Qt::ArrowCursor); - break; - case Qt::LeftEdge: - case Qt::RightEdge: - window()->setCursor(Qt::SizeHorCursor); - break; - case Qt::TopEdge: - case Qt::BottomEdge: - window()->setCursor(Qt::SizeVerCursor); - break; - case Qt::LeftEdge | Qt::TopEdge: - case Qt::RightEdge | Qt::BottomEdge: - window()->setCursor(Qt::SizeFDiagCursor); - break; - case Qt::RightEdge | Qt::TopEdge: - case Qt::LeftEdge | Qt::BottomEdge: - window()->setCursor(Qt::SizeBDiagCursor); - break; + case 0: + window()->setCursor(Qt::ArrowCursor); + break; + case Qt::LeftEdge: + case Qt::RightEdge: + window()->setCursor(Qt::SizeHorCursor); + break; + case Qt::TopEdge: + case Qt::BottomEdge: + window()->setCursor(Qt::SizeVerCursor); + break; + case Qt::LeftEdge | Qt::TopEdge: + case Qt::RightEdge | Qt::BottomEdge: + window()->setCursor(Qt::SizeFDiagCursor); + break; + case Qt::RightEdge | Qt::TopEdge: + case Qt::LeftEdge | Qt::BottomEdge: + window()->setCursor(Qt::SizeBDiagCursor); + break; + default: + break; } } -void FluFrameless::showFullScreen(){ +[[maybe_unused]] void FluFrameless::showFullScreen() { window()->showFullScreen(); } -void FluFrameless::showMaximized(){ +void FluFrameless::showMaximized() { #ifdef Q_OS_WIN HWND hwnd = reinterpret_cast(window()->winId()); - ::ShowWindow(hwnd,3); + ::ShowWindow(hwnd, 3); #else window()->showMaximized(); #endif } -void FluFrameless::showMinimized(){ +[[maybe_unused]] void FluFrameless::showMinimized() { window()->showMinimized(); } -void FluFrameless::showNormal(){ +void FluFrameless::showNormal() { window()->showNormal(); } -void FluFrameless::setHitTestVisible(QQuickItem* val){ - if(!_hitTestList.contains(val)){ +void FluFrameless::setHitTestVisible(QQuickItem *val) { + if (!_hitTestList.contains(val)) { _hitTestList.append(val); } } -void FluFrameless::_setWindowTopmost(bool topmost){ +void FluFrameless::_setWindowTopmost(bool topmost) { #ifdef Q_OS_WIN HWND hwnd = reinterpret_cast(window()->winId()); - if(topmost){ + if (topmost) { ::SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - }else{ + } else { ::SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } #else @@ -409,7 +419,7 @@ void FluFrameless::_setWindowTopmost(bool topmost){ #endif } -bool FluFrameless::eventFilter(QObject *obj, QEvent *ev){ +bool FluFrameless::eventFilter(QObject *obj, QEvent *ev) { #ifndef Q_OS_WIN switch (ev->type()) { case QEvent::MouseButtonPress: diff --git a/src/FluFrameless.h b/src/FluFrameless.h index cce2d0ed..60afec2f 100644 --- a/src/FluFrameless.h +++ b/src/FluFrameless.h @@ -1,5 +1,4 @@ -#ifndef FLUFRAMELESS_H -#define FLUFRAMELESS_H +#pragma once #include #include @@ -15,47 +14,63 @@ using QT_ENTER_EVENT_TYPE = QEvent; #endif -class FluFrameless : public QQuickItem,QAbstractNativeEventFilter -{ - Q_OBJECT - Q_PROPERTY_AUTO(QQuickItem*,appbar) - Q_PROPERTY_AUTO(bool,topmost) - Q_PROPERTY_AUTO(QQuickItem*,maximizeButton) - Q_PROPERTY_AUTO(QQuickItem*,minimizedButton) - Q_PROPERTY_AUTO(QQuickItem*,closeButton) - Q_PROPERTY_AUTO(bool,disabled) - Q_PROPERTY_AUTO(bool,fixSize) +class FluFrameless : public QQuickItem, QAbstractNativeEventFilter { +Q_OBJECT +Q_PROPERTY_AUTO_P(QQuickItem*, appbar) +Q_PROPERTY_AUTO_P(QQuickItem*, maximizeButton) +Q_PROPERTY_AUTO_P(QQuickItem*, minimizedButton) +Q_PROPERTY_AUTO_P(QQuickItem*, closeButton) +Q_PROPERTY_AUTO(bool, topmost) +Q_PROPERTY_AUTO(bool, disabled) +Q_PROPERTY_AUTO(bool, fixSize) QML_NAMED_ELEMENT(FluFrameless) public: - explicit FluFrameless(QQuickItem* parent = nullptr); - ~FluFrameless(); + explicit FluFrameless(QQuickItem *parent = nullptr); + + ~FluFrameless() override; + void componentComplete() override; - bool nativeEventFilter(const QByteArray &eventType, void *message, QT_NATIVE_EVENT_RESULT_TYPE *result) override; - Q_INVOKABLE void showFullScreen(); + + [[maybe_unused]] bool nativeEventFilter(const QByteArray &eventType, void *message, QT_NATIVE_EVENT_RESULT_TYPE *result) override; + + Q_INVOKABLE [[maybe_unused]] void showFullScreen(); + Q_INVOKABLE void showMaximized(); - Q_INVOKABLE void showMinimized(); + + Q_INVOKABLE [[maybe_unused]] void showMinimized(); + Q_INVOKABLE void showNormal(); - Q_INVOKABLE void setHitTestVisible(QQuickItem*); - Q_INVOKABLE void onDestruction(); + + Q_INVOKABLE void setHitTestVisible(QQuickItem *); + + Q_INVOKABLE [[maybe_unused]] void onDestruction(); + protected: bool eventFilter(QObject *obj, QEvent *event) override; + private: bool _isFullScreen(); + bool _isMaximized(); + void _updateCursor(int edges); + void _setWindowTopmost(bool topmost); + void _showSystemMenu(QPoint point); - bool _containsCursorToItem(QQuickItem* item); + bool _hitAppBar(); + bool _hitMaximizeButton(); + void _setMaximizePressed(bool val); + void _setMaximizeHovered(bool val); + private: - qint64 _current; + quint64 _current = 0; int _edges = 0; int _margins = 8; - qint64 _clickTimer = 0; + quint64 _clickTimer = 0; QList> _hitTestList; -}; - -#endif // FLUFRAMELESS_H +}; \ No newline at end of file diff --git a/src/FluQrCodeItem.cpp b/src/FluQrCodeItem.cpp index f8ccd9ed..5a0ce90f 100644 --- a/src/FluQrCodeItem.cpp +++ b/src/FluQrCodeItem.cpp @@ -2,51 +2,47 @@ #include "qrcode/qrencode.h" -FluQrCodeItem::FluQrCodeItem(QQuickItem* parent):QQuickPaintedItem(parent){ - color(QColor(0,0,0,255)); - bgColor(QColor(255,255,255,255)); - size(100); +FluQrCodeItem::FluQrCodeItem(QQuickItem *parent) : QQuickPaintedItem(parent) { + _color = QColor(0, 0, 0, 255); + _bgColor = QColor(255, 255, 255, 255); + _size = 100; setWidth(_size); setHeight(_size); - connect(this,&FluQrCodeItem::textChanged,this,[=]{update();}); - connect(this,&FluQrCodeItem::colorChanged,this,[=]{update();}); - connect(this,&FluQrCodeItem::bgColorChanged,this,[=]{update();}); - connect(this,&FluQrCodeItem::sizeChanged,this,[=]{ + connect(this, &FluQrCodeItem::textChanged, this, [=] { update(); }); + connect(this, &FluQrCodeItem::colorChanged, this, [=] { update(); }); + connect(this, &FluQrCodeItem::bgColorChanged, this, [=] { update(); }); + connect(this, &FluQrCodeItem::sizeChanged, this, [=] { setWidth(_size); setHeight(_size); update(); }); } - -void FluQrCodeItem::paint(QPainter* painter){ - if(_text.isEmpty()){ +void FluQrCodeItem::paint(QPainter *painter) { + if (_text.isEmpty()) { return; } - if(_text.length()>1024){ + if (_text.length() > 1024) { return; } painter->save(); QRcode *qrcode = QRcode_encodeString(_text.toUtf8().constData(), 2, QR_ECLEVEL_Q, QR_MODE_8, 1); - qint32 w = width(); - qint32 h = height(); + auto w = qint32(width()); + auto h = qint32(height()); qint32 qrcodeW = qrcode->width > 0 ? qrcode->width : 1; - double scaleX = (double)w / (double)qrcodeW; - double scaleY = (double)h / (double)qrcodeW; + double scaleX = (double) w / (double) qrcodeW; + double scaleY = (double) h / (double) qrcodeW; QImage image = QImage(w, h, QImage::Format_ARGB32); QPainter p(&image); p.setBrush(_bgColor); p.setPen(Qt::NoPen); p.drawRect(0, 0, w, h); p.setBrush(_color); - for (qint32 y = 0; y < qrcodeW; y++) - { - for (qint32 x = 0; x < qrcodeW; x++) - { - unsigned char b = qrcode->data[y*qrcodeW + x]; - if (b & 0x01) - { - QRectF r(x * scaleX,y * scaleY, scaleX, scaleY); + for (qint32 y = 0; y < qrcodeW; y++) { + for (qint32 x = 0; x < qrcodeW; x++) { + unsigned char b = qrcode->data[y * qrcodeW + x]; + if (b & 0x01) { + QRectF r(x * scaleX, y * scaleY, scaleX, scaleY); p.drawRects(&r, 1); } } diff --git a/src/FluQrCodeItem.h b/src/FluQrCodeItem.h index 3e2a5814..0e665d61 100644 --- a/src/FluQrCodeItem.h +++ b/src/FluQrCodeItem.h @@ -1,5 +1,4 @@ -#ifndef FLUQRCODEITEM_H -#define FLUQRCODEITEM_H +#pragma once #include #include @@ -9,17 +8,16 @@ /** * @brief The FluQrCodeItem class */ -class FluQrCodeItem : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY_AUTO(QString,text) - Q_PROPERTY_AUTO(QColor,color) - Q_PROPERTY_AUTO(QColor,bgColor) - Q_PROPERTY_AUTO(int,size); +class FluQrCodeItem : public QQuickPaintedItem { +Q_OBJECT + +Q_PROPERTY_AUTO(QString, text) +Q_PROPERTY_AUTO(QColor, color) +Q_PROPERTY_AUTO(QColor, bgColor) +Q_PROPERTY_AUTO(int, size); QML_NAMED_ELEMENT(FluQrCodeItem) public: explicit FluQrCodeItem(QQuickItem *parent = nullptr); - void paint(QPainter* painter) override; -}; -#endif // FLUQRCODEITEM_H + void paint(QPainter *painter) override; +}; \ No newline at end of file diff --git a/src/FluRectangle.cpp b/src/FluRectangle.cpp index be711054..b6e62246 100644 --- a/src/FluRectangle.cpp +++ b/src/FluRectangle.cpp @@ -1,14 +1,14 @@ #include "FluRectangle.h" #include -FluRectangle::FluRectangle(QQuickItem* parent) : QQuickPaintedItem(parent){ - color(QColor(255,255,255,255)); - radius({0,0,0,0}); - connect(this,&FluRectangle::colorChanged,this,[=]{update();}); - connect(this,&FluRectangle::radiusChanged,this,[=]{update();}); +FluRectangle::FluRectangle(QQuickItem *parent) : QQuickPaintedItem(parent) { + color(QColor(255, 255, 255, 255)); + radius({0, 0, 0, 0}); + connect(this, &FluRectangle::colorChanged, this, [=] { update(); }); + connect(this, &FluRectangle::radiusChanged, this, [=] { update(); }); } -void FluRectangle::paint(QPainter* painter){ +void FluRectangle::paint(QPainter *painter) { painter->save(); painter->setRenderHint(QPainter::Antialiasing); QPainterPath path; @@ -22,6 +22,6 @@ void FluRectangle::paint(QPainter* painter){ path.arcTo(QRectF(QPointF(rect.bottomLeft() - QPointF(0, _radius[3] * 2)), QSize(_radius[3] * 2, _radius[3] * 2)), 180, 90); path.lineTo(rect.bottomRight() - QPointF(_radius[2], 0)); path.arcTo(QRectF(QPointF(rect.bottomRight() - QPointF(_radius[2] * 2, _radius[2] * 2)), QSize(_radius[2] * 2, _radius[2] * 2)), 270, 90); - painter->fillPath(path,_color); + painter->fillPath(path, _color); painter->restore(); } diff --git a/src/FluRectangle.h b/src/FluRectangle.h index 7a505b43..7950d0a8 100644 --- a/src/FluRectangle.h +++ b/src/FluRectangle.h @@ -1,5 +1,4 @@ -#ifndef FLURECTANGLE_H -#define FLURECTANGLE_H +#pragma once #include #include @@ -9,15 +8,13 @@ /** * @brief The FluRectangle class */ -class FluRectangle : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY_AUTO(QColor,color) - Q_PROPERTY_AUTO(QList,radius) +class FluRectangle : public QQuickPaintedItem { +Q_OBJECT +Q_PROPERTY_AUTO(QColor, color) +Q_PROPERTY_AUTO(QList, radius) QML_NAMED_ELEMENT(FluRectangle) public: explicit FluRectangle(QQuickItem *parent = nullptr); - void paint(QPainter* painter) override; -}; -#endif // FLURECTANGLE_H + void paint(QPainter *painter) override; +}; \ No newline at end of file diff --git a/src/FluTableSortProxyModel.cpp b/src/FluTableSortProxyModel.cpp index 4101b630..644f652a 100644 --- a/src/FluTableSortProxyModel.cpp +++ b/src/FluTableSortProxyModel.cpp @@ -2,74 +2,72 @@ #include -FluTableSortProxyModel::FluTableSortProxyModel(QSortFilterProxyModel *parent) - : QSortFilterProxyModel {parent} -{ +FluTableSortProxyModel::FluTableSortProxyModel(QSortFilterProxyModel *parent) : QSortFilterProxyModel{parent} { _model = nullptr; - connect(this,&FluTableSortProxyModel::modelChanged,this,[=]{ + connect(this, &FluTableSortProxyModel::modelChanged, this, [=] { setSourceModel(this->model()); }); } -bool FluTableSortProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const{ +bool FluTableSortProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { QJSValue filter = _filter; - if(filter.isUndefined()){ + if (filter.isUndefined()) { return true; } QJSValueList data; - data<_comparator = comparator; - if(sortOrder()==Qt::AscendingOrder){ - sort(column,Qt::DescendingOrder); - }else{ - sort(column,Qt::AscendingOrder); + if (sortOrder() == Qt::AscendingOrder) { + sort(column, Qt::DescendingOrder); + } else { + sort(column, Qt::AscendingOrder); } } -void FluTableSortProxyModel::setFilter(QJSValue filter){ +[[maybe_unused]] void FluTableSortProxyModel::setFilter(const QJSValue &filter) { this->_filter = filter; invalidateFilter(); } -QVariant FluTableSortProxyModel::getRow(int rowIndex){ +[[maybe_unused]] QVariant FluTableSortProxyModel::getRow(int rowIndex) { QVariant result; - QMetaObject::invokeMethod(_model, "getRow",Q_RETURN_ARG(QVariant, result),Q_ARG(int, mapToSource(index(rowIndex,0)).row())); + QMetaObject::invokeMethod(_model, "getRow", Q_RETURN_ARG(QVariant, result), Q_ARG(int, mapToSource(index(rowIndex, 0)).row())); return result; } -void FluTableSortProxyModel::setRow(int rowIndex,QVariant val){ - QMetaObject::invokeMethod(_model, "setRow",Q_ARG(int, mapToSource(index(rowIndex,0)).row()),Q_ARG(QVariant,val)); +[[maybe_unused]] void FluTableSortProxyModel::setRow(int rowIndex, const QVariant &val) { + QMetaObject::invokeMethod(_model, "setRow", Q_ARG(int, mapToSource(index(rowIndex, 0)).row()), Q_ARG(QVariant, val)); } -void FluTableSortProxyModel::removeRow(int rowIndex,int rows){ - QMetaObject::invokeMethod(_model, "removeRow",Q_ARG(int, mapToSource(index(rowIndex,0)).row()),Q_ARG(int,rows)); +[[maybe_unused]] void FluTableSortProxyModel::removeRow(int rowIndex, int rows) { + QMetaObject::invokeMethod(_model, "removeRow", Q_ARG(int, mapToSource(index(rowIndex, 0)).row()), Q_ARG(int, rows)); } diff --git a/src/FluTableSortProxyModel.h b/src/FluTableSortProxyModel.h index baa1b84c..0cf27849 100644 --- a/src/FluTableSortProxyModel.h +++ b/src/FluTableSortProxyModel.h @@ -1,5 +1,4 @@ -#ifndef FLUTABLESORTPROXYMODEL_H -#define FLUTABLESORTPROXYMODEL_H +#pragma once #include #include @@ -7,24 +6,30 @@ #include #include "stdafx.h" -class FluTableSortProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY_AUTO(QAbstractTableModel*,model) +class FluTableSortProxyModel : public QSortFilterProxyModel { +Q_OBJECT +Q_PROPERTY_AUTO_P(QAbstractTableModel*, model) QML_NAMED_ELEMENT(FluTableSortProxyModel) public: explicit FluTableSortProxyModel(QSortFilterProxyModel *parent = nullptr); + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; + bool filterAcceptsColumn(int sourceColumn, const QModelIndex &sourceParent) const override; + bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override; - Q_INVOKABLE QVariant getRow(int rowIndex); - Q_INVOKABLE void setRow(int rowIndex,QVariant val); - Q_INVOKABLE void removeRow(int rowIndex,int rows); - Q_INVOKABLE void setComparator(QJSValue comparator); - Q_INVOKABLE void setFilter(QJSValue filter); + + Q_INVOKABLE [[maybe_unused]] QVariant getRow(int rowIndex); + + Q_INVOKABLE [[maybe_unused]] void setRow(int rowIndex, const QVariant &val); + + Q_INVOKABLE [[maybe_unused]] void removeRow(int rowIndex, int rows); + + Q_INVOKABLE [[maybe_unused]] [[maybe_unused]] void setComparator(const QJSValue &comparator); + + Q_INVOKABLE [[maybe_unused]] void setFilter(const QJSValue &filter); + private: QJSValue _filter; QJSValue _comparator; -}; - -#endif // FLUTABLESORTPROXYMODEL_H +}; \ No newline at end of file diff --git a/src/FluTextStyle.cpp b/src/FluTextStyle.cpp index 7e81de1a..1d453716 100644 --- a/src/FluTextStyle.cpp +++ b/src/FluTextStyle.cpp @@ -1,6 +1,6 @@ #include "FluTextStyle.h" -FluTextStyle::FluTextStyle(QObject *parent):QObject{parent}{ +FluTextStyle::FluTextStyle(QObject *parent) : QObject{parent} { _family = QFont().defaultFamily(); #ifdef Q_OS_WIN _family = "微软雅黑"; diff --git a/src/FluTextStyle.h b/src/FluTextStyle.h index 8cbabe45..defa9d1e 100644 --- a/src/FluTextStyle.h +++ b/src/FluTextStyle.h @@ -1,5 +1,4 @@ -#ifndef FLUTEXTSTYLE_H -#define FLUTEXTSTYLE_H +#pragma once #include #include @@ -10,25 +9,25 @@ /** * @brief The FluTextStyle class */ -class FluTextStyle : public QObject -{ - Q_OBJECT +class FluTextStyle : public QObject { +Q_OBJECT public: - Q_PROPERTY_AUTO(QString,family) - Q_PROPERTY_AUTO(QFont,Caption); - Q_PROPERTY_AUTO(QFont,Body); - Q_PROPERTY_AUTO(QFont,BodyStrong); - Q_PROPERTY_AUTO(QFont,Subtitle); - Q_PROPERTY_AUTO(QFont,Title); - Q_PROPERTY_AUTO(QFont,TitleLarge); - Q_PROPERTY_AUTO(QFont,Display); +Q_PROPERTY_AUTO(QString, family) +Q_PROPERTY_AUTO(QFont, Caption); +Q_PROPERTY_AUTO(QFont, Body); +Q_PROPERTY_AUTO(QFont, BodyStrong); +Q_PROPERTY_AUTO(QFont, Subtitle); +Q_PROPERTY_AUTO(QFont, Title); +Q_PROPERTY_AUTO(QFont, TitleLarge); +Q_PROPERTY_AUTO(QFont, Display); QML_NAMED_ELEMENT(FluTextStyle) QML_SINGLETON + private: explicit FluTextStyle(QObject *parent = nullptr); -public: - SINGLETON(FluTextStyle) - static FluTextStyle *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();} -}; -#endif // FLUTEXTSTYLE_H +public: +SINGLETON(FluTextStyle) + + static FluTextStyle *create(QQmlEngine *, QJSEngine *) { return getInstance(); } +}; \ No newline at end of file diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 7e3c75af..45ece456 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -5,40 +5,45 @@ #include "Def.h" #include "FluColors.h" -FluTheme::FluTheme(QObject *parent):QObject{parent}{ - connect(this,&FluTheme::darkModeChanged,this,[=]{ +bool systemDark() { + QPalette palette = QGuiApplication::palette(); + QColor color = palette.color(QPalette::Window).rgb(); + return color.red() * 0.2126 + color.green() * 0.7152 + color.blue() * 0.0722 <= 255.0f / 2; +} + +FluTheme::FluTheme(QObject *parent) : QObject{parent} { + _accentColor = FluColors::getInstance()->Blue(); + _darkMode = FluThemeType::DarkMode::Light; + _nativeText = false; + _animationEnabled = true; + _systemDark = systemDark(); + QGuiApplication::instance()->installEventFilter(this); + connect(this, &FluTheme::darkModeChanged, this, [=] { Q_EMIT darkChanged(); }); - connect(this,&FluTheme::darkChanged,this,[=]{refreshColors();}); - connect(this,&FluTheme::accentColorChanged,this,[=]{refreshColors();}); - accentColor(FluColors::getInstance()->Blue()); - darkMode(FluThemeType::DarkMode::Light); - nativeText(false); - animationEnabled(true); - _systemDark = systemDark(); - qApp->installEventFilter(this); + connect(this, &FluTheme::darkChanged, this, [=] { refreshColors(); }); + connect(this, &FluTheme::accentColorChanged, this, [=] { refreshColors(); }); + refreshColors(); } -void FluTheme::refreshColors(){ +void FluTheme::refreshColors() { auto isDark = dark(); primaryColor(isDark ? _accentColor->lighter() : _accentColor->dark()); - backgroundColor(isDark ? QColor(0,0,0,255) : QColor(255,255,255,255)); - dividerColor(isDark ? QColor(80,80,80,255) : QColor(210,210,210,255)); - windowBackgroundColor(isDark ? QColor(32,32,32,255) : QColor(237,237,237,255)); - windowActiveBackgroundColor(isDark ? QColor(26,26,26,255) : QColor(243,243,243,255)); - fontPrimaryColor(isDark ? QColor(248,248,248,255) : QColor(7,7,7,255)); - fontSecondaryColor(isDark ? QColor(222,222,222,255) : QColor(102,102,102,255)); - fontTertiaryColor(isDark ? QColor(200,200,200,255) : QColor(153,153,153,255)); - itemNormalColor(isDark ? QColor(255,255,255,0) : QColor(0,0,0,0)); - itemHoverColor(isDark ? QColor(255,255,255,255*0.06) : QColor(0,0,0,255*0.03)); - itemPressColor(isDark ? QColor(255,255,255,255*0.09) : QColor(0,0,0,255*0.06)); - itemCheckColor(isDark ? QColor(255,255,255,255*0.12) : QColor(0,0,0,255*0.09)); + backgroundColor(isDark ? QColor(0, 0, 0, 255) : QColor(255, 255, 255, 255)); + dividerColor(isDark ? QColor(80, 80, 80, 255) : QColor(210, 210, 210, 255)); + windowBackgroundColor(isDark ? QColor(32, 32, 32, 255) : QColor(237, 237, 237, 255)); + windowActiveBackgroundColor(isDark ? QColor(26, 26, 26, 255) : QColor(243, 243, 243, 255)); + fontPrimaryColor(isDark ? QColor(248, 248, 248, 255) : QColor(7, 7, 7, 255)); + fontSecondaryColor(isDark ? QColor(222, 222, 222, 255) : QColor(102, 102, 102, 255)); + fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255)); + itemNormalColor(isDark ? QColor(255, 255, 255, 0) : QColor(0, 0, 0, 0)); + itemHoverColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.06)) : QColor(0, 0, 0, qRound(255 * 0.03))); + itemPressColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.09)) : QColor(0, 0, 0, qRound(255 * 0.06))); + itemCheckColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); } -bool FluTheme::eventFilter(QObject *obj, QEvent *event){ - Q_UNUSED(obj); - if (event->type() == QEvent::ApplicationPaletteChange || event->type() == QEvent::ThemeChange) - { +bool FluTheme::eventFilter(QObject *, QEvent *event) { + if (event->type() == QEvent::ApplicationPaletteChange || event->type() == QEvent::ThemeChange) { _systemDark = systemDark(); Q_EMIT darkChanged(); event->accept(); @@ -47,36 +52,28 @@ bool FluTheme::eventFilter(QObject *obj, QEvent *event){ return false; } -QJsonArray FluTheme::awesomeList(const QString& keyword){ +[[maybe_unused]] QJsonArray FluTheme::awesomeList(const QString &keyword) { QJsonArray arr; QMetaEnum enumType = Fluent_Awesome::staticMetaObject.enumerator(Fluent_Awesome::staticMetaObject.indexOfEnumerator("Fluent_AwesomeType")); - for(int i=0; i < enumType.keyCount(); ++i){ + for (int i = 0; i <= enumType.keyCount() - 1; ++i) { QString name = enumType.key(i); int icon = enumType.value(i); - if(keyword.isEmpty() || name.contains(keyword)){ + if (keyword.isEmpty() || name.contains(keyword)) { QJsonObject obj; - obj.insert("name",name); - obj.insert("icon",icon); + obj.insert("name", name); + obj.insert("icon", icon); arr.append(obj); } } return arr; } -bool FluTheme::systemDark(){ - QPalette palette = qApp->palette(); - QColor color = palette.color(QPalette::Window).rgb(); - return !(color.red() * 0.2126 + color.green() * 0.7152 + color.blue() * 0.0722 > 255 / 2); -} - -bool FluTheme::dark(){ - if(_darkMode == FluThemeType::DarkMode::Dark){ +bool FluTheme::dark() const { + if (_darkMode == FluThemeType::DarkMode::Dark) { return true; - }else if(_darkMode == FluThemeType::DarkMode::Light){ - return false; - }else if(_darkMode == FluThemeType::DarkMode::System){ + } else if (_darkMode == FluThemeType::DarkMode::System) { return _systemDark; - }else{ + } else { return false; } } diff --git a/src/FluTheme.h b/src/FluTheme.h index b36da840..6b5cf5bc 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -13,39 +13,46 @@ /** * @brief The FluTheme class */ -class FluTheme : public QObject -{ - Q_OBJECT +class FluTheme : public QObject { +Q_OBJECT Q_PROPERTY(bool dark READ dark NOTIFY darkChanged) - Q_PROPERTY_AUTO(FluAccentColor*,accentColor); - Q_PROPERTY_AUTO(QColor,primaryColor); - Q_PROPERTY_AUTO(QColor,backgroundColor); - Q_PROPERTY_AUTO(QColor,dividerColor); - Q_PROPERTY_AUTO(QColor,windowBackgroundColor); - Q_PROPERTY_AUTO(QColor,windowActiveBackgroundColor); - Q_PROPERTY_AUTO(QColor,fontPrimaryColor); - Q_PROPERTY_AUTO(QColor,fontSecondaryColor); - Q_PROPERTY_AUTO(QColor,fontTertiaryColor); - Q_PROPERTY_AUTO(QColor,itemNormalColor); - Q_PROPERTY_AUTO(QColor,itemHoverColor); - Q_PROPERTY_AUTO(QColor,itemPressColor); - Q_PROPERTY_AUTO(QColor,itemCheckColor); - Q_PROPERTY_AUTO(int,darkMode); - Q_PROPERTY_AUTO(bool,nativeText); - Q_PROPERTY_AUTO(bool,animationEnabled); +Q_PROPERTY_AUTO_P(FluAccentColor*, accentColor); +Q_PROPERTY_AUTO(QColor, primaryColor); +Q_PROPERTY_AUTO(QColor, backgroundColor); +Q_PROPERTY_AUTO(QColor, dividerColor); +Q_PROPERTY_AUTO(QColor, windowBackgroundColor); +Q_PROPERTY_AUTO(QColor, windowActiveBackgroundColor); +Q_PROPERTY_AUTO(QColor, fontPrimaryColor); +Q_PROPERTY_AUTO(QColor, fontSecondaryColor); +Q_PROPERTY_AUTO(QColor, fontTertiaryColor); +Q_PROPERTY_AUTO(QColor, itemNormalColor); +Q_PROPERTY_AUTO(QColor, itemHoverColor); +Q_PROPERTY_AUTO(QColor, itemPressColor); +Q_PROPERTY_AUTO(QColor, itemCheckColor); +Q_PROPERTY_AUTO(int, darkMode); +Q_PROPERTY_AUTO(bool, nativeText); +Q_PROPERTY_AUTO(bool, animationEnabled); QML_NAMED_ELEMENT(FluTheme) QML_SINGLETON + private: explicit FluTheme(QObject *parent = nullptr); - bool eventFilter(QObject *obj, QEvent *event); - bool systemDark(); + + bool eventFilter(QObject *obj, QEvent *event) override; + void refreshColors(); + public: - SINGLETON(FluTheme) - Q_INVOKABLE QJsonArray awesomeList(const QString& keyword = ""); +SINGLETON(FluTheme) + + Q_INVOKABLE [[maybe_unused]] static QJsonArray awesomeList(const QString &keyword = ""); + Q_SIGNAL void darkChanged(); - static FluTheme *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();} - bool dark(); + + static FluTheme *create(QQmlEngine *, QJSEngine *) { return getInstance(); } + + bool dark() const; + private: bool _systemDark; }; diff --git a/src/FluTools.cpp b/src/FluTools.cpp index 47473811..22d2c85d 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -1,3 +1,7 @@ +#pragma clang diagnostic push +#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" +#pragma ide diagnostic ignored "readability-convert-member-functions-to-static" + #include "FluTools.h" #include @@ -16,19 +20,19 @@ #include #include -FluTools::FluTools(QObject *parent):QObject{parent}{ +FluTools::FluTools(QObject *parent) : QObject{parent} { } -void FluTools::clipText(const QString& text){ +void FluTools::clipText(const QString &text) { QGuiApplication::clipboard()->setText(text); } -QString FluTools::uuid(){ +QString FluTools::uuid() { return QUuid::createUuid().toString().remove('-').remove('{').remove('}'); } -QString FluTools::readFile(const QString &fileName){ +QString FluTools::readFile(const QString &fileName) { QString content; QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { @@ -38,7 +42,7 @@ QString FluTools::readFile(const QString &fileName){ return content; } -bool FluTools::isMacos(){ +bool FluTools::isMacos() { #if defined(Q_OS_MACOS) return true; #else @@ -46,7 +50,7 @@ bool FluTools::isMacos(){ #endif } -bool FluTools::isLinux(){ +bool FluTools::isLinux() { #if defined(Q_OS_LINUX) return true; #else @@ -54,7 +58,7 @@ bool FluTools::isLinux(){ #endif } -bool FluTools::isWin(){ +bool FluTools::isWin() { #if defined(Q_OS_WIN) return true; #else @@ -62,95 +66,94 @@ bool FluTools::isWin(){ #endif } -int FluTools::qtMajor(){ +int FluTools::qtMajor() { const QString qtVersion = QString::fromLatin1(qVersion()); const QStringList versionParts = qtVersion.split('.'); return versionParts[0].toInt(); } -int FluTools::qtMinor(){ +int FluTools::qtMinor() { const QString qtVersion = QString::fromLatin1(qVersion()); const QStringList versionParts = qtVersion.split('.'); return versionParts[1].toInt(); } -void FluTools::setQuitOnLastWindowClosed(bool val){ - qApp->setQuitOnLastWindowClosed(val); +void FluTools::setQuitOnLastWindowClosed(bool val) { + QGuiApplication::setQuitOnLastWindowClosed(val); } -void FluTools::setOverrideCursor(Qt::CursorShape shape){ - qApp->setOverrideCursor(QCursor(shape)); +void FluTools::setOverrideCursor(Qt::CursorShape shape) { + QGuiApplication::setOverrideCursor(QCursor(shape)); } -void FluTools::restoreOverrideCursor(){ - qApp->restoreOverrideCursor(); +void FluTools::restoreOverrideCursor() { + QGuiApplication::restoreOverrideCursor(); } -void FluTools::deleteLater(QObject *p){ - if(p){ +void FluTools::deleteLater(QObject *p) { + if (p) { p->deleteLater(); - p = nullptr; } } -QString FluTools::toLocalPath(const QUrl& url){ +QString FluTools::toLocalPath(const QUrl &url) { return url.toLocalFile(); } -QString FluTools::getFileNameByUrl(const QUrl& url){ +QString FluTools::getFileNameByUrl(const QUrl &url) { return QFileInfo(url.toLocalFile()).fileName(); } -QString FluTools::html2PlantText(const QString& html){ +QString FluTools::html2PlantText(const QString &html) { QTextDocument textDocument; textDocument.setHtml(html); return textDocument.toPlainText(); } -QRect FluTools::getVirtualGeometry(){ - return qApp->primaryScreen()->virtualGeometry(); +QRect FluTools::getVirtualGeometry() { + return QGuiApplication::primaryScreen()->virtualGeometry(); } -QString FluTools::getApplicationDirPath(){ - return qApp->applicationDirPath(); +QString FluTools::getApplicationDirPath() { + return QGuiApplication::applicationDirPath(); } -QUrl FluTools::getUrlByFilePath(const QString& path){ +QUrl FluTools::getUrlByFilePath(const QString &path) { return QUrl::fromLocalFile(path); } -QColor FluTools::withOpacity(const QColor& color,qreal opacity){ +QColor FluTools::withOpacity(const QColor &color, qreal opacity) { int alpha = qRound(opacity * 255) & 0xff; return QColor::fromRgba((alpha << 24) | (color.rgba() & 0xffffff)); } -QString FluTools::md5(QString text){ +QString FluTools::md5(const QString &text) { return QCryptographicHash::hash(text.toUtf8(), QCryptographicHash::Md5).toHex(); } -QString FluTools::toBase64(QString text){ +QString FluTools::toBase64(const QString &text) { return text.toUtf8().toBase64(); } -QString FluTools::fromBase64(QString text){ +QString FluTools::fromBase64(const QString &text) { return QByteArray::fromBase64(text.toUtf8()); } -bool FluTools::removeDir(QString dirPath){ +bool FluTools::removeDir(const QString &dirPath) { QDir qDir(dirPath); return qDir.removeRecursively(); } -bool FluTools::removeFile(QString filePath){ +bool FluTools::removeFile(const QString &filePath) { QFile file(filePath); return file.remove(); } -QString FluTools::sha256(QString text){ +QString FluTools::sha256(const QString &text) { return QCryptographicHash::hash(text.toUtf8(), QCryptographicHash::Sha256).toHex(); } -void FluTools::showFileInFolder(QString path){ +void FluTools::showFileInFolder(const QString &path) { #if defined(Q_OS_WIN) QProcess::startDetached("explorer.exe", {"/select,", QDir::toNativeSeparators(path)}); #endif @@ -166,29 +169,29 @@ void FluTools::showFileInFolder(QString path){ #endif } -bool FluTools::isSoftware(){ +bool FluTools::isSoftware() { return QQuickWindow::sceneGraphBackend() == "software"; } -QPoint FluTools::cursorPos(){ +QPoint FluTools::cursorPos() { return QCursor::pos(); } -qint64 FluTools::currentTimestamp(){ +qint64 FluTools::currentTimestamp() { return QDateTime::currentMSecsSinceEpoch(); } -QIcon FluTools::windowIcon(){ +QIcon FluTools::windowIcon() { return QGuiApplication::windowIcon(); } -int FluTools::cursorScreenIndex(){ +int FluTools::cursorScreenIndex() { int screenIndex = 0; - int screenCount = qApp->screens().count(); + int screenCount = QGuiApplication::screens().count(); if (screenCount > 1) { QPoint pos = QCursor::pos(); - for (int i = 0; i < screenCount; ++i) { - if (qApp->screens().at(i)->geometry().contains(pos)) { + for (int i = 0; i <= screenCount - 1; ++i) { + if (QGuiApplication::screens().at(i)->geometry().contains(pos)) { screenIndex = i; break; } @@ -197,9 +200,9 @@ int FluTools::cursorScreenIndex(){ return screenIndex; } -int FluTools::windowBuildNumber(){ +int FluTools::windowBuildNumber() { #if defined(Q_OS_WIN) - QSettings regKey {QString::fromUtf8("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), QSettings::NativeFormat}; + QSettings regKey{QString::fromUtf8(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion)"), QSettings::NativeFormat}; if (regKey.contains(QString::fromUtf8("CurrentBuildNumber"))) { auto buildNumber = regKey.value(QString::fromUtf8("CurrentBuildNumber")).toInt(); return buildNumber; @@ -208,40 +211,42 @@ int FluTools::windowBuildNumber(){ return -1; } -bool FluTools::isWindows11OrGreater(){ +bool FluTools::isWindows11OrGreater() { static QVariant var; - if(var.isNull()){ + if (var.isNull()) { #if defined(Q_OS_WIN) auto buildNumber = windowBuildNumber(); - if(buildNumber>=22000){ + if (buildNumber >= 22000) { var = QVariant::fromValue(true); return true; } #endif var = QVariant::fromValue(false); - return false; - }else{ + return false; + } else { return var.toBool(); } } -bool FluTools::isWindows10OrGreater(){ +bool FluTools::isWindows10OrGreater() { static QVariant var; - if(var.isNull()){ + if (var.isNull()) { #if defined(Q_OS_WIN) auto buildNumber = windowBuildNumber(); - if(buildNumber>=10240){ + if (buildNumber >= 10240) { var = QVariant::fromValue(true); return true; } #endif var = QVariant::fromValue(false); - return false; - }else{ + return false; + } else { return var.toBool(); } } -QRect FluTools::desktopAvailableGeometry(QQuickWindow* window){ +QRect FluTools::desktopAvailableGeometry(QQuickWindow *window) { return window->screen()->availableGeometry(); } + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/src/FluTools.h b/src/FluTools.h index 60b8b3a3..0b97da3a 100644 --- a/src/FluTools.h +++ b/src/FluTools.h @@ -1,5 +1,6 @@ -#ifndef FLUTOOLS_H -#define FLUTOOLS_H +#pragma clang diagnostic push +#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" +#pragma once #include #include @@ -11,51 +12,88 @@ /** * @brief The FluTools class */ -class FluTools : public QObject -{ - Q_OBJECT +class FluTools : public QObject { +Q_OBJECT QML_NAMED_ELEMENT(FluTools) QML_SINGLETON + private: explicit FluTools(QObject *parent = nullptr); + public: - SINGLETON(FluTools) - static FluTools *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();} +SINGLETON(FluTools) + + static FluTools *create(QQmlEngine *, QJSEngine *) { return getInstance(); } + Q_INVOKABLE int qtMajor(); + Q_INVOKABLE int qtMinor(); + Q_INVOKABLE bool isMacos(); + Q_INVOKABLE bool isLinux(); + Q_INVOKABLE bool isWin(); - Q_INVOKABLE void clipText(const QString& text); + + Q_INVOKABLE void clipText(const QString &text); + Q_INVOKABLE QString uuid(); - Q_INVOKABLE QString readFile(const QString& fileName); + + Q_INVOKABLE QString readFile(const QString &fileName); + Q_INVOKABLE void setQuitOnLastWindowClosed(bool val); + Q_INVOKABLE void setOverrideCursor(Qt::CursorShape shape); + Q_INVOKABLE void restoreOverrideCursor(); - Q_INVOKABLE QString html2PlantText(const QString& html); - Q_INVOKABLE QString toLocalPath(const QUrl& url); + + Q_INVOKABLE QString html2PlantText(const QString &html); + + Q_INVOKABLE QString toLocalPath(const QUrl &url); + Q_INVOKABLE void deleteLater(QObject *p); - Q_INVOKABLE QString getFileNameByUrl(const QUrl& url); + + Q_INVOKABLE QString getFileNameByUrl(const QUrl &url); + Q_INVOKABLE QRect getVirtualGeometry(); + Q_INVOKABLE QString getApplicationDirPath(); - Q_INVOKABLE QUrl getUrlByFilePath(const QString& path); - Q_INVOKABLE QColor withOpacity(const QColor&,qreal alpha); - Q_INVOKABLE QString md5(QString text); - Q_INVOKABLE QString sha256(QString text); - Q_INVOKABLE QString toBase64(QString text); - Q_INVOKABLE QString fromBase64(QString text); - Q_INVOKABLE bool removeDir(QString dirPath); - Q_INVOKABLE bool removeFile(QString filePath); - Q_INVOKABLE void showFileInFolder(QString path); + + Q_INVOKABLE QUrl getUrlByFilePath(const QString &path); + + Q_INVOKABLE QColor withOpacity(const QColor &, qreal alpha); + + Q_INVOKABLE QString md5(const QString &text); + + Q_INVOKABLE QString sha256(const QString &text); + + Q_INVOKABLE QString toBase64(const QString &text); + + Q_INVOKABLE QString fromBase64(const QString &text); + + Q_INVOKABLE bool removeDir(const QString &dirPath); + + Q_INVOKABLE bool removeFile(const QString &filePath); + + Q_INVOKABLE void showFileInFolder(const QString &path); + Q_INVOKABLE bool isSoftware(); + Q_INVOKABLE qint64 currentTimestamp(); + Q_INVOKABLE QPoint cursorPos(); + Q_INVOKABLE QIcon windowIcon(); + Q_INVOKABLE int cursorScreenIndex(); + Q_INVOKABLE int windowBuildNumber(); + Q_INVOKABLE bool isWindows11OrGreater(); + Q_INVOKABLE bool isWindows10OrGreater(); - Q_INVOKABLE QRect desktopAvailableGeometry(QQuickWindow* window); + + Q_INVOKABLE QRect desktopAvailableGeometry(QQuickWindow *window); }; -#endif // FLUTOOLS_H +#pragma clang diagnostic pop \ No newline at end of file diff --git a/src/FluTreeModel.cpp b/src/FluTreeModel.cpp index d2c3b5b9..fd94b58d 100644 --- a/src/FluTreeModel.cpp +++ b/src/FluTreeModel.cpp @@ -1,75 +1,80 @@ +#pragma clang diagnostic push +#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" +#pragma ide diagnostic ignored "google-default-arguments" + #include "FluTreeModel.h" #include +#include -FluTreeNode::FluTreeNode(QObject *parent): QObject{parent}{ +FluTreeNode::FluTreeNode(QObject *parent) : QObject{parent} { } -FluTreeModel::FluTreeModel(QObject *parent): QAbstractItemModel{parent}{ - dataSourceSize(0); +FluTreeModel::FluTreeModel(QObject *parent) : QAbstractItemModel{parent} { + _dataSourceSize = 0; } -QModelIndex FluTreeModel::parent(const QModelIndex &child) const{ - return QModelIndex(); +QModelIndex FluTreeModel::parent(const QModelIndex &child) const { + return {}; } -QModelIndex FluTreeModel::index(int row, int column,const QModelIndex &parent) const{ +QModelIndex FluTreeModel::index(int row, int column, const QModelIndex &parent) const { if (!hasIndex(row, column, parent) || parent.isValid()) - return QModelIndex(); + return {}; return createIndex(row, column, _rows.at(row)); } int FluTreeModel::rowCount(const QModelIndex &parent) const { return _rows.count(); -}; +} int FluTreeModel::columnCount(const QModelIndex &parent) const { return this->_columnSource.size(); -}; +} QVariant FluTreeModel::data(const QModelIndex &index, int role) const { switch (role) { - case TreeModelRoles::RowModel: - return QVariant::fromValue(_rows.at(index.row())); - case TreeModelRoles::ColumnModel: - return QVariant::fromValue(_columnSource.at(index.column())); - default: - break; + case TreeModelRoles::RowModel: + return QVariant::fromValue(_rows.at(index.row())); + case TreeModelRoles::ColumnModel: + return QVariant::fromValue(_columnSource.at(index.column())); + default: + break; } - return QVariant(); -}; + return {}; +} QHash FluTreeModel::roleNames() const { return { - {TreeModelRoles::RowModel, "rowModel"}, - {TreeModelRoles::ColumnModel, "columnModel"} + {TreeModelRoles::RowModel, "rowModel"}, + {TreeModelRoles::ColumnModel, "columnModel"} }; -}; +} -void FluTreeModel::setData(QList data){ +void FluTreeModel::setData(QList data) { beginResetModel(); - _rows = data; + _rows = std::move(data); endResetModel(); } -void FluTreeModel::removeRows(int row,int count){ - if (row < 0 || row + count > _rows.size() || count==0) +void FluTreeModel::removeRows(int row, int count) { + if (row < 0 || row + count > _rows.size() || count == 0) return; - beginRemoveRows(QModelIndex(),row, row + count - 1); - QList firstPart = _rows.mid(0,row); - QList secondPart = _rows.mid(row + count); + beginRemoveRows(QModelIndex(), row, row + count - 1); + QList firstPart = _rows.mid(0, row); + QList secondPart = _rows.mid(row + count); _rows.clear(); _rows.append(firstPart); _rows.append(secondPart); endRemoveRows(); } -void FluTreeModel::insertRows(int row,QList data){ - if (row < 0 || row > _rows.size() || data.size() == 0) - return;; +void FluTreeModel::insertRows(int row, const QList &data) { + if (row < 0 || row > _rows.size() || data.empty()) + return; beginInsertRows(QModelIndex(), row, row + data.size() - 1); - QList firstPart = _rows.mid(0, row); - QList secondPart = _rows.mid(row); + QList firstPart = _rows.mid(0, row); + QList secondPart = _rows.mid(row); _rows.clear(); _rows.append(firstPart); _rows.append(data); @@ -77,83 +82,83 @@ void FluTreeModel::insertRows(int row,QList data){ endInsertRows(); } -QObject* FluTreeModel::getRow(int row){ +QObject *FluTreeModel::getRow(int row) { return _rows.at(row); } -void FluTreeModel::setRow(int row,QVariantMap data){ - _rows.at(row)->_data = data; - Q_EMIT dataChanged(index(row,0),index(row,columnCount()-1)); +void FluTreeModel::setRow(int row, QVariantMap data) { + _rows.at(row)->_data = std::move(data); + Q_EMIT dataChanged(index(row, 0), index(row, columnCount() - 1)); } -void FluTreeModel::checkRow(int row,bool checked){ +void FluTreeModel::checkRow(int row, bool checked) { auto itemData = _rows.at(row); - if(itemData->hasChildren()){ - QList stack = itemData->_children; + if (itemData->hasChildren()) { + QList stack = itemData->_children; std::reverse(stack.begin(), stack.end()); while (stack.count() > 0) { - auto item = stack.at(stack.count()-1); + auto item = stack.at(stack.count() - 1); stack.pop_back(); - if(!item->hasChildren()){ + if (!item->hasChildren()) { item->_checked = checked; } - QList children = item->_children; - if(!children.isEmpty()){ + QList children = item->_children; + if (!children.isEmpty()) { std::reverse(children.begin(), children.end()); - foreach (auto c, children) { - stack.append(c); - } + foreach (auto c, children) { + stack.append(c); + } } } - }else{ - if(itemData->_checked == checked){ + } else { + if (itemData->_checked == checked) { return; } itemData->_checked = checked; } - Q_EMIT dataChanged(index(0,0),index(rowCount()-1,0)); - QList data; - foreach (auto item, _dataSource) { - if(!item->hasChildren()){ - if(item->_checked){ - data.append(item); + Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0)); + QList data; + foreach (auto item, _dataSource) { + if (!item->hasChildren()) { + if (item->_checked) { + data.append(item); + } } } - } selectionModel(data); } -void FluTreeModel::setDataSource(QList> data){ +void FluTreeModel::setDataSource(QList> data) { _dataSource.clear(); - if(_root){ + if (_root) { delete _root; _root = nullptr; } _root = new FluTreeNode(this); std::reverse(data.begin(), data.end()); while (data.count() > 0) { - auto item = data.at(data.count()-1); + auto item = data.at(data.count() - 1); data.pop_back(); - FluTreeNode* node = new FluTreeNode(this); + auto *node = new FluTreeNode(this); node->_depth = item.value("__depth").toInt(); - node->_parent = item.value("__parent").value(); + node->_parent = item.value("__parent").value(); node->_data = item; node->_isExpanded = true; - if(node->_parent){ + if (node->_parent) { node->_parent->_children.append(node); - }else{ + } else { node->_parent = _root; _root->_children.append(node); } _dataSource.append(node); if (item.contains("children")) { QList children = item.value("children").toList(); - if(!children.isEmpty()){ + if (!children.isEmpty()) { std::reverse(children.begin(), children.end()); - for (int i = 0; i < children.count(); ++i) { + for (int i = 0; i <= children.count() - 1; ++i) { auto child = children.at(i).toMap(); - child.insert("__depth",item.value("__depth").toInt(0)+1); - child.insert("__parent",QVariant::fromValue(node)); + child.insert("__depth", item.value("__depth").toInt(nullptr) + 1); + child.insert("__parent", QVariant::fromValue(node)); data.append(child); } } @@ -165,108 +170,111 @@ void FluTreeModel::setDataSource(QList> data){ dataSourceSize(_dataSource.size()); } -void FluTreeModel::collapse(int row){ - if(!_rows.at(row)->_isExpanded){ +void FluTreeModel::collapse(int row) { + if (!_rows.at(row)->_isExpanded) { return; } _rows.at(row)->_isExpanded = false; - Q_EMIT dataChanged(index(row,0),index(row,0)); + Q_EMIT dataChanged(index(row, 0), index(row, 0)); auto modelData = _rows.at(row); int removeCount = 0; - for(int i=row+1;i<_rows.count();i++){ + for (int i = row + 1; i < _rows.count(); i++) { auto obj = _rows[i]; - if(obj->_depth<=modelData->_depth){ + if (obj->_depth <= modelData->_depth) { break; } removeCount = removeCount + 1; } - removeRows(row+1,removeCount); + removeRows(row + 1, removeCount); } -void FluTreeModel::expand(int row){ - if(_rows.at(row)->_isExpanded){ +void FluTreeModel::expand(int row) { + if (_rows.at(row)->_isExpanded) { return; } _rows.at(row)->_isExpanded = true; - Q_EMIT dataChanged(index(row,0),index(row,0)); + Q_EMIT dataChanged(index(row, 0), index(row, 0)); auto modelData = _rows.at(row); - QList insertData; - QList stack = modelData->_children; + QList insertData; + QList stack = modelData->_children; std::reverse(stack.begin(), stack.end()); while (stack.count() > 0) { - auto item = stack.at(stack.count()-1); + auto item = stack.at(stack.count() - 1); stack.pop_back(); - if(item->isShown()){ + if (item->isShown()) { insertData.append(item); } - QList children = item->_children; - if(!children.isEmpty()){ + QList children = item->_children; + if (!children.isEmpty()) { std::reverse(children.begin(), children.end()); - foreach (auto c, children) { - stack.append(c); - } + foreach (auto c, children) { + stack.append(c); + } } } - insertRows(row+1,insertData); + insertRows(row + 1, insertData); } -bool FluTreeModel::hitHasChildrenExpanded(int row){ +bool FluTreeModel::hitHasChildrenExpanded(int row) { auto itemData = _rows.at(row); - if(itemData->hasChildren() && itemData->_isExpanded){ + if (itemData->hasChildren() && itemData->_isExpanded) { return true; } return false; } -void FluTreeModel::refreshNode(int row){ - Q_EMIT dataChanged(index(row,0),index(row,0)); -}; +void FluTreeModel::refreshNode(int row) { + Q_EMIT dataChanged(index(row, 0), index(row, 0)); +} -FluTreeNode* FluTreeModel::getNode(int row){ +FluTreeNode *FluTreeModel::getNode(int row) { return _rows.at(row); } -void FluTreeModel::allExpand(){ +void FluTreeModel::allExpand() { beginResetModel(); - QList data; - QList stack = _root->_children; + QList data; + QList stack = _root->_children; std::reverse(stack.begin(), stack.end()); while (stack.count() > 0) { - auto item = stack.at(stack.count()-1); + auto item = stack.at(stack.count() - 1); stack.pop_back(); - if(item->hasChildren()){ + if (item->hasChildren()) { item->_isExpanded = true; } data.append(item); - QList children = item->_children; - if(!children.isEmpty()){ + QList children = item->_children; + if (!children.isEmpty()) { std::reverse(children.begin(), children.end()); - foreach (auto c, children) { - stack.append(c); - } + foreach (auto c, children) { + stack.append(c); + } } } _rows = data; endResetModel(); } -void FluTreeModel::allCollapse(){ + +void FluTreeModel::allCollapse() { beginResetModel(); - QList stack = _root->_children; + QList stack = _root->_children; std::reverse(stack.begin(), stack.end()); while (stack.count() > 0) { - auto item = stack.at(stack.count()-1); + auto item = stack.at(stack.count() - 1); stack.pop_back(); - if(item->hasChildren()){ + if (item->hasChildren()) { item->_isExpanded = false; } - QList children = item->_children; - if(!children.isEmpty()){ + QList children = item->_children; + if (!children.isEmpty()) { std::reverse(children.begin(), children.end()); - foreach (auto c, children) { - stack.append(c); - } + foreach (auto c, children) { + stack.append(c); + } } } _rows = _root->_children; endResetModel(); } + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/src/FluTreeModel.h b/src/FluTreeModel.h index a64e1efb..d46fa250 100644 --- a/src/FluTreeModel.h +++ b/src/FluTreeModel.h @@ -1,5 +1,7 @@ -#ifndef FLUTREEMODEL_H -#define FLUTREEMODEL_H +#pragma clang diagnostic push +#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" +#pragma ide diagnostic ignored "google-default-arguments" +#pragma once #include #include @@ -11,79 +13,82 @@ /** * @brief The FluTreeNode class */ -class FluTreeNode : public QObject{ - Q_OBJECT +class FluTreeNode : public QObject { +Q_OBJECT Q_PROPERTY(QVariantMap data READ data CONSTANT) Q_PROPERTY(int depth READ depth CONSTANT) Q_PROPERTY(bool isExpanded READ isExpanded CONSTANT) Q_PROPERTY(bool checked READ checked CONSTANT) public: explicit FluTreeNode(QObject *parent = nullptr); - Q_INVOKABLE int depth(){return _depth;}; - Q_INVOKABLE bool isExpanded(){return _isExpanded;}; - Q_INVOKABLE QVariantMap data(){return _data;}; - Q_INVOKABLE bool hasChildren(){ return !_children.isEmpty();}; - Q_INVOKABLE bool hasNextNodeByIndex(int index){ - FluTreeNode* p = this; - for(int i=0;i<(_depth - index -1);i++){ + + Q_INVOKABLE [[nodiscard]] int depth() const { return _depth; }; + Q_INVOKABLE [[nodiscard]] bool isExpanded() const { return _isExpanded; }; + Q_INVOKABLE [[nodiscard]] QVariantMap data() const { return _data; }; + Q_INVOKABLE [[nodiscard]] bool hasChildren() const { return !_children.isEmpty(); }; + Q_INVOKABLE bool hasNextNodeByIndex(int index) { + FluTreeNode *p = this; + for (int i = 0; i <= _depth - index - 1; i++) { p = p->_parent; } - if(p->_parent->_children.indexOf(p) == p->_parent->_children.count()-1){ + if (p->_parent->_children.indexOf(p) == p->_parent->_children.count() - 1) { return false; } return true; } - Q_INVOKABLE bool checked(){ - if(!hasChildren()){ + + Q_INVOKABLE [[nodiscard]] bool checked() const { + if (!hasChildren()) { return _checked; } - foreach (auto item, _children) { - if(!item->checked()){ - + for (int i = 0; i <= _children.size() - 1; ++i) { + auto item = _children.at(i); + if (!item->checked()) { return false; } } return true; }; - Q_INVOKABLE bool hideLineFooter(){ - if(_parent){ - auto childIndex = _parent->_children.indexOf(this); - if(childIndex==_parent->_children.count()-1){ + Q_INVOKABLE bool hideLineFooter() { + if (_parent) { + auto childIndex = _parent->_children.indexOf(this); + if (childIndex == _parent->_children.count() - 1) { return true; } - if(_parent->_children.at(childIndex+1)->hasChildren()){ + if (_parent->_children.at(childIndex + 1)->hasChildren()) { return true; } return false; } return false; }; - bool isShown(){ + + [[nodiscard]] bool isShown() const { auto p = _parent; while (p) { - if(!p->_isExpanded){ + if (!p->_isExpanded) { return false; } p = p->_parent; } return true; } + public: - QString _title=""; - int _depth=0; + QString _title = ""; + int _depth = 0; bool _checked = false; - bool _isExpanded=true; + bool _isExpanded = true; QVariantMap _data; - QList _children; - FluTreeNode* _parent = nullptr; + QList _children; + FluTreeNode *_parent = nullptr; }; -class FluTreeModel : public QAbstractItemModel -{ - Q_OBJECT - Q_PROPERTY_AUTO(int,dataSourceSize) - Q_PROPERTY_AUTO(QList,selectionModel) - Q_PROPERTY_AUTO(QList,columnSource) +class FluTreeModel : public QAbstractItemModel { +Q_OBJECT +Q_PROPERTY_AUTO(int, dataSourceSize) +Q_PROPERTY_AUTO(QList, selectionModel) +Q_PROPERTY_AUTO(QList, columnSource) QML_NAMED_ELEMENT(FluTreeModel) QML_ADDED_IN_MINOR_VERSION(1) public: @@ -91,32 +96,53 @@ public: RowModel = 0x0101, ColumnModel = 0x0102 }; - explicit FluTreeModel(QObject *parent = nullptr); - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - int columnCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - QHash roleNames() const override; - QModelIndex parent(const QModelIndex &child) const override; - QModelIndex index(int row, int column,const QModelIndex &parent = QModelIndex()) const override; - Q_INVOKABLE void removeRows(int row,int count); - Q_INVOKABLE void insertRows(int row,QList data); - Q_INVOKABLE QObject* getRow(int row); - Q_INVOKABLE void setRow(int row,QVariantMap data); - Q_INVOKABLE void setData(QList data); - Q_INVOKABLE void setDataSource(QList> data); + explicit FluTreeModel(QObject *parent = nullptr); + + [[nodiscard]] int rowCount(const QModelIndex &parent = {}) const override; + + [[nodiscard]] int columnCount(const QModelIndex &parent = {}) const override; + + [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + + [[nodiscard]] QHash roleNames() const override; + + [[nodiscard]] QModelIndex parent(const QModelIndex &child) const override; + + [[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override; + + Q_INVOKABLE void removeRows(int row, int count); + + Q_INVOKABLE void insertRows(int row, const QList &data); + + Q_INVOKABLE QObject *getRow(int row); + + Q_INVOKABLE void setRow(int row, QVariantMap data); + + Q_INVOKABLE void setData(QList data); + + Q_INVOKABLE void setDataSource(QList> data); + Q_INVOKABLE void collapse(int row); + Q_INVOKABLE void expand(int row); - Q_INVOKABLE FluTreeNode* getNode(int row); + + Q_INVOKABLE FluTreeNode *getNode(int row); + Q_INVOKABLE void refreshNode(int row); - Q_INVOKABLE void checkRow(int row,bool checked); + + Q_INVOKABLE void checkRow(int row, bool checked); + Q_INVOKABLE bool hitHasChildrenExpanded(int row); + Q_INVOKABLE void allExpand(); + Q_INVOKABLE void allCollapse(); + private: - QList _rows; - QList _dataSource; - FluTreeNode* _root = nullptr; + QList _rows; + QList _dataSource; + FluTreeNode *_root = nullptr; }; -#endif // FLUTREEMODEL_H +#pragma clang diagnostic pop \ No newline at end of file diff --git a/src/FluWatermark.cpp b/src/FluWatermark.cpp index 54f2405e..62a42b11 100644 --- a/src/FluWatermark.cpp +++ b/src/FluWatermark.cpp @@ -2,22 +2,22 @@ #include "FluTextStyle.h" -FluWatermark::FluWatermark(QQuickItem* parent) : QQuickPaintedItem(parent){ - gap(QPoint(100,100)); - offset(QPoint(_gap.x()/2,_gap.y()/2)); - rotate(22); +FluWatermark::FluWatermark(QQuickItem *parent) : QQuickPaintedItem(parent) { + _gap = QPoint(100, 100); + _offset = QPoint(_gap.x() / 2, _gap.y() / 2); + _rotate = 22; + _textColor = QColor(222, 222, 222, 222); + _textSize = 16; setZ(9999); - textColor(QColor(222,222,222,222)); - textSize(16); - connect(this,&FluWatermark::textColorChanged,this,[=]{update();}); - connect(this,&FluWatermark::gapChanged,this,[=]{update();}); - connect(this,&FluWatermark::offsetChanged,this,[=]{update();}); - connect(this,&FluWatermark::textChanged,this,[=]{update();}); - connect(this,&FluWatermark::rotateChanged,this,[=]{update();}); - connect(this,&FluWatermark::textSizeChanged,this,[=]{update();}); + connect(this, &FluWatermark::textColorChanged, this, [=] { update(); }); + connect(this, &FluWatermark::gapChanged, this, [=] { update(); }); + connect(this, &FluWatermark::offsetChanged, this, [=] { update(); }); + connect(this, &FluWatermark::textChanged, this, [=] { update(); }); + connect(this, &FluWatermark::rotateChanged, this, [=] { update(); }); + connect(this, &FluWatermark::textSizeChanged, this, [=] { update(); }); } -void FluWatermark::paint(QPainter* painter){ +void FluWatermark::paint(QPainter *painter) { QFont font; font.setFamily(FluTextStyle::getInstance()->family()); font.setPixelSize(_textSize); @@ -26,14 +26,12 @@ void FluWatermark::paint(QPainter* painter){ QFontMetricsF fontMetrics(font); qreal fontWidth = fontMetrics.horizontalAdvance(_text); qreal fontHeight = fontMetrics.height(); - int stepX = fontWidth + _gap.x(); - int stepY = fontHeight + _gap.y(); - int rowCount = width() / stepX+1; - int colCount = height() / stepY+1; - for (int r = 0; r < rowCount; r++) - { - for (int c = 0; c < colCount; c++) - { + int stepX = qRound(fontWidth + _gap.x()); + int stepY = qRound(fontHeight + _gap.y()); + int rowCount = qRound(width() / stepX + 1); + int colCount = qRound(height() / stepY + 1); + for (int r = 0; r < rowCount; r++) { + for (int c = 0; c < colCount; c++) { qreal centerX = stepX * r + _offset.x() + fontWidth / 2.0; qreal centerY = stepY * c + _offset.y() + fontHeight / 2.0; painter->save(); diff --git a/src/FluWatermark.h b/src/FluWatermark.h index 26381047..3acef5ad 100644 --- a/src/FluWatermark.h +++ b/src/FluWatermark.h @@ -1,5 +1,4 @@ -#ifndef FLUWATERMARK_H -#define FLUWATERMARK_H +#pragma once #include #include @@ -9,19 +8,17 @@ /** * @brief The FluWatermark class */ -class FluWatermark : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY_AUTO(QString,text) - Q_PROPERTY_AUTO(QPoint,gap) - Q_PROPERTY_AUTO(QPoint,offset); - Q_PROPERTY_AUTO(QColor,textColor); - Q_PROPERTY_AUTO(int,rotate); - Q_PROPERTY_AUTO(int,textSize); +class FluWatermark : public QQuickPaintedItem { +Q_OBJECT +Q_PROPERTY_AUTO(QString, text) +Q_PROPERTY_AUTO(QPoint, gap) +Q_PROPERTY_AUTO(QPoint, offset); +Q_PROPERTY_AUTO(QColor, textColor); +Q_PROPERTY_AUTO(int, rotate); +Q_PROPERTY_AUTO(int, textSize); QML_NAMED_ELEMENT(FluWatermark) public: explicit FluWatermark(QQuickItem *parent = nullptr); - void paint(QPainter* painter) override; -}; -#endif // FLUWATERMARK_H + void paint(QPainter *painter) override; +}; diff --git a/src/FluentUI.cpp b/src/FluentUI.cpp index ec0f525e..e4aa166e 100644 --- a/src/FluentUI.cpp +++ b/src/FluentUI.cpp @@ -15,143 +15,144 @@ #include "FluTableSortProxyModel.h" #include "FluFrameless.h" -void FluentUI::registerTypes(QQmlEngine *engine){ - initializeEngine(engine,uri); - registerTypes(uri); +void FluentUI::registerTypes(QQmlEngine *engine) { + initializeEngine(engine, _uri); + registerTypes(_uri); } -void FluentUI::registerTypes(const char *uri){ +void FluentUI::registerTypes(const char *uri) const { #if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0)) Q_INIT_RESOURCE(fluentui); - + int major = _major; + int minor = _minor; //@uri FluentUI - qmlRegisterType(uri,major,minor,"FluQrCodeItem"); - qmlRegisterType(uri,major,minor,"FluCaptcha"); - qmlRegisterType(uri,major,minor,"FluWatermark"); - qmlRegisterType(uri,major,minor,"FluAccentColor"); - qmlRegisterType(uri,major,minor,"FluTreeModel"); - qmlRegisterType(uri,major,minor,"FluRectangle"); - qmlRegisterType(uri,major,minor,"FluFrameless"); - qmlRegisterType(uri,major,minor,"FluTableSortProxyModel"); + qmlRegisterType(uri, major, minor, "FluQrCodeItem"); + qmlRegisterType(uri, major, minor, "FluCaptcha"); + qmlRegisterType(uri, major, minor, "FluWatermark"); + qmlRegisterType(uri, major, minor, "FluAccentColor"); + qmlRegisterType(uri, major, minor, "FluTreeModel"); + qmlRegisterType(uri, major, minor, "FluRectangle"); + qmlRegisterType(uri, major, minor, "FluFrameless"); + qmlRegisterType(uri, major, minor, "FluTableSortProxyModel"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAcrylic.qml"),uri,major,minor,"FluAcrylic"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAppBar.qml"),uri,major,minor,"FluAppBar"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFrame.qml"),uri,major,minor,"FluFrame"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAutoSuggestBox.qml"),uri,major,minor,"FluAutoSuggestBox"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluBadge.qml"),uri,major,minor,"FluBadge"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluBreadcrumbBar.qml"),uri,major,minor,"FluBreadcrumbBar"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluButton.qml"),uri,major,minor,"FluButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCalendarPicker.qml"),uri,major,minor,"FluCalendarPicker"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCarousel.qml"),uri,major,minor,"FluCarousel"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluChart.qml"),uri,major,minor,"FluChart"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCheckBox.qml"),uri,major,minor,"FluCheckBox"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluColorPicker.qml"),uri,major,minor,"FluColorPicker"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluComboBox.qml"),uri,major,minor,"FluComboBox"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluContentDialog.qml"),uri,major,minor,"FluContentDialog"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluContentPage.qml"),uri,major,minor,"FluContentPage"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluControl.qml"),uri,major,minor,"FluControl"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCopyableText.qml"),uri,major,minor,"FluCopyableText"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDatePicker.qml"),uri,major,minor,"FluDatePicker"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDivider.qml"),uri,major,minor,"FluDivider"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDropDownButton.qml"),uri,major,minor,"FluDropDownButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluExpander.qml"),uri,major,minor,"FluExpander"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFilledButton.qml"),uri,major,minor,"FluFilledButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFlipView.qml"),uri,major,minor,"FluFlipView"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFocusRectangle.qml"),uri,major,minor,"FluFocusRectangle"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluIcon.qml"),uri,major,minor,"FluIcon"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluIconButton.qml"),uri,major,minor,"FluIconButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluImage.qml"),uri,major,minor,"FluImage"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluImageButton.qml"),uri,major,minor,"FluImageButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluInfoBar.qml"),uri,major,minor,"FluInfoBar"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluItemDelegate.qml"),uri,major,minor,"FluItemDelegate"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenu.qml"),uri,major,minor,"FluMenu"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuBar.qml"),uri,major,minor,"FluMenuBar"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuBarItem.qml"),uri,major,minor,"FluMenuBarItem"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuItem.qml"),uri,major,minor,"FluMenuItem"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuSeparator.qml"),uri,major,minor,"FluMenuSeparator"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMultilineTextBox.qml"),uri,major,minor,"FluMultilineTextBox"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluNavigationView.qml"),uri,major,minor,"FluNavigationView"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluObject.qml"),uri,major,minor,"FluObject"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPage.qml"),uri,major,minor,"FluPage"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPagination.qml"),uri,major,minor,"FluPagination"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItem.qml"),uri,major,minor,"FluPaneItem"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemEmpty.qml"),uri,major,minor,"FluPaneItemEmpty"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemExpander.qml"),uri,major,minor,"FluPaneItemExpander"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemHeader.qml"),uri,major,minor,"FluPaneItemHeader"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemSeparator.qml"),uri,major,minor,"FluPaneItemSeparator"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPasswordBox.qml"),uri,major,minor,"FluPasswordBox"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPivot.qml"),uri,major,minor,"FluPivot"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPivotItem.qml"),uri,major,minor,"FluPivotItem"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPopup.qml"),uri,major,minor,"FluPopup"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressBar.qml"),uri,major,minor,"FluProgressBar"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressRing.qml"),uri,major,minor,"FluProgressRing"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluQRCode.qml"),uri,major,minor,"FluQRCode"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRadioButton.qml"),uri,major,minor,"FluRadioButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRadioButtons.qml"),uri,major,minor,"FluRadioButtons"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRatingControl.qml"),uri,major,minor,"FluRatingControl"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRemoteLoader.qml"),uri,major,minor,"FluRemoteLoader"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollBar.qml"),uri,major,minor,"FluScrollBar"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollIndicator.qml"),uri,major,minor,"FluScrollIndicator"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollablePage.qml"),uri,major,minor,"FluScrollablePage"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShadow.qml"),uri,major,minor,"FluShadow"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSlider.qml"),uri,major,minor,"FluSlider"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSpinBox.qml"),uri,major,minor,"FluSpinBox"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStatusLayout.qml"),uri,major,minor,"FluStatusLayout"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTabView.qml"),uri,major,minor,"FluTabView"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTableView.qml"),uri,major,minor,"FluTableView"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluText.qml"),uri,major,minor,"FluText"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBox.qml"),uri,major,minor,"FluTextBox"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBoxBackground.qml"),uri,major,minor,"FluTextBoxBackground"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBoxMenu.qml"),uri,major,minor,"FluTextBoxMenu"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextButton.qml"),uri,major,minor,"FluTextButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTimePicker.qml"),uri,major,minor,"FluTimePicker"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTimeline.qml"),uri,major,minor,"FluTimeline"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluToggleButton.qml"),uri,major,minor,"FluToggleButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluToggleSwitch.qml"),uri,major,minor,"FluToggleSwitch"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTooltip.qml"),uri,major,minor,"FluTooltip"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTour.qml"),uri,major,minor,"FluTour"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTreeView.qml"),uri,major,minor,"FluTreeView"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindow.qml"),uri,major,minor,"FluWindow"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindowDialog.qml"),uri,major,minor,"FluWindowDialog"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRangeSlider.qml"),uri,major,minor,"FluRangeSlider"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStaggeredLayout.qml"),uri,major,minor,"FluStaggeredLayout"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressButton.qml"),uri,major,minor,"FluProgressButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLoadingButton.qml"),uri,major,minor,"FluLoadingButton"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluClip.qml"),uri,major,minor,"FluClip"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLoader.qml"),uri,major,minor,"FluLoader"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShortcutPicker.qml"),uri,major,minor,"FluShortcutPicker"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSplitLayout.qml"),uri,major,minor,"FluSplitLayout"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindowResultLauncher.qml"),uri,major,minor,"FluWindowResultLauncher"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLauncher.qml"),uri,major,minor,"FluLauncher"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEvent.qml"),uri,major,minor,"FluEvent"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSheet.qml"),uri,major,minor,"FluSheet"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluGroupBox.qml"),uri,major,minor,"FluGroupBox"); - qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluControlBackground.qml"),uri,major,minor,"FluControlBackground"); - qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRouter.qml"),uri,major,minor,"FluRouter"); - qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEventBus.qml"),uri,major,minor,"FluEventBus"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAcrylic.qml"), uri, major, minor, "FluAcrylic"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAppBar.qml"), uri, major, minor, "FluAppBar"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFrame.qml"), uri, major, minor, "FluFrame"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAutoSuggestBox.qml"), uri, major, minor, "FluAutoSuggestBox"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluBadge.qml"), uri, major, minor, "FluBadge"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluBreadcrumbBar.qml"), uri, major, minor, "FluBreadcrumbBar"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluButton.qml"), uri, major, minor, "FluButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCalendarPicker.qml"), uri, major, minor, "FluCalendarPicker"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCarousel.qml"), uri, major, minor, "FluCarousel"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluChart.qml"), uri, major, minor, "FluChart"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCheckBox.qml"), uri, major, minor, "FluCheckBox"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluColorPicker.qml"), uri, major, minor, "FluColorPicker"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluComboBox.qml"), uri, major, minor, "FluComboBox"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluContentDialog.qml"), uri, major, minor, "FluContentDialog"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluContentPage.qml"), uri, major, minor, "FluContentPage"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluControl.qml"), uri, major, minor, "FluControl"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCopyableText.qml"), uri, major, minor, "FluCopyableText"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDatePicker.qml"), uri, major, minor, "FluDatePicker"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDivider.qml"), uri, major, minor, "FluDivider"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDropDownButton.qml"), uri, major, minor, "FluDropDownButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluExpander.qml"), uri, major, minor, "FluExpander"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFilledButton.qml"), uri, major, minor, "FluFilledButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFlipView.qml"), uri, major, minor, "FluFlipView"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFocusRectangle.qml"), uri, major, minor, "FluFocusRectangle"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluIcon.qml"), uri, major, minor, "FluIcon"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluIconButton.qml"), uri, major, minor, "FluIconButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluImage.qml"), uri, major, minor, "FluImage"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluImageButton.qml"), uri, major, minor, "FluImageButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluInfoBar.qml"), uri, major, minor, "FluInfoBar"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluItemDelegate.qml"), uri, major, minor, "FluItemDelegate"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenu.qml"), uri, major, minor, "FluMenu"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuBar.qml"), uri, major, minor, "FluMenuBar"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuBarItem.qml"), uri, major, minor, "FluMenuBarItem"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuItem.qml"), uri, major, minor, "FluMenuItem"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuSeparator.qml"), uri, major, minor, "FluMenuSeparator"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMultilineTextBox.qml"), uri, major, minor, "FluMultilineTextBox"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluNavigationView.qml"), uri, major, minor, "FluNavigationView"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluObject.qml"), uri, major, minor, "FluObject"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPage.qml"), uri, major, minor, "FluPage"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPagination.qml"), uri, major, minor, "FluPagination"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItem.qml"), uri, major, minor, "FluPaneItem"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemEmpty.qml"), uri, major, minor, "FluPaneItemEmpty"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemExpander.qml"), uri, major, minor, "FluPaneItemExpander"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemHeader.qml"), uri, major, minor, "FluPaneItemHeader"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemSeparator.qml"), uri, major, minor, "FluPaneItemSeparator"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPasswordBox.qml"), uri, major, minor, "FluPasswordBox"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPivot.qml"), uri, major, minor, "FluPivot"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPivotItem.qml"), uri, major, minor, "FluPivotItem"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPopup.qml"), uri, major, minor, "FluPopup"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressBar.qml"), uri, major, minor, "FluProgressBar"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressRing.qml"), uri, major, minor, "FluProgressRing"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluQRCode.qml"), uri, major, minor, "FluQRCode"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRadioButton.qml"), uri, major, minor, "FluRadioButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRadioButtons.qml"), uri, major, minor, "FluRadioButtons"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRatingControl.qml"), uri, major, minor, "FluRatingControl"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRemoteLoader.qml"), uri, major, minor, "FluRemoteLoader"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollBar.qml"), uri, major, minor, "FluScrollBar"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollIndicator.qml"), uri, major, minor, "FluScrollIndicator"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollablePage.qml"), uri, major, minor, "FluScrollablePage"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShadow.qml"), uri, major, minor, "FluShadow"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSlider.qml"), uri, major, minor, "FluSlider"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSpinBox.qml"), uri, major, minor, "FluSpinBox"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStatusLayout.qml"), uri, major, minor, "FluStatusLayout"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTabView.qml"), uri, major, minor, "FluTabView"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTableView.qml"), uri, major, minor, "FluTableView"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluText.qml"), uri, major, minor, "FluText"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBox.qml"), uri, major, minor, "FluTextBox"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBoxBackground.qml"), uri, major, minor, "FluTextBoxBackground"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBoxMenu.qml"), uri, major, minor, "FluTextBoxMenu"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextButton.qml"), uri, major, minor, "FluTextButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTimePicker.qml"), uri, major, minor, "FluTimePicker"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTimeline.qml"), uri, major, minor, "FluTimeline"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluToggleButton.qml"), uri, major, minor, "FluToggleButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluToggleSwitch.qml"), uri, major, minor, "FluToggleSwitch"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTooltip.qml"), uri, major, minor, "FluTooltip"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTour.qml"), uri, major, minor, "FluTour"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTreeView.qml"), uri, major, minor, "FluTreeView"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindow.qml"), uri, major, minor, "FluWindow"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindowDialog.qml"), uri, major, minor, "FluWindowDialog"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRangeSlider.qml"), uri, major, minor, "FluRangeSlider"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStaggeredLayout.qml"), uri, major, minor, "FluStaggeredLayout"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressButton.qml"), uri, major, minor, "FluProgressButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLoadingButton.qml"), uri, major, minor, "FluLoadingButton"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluClip.qml"), uri, major, minor, "FluClip"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLoader.qml"), uri, major, minor, "FluLoader"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShortcutPicker.qml"), uri, major, minor, "FluShortcutPicker"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSplitLayout.qml"), uri, major, minor, "FluSplitLayout"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindowResultLauncher.qml"), uri, major, minor, "FluWindowResultLauncher"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLauncher.qml"), uri, major, minor, "FluLauncher"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEvent.qml"), uri, major, minor, "FluEvent"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSheet.qml"), uri, major, minor, "FluSheet"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluGroupBox.qml"), uri, major, minor, "FluGroupBox"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluControlBackground.qml"), uri, major, minor, "FluControlBackground"); + qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRouter.qml"), uri, major, minor, "FluRouter"); + qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEventBus.qml"), uri, major, minor, "FluEventBus"); - qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri,major,minor,"FluThemeType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluPageType::staticMetaObject, uri,major,minor,"FluPageType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluWindowType::staticMetaObject, uri,major,minor,"FluWindowType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluTreeViewType::staticMetaObject, uri,major,minor,"FluTreeViewType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluStatusLayoutType::staticMetaObject, uri,major,minor,"FluStatusLayoutType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluContentDialogType::staticMetaObject, uri,major,minor,"FluContentDialogType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluTimePickerType::staticMetaObject, uri,major,minor,"FluTimePickerType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluCalendarViewType::staticMetaObject, uri,major,minor,"FluCalendarViewType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluTabViewType::staticMetaObject, uri,major,minor,"FluTabViewType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri,major,minor,"FluNavigationViewType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri,major,minor,"FluTimelineType", "Access to enums & flags only"); - qmlRegisterUncreatableMetaObject(FluSheetType::staticMetaObject, uri,major,minor,"FluSheetType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri, major, minor, "FluentIcons", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri, major, minor, "FluThemeType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluPageType::staticMetaObject, uri, major, minor, "FluPageType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluWindowType::staticMetaObject, uri, major, minor, "FluWindowType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluTreeViewType::staticMetaObject, uri, major, minor, "FluTreeViewType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluStatusLayoutType::staticMetaObject, uri, major, minor, "FluStatusLayoutType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluContentDialogType::staticMetaObject, uri, major, minor, "FluContentDialogType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluTimePickerType::staticMetaObject, uri, major, minor, "FluTimePickerType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluCalendarViewType::staticMetaObject, uri, major, minor, "FluCalendarViewType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluTabViewType::staticMetaObject, uri, major, minor, "FluTabViewType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri, major, minor, "FluNavigationViewType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri, major, minor, "FluTimelineType", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(FluSheetType::staticMetaObject, uri, major, minor, "FluSheetType", "Access to enums & flags only"); - qmlRegisterModule(uri,major,minor); + qmlRegisterModule(uri, major, minor); #endif } -void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){ - engine->rootContext()->setContextProperty("FluApp",FluApp::getInstance()); - engine->rootContext()->setContextProperty("FluColors",FluColors::getInstance()); - engine->rootContext()->setContextProperty("FluTheme",FluTheme::getInstance()); - engine->rootContext()->setContextProperty("FluTools",FluTools::getInstance()); - engine->rootContext()->setContextProperty("FluTextStyle",FluTextStyle::getInstance()); +void FluentUI::initializeEngine(QQmlEngine *engine, [[maybe_unused]] const char *uri) { + engine->rootContext()->setContextProperty("FluApp", FluApp::getInstance()); + engine->rootContext()->setContextProperty("FluColors", FluColors::getInstance()); + engine->rootContext()->setContextProperty("FluTheme", FluTheme::getInstance()); + engine->rootContext()->setContextProperty("FluTools", FluTools::getInstance()); + engine->rootContext()->setContextProperty("FluTextStyle", FluTextStyle::getInstance()); } diff --git a/src/FluentUI.h b/src/FluentUI.h index caf6c664..eb454741 100644 --- a/src/FluentUI.h +++ b/src/FluentUI.h @@ -1,5 +1,4 @@ -#ifndef FLUENTUI_H -#define FLUENTUI_H +#pragma once #include #include @@ -8,18 +7,20 @@ /** * @brief The FluentUI class */ -class FluentUI : public QObject -{ - Q_OBJECT -public: - SINGLETON(FluentUI) - Q_DECL_EXPORT void registerTypes(QQmlEngine *engine); - void registerTypes(const char *uri); - void initializeEngine(QQmlEngine *engine, const char *uri); -private: - const int major = 1; - const int minor = 0; - const char *uri = "FluentUI"; -}; +class FluentUI : public QObject { +Q_OBJECT -#endif // FLUENTUI_H +public: +SINGLETON(FluentUI) + + Q_DECL_EXPORT void registerTypes(QQmlEngine *engine); + + void registerTypes(const char *uri) const; + + void initializeEngine(QQmlEngine *engine, [[maybe_unused]] const char *uri); + +private: + const int _major = 1; + const int _minor = 0; + const char *_uri = "FluentUI"; +}; \ No newline at end of file diff --git a/src/fluentuiplugin.cpp b/src/fluentuiplugin.cpp index 59eac0a5..55d865c5 100644 --- a/src/fluentuiplugin.cpp +++ b/src/fluentuiplugin.cpp @@ -2,18 +2,12 @@ #include "FluentUI.h" -FluentUIPlugin::FluentUIPlugin() -{ +FluentUIPlugin::FluentUIPlugin() = default; -} - -void FluentUIPlugin::registerTypes(const char *uri) -{ +void FluentUIPlugin::registerTypes(const char *uri) { FluentUI::getInstance()->registerTypes(uri); } -void FluentUIPlugin::initializeEngine(QQmlEngine *engine, const char *uri) -{ - Q_UNUSED(uri) - FluentUI::getInstance()->initializeEngine(engine,uri); +void FluentUIPlugin::initializeEngine(QQmlEngine *engine, const char *uri) { + FluentUI::getInstance()->initializeEngine(engine, uri); } diff --git a/src/fluentuiplugin.h b/src/fluentuiplugin.h index d87b9b3f..bc609baa 100644 --- a/src/fluentuiplugin.h +++ b/src/fluentuiplugin.h @@ -1,19 +1,18 @@ -#ifndef FLUENTUIPLUGIN_H -#define FLUENTUIPLUGIN_H +#pragma once #include /** * @brief The FluentUIPlugin class */ -class FluentUIPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT +class FluentUIPlugin : public QQmlExtensionPlugin { +Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: FluentUIPlugin(); - void registerTypes(const char *uri) Q_DECL_OVERRIDE; - void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE; -}; -#endif // FLUENTUIPLUGIN_H + void registerTypes(const char *uri) Q_DECL_OVERRIDE; + + void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE; +}; \ No newline at end of file diff --git a/src/singleton.h b/src/singleton.h index 8d6c10e6..9583c687 100644 --- a/src/singleton.h +++ b/src/singleton.h @@ -1,18 +1,17 @@ -#ifndef SINGLETON_H -#define SINGLETON_H +#pragma once /** * @brief The Singleton class */ -template +template class Singleton { public: - static T* getInstance(); + static T *getInstance(); }; -template -T* Singleton::getInstance() { - static T* instance = new T(); +template +T *Singleton::getInstance() { + static T *instance = new T(); return instance; } @@ -23,5 +22,3 @@ private: \ static Class* getInstance() { \ return Singleton::getInstance(); \ } - -#endif // SINGLETON_H diff --git a/src/stdafx.h b/src/stdafx.h index 4b4d821c..b411a82a 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -1,37 +1,50 @@ -#ifndef STDAFX_H -#define STDAFX_H +#pragma once -#define Q_PROPERTY_AUTO(TYPE, M) \ +#define Q_PROPERTY_AUTO_P(TYPE, M) \ Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ - public: \ - Q_SIGNAL void M##Changed(); \ - void M(TYPE in_##M) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(TYPE in_##M) \ { \ - _##M = in_##M; \ - Q_EMIT M##Changed(); \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ } \ - TYPE M() \ + TYPE M() \ { \ - return _##M; \ + return _##M; \ } \ - private: \ - TYPE _##M; \ + private: \ + TYPE _##M; \ + +#define Q_PROPERTY_AUTO(TYPE, M) \ +Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(const TYPE& in_##M) \ +{ \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ +} \ + TYPE M() \ +{ \ + return _##M; \ +} \ + private: \ + TYPE _##M; \ -#define Q_PROPERTY_READONLY_AUTO(TYPE, M) \ +#define Q_PROPERTY_READONLY_AUTO(TYPE, M) \ Q_PROPERTY(TYPE M READ M NOTIFY M##Changed FINAL) \ - public: \ - Q_SIGNAL void M##Changed(); \ - void M(TYPE in_##M) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(const TYPE& in_##M) \ { \ - _##M = in_##M; \ - Q_EMIT M##Changed(); \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ } \ - TYPE M() \ + TYPE M() \ { \ - return _##M; \ + return _##M; \ } \ - private: \ - TYPE _##M; \ - -#endif // STDAFX_H + private: \ + TYPE _##M; \ From 96fef84c2d892c9ee87677a6a6a93b3781124f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Thu, 11 Apr 2024 14:56:22 +0800 Subject: [PATCH 03/29] update --- example/qml/page/T_OpenGL.qml | 32 ++++++++++ example/src/component/OpenGLItem.cpp | 93 ++++++++++++++++++++++++++++ example/src/component/OpenGLItem.h | 33 ++++++++++ 3 files changed, 158 insertions(+) create mode 100644 example/qml/page/T_OpenGL.qml create mode 100644 example/src/component/OpenGLItem.cpp create mode 100644 example/src/component/OpenGLItem.h diff --git a/example/qml/page/T_OpenGL.qml b/example/qml/page/T_OpenGL.qml new file mode 100644 index 00000000..8582fb3e --- /dev/null +++ b/example/qml/page/T_OpenGL.qml @@ -0,0 +1,32 @@ +import QtQuick 2.15 +import QtQuick.Layouts 1.15 +import QtQuick.Window 2.15 +import QtQuick.Controls 2.15 +import FluentUI 1.0 +import example 1.0 +import "../component" + +FluContentPage{ + + title: qsTr("OpenGL") + + + FluFrame{ + anchors.fill: parent + + OpenGLItem{ + width: 320 + height: 480 + SequentialAnimation on t { + NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad } + NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad } + loops: Animation.Infinite + running: true + } + } + + } + + + +} diff --git a/example/src/component/OpenGLItem.cpp b/example/src/component/OpenGLItem.cpp new file mode 100644 index 00000000..60c6bdee --- /dev/null +++ b/example/src/component/OpenGLItem.cpp @@ -0,0 +1,93 @@ +#include "OpenGLItem.h" + +#include +#include + +class FBORenderer : public QQuickFramebufferObject::Renderer, protected QOpenGLFunctions { +public: + explicit FBORenderer(const OpenGLItem *item); + + void render() override; + + QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) override; + + QOpenGLShaderProgram program; + const OpenGLItem *item = nullptr; +}; + +FBORenderer::FBORenderer(const OpenGLItem *item) { + this->item = item; + initializeOpenGLFunctions(); + program.addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, + "attribute highp vec4 vertices;" + "varying highp vec2 coords;" + "void main() {" + " gl_Position = vertices;" + " coords = vertices.xy;" + "}"); + program.addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, + "uniform lowp float t;" + "varying highp vec2 coords;" + "void main() {" + " lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));" + " i = smoothstep(t - 0.8, t + 0.8, i);" + " i = floor(i * 20.) / 20.;" + " gl_FragColor = vec4(coords * .5 + .5, i, i);" + "}"); + + program.bindAttributeLocation("vertices", 0); + program.link(); +} + +QOpenGLFramebufferObject *FBORenderer::createFramebufferObject(const QSize &size) { + QOpenGLFramebufferObjectFormat format; + format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); + format.setSamples(4); + return new QOpenGLFramebufferObject(size, format); +} + +void FBORenderer::render() { + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glEnable(GL_DEPTH_TEST); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + program.bind(); + program.enableAttributeArray(0); + float values[] = { + -1, -1, + 1, -1, + -1, 1, + 1, 1 + }; + glBindBuffer(GL_ARRAY_BUFFER, 0); + program.setAttributeArray(0, GL_FLOAT, values, 2); + program.setUniformValue("t", (float) item->t()); + glViewport(0, 0, qRound(item->width()), qRound(item->height())); + glDisable(GL_DEPTH_TEST); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + program.disableAttributeArray(0); + program.release(); +} + + +OpenGLItem::OpenGLItem(QQuickItem *parent) : QQuickFramebufferObject(parent) { + setMirrorVertically(true); + startTimer(1); +} + +void OpenGLItem::timerEvent(QTimerEvent *) { + update(); +} + +void OpenGLItem::setT(qreal t) { + if (t == m_t) + return; + m_t = t; + emit tChanged(); +} + + +QQuickFramebufferObject::Renderer *OpenGLItem::createRenderer() const { + return new FBORenderer(this); +} diff --git a/example/src/component/OpenGLItem.h b/example/src/component/OpenGLItem.h new file mode 100644 index 00000000..0aac13f4 --- /dev/null +++ b/example/src/component/OpenGLItem.h @@ -0,0 +1,33 @@ +#pragma once +#pragma clang diagnostic push +#pragma ide diagnostic ignored "NotImplementedFunctions" + +#include +#include +#include + +class FBORenderer; + +class OpenGLItem : public QQuickFramebufferObject, protected QOpenGLFunctions { +Q_OBJECT + Q_PROPERTY(qreal t READ t WRITE setT NOTIFY tChanged) +public: + explicit OpenGLItem(QQuickItem *parent = nullptr); + + [[nodiscard]] QQuickFramebufferObject::Renderer *createRenderer() const override; + + void timerEvent(QTimerEvent *) override; + + [[nodiscard]] qreal t() const { return m_t; } + + void setT(qreal t); + +signals: + + void tChanged(); + +private: + qreal m_t{}; +}; + +#pragma clang diagnostic pop \ No newline at end of file From 3f6ef13cd0fc39af45b276521ab2a0a1796bcd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Thu, 11 Apr 2024 15:09:47 +0800 Subject: [PATCH 04/29] update --- example/src/app_dmp.h | 6 +----- example/src/component/CircularReveal.h | 4 ---- example/src/component/FileWatcher.h | 4 ---- example/src/component/OpenGLItem.h | 8 ++----- example/src/helper/InitializrHelper.h | 4 ---- example/src/helper/Network.cpp | 6 ------ example/src/helper/Network.h | 12 ++++------- example/src/helper/SettingsHelper.cpp | 5 ----- example/src/helper/SettingsHelper.h | 3 --- src/FluTools.cpp | 6 ------ src/FluTools.h | 6 +----- src/FluTreeModel.cpp | 6 ------ src/FluTreeModel.h | 29 +++++++++++--------------- 13 files changed, 20 insertions(+), 79 deletions(-) diff --git a/example/src/app_dmp.h b/example/src/app_dmp.h index 9fee040f..114ba376 100644 --- a/example/src/app_dmp.h +++ b/example/src/app_dmp.h @@ -1,6 +1,4 @@ #pragma once -#pragma clang diagnostic push -#pragma ide diagnostic ignored "misc-misplaced-const" #include #include @@ -78,6 +76,4 @@ LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS *exp) { arguments << "-crashed=" + dumpFilePath; QProcess::startDetached(QGuiApplication::applicationFilePath(), arguments); return EXCEPTION_EXECUTE_HANDLER; -} - -#pragma clang diagnostic pop \ No newline at end of file +} \ No newline at end of file diff --git a/example/src/component/CircularReveal.h b/example/src/component/CircularReveal.h index 540d4876..03101678 100644 --- a/example/src/component/CircularReveal.h +++ b/example/src/component/CircularReveal.h @@ -1,6 +1,4 @@ #pragma once -#pragma clang diagnostic push -#pragma ide diagnostic ignored "NotImplementedFunctions" #include #include @@ -31,5 +29,3 @@ private: QPoint _center; QSharedPointer _grabResult; }; - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/component/FileWatcher.h b/example/src/component/FileWatcher.h index 14f40fb5..e70844cc 100644 --- a/example/src/component/FileWatcher.h +++ b/example/src/component/FileWatcher.h @@ -1,6 +1,4 @@ #pragma once -#pragma clang diagnostic push -#pragma ide diagnostic ignored "NotImplementedFunctions" #include #include @@ -21,5 +19,3 @@ private: private: QFileSystemWatcher _watcher; }; - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/component/OpenGLItem.h b/example/src/component/OpenGLItem.h index 0aac13f4..4b9da909 100644 --- a/example/src/component/OpenGLItem.h +++ b/example/src/component/OpenGLItem.h @@ -1,6 +1,4 @@ #pragma once -#pragma clang diagnostic push -#pragma ide diagnostic ignored "NotImplementedFunctions" #include #include @@ -14,11 +12,11 @@ Q_OBJECT public: explicit OpenGLItem(QQuickItem *parent = nullptr); - [[nodiscard]] QQuickFramebufferObject::Renderer *createRenderer() const override; + QQuickFramebufferObject::Renderer *createRenderer() const override; void timerEvent(QTimerEvent *) override; - [[nodiscard]] qreal t() const { return m_t; } + qreal t() const { return m_t; } void setT(qreal t); @@ -29,5 +27,3 @@ signals: private: qreal m_t{}; }; - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/InitializrHelper.h b/example/src/helper/InitializrHelper.h index 2a9c250d..3f3ba910 100644 --- a/example/src/helper/InitializrHelper.h +++ b/example/src/helper/InitializrHelper.h @@ -1,5 +1,3 @@ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "NotImplementedFunctions" #pragma once #include @@ -30,5 +28,3 @@ SINGLETON(InitializrHelper) Q_SIGNAL void success(const QString &path); }; - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/Network.cpp b/example/src/helper/Network.cpp index 7f2ebc04..071f303b 100644 --- a/example/src/helper/Network.cpp +++ b/example/src/helper/Network.cpp @@ -1,7 +1,3 @@ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "UnusedParameter" -#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" - #include "Network.h" #include @@ -666,5 +662,3 @@ NetworkParams *Network::deleteJsonArray(const QString &url) { void Network::setInterceptor(QJSValue interceptor) { this->_interceptor = std::move(interceptor); } - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/Network.h b/example/src/helper/Network.h index 1e37707c..d0f7e3e2 100644 --- a/example/src/helper/Network.h +++ b/example/src/helper/Network.h @@ -1,6 +1,4 @@ #pragma once -#pragma clang diagnostic push -#pragma ide diagnostic ignored "NotImplementedFunctions" #include #include @@ -206,13 +204,13 @@ SINGLETON(Network) void handleDownload(NetworkParams *params, NetworkCallable *result); private: - static void sendRequest(QNetworkAccessManager *manager, QNetworkRequest request, NetworkParams *params, QNetworkReply *&reply, bool isFirst, const QPointer& callable); + static void sendRequest(QNetworkAccessManager *manager, QNetworkRequest request, NetworkParams *params, QNetworkReply *&reply, bool isFirst, const QPointer &callable); static void addQueryParam(QUrl *url, const QMap ¶ms); static void addHeaders(QNetworkRequest *request, const QMap &headers); - void saveResponse(const QString& key, const QString& response); + void saveResponse(const QString &key, const QString &response); QString readCache(const QString &key); @@ -222,14 +220,12 @@ private: static QString headerList2String(const QList &data); - static void printRequestStartLog(const QNetworkRequest& request, NetworkParams *params); + static void printRequestStartLog(const QNetworkRequest &request, NetworkParams *params); - static void printRequestEndLog(const QNetworkRequest& request, NetworkParams *params, QNetworkReply *&reply, const QString &response); + static void printRequestEndLog(const QNetworkRequest &request, NetworkParams *params, QNetworkReply *&reply, const QString &response); static QString map2String(const QMap &map); public: QJSValue _interceptor; }; - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/SettingsHelper.cpp b/example/src/helper/SettingsHelper.cpp index af77d709..34e8cfda 100644 --- a/example/src/helper/SettingsHelper.cpp +++ b/example/src/helper/SettingsHelper.cpp @@ -1,6 +1,3 @@ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" - #include "SettingsHelper.h" #include @@ -31,5 +28,3 @@ void SettingsHelper::init(char *argv[]) { const QString iniFilePath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + iniFileName; m_settings.reset(new QSettings(iniFilePath, QSettings::IniFormat)); } - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/example/src/helper/SettingsHelper.h b/example/src/helper/SettingsHelper.h index ab49a49d..9440fdf7 100644 --- a/example/src/helper/SettingsHelper.h +++ b/example/src/helper/SettingsHelper.h @@ -1,5 +1,3 @@ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" #pragma once #include @@ -43,4 +41,3 @@ private: private: QScopedPointer m_settings; }; -#pragma clang diagnostic pop \ No newline at end of file diff --git a/src/FluTools.cpp b/src/FluTools.cpp index 22d2c85d..bed2f651 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -1,7 +1,3 @@ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" -#pragma ide diagnostic ignored "readability-convert-member-functions-to-static" - #include "FluTools.h" #include @@ -248,5 +244,3 @@ bool FluTools::isWindows10OrGreater() { QRect FluTools::desktopAvailableGeometry(QQuickWindow *window) { return window->screen()->availableGeometry(); } - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/src/FluTools.h b/src/FluTools.h index 0b97da3a..f1b4bb95 100644 --- a/src/FluTools.h +++ b/src/FluTools.h @@ -1,5 +1,3 @@ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" #pragma once #include @@ -94,6 +92,4 @@ SINGLETON(FluTools) Q_INVOKABLE bool isWindows10OrGreater(); Q_INVOKABLE QRect desktopAvailableGeometry(QQuickWindow *window); -}; - -#pragma clang diagnostic pop \ No newline at end of file +}; \ No newline at end of file diff --git a/src/FluTreeModel.cpp b/src/FluTreeModel.cpp index fd94b58d..aada5733 100644 --- a/src/FluTreeModel.cpp +++ b/src/FluTreeModel.cpp @@ -1,7 +1,3 @@ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" -#pragma ide diagnostic ignored "google-default-arguments" - #include "FluTreeModel.h" #include @@ -276,5 +272,3 @@ void FluTreeModel::allCollapse() { _rows = _root->_children; endResetModel(); } - -#pragma clang diagnostic pop \ No newline at end of file diff --git a/src/FluTreeModel.h b/src/FluTreeModel.h index d46fa250..7765a66f 100644 --- a/src/FluTreeModel.h +++ b/src/FluTreeModel.h @@ -1,6 +1,3 @@ -#pragma clang diagnostic push -#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" -#pragma ide diagnostic ignored "google-default-arguments" #pragma once #include @@ -22,10 +19,10 @@ Q_OBJECT public: explicit FluTreeNode(QObject *parent = nullptr); - Q_INVOKABLE [[nodiscard]] int depth() const { return _depth; }; - Q_INVOKABLE [[nodiscard]] bool isExpanded() const { return _isExpanded; }; - Q_INVOKABLE [[nodiscard]] QVariantMap data() const { return _data; }; - Q_INVOKABLE [[nodiscard]] bool hasChildren() const { return !_children.isEmpty(); }; + Q_INVOKABLE int depth() const { return _depth; }; + Q_INVOKABLE bool isExpanded() const { return _isExpanded; }; + Q_INVOKABLE QVariantMap data() const { return _data; }; + Q_INVOKABLE bool hasChildren() const { return !_children.isEmpty(); }; Q_INVOKABLE bool hasNextNodeByIndex(int index) { FluTreeNode *p = this; for (int i = 0; i <= _depth - index - 1; i++) { @@ -37,7 +34,7 @@ public: return true; } - Q_INVOKABLE [[nodiscard]] bool checked() const { + Q_INVOKABLE bool checked() const { if (!hasChildren()) { return _checked; } @@ -63,7 +60,7 @@ public: return false; }; - [[nodiscard]] bool isShown() const { + bool isShown() const { auto p = _parent; while (p) { if (!p->_isExpanded) { @@ -99,17 +96,17 @@ public: explicit FluTreeModel(QObject *parent = nullptr); - [[nodiscard]] int rowCount(const QModelIndex &parent = {}) const override; + int rowCount(const QModelIndex &parent = {}) const override; - [[nodiscard]] int columnCount(const QModelIndex &parent = {}) const override; + int columnCount(const QModelIndex &parent = {}) const override; - [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - [[nodiscard]] QHash roleNames() const override; + QHash roleNames() const override; - [[nodiscard]] QModelIndex parent(const QModelIndex &child) const override; + QModelIndex parent(const QModelIndex &child) const override; - [[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override; + QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override; Q_INVOKABLE void removeRows(int row, int count); @@ -144,5 +141,3 @@ private: QList _dataSource; FluTreeNode *_root = nullptr; }; - -#pragma clang diagnostic pop \ No newline at end of file From 531f659e591402c4b390d0b445744a44368758b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Thu, 11 Apr 2024 15:27:15 +0800 Subject: [PATCH 05/29] update --- example/qml/page/T_OpenGL.qml | 8 +------- example/src/component/OpenGLItem.cpp | 2 +- example/src/component/OpenGLItem.h | 4 ++-- src/FluTreeModel.h | 29 ++++++++++++++++------------ 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/example/qml/page/T_OpenGL.qml b/example/qml/page/T_OpenGL.qml index 8582fb3e..c39b4869 100644 --- a/example/qml/page/T_OpenGL.qml +++ b/example/qml/page/T_OpenGL.qml @@ -10,13 +10,10 @@ FluContentPage{ title: qsTr("OpenGL") - FluFrame{ anchors.fill: parent - OpenGLItem{ - width: 320 - height: 480 + anchors.fill: parent SequentialAnimation on t { NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad } NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad } @@ -24,9 +21,6 @@ FluContentPage{ running: true } } - } - - } diff --git a/example/src/component/OpenGLItem.cpp b/example/src/component/OpenGLItem.cpp index 60c6bdee..58e86d78 100644 --- a/example/src/component/OpenGLItem.cpp +++ b/example/src/component/OpenGLItem.cpp @@ -47,7 +47,7 @@ QOpenGLFramebufferObject *FBORenderer::createFramebufferObject(const QSize &size } void FBORenderer::render() { - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_DEPTH_TEST); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); program.bind(); diff --git a/example/src/component/OpenGLItem.h b/example/src/component/OpenGLItem.h index 4b9da909..d1570c7f 100644 --- a/example/src/component/OpenGLItem.h +++ b/example/src/component/OpenGLItem.h @@ -12,11 +12,11 @@ Q_OBJECT public: explicit OpenGLItem(QQuickItem *parent = nullptr); - QQuickFramebufferObject::Renderer *createRenderer() const override; + [[nodiscard]] QQuickFramebufferObject::Renderer *createRenderer() const override; void timerEvent(QTimerEvent *) override; - qreal t() const { return m_t; } + [[nodiscard]] qreal t() const { return m_t; } void setT(qreal t); diff --git a/src/FluTreeModel.h b/src/FluTreeModel.h index 7765a66f..07eb6ed6 100644 --- a/src/FluTreeModel.h +++ b/src/FluTreeModel.h @@ -19,10 +19,14 @@ Q_OBJECT public: explicit FluTreeNode(QObject *parent = nullptr); - Q_INVOKABLE int depth() const { return _depth; }; - Q_INVOKABLE bool isExpanded() const { return _isExpanded; }; - Q_INVOKABLE QVariantMap data() const { return _data; }; - Q_INVOKABLE bool hasChildren() const { return !_children.isEmpty(); }; + [[nodiscard]] Q_INVOKABLE int depth() const { return _depth; }; + + [[nodiscard]] Q_INVOKABLE bool isExpanded() const { return _isExpanded; }; + + [[nodiscard]] Q_INVOKABLE QVariantMap data() const { return _data; }; + + [[nodiscard]] Q_INVOKABLE bool hasChildren() const { return !_children.isEmpty(); }; + Q_INVOKABLE bool hasNextNodeByIndex(int index) { FluTreeNode *p = this; for (int i = 0; i <= _depth - index - 1; i++) { @@ -34,7 +38,7 @@ public: return true; } - Q_INVOKABLE bool checked() const { + [[nodiscard]] Q_INVOKABLE bool checked() const { if (!hasChildren()) { return _checked; } @@ -46,6 +50,7 @@ public: } return true; }; + Q_INVOKABLE bool hideLineFooter() { if (_parent) { auto childIndex = _parent->_children.indexOf(this); @@ -60,7 +65,7 @@ public: return false; }; - bool isShown() const { + [[nodiscard]] bool isShown() const { auto p = _parent; while (p) { if (!p->_isExpanded) { @@ -96,17 +101,17 @@ public: explicit FluTreeModel(QObject *parent = nullptr); - int rowCount(const QModelIndex &parent = {}) const override; + [[nodiscard]] int rowCount(const QModelIndex &parent = {}) const override; - int columnCount(const QModelIndex &parent = {}) const override; + [[nodiscard]] int columnCount(const QModelIndex &parent = {}) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - QHash roleNames() const override; + [[nodiscard]] QHash roleNames() const override; - QModelIndex parent(const QModelIndex &child) const override; + [[nodiscard]] QModelIndex parent(const QModelIndex &child) const override; - QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override; + [[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override; Q_INVOKABLE void removeRows(int row, int count); From 3997daaa11de6c67ec8ca686a7a6a7e96680176e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Thu, 11 Apr 2024 19:18:37 +0800 Subject: [PATCH 06/29] update --- example/CMakeLists.txt | 5 - example/example.qrc | 2 +- example/example_en_US.ts | 56 +- example/example_zh_CN.ts | 45 +- example/qml/global/ItemsOriginal.qml | 4 +- .../qml/page/{T_Awesome.qml => T_Icons.qml} | 46 +- example/src/AppInfo.h | 2 +- src/Def.h | 1413 ---------------- src/FluCaptcha.h | 2 +- src/FluColors.cpp | 10 +- src/FluColors.h | 4 +- src/FluFrameless.h | 8 +- src/FluTableSortProxyModel.h | 12 +- src/FluTheme.cpp | 3 +- src/FluTheme.h | 2 +- src/FluentIconDef.h | 1417 +++++++++++++++++ src/FluentUI.cpp | 3 +- src/Qt5/imports/FluentUI/Controls/FluIcon.qml | 6 +- ...Segoe_Fluent_Icons.ttf => FluentIcons.ttf} | Bin src/Qt5/imports/fluentui.qrc | 2 +- src/Qt6/imports/FluentUI/Controls/FluIcon.qml | 6 +- ...Segoe_Fluent_Icons.ttf => FluentIcons.ttf} | Bin 22 files changed, 1545 insertions(+), 1503 deletions(-) rename example/qml/page/{T_Awesome.qml => T_Icons.qml} (60%) create mode 100644 src/FluentIconDef.h rename src/Qt5/imports/FluentUI/Font/{Segoe_Fluent_Icons.ttf => FluentIcons.ttf} (100%) rename src/Qt6/imports/FluentUI/Font/{Segoe_Fluent_Icons.ttf => FluentIcons.ttf} (100%) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index b4b028bf..0fc53fe1 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -171,10 +171,5 @@ if (CMAKE_BUILD_TYPE MATCHES "Release") SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) - - target_sources(Script-DeployRelease - PRIVATE - src/component/OpenGLItem.h src/component/OpenGLItem.cpp - ) endif () endif () diff --git a/example/example.qrc b/example/example.qrc index 646ef145..696c79bc 100644 --- a/example/example.qrc +++ b/example/example.qrc @@ -127,7 +127,6 @@ qml/global/ItemsOriginal.qml qml/global/qmldir qml/page/T_Acrylic.qml - qml/page/T_Awesome.qml qml/page/T_Badge.qml qml/page/T_BreadcrumbBar.qml qml/page/T_Buttons.qml @@ -210,6 +209,7 @@ res/image/bg_scenic.jpg qml/window/FluentInitializrWindow.qml qml/page/T_OpenGL.qml + qml/page/T_Icons.qml diff --git a/example/example_en_US.ts b/example/example_en_US.ts index b3d08a52..8d3c2fce 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -87,21 +87,29 @@ InitializrHelper + + The name cannot be empty + + The creation path cannot be empty + + The path does not exist + + %1 folder already exists @@ -425,7 +433,7 @@ - Awesome + Icons @@ -774,29 +782,6 @@ Updated content: - - T_Awesome - - - Awesome - - - - - Please enter a keyword - - - - - Search - - - - - You Copied - - - T_Badge @@ -1386,6 +1371,29 @@ My only desire is to be permitted to drive out the traitors and restore the Han. + + T_Icons + + + Icons + + + + + Please enter a keyword + + + + + Search + + + + + You Copied + + + T_Image diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 7ecd333f..659077c2 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -87,21 +87,29 @@ InitializrHelper + + The name cannot be empty 名称不能为空 + + The creation path cannot be empty 创建路径不能为空 + + The path does not exist 路径不存在 + + %1 folder already exists %1 文件夹已经存在 @@ -425,7 +433,7 @@ - Awesome + Icons 图标 @@ -781,24 +789,20 @@ Updated content: T_Awesome - Awesome - 图标 + 图标 - Please enter a keyword - 请输入关键字 + 请输入关键字 - Search - 搜索 + 搜索 - You Copied - 您复制 + 您复制 @@ -1417,6 +1421,29 @@ My only desire is to be permitted to drive out the traitors and restore the Han. FluentUI 脚手架是一个快速创建项目工具,可帮助您创建和自定义具有各种选项的 Fluent UI 项目 + + T_Icons + + + Icons + 图标 + + + + Please enter a keyword + 请输入关键字 + + + + Search + 搜索 + + + + You Copied + 您复制 + + T_Image diff --git a/example/qml/global/ItemsOriginal.qml b/example/qml/global/ItemsOriginal.qml index cbd84e99..522b91b5 100644 --- a/example/qml/global/ItemsOriginal.qml +++ b/example/qml/global/ItemsOriginal.qml @@ -364,9 +364,9 @@ FluObject{ onTap: { navigationView.push(url) } } FluPaneItem{ - title: qsTr("Awesome") + title: qsTr("Icons") menuDelegate: paneItemMenu - url: "qrc:/example/qml/page/T_Awesome.qml" + url: "qrc:/example/qml/page/T_Icons.qml" onTap: { navigationView.push(url) } } } diff --git a/example/qml/page/T_Awesome.qml b/example/qml/page/T_Icons.qml similarity index 60% rename from example/qml/page/T_Awesome.qml rename to example/qml/page/T_Icons.qml index 5f304426..7e48bcd5 100644 --- a/example/qml/page/T_Awesome.qml +++ b/example/qml/page/T_Icons.qml @@ -6,13 +6,13 @@ import FluentUI 1.0 FluContentPage { - title: qsTr("Awesome") + title: qsTr("Icons") FluTextBox{ - id:text_box + id: text_box placeholderText: qsTr("Please enter a keyword") anchors{ - top:parent.top + top: parent.top } } @@ -28,43 +28,45 @@ FluContentPage { } } GridView{ - id:grid_view - cellWidth: 80 - cellHeight: 80 + id: grid_view + cellWidth: 110 + cellHeight: 110 clip: true boundsBehavior: GridView.StopAtBounds model:FluTheme.awesomeList() ScrollBar.vertical: FluScrollBar {} anchors{ topMargin: 10 - top:text_box.bottom + top: text_box.bottom left: parent.left right: parent.right bottom: parent.bottom } delegate: Item { - width: 68 - height: 80 + width: 100 + height: 100 FluIconButton{ id:item_icon - iconSource:modelData.icon - anchors.horizontalCenter: parent.horizontalCenter + iconSource: modelData.icon + iconSize: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 + bottomPadding: 30 + anchors.fill: parent onClicked: { var text ="FluentIcons."+modelData.name; FluTools.clipText(text) showSuccess(qsTr("You Copied ")+text) } - } - FluText { - id:item_name - font.pixelSize: 10 - font.family: FluTextStyle.family - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: item_icon.bottom - width:parent.width - wrapMode: Text.WrapAnywhere - text: modelData.name - horizontalAlignment: Text.AlignHCenter + FluText{ + width: parent.width + horizontalAlignment: Qt.AlignHCenter + wrapMode: Text.WrapAnywhere + text: modelData.name + anchors.top: parent.top + anchors.topMargin: 60 + } } } } diff --git a/example/src/AppInfo.h b/example/src/AppInfo.h index f8bb0719..67780f88 100644 --- a/example/src/AppInfo.h +++ b/example/src/AppInfo.h @@ -14,5 +14,5 @@ private: public: SINGLETON(AppInfo) - Q_INVOKABLE [[maybe_unused]] void testCrash(); + [[maybe_unused]] Q_INVOKABLE void testCrash(); }; diff --git a/src/Def.h b/src/Def.h index 5f2a5b19..872d9e0d 100644 --- a/src/Def.h +++ b/src/Def.h @@ -176,1416 +176,3 @@ namespace FluNavigationViewType { QML_NAMED_ELEMENT(FluNavigationViewType) } - -namespace Fluent_Awesome { - Q_NAMESPACE - enum class Fluent_AwesomeType { - GlobalNavButton = 0xe700, - Wifi = 0xe701, - Bluetooth = 0xe702, - Connect = 0xe703, - InternetSharing = 0xe704, - VPN = 0xe705, - Brightness = 0xe706, - MapPin = 0xe707, - QuietHours = 0xe708, - Airplane = 0xe709, - Tablet = 0xe70a, - QuickNote = 0xe70b, - RememberedDevice = 0xe70c, - ChevronDown = 0xe70d, - ChevronUp = 0xe70e, - Edit = 0xe70f, - Add = 0xe710, - Cancel = 0xe711, - More = 0xe712, - Settings = 0xe713, - Video = 0xe714, - Mail = 0xe715, - People = 0xe716, - Phone = 0xe717, - Pin = 0xe718, - Shop = 0xe719, - Stop = 0xe71a, - Link = 0xe71b, - Filter = 0xe71c, - AllApps = 0xe71d, - Zoom = 0xe71e, - ZoomOut = 0xe71f, - Microphone = 0xe720, - Search = 0xe721, - Camera = 0xe722, - Attach = 0xe723, - Send = 0xe724, - SendFill = 0xe725, - WalkSolid = 0xe726, - InPrivate = 0xe727, - FavoriteList = 0xe728, - PageSolid = 0xe729, - Forward = 0xe72a, - Back = 0xe72b, - Refresh = 0xe72c, - Share = 0xe72d, - Lock = 0xe72e, - ReportHacked = 0xe730, - EMI = 0xe731, - FavoriteStar = 0xe734, - FavoriteStarFill = 0xe735, - ReadingMode = 0xe736, - Favicon = 0xe737, - Remove = 0xe738, - Checkbox = 0xe739, - CheckboxComposite = 0xe73a, - CheckboxFill = 0xe73b, - CheckboxIndeterminate = 0xe73c, - CheckboxCompositeReversed = 0xe73d, - CheckMark = 0xe73e, - BackToWindow = 0xe73f, - FullScreen = 0xe740, - ResizeTouchLarger = 0xe741, - ResizeTouchSmaller = 0xe742, - ResizeMouseSmall = 0xe743, - ResizeMouseMedium = 0xe744, - ResizeMouseWide = 0xe745, - ResizeMouseTall = 0xe746, - ResizeMouseLarge = 0xe747, - SwitchUser = 0xe748, - Print = 0xe749, - Up = 0xe74a, - Down = 0xe74b, - OEM = 0xe74c, - Delete = 0xe74d, - Save = 0xe74e, - Mute = 0xe74f, - BackSpaceQWERTY = 0xe750, - ReturnKey = 0xe751, - UpArrowShiftKey = 0xe752, - Cloud = 0xe753, - Flashlight = 0xe754, - RotationLock = 0xe755, - CommandPrompt = 0xe756, - SIPMove = 0xe759, - SIPUndock = 0xe75a, - SIPRedock = 0xe75b, - EraseTool = 0xe75c, - UnderscoreSpace = 0xe75d, - GripperTool = 0xe75e, - Dialpad = 0xe75f, - PageLeft = 0xe760, - PageRight = 0xe761, - MultiSelect = 0xe762, - KeyboardLeftHanded = 0xe763, - KeyboardRightHanded = 0xe764, - KeyboardClassic = 0xe765, - KeyboardSplit = 0xe766, - Volume = 0xe767, - Play = 0xe768, - Pause = 0xe769, - ChevronLeft = 0xe76b, - ChevronRight = 0xe76c, - InkingTool = 0xe76d, - Emoji2 = 0xe76e, - GripperBarHorizontal = 0xe76f, - System = 0xe770, - Personalize = 0xe771, - Devices = 0xe772, - SearchAndApps = 0xe773, - Globe = 0xe774, - TimeLanguage = 0xe775, - EaseOfAccess = 0xe776, - UpdateRestore = 0xe777, - HangUp = 0xe778, - ContactInfo = 0xe779, - Unpin = 0xe77a, - Contact = 0xe77b, - Memo = 0xe77c, - IncomingCall = 0xe77e, - Paste = 0xe77f, - PhoneBook = 0xe780, - LEDLight = 0xe781, - Error = 0xe783, - GripperBarVertical = 0xe784, - Unlock = 0xe785, - Slideshow = 0xe786, - Calendar = 0xe787, - GripperResize = 0xe788, - Megaphone = 0xe789, - Trim = 0xe78a, - NewWindow = 0xe78b, - SaveLocal = 0xe78c, - Color = 0xe790, - DataSense = 0xe791, - SaveAs = 0xe792, - Light = 0xe793, - AspectRatio = 0xe799, - DataSenseBar = 0xe7a5, - Redo = 0xe7a6, - Undo = 0xe7a7, - Crop = 0xe7a8, - OpenWith = 0xe7ac, - Rotate = 0xe7ad, - RedEye = 0xe7b3, - SetlockScreen = 0xe7b5, - MapPin2 = 0xe7b7, - Package = 0xe7b8, - Warning = 0xe7ba, - ReadingList = 0xe7bc, - Education = 0xe7be, - ShoppingCart = 0xe7bf, - Train = 0xe7c0, - Flag = 0xe7c1, - Move = 0xe7c2, - Page = 0xe7c3, - TaskView = 0xe7c4, - BrowsePhotos = 0xe7c5, - HalfStarLeft = 0xe7c6, - HalfStarRight = 0xe7c7, - Record = 0xe7c8, - TouchPointer = 0xe7c9, - LangJPN = 0xe7de, - Ferry = 0xe7e3, - Highlight = 0xe7e6, - ActionCenterNotification = 0xe7e7, - PowerButton = 0xe7e8, - ResizeTouchNarrower = 0xe7ea, - ResizeTouchShorter = 0xe7eb, - DrivingMode = 0xe7ec, - RingerSilent = 0xe7ed, - OtherUser = 0xe7ee, - Admin = 0xe7ef, - CC = 0xe7f0, - SDCard = 0xe7f1, - CallForwarding = 0xe7f2, - SettingsDisplaySound = 0xe7f3, - TVMonitor = 0xe7f4, - Speakers = 0xe7f5, - Headphone = 0xe7f6, - DeviceLaptopPic = 0xe7f7, - DeviceLaptopNoPic = 0xe7f8, - DeviceMonitorRightPic = 0xe7f9, - DeviceMonitorLeftPic = 0xe7fa, - DeviceMonitorNoPic = 0xe7fb, - Game = 0xe7fc, - HorizontalTabKey = 0xe7fd, - StreetsideSplitMinimize = 0xe802, - StreetsideSplitExpand = 0xe803, - Car = 0xe804, - Walk = 0xe805, - Bus = 0xe806, - TiltUp = 0xe809, - TiltDown = 0xe80a, - CallControl = 0xe80b, - RotateMapRight = 0xe80c, - RotateMapLeft = 0xe80d, - Home = 0xe80f, - ParkingLocation = 0xe811, - MapCompassTop = 0xe812, - MapCompassBottom = 0xe813, - IncidentTriangle = 0xe814, - Touch = 0xe815, - MapDirections = 0xe816, - StartPoint = 0xe819, - StopPoint = 0xe81a, - EndPoint = 0xe81b, - History = 0xe81c, - Location = 0xe81d, - MapLayers = 0xe81e, - Accident = 0xe81f, - Work = 0xe821, - Construction = 0xe822, - Recent = 0xe823, - Bank = 0xe825, - DownloadMap = 0xe826, - InkingToolFill2 = 0xe829, - HighlightFill2 = 0xe82a, - EraseToolFill = 0xe82b, - EraseToolFill2 = 0xe82c, - Dictionary = 0xe82d, - DictionaryAdd = 0xe82e, - ToolTip = 0xe82f, - ChromeBack = 0xe830, - ProvisioningPackage = 0xe835, - AddRemoteDevice = 0xe836, - FolderOpen = 0xe838, - Ethernet = 0xe839, - ShareBroadband = 0xe83a, - DirectAccess = 0xe83b, - DialUp = 0xe83c, - DefenderApp = 0xe83d, - BatteryCharging9 = 0xe83e, - Battery10 = 0xe83f, - Pinned = 0xe840, - PinFill = 0xe841, - PinnedFill = 0xe842, - PeriodKey = 0xe843, - PuncKey = 0xe844, - RevToggleKey = 0xe845, - RightArrowKeyTime1 = 0xe846, - RightArrowKeyTime2 = 0xe847, - LeftQuote = 0xe848, - RightQuote = 0xe849, - DownShiftKey = 0xe84a, - UpShiftKey = 0xe84b, - PuncKey0 = 0xe84c, - PuncKeyLeftBottom = 0xe84d, - RightArrowKeyTime3 = 0xe84e, - RightArrowKeyTime4 = 0xe84f, - Battery0 = 0xe850, - Battery1 = 0xe851, - Battery2 = 0xe852, - Battery3 = 0xe853, - Battery4 = 0xe854, - Battery5 = 0xe855, - Battery6 = 0xe856, - Battery7 = 0xe857, - Battery8 = 0xe858, - Battery9 = 0xe859, - BatteryCharging0 = 0xe85a, - BatteryCharging1 = 0xe85b, - BatteryCharging2 = 0xe85c, - BatteryCharging3 = 0xe85d, - BatteryCharging4 = 0xe85e, - BatteryCharging5 = 0xe85f, - BatteryCharging6 = 0xe860, - BatteryCharging7 = 0xe861, - BatteryCharging8 = 0xe862, - BatterySaver0 = 0xe863, - BatterySaver1 = 0xe864, - BatterySaver2 = 0xe865, - BatterySaver3 = 0xe866, - BatterySaver4 = 0xe867, - BatterySaver5 = 0xe868, - BatterySaver6 = 0xe869, - BatterySaver7 = 0xe86a, - BatterySaver8 = 0xe86b, - SignalBars1 = 0xe86c, - SignalBars2 = 0xe86d, - SignalBars3 = 0xe86e, - SignalBars4 = 0xe86f, - SignalBars5 = 0xe870, - SignalNotConnected = 0xe871, - Wifi1 = 0xe872, - Wifi2 = 0xe873, - Wifi3 = 0xe874, - MobSIMLock = 0xe875, - MobSIMMissing = 0xe876, - Vibrate = 0xe877, - RoamingInternational = 0xe878, - RoamingDomestic = 0xe879, - CallForwardInternational = 0xe87a, - CallForwardRoaming = 0xe87b, - JpnRomanji = 0xe87c, - JpnRomanjiLock = 0xe87d, - JpnRomanjiShift = 0xe87e, - JpnRomanjiShiftLock = 0xe87f, - StatusDataTransfer = 0xe880, - StatusDataTransferVPN = 0xe881, - StatusDualSIM2 = 0xe882, - StatusDualSIM2VPN = 0xe883, - StatusDualSIM1 = 0xe884, - StatusDualSIM1VPN = 0xe885, - StatusSGLTE = 0xe886, - StatusSGLTECell = 0xe887, - StatusSGLTEDataVPN = 0xe888, - StatusVPN = 0xe889, - WifiHotspot = 0xe88a, - LanguageKor = 0xe88b, - LanguageCht = 0xe88c, - LanguageChs = 0xe88d, - USB = 0xe88e, - InkingToolFill = 0xe88f, - View = 0xe890, - HighlightFill = 0xe891, - Previous = 0xe892, - Next = 0xe893, - Clear = 0xe894, - Sync = 0xe895, - Download = 0xe896, - Help = 0xe897, - Upload = 0xe898, - Emoji = 0xe899, - TwoPage = 0xe89a, - LeaveChat = 0xe89b, - MailForward = 0xe89c, - RotateCamera = 0xe89e, - ClosePane = 0xe89f, - OpenPane = 0xe8a0, - PreviewLink = 0xe8a1, - AttachCamera = 0xe8a2, - ZoomIn = 0xe8a3, - Bookmarks = 0xe8a4, - Document = 0xe8a5, - ProtectedDocument = 0xe8a6, - OpenInNewWindow = 0xe8a7, - MailFill = 0xe8a8, - ViewAll = 0xe8a9, - VideoChat = 0xe8aa, - Switch = 0xe8ab, - Rename = 0xe8ac, - Go = 0xe8ad, - SurfaceHub = 0xe8ae, - Remote = 0xe8af, - Click = 0xe8b0, - Shuffle = 0xe8b1, - Movies = 0xe8b2, - SelectAll = 0xe8b3, - Orientation = 0xe8b4, - Import = 0xe8b5, - ImportAll = 0xe8b6, - Folder = 0xe8b7, - Webcam = 0xe8b8, - Picture = 0xe8b9, - Caption = 0xe8ba, - ChromeClose = 0xe8bb, - ShowResults = 0xe8bc, - Message = 0xe8bd, - Leaf = 0xe8be, - CalendarDay = 0xe8bf, - CalendarWeek = 0xe8c0, - Characters = 0xe8c1, - MailReplyAll = 0xe8c2, - Read = 0xe8c3, - ShowBcc = 0xe8c4, - HideBcc = 0xe8c5, - Cut = 0xe8c6, - PaymentCard = 0xe8c7, - Copy = 0xe8c8, - Important = 0xe8c9, - MailReply = 0xe8ca, - Sort = 0xe8cb, - MobileTablet = 0xe8cc, - DisconnectDrive = 0xe8cd, - MapDrive = 0xe8ce, - ContactPresence = 0xe8cf, - Priority = 0xe8d0, - GotoToday = 0xe8d1, - Font = 0xe8d2, - FontColor = 0xe8d3, - Contact2 = 0xe8d4, - FolderFill = 0xe8d5, - Audio = 0xe8d6, - Permissions = 0xe8d7, - DisableUpdates = 0xe8d8, - Unfavorite = 0xe8d9, - OpenLocal = 0xe8da, - Italic = 0xe8db, - Underline = 0xe8dc, - Bold = 0xe8dd, - MoveToFolder = 0xe8de, - LikeDislike = 0xe8df, - Dislike = 0xe8e0, - Like = 0xe8e1, - AlignRight = 0xe8e2, - AlignCenter = 0xe8e3, - AlignLeft = 0xe8e4, - OpenFile = 0xe8e5, - ClearSelection = 0xe8e6, - FontDecrease = 0xe8e7, - FontIncrease = 0xe8e8, - FontSize = 0xe8e9, - CellPhone = 0xe8ea, - Reshare = 0xe8eb, - Tag = 0xe8ec, - RepeatOne = 0xe8ed, - RepeatAll = 0xe8ee, - Calculator = 0xe8ef, - Directions = 0xe8f0, - Library = 0xe8f1, - ChatBubbles = 0xe8f2, - PostUpdate = 0xe8f3, - NewFolder = 0xe8f4, - CalendarReply = 0xe8f5, - UnsyncFolder = 0xe8f6, - SyncFolder = 0xe8f7, - BlockContact = 0xe8f8, - SwitchApps = 0xe8f9, - AddFriend = 0xe8fa, - Accept = 0xe8fb, - GoToStart = 0xe8fc, - BulletedList = 0xe8fd, - Scan = 0xe8fe, - Preview = 0xe8ff, - Group = 0xe902, - ZeroBars = 0xe904, - OneBar = 0xe905, - TwoBars = 0xe906, - ThreeBars = 0xe907, - FourBars = 0xe908, - World = 0xe909, - Comment = 0xe90a, - MusicInfo = 0xe90b, - DockLeft = 0xe90c, - DockRight = 0xe90d, - DockBottom = 0xe90e, - Repair = 0xe90f, - Accounts = 0xe910, - DullSound = 0xe911, - Manage = 0xe912, - Street = 0xe913, - Printer3D = 0xe914, - RadioBullet = 0xe915, - Stopwatch = 0xe916, - Photo = 0xe91b, - ActionCenter = 0xe91c, - FullCircleMask = 0xe91f, - ChromeMinimize = 0xe921, - ChromeMaximize = 0xe922, - ChromeRestore = 0xe923, - Annotation = 0xe924, - BackSpaceQWERTYSm = 0xe925, - BackSpaceQWERTYMd = 0xe926, - Swipe = 0xe927, - Fingerprint = 0xe928, - Handwriting = 0xe929, - ChromeBackToWindow = 0xe92c, - ChromeFullScreen = 0xe92d, - KeyboardStandard = 0xe92e, - KeyboardDismiss = 0xe92f, - Completed = 0xe930, - ChromeAnnotate = 0xe931, - Label = 0xe932, - IBeam = 0xe933, - IBeamOutline = 0xe934, - FlickDown = 0xe935, - FlickUp = 0xe936, - FlickLeft = 0xe937, - FlickRight = 0xe938, - FeedbackApp = 0xe939, - MusicAlbum = 0xe93c, - Streaming = 0xe93e, - Code = 0xe943, - ReturnToWindow = 0xe944, - LightningBolt = 0xe945, - Info = 0xe946, - CalculatorMultiply = 0xe947, - CalculatorAddition = 0xe948, - CalculatorSubtract = 0xe949, - CalculatorDivide = 0xe94a, - CalculatorSquareroot = 0xe94b, - CalculatorPercentage = 0xe94c, - CalculatorNegate = 0xe94d, - CalculatorEqualTo = 0xe94e, - CalculatorBackspace = 0xe94f, - Component = 0xe950, - DMC = 0xe951, - Dock = 0xe952, - MultimediaDMS = 0xe953, - MultimediaDVR = 0xe954, - MultimediaPMP = 0xe955, - PrintfaxPrinterFile = 0xe956, - Sensor = 0xe957, - StorageOptical = 0xe958, - Communications = 0xe95a, - Headset = 0xe95b, - Projector = 0xe95d, - Health = 0xe95e, - Wire = 0xe95f, - Webcam2 = 0xe960, - Input = 0xe961, - Mouse = 0xe962, - Smartcard = 0xe963, - SmartcardVirtual = 0xe964, - MediaStorageTower = 0xe965, - ReturnKeySm = 0xe966, - GameConsole = 0xe967, - Network = 0xe968, - StorageNetworkWireless = 0xe969, - StorageTape = 0xe96a, - ChevronUpSmall = 0xe96d, - ChevronDownSmall = 0xe96e, - ChevronLeftSmall = 0xe96f, - ChevronRightSmall = 0xe970, - ChevronUpMed = 0xe971, - ChevronDownMed = 0xe972, - ChevronLeftMed = 0xe973, - ChevronRightMed = 0xe974, - Devices2 = 0xe975, - ExpandTile = 0xe976, - PC1 = 0xe977, - PresenceChicklet = 0xe978, - PresenceChickletVideo = 0xe979, - Reply = 0xe97a, - SetTile = 0xe97b, - Type = 0xe97c, - Korean = 0xe97d, - HalfAlpha = 0xe97e, - FullAlpha = 0xe97f, - Key12On = 0xe980, - ChineseChangjie = 0xe981, - QWERTYOn = 0xe982, - QWERTYOff = 0xe983, - ChineseQuick = 0xe984, - Japanese = 0xe985, - FullHiragana = 0xe986, - FullKatakana = 0xe987, - HalfKatakana = 0xe988, - ChineseBoPoMoFo = 0xe989, - ChinesePinyin = 0xe98a, - ConstructionCone = 0xe98f, - XboxOneConsole = 0xe990, - Volume0 = 0xe992, - Volume1 = 0xe993, - Volume2 = 0xe994, - Volume3 = 0xe995, - BatteryUnknown = 0xe996, - WifiAttentionOverlay = 0xe998, - Robot = 0xe99a, - TapAndSend = 0xe9a1, - FitPage = 0xe9a6, - PasswordKeyShow = 0xe9a8, - PasswordKeyHide = 0xe9a9, - BidiLtr = 0xe9aa, - BidiRtl = 0xe9ab, - ForwardSm = 0xe9ac, - CommaKey = 0xe9ad, - DashKey = 0xe9ae, - DullSoundKey = 0xe9af, - HalfDullSound = 0xe9b0, - RightDoubleQuote = 0xe9b1, - LeftDoubleQuote = 0xe9b2, - PuncKeyRightBottom = 0xe9b3, - PuncKey1 = 0xe9b4, - PuncKey2 = 0xe9b5, - PuncKey3 = 0xe9b6, - PuncKey4 = 0xe9b7, - PuncKey5 = 0xe9b8, - PuncKey6 = 0xe9b9, - PuncKey9 = 0xe9ba, - PuncKey7 = 0xe9bb, - PuncKey8 = 0xe9bc, - Frigid = 0xe9ca, - Unknown = 0xe9ce, - AreaChart = 0xe9d2, - CheckList = 0xe9d5, - Diagnostic = 0xe9d9, - Equalizer = 0xe9e9, - Process = 0xe9f3, - Processing = 0xe9f5, - ReportDocument = 0xe9f9, - VideoSolid = 0xea0c, - MixedMediaBadge = 0xea0d, - DisconnectDisplay = 0xea14, - Shield = 0xea18, - Info2 = 0xea1f, - ActionCenterAsterisk = 0xea21, - Beta = 0xea24, - SaveCopy = 0xea35, - List = 0xea37, - Asterisk = 0xea38, - ErrorBadge = 0xea39, - CircleRing = 0xea3a, - CircleFill = 0xea3b, - MergeCall = 0xea3c, - PrivateCall = 0xea3d, - Record2 = 0xea3f, - AllAppsMirrored = 0xea40, - BookmarksMirrored = 0xea41, - BulletedListMirrored = 0xea42, - CallForwardInternationalMirrored = 0xea43, - CallForwardRoamingMirrored = 0xea44, - ChromeBackMirrored = 0xea47, - ClearSelectionMirrored = 0xea48, - ClosePaneMirrored = 0xea49, - ContactInfoMirrored = 0xea4a, - DockRightMirrored = 0xea4b, - DockLeftMirrored = 0xea4c, - ExpandTileMirrored = 0xea4e, - GoMirrored = 0xea4f, - GripperResizeMirrored = 0xea50, - HelpMirrored = 0xea51, - ImportMirrored = 0xea52, - ImportAllMirrored = 0xea53, - LeaveChatMirrored = 0xea54, - ListMirrored = 0xea55, - MailForwardMirrored = 0xea56, - MailReplyMirrored = 0xea57, - MailReplyAllMirrored = 0xea58, - OpenPaneMirrored = 0xea5b, - OpenWithMirrored = 0xea5c, - ParkingLocationMirrored = 0xea5e, - ResizeMouseMediumMirrored = 0xea5f, - ResizeMouseSmallMirrored = 0xea60, - ResizeMouseTallMirrored = 0xea61, - ResizeTouchNarrowerMirrored = 0xea62, - SendMirrored = 0xea63, - SendFillMirrored = 0xea64, - ShowResultsMirrored = 0xea65, - Media = 0xea69, - SyncError = 0xea6a, - Devices3 = 0xea6c, - SlowMotionOn = 0xea79, - Lightbulb = 0xea80, - StatusCircle = 0xea81, - StatusTriangle = 0xea82, - StatusError = 0xea83, - StatusWarning = 0xea84, - Puzzle = 0xea86, - CalendarSolid = 0xea89, - HomeSolid = 0xea8a, - ParkingLocationSolid = 0xea8b, - ContactSolid = 0xea8c, - ConstructionSolid = 0xea8d, - AccidentSolid = 0xea8e, - Ringer = 0xea8f, - PDF = 0xea90, - ThoughtBubble = 0xea91, - HeartBroken = 0xea92, - BatteryCharging10 = 0xea93, - BatterySaver9 = 0xea94, - BatterySaver10 = 0xea95, - CallForwardingMirrored = 0xea97, - MultiSelectMirrored = 0xea98, - Broom = 0xea99, - ForwardCall = 0xeac2, - Trackers = 0xeadf, - Market = 0xeafc, - PieSingle = 0xeb05, - StockUp = 0xeb0f, - StockDown = 0xeb11, - Design = 0xeb3c, - Website = 0xeb41, - Drop = 0xeb42, - Radar = 0xeb44, - BusSolid = 0xeb47, - FerrySolid = 0xeb48, - StartPointSolid = 0xeb49, - StopPointSolid = 0xeb4a, - EndPointSolid = 0xeb4b, - AirplaneSolid = 0xeb4c, - TrainSolid = 0xeb4d, - WorkSolid = 0xeb4e, - ReminderFill = 0xeb4f, - Reminder = 0xeb50, - Heart = 0xeb51, - HeartFill = 0xeb52, - EthernetError = 0xeb55, - EthernetWarning = 0xeb56, - StatusConnecting1 = 0xeb57, - StatusConnecting2 = 0xeb58, - StatusUnsecure = 0xeb59, - WifiError0 = 0xeb5a, - WifiError1 = 0xeb5b, - WifiError2 = 0xeb5c, - WifiError3 = 0xeb5d, - WifiError4 = 0xeb5e, - WifiWarning0 = 0xeb5f, - WifiWarning1 = 0xeb60, - WifiWarning2 = 0xeb61, - WifiWarning3 = 0xeb62, - WifiWarning4 = 0xeb63, - Devices4 = 0xeb66, - NUIIris = 0xeb67, - NUIFace = 0xeb68, - GatewayRouter = 0xeb77, - EditMirrored = 0xeb7e, - NUIFPStartSlideHand = 0xeb82, - NUIFPStartSlideAction = 0xeb83, - NUIFPContinueSlideHand = 0xeb84, - NUIFPContinueSlideAction = 0xeb85, - NUIFPRollRightHand = 0xeb86, - NUIFPRollRightHandAction = 0xeb87, - NUIFPRollLeftHand = 0xeb88, - NUIFPRollLeftAction = 0xeb89, - NUIFPPressHand = 0xeb8a, - NUIFPPressAction = 0xeb8b, - NUIFPPressRepeatHand = 0xeb8c, - NUIFPPressRepeatAction = 0xeb8d, - StatusErrorFull = 0xeb90, - TaskViewExpanded = 0xeb91, - Certificate = 0xeb95, - BackSpaceQWERTYLg = 0xeb96, - ReturnKeyLg = 0xeb97, - FastForward = 0xeb9d, - Rewind = 0xeb9e, - Photo2 = 0xeb9f, - MobBattery0 = 0xeba0, - MobBattery1 = 0xeba1, - MobBattery2 = 0xeba2, - MobBattery3 = 0xeba3, - MobBattery4 = 0xeba4, - MobBattery5 = 0xeba5, - MobBattery6 = 0xeba6, - MobBattery7 = 0xeba7, - MobBattery8 = 0xeba8, - MobBattery9 = 0xeba9, - MobBattery10 = 0xebaa, - MobBatteryCharging0 = 0xebab, - MobBatteryCharging1 = 0xebac, - MobBatteryCharging2 = 0xebad, - MobBatteryCharging3 = 0xebae, - MobBatteryCharging4 = 0xebaf, - MobBatteryCharging5 = 0xebb0, - MobBatteryCharging6 = 0xebb1, - MobBatteryCharging7 = 0xebb2, - MobBatteryCharging8 = 0xebb3, - MobBatteryCharging9 = 0xebb4, - MobBatteryCharging10 = 0xebb5, - MobBatterySaver0 = 0xebb6, - MobBatterySaver1 = 0xebb7, - MobBatterySaver2 = 0xebb8, - MobBatterySaver3 = 0xebb9, - MobBatterySaver4 = 0xebba, - MobBatterySaver5 = 0xebbb, - MobBatterySaver6 = 0xebbc, - MobBatterySaver7 = 0xebbd, - MobBatterySaver8 = 0xebbe, - MobBatterySaver9 = 0xebbf, - MobBatterySaver10 = 0xebc0, - DictionaryCloud = 0xebc3, - ResetDrive = 0xebc4, - VolumeBars = 0xebc5, - Project = 0xebc6, - AdjustHologram = 0xebd2, - CloudDownload = 0xebd3, - MobWifiCallBars = 0xebd4, - MobWifiCall0 = 0xebd5, - MobWifiCall1 = 0xebd6, - MobWifiCall2 = 0xebd7, - MobWifiCall3 = 0xebd8, - MobWifiCall4 = 0xebd9, - Family = 0xebda, - LockFeedback = 0xebdb, - DeviceDiscovery = 0xebde, - WindDirection = 0xebe6, - RightArrowKeyTime0 = 0xebe7, - Bug = 0xebe8, - TabletMode = 0xebfc, - StatusCircleLeft = 0xebfd, - StatusTriangleLeft = 0xebfe, - StatusErrorLeft = 0xebff, - StatusWarningLeft = 0xec00, - MobBatteryUnknown = 0xec02, - NetworkTower = 0xec05, - CityNext = 0xec06, - CityNext2 = 0xec07, - Courthouse = 0xec08, - Groceries = 0xec09, - Sustainable = 0xec0a, - BuildingEnergy = 0xec0b, - ToggleFilled = 0xec11, - ToggleBorder = 0xec12, - SliderThumb = 0xec13, - ToggleThumb = 0xec14, - MiracastLogoSmall = 0xec15, - MiracastLogoLarge = 0xec16, - PLAP = 0xec19, - Badge = 0xec1b, - SignalRoaming = 0xec1e, - MobileLocked = 0xec20, - InsiderHubApp = 0xec24, - PersonalFolder = 0xec25, - HomeGroup = 0xec26, - MyNetwork = 0xec27, - KeyboardFull = 0xec31, - Cafe = 0xec32, - MobSignal1 = 0xec37, - MobSignal2 = 0xec38, - MobSignal3 = 0xec39, - MobSignal4 = 0xec3a, - MobSignal5 = 0xec3b, - MobWifi1 = 0xec3c, - MobWifi2 = 0xec3d, - MobWifi3 = 0xec3e, - MobWifi4 = 0xec3f, - MobAirplane = 0xec40, - MobBluetooth = 0xec41, - MobActionCenter = 0xec42, - MobLocation = 0xec43, - MobWifiHotspot = 0xec44, - LanguageJpn = 0xec45, - MobQuietHours = 0xec46, - MobDrivingMode = 0xec47, - SpeedOff = 0xec48, - SpeedMedium = 0xec49, - SpeedHigh = 0xec4a, - ThisPC = 0xec4e, - MusicNote = 0xec4f, - FileExplorer = 0xec50, - FileExplorerApp = 0xec51, - LeftArrowKeyTime0 = 0xec52, - MicOff = 0xec54, - MicSleep = 0xec55, - MicError = 0xec56, - PlaybackRate1x = 0xec57, - PlaybackRateOther = 0xec58, - CashDrawer = 0xec59, - BarcodeScanner = 0xec5a, - ReceiptPrinter = 0xec5b, - MagStripeReader = 0xec5c, - CompletedSolid = 0xec61, - CompanionApp = 0xec64, - Favicon2 = 0xec6c, - SwipeRevealArt = 0xec6d, - MicOn = 0xec71, - MicClipping = 0xec72, - TabletSelected = 0xec74, - MobileSelected = 0xec75, - LaptopSelected = 0xec76, - TVMonitorSelected = 0xec77, - DeveloperTools = 0xec7a, - MobCallForwarding = 0xec7e, - MobCallForwardingMirrored = 0xec7f, - BodyCam = 0xec80, - PoliceCar = 0xec81, - Draw = 0xec87, - DrawSolid = 0xec88, - LowerBrightness = 0xec8a, - ScrollUpDown = 0xec8f, - DateTime = 0xec92, - HoloLens = 0xec94, - Tiles = 0xeca5, - PartyLeader = 0xeca7, - AppIconDefault = 0xecaa, - Calories = 0xecad, - POI = 0xecaf, - BandBattery0 = 0xecb9, - BandBattery1 = 0xecba, - BandBattery2 = 0xecbb, - BandBattery3 = 0xecbc, - BandBattery4 = 0xecbd, - BandBattery5 = 0xecbe, - BandBattery6 = 0xecbf, - AddSurfaceHub = 0xecc4, - DevUpdate = 0xecc5, - Unit = 0xecc6, - AddTo = 0xecc8, - RemoveFrom = 0xecc9, - RadioBtnOff = 0xecca, - RadioBtnOn = 0xeccb, - RadioBullet2 = 0xeccc, - ExploreContent = 0xeccd, - Blocked2 = 0xece4, - ScrollMode = 0xece7, - ZoomMode = 0xece8, - PanMode = 0xece9, - WiredUSB = 0xecf0, - WirelessUSB = 0xecf1, - USBSafeConnect = 0xecf3, - ActionCenterNotificationMirrored = 0xed0c, - ActionCenterMirrored = 0xed0d, - SubscriptionAdd = 0xed0e, - ResetDevice = 0xed10, - SubscriptionAddMirrored = 0xed11, - QRCode = 0xed14, - Feedback = 0xed15, - Hide = 0xed1a, - Subtitles = 0xed1e, - SubtitlesAudio = 0xed1f, - OpenFolderHorizontal = 0xed25, - CalendarMirrored = 0xed28, - MobeSIM = 0xed2a, - MobeSIMNoProfile = 0xed2b, - MobeSIMLocked = 0xed2c, - MobeSIMBusy = 0xed2d, - SignalError = 0xed2e, - StreamingEnterprise = 0xed2f, - Headphone0 = 0xed30, - Headphone1 = 0xed31, - Headphone2 = 0xed32, - Headphone3 = 0xed33, - Apps = 0xed35, - KeyboardBrightness = 0xed39, - KeyboardLowerBrightness = 0xed3a, - SkipBack10 = 0xed3c, - SkipForward30 = 0xed3d, - TreeFolderFolder = 0xed41, - TreeFolderFolderFill = 0xed42, - TreeFolderFolderOpen = 0xed43, - TreeFolderFolderOpenFill = 0xed44, - MultimediaDMP = 0xed47, - KeyboardOneHanded = 0xed4c, - Narrator = 0xed4d, - EmojiTabPeople = 0xed53, - EmojiTabSmilesAnimals = 0xed54, - EmojiTabCelebrationObjects = 0xed55, - EmojiTabFoodPlants = 0xed56, - EmojiTabTransitPlaces = 0xed57, - EmojiTabSymbols = 0xed58, - EmojiTabTextSmiles = 0xed59, - EmojiTabFavorites = 0xed5a, - EmojiSwatch = 0xed5b, - ConnectApp = 0xed5c, - CompanionDeviceFramework = 0xed5d, - Ruler = 0xed5e, - FingerInking = 0xed5f, - StrokeErase = 0xed60, - PointErase = 0xed61, - ClearAllInk = 0xed62, - Pencil = 0xed63, - Marker = 0xed64, - InkingCaret = 0xed65, - InkingColorOutline = 0xed66, - InkingColorFill = 0xed67, - HardDrive = 0xeda2, - NetworkAdapter = 0xeda3, - Touchscreen = 0xeda4, - NetworkPrinter = 0xeda5, - CloudPrinter = 0xeda6, - KeyboardShortcut = 0xeda7, - BrushSize = 0xeda8, - NarratorForward = 0xeda9, - NarratorForwardMirrored = 0xedaa, - SyncBadge12 = 0xedab, - RingerBadge12 = 0xedac, - AsteriskBadge12 = 0xedad, - ErrorBadge12 = 0xedae, - CircleRingBadge12 = 0xedaf, - CircleFillBadge12 = 0xedb0, - ImportantBadge12 = 0xedb1, - MailBadge12 = 0xedb3, - PauseBadge12 = 0xedb4, - PlayBadge12 = 0xedb5, - PenWorkspace = 0xedc6, - CaretLeft8 = 0xedd5, - CaretRight8 = 0xedd6, - CaretUp8 = 0xedd7, - CaretDown8 = 0xedd8, - CaretLeftSolid8 = 0xedd9, - CaretRightSolid8 = 0xedda, - CaretUpSolid8 = 0xeddb, - CaretDownSolid8 = 0xeddc, - Strikethrough = 0xede0, - Export = 0xede1, - ExportMirrored = 0xede2, - ButtonMenu = 0xede3, - CloudSearch = 0xede4, - PinyinIMELogo = 0xede5, - CalligraphyPen = 0xedfb, - ReplyMirrored = 0xee35, - LockscreenDesktop = 0xee3f, - TaskViewSettings = 0xee40, - MiniExpand2Mirrored = 0xee47, - MiniContract2Mirrored = 0xee49, - Play36 = 0xee4a, - PenPalette = 0xee56, - GuestUser = 0xee57, - SettingsBattery = 0xee63, - TaskbarPhone = 0xee64, - LockScreenGlance = 0xee65, - GenericScan = 0xee6f, - ImageExport = 0xee71, - WifiEthernet = 0xee77, - ActionCenterQuiet = 0xee79, - ActionCenterQuietNotification = 0xee7a, - TrackersMirrored = 0xee92, - DateTimeMirrored = 0xee93, - Wheel = 0xee94, - VirtualMachineGroup = 0xeea3, - ButtonView2 = 0xeeca, - PenWorkspaceMirrored = 0xef15, - PenPaletteMirrored = 0xef16, - StrokeEraseMirrored = 0xef17, - PointEraseMirrored = 0xef18, - ClearAllInkMirrored = 0xef19, - BackgroundToggle = 0xef1f, - Marquee = 0xef20, - ChromeCloseContrast = 0xef2c, - ChromeMinimizeContrast = 0xef2d, - ChromeMaximizeContrast = 0xef2e, - ChromeRestoreContrast = 0xef2f, - TrafficLight = 0xef31, - Replay = 0xef3b, - Eyedropper = 0xef3c, - LineDisplay = 0xef3d, - PINPad = 0xef3e, - SignatureCapture = 0xef3f, - ChipCardCreditCardReader = 0xef40, - MarketDown = 0xef42, - PlayerSettings = 0xef58, - LandscapeOrientation = 0xef6b, - Flow = 0xef90, - Touchpad = 0xefa5, - Speech = 0xefa9, - KnowledgeArticle = 0xf000, - Relationship = 0xf003, - ZipFolder = 0xf012, - DefaultAPN = 0xf080, - UserAPN = 0xf081, - DoublePinyin = 0xf085, - BlueLight = 0xf08c, - CaretSolidLeft = 0xf08d, - CaretSolidDown = 0xf08e, - CaretSolidRight = 0xf08f, - CaretSolidUp = 0xf090, - ButtonA = 0xf093, - ButtonB = 0xf094, - ButtonY = 0xf095, - ButtonX = 0xf096, - ArrowUp8 = 0xf0ad, - ArrowDown8 = 0xf0ae, - ArrowRight8 = 0xf0af, - ArrowLeft8 = 0xf0b0, - QuarentinedItems = 0xf0b2, - QuarentinedItemsMirrored = 0xf0b3, - Protractor = 0xf0b4, - ChecklistMirrored = 0xf0b5, - StatusCircle7 = 0xf0b6, - StatusCheckmark7 = 0xf0b7, - StatusErrorCircle7 = 0xf0b8, - Connected = 0xf0b9, - PencilFill = 0xf0c6, - CalligraphyFill = 0xf0c7, - QuarterStarLeft = 0xf0ca, - QuarterStarRight = 0xf0cb, - ThreeQuarterStarLeft = 0xf0cc, - ThreeQuarterStarRight = 0xf0cd, - QuietHoursBadge12 = 0xf0ce, - BackMirrored = 0xf0d2, - ForwardMirrored = 0xf0d3, - ChromeBackContrast = 0xf0d5, - ChromeBackContrastMirrored = 0xf0d6, - ChromeBackToWindowContrast = 0xf0d7, - ChromeFullScreenContrast = 0xf0d8, - GridView = 0xf0e2, - ClipboardList = 0xf0e3, - ClipboardListMirrored = 0xf0e4, - OutlineQuarterStarLeft = 0xf0e5, - OutlineQuarterStarRight = 0xf0e6, - OutlineHalfStarLeft = 0xf0e7, - OutlineHalfStarRight = 0xf0e8, - OutlineThreeQuarterStarLeft = 0xf0e9, - OutlineThreeQuarterStarRight = 0xf0ea, - SpatialVolume0 = 0xf0eb, - SpatialVolume1 = 0xf0ec, - SpatialVolume2 = 0xf0ed, - SpatialVolume3 = 0xf0ee, - ApplicationGuard = 0xf0ef, - OutlineStarLeftHalf = 0xf0f7, - OutlineStarRightHalf = 0xf0f8, - ChromeAnnotateContrast = 0xf0f9, - DefenderBadge12 = 0xf0fb, - DetachablePC = 0xf103, - LeftStick = 0xf108, - RightStick = 0xf109, - TriggerLeft = 0xf10a, - TriggerRight = 0xf10b, - BumperLeft = 0xf10c, - BumperRight = 0xf10d, - Dpad = 0xf10e, - EnglishPunctuation = 0xf110, - ChinesePunctuation = 0xf111, - HMD = 0xf119, - CtrlSpatialRight = 0xf11b, - PaginationDotOutline10 = 0xf126, - PaginationDotSolid10 = 0xf127, - StrokeErase2 = 0xf128, - SmallErase = 0xf129, - LargeErase = 0xf12a, - FolderHorizontal = 0xf12b, - MicrophoneListening = 0xf12e, - StatusExclamationCircle7 = 0xf12f, - Video360 = 0xf131, - GiftboxOpen = 0xf133, - StatusCircleOuter = 0xf136, - StatusCircleInner = 0xf137, - StatusCircleRing = 0xf138, - StatusTriangleOuter = 0xf139, - StatusTriangleInner = 0xf13a, - StatusTriangleExclamation = 0xf13b, - StatusCircleExclamation = 0xf13c, - StatusCircleErrorX = 0xf13d, - StatusCircleCheckmark = 0xf13e, - StatusCircleInfo = 0xf13f, - StatusCircleBlock = 0xf140, - StatusCircleBlock2 = 0xf141, - StatusCircleQuestionMark = 0xf142, - StatusCircleSync = 0xf143, - Dial1 = 0xf146, - Dial2 = 0xf147, - Dial3 = 0xf148, - Dial4 = 0xf149, - Dial5 = 0xf14a, - Dial6 = 0xf14b, - Dial7 = 0xf14c, - Dial8 = 0xf14d, - Dial9 = 0xf14e, - Dial10 = 0xf14f, - Dial11 = 0xf150, - Dial12 = 0xf151, - Dial13 = 0xf152, - Dial14 = 0xf153, - Dial15 = 0xf154, - Dial16 = 0xf155, - DialShape1 = 0xf156, - DialShape2 = 0xf157, - DialShape3 = 0xf158, - DialShape4 = 0xf159, - ClosedCaptionsInternational = 0xf15f, - TollSolid = 0xf161, - TrafficCongestionSolid = 0xf163, - ExploreContentSingle = 0xf164, - CollapseContent = 0xf165, - CollapseContentSingle = 0xf166, - InfoSolid = 0xf167, - GroupList = 0xf168, - CaretBottomRightSolidCenter8 = 0xf169, - ProgressRingDots = 0xf16a, - Checkbox14 = 0xf16b, - CheckboxComposite14 = 0xf16c, - CheckboxIndeterminateCombo14 = 0xf16d, - CheckboxIndeterminateCombo = 0xf16e, - StatusPause7 = 0xf175, - CharacterAppearance = 0xf17f, - Lexicon = 0xf180, - ScreenTime = 0xf182, - HeadlessDevice = 0xf191, - NetworkSharing = 0xf193, - EyeGaze = 0xf19d, - ToggleLeft = 0xf19e, - ToggleRight = 0xf19f, - WindowsInsider = 0xf1ad, - ChromeSwitch = 0xf1cb, - ChromeSwitchContast = 0xf1cc, - StatusCheckmark = 0xf1d8, - StatusCheckmarkLeft = 0xf1d9, - KeyboardLeftAligned = 0xf20c, - KeyboardRightAligned = 0xf20d, - KeyboardSettings = 0xf210, - NetworkPhysical = 0xf211, - IOT = 0xf22c, - UnknownMirrored = 0xf22e, - ViewDashboard = 0xf246, - ExploitProtectionSettings = 0xf259, - KeyboardNarrow = 0xf260, - Keyboard12Key = 0xf261, - KeyboardDock = 0xf26b, - KeyboardUndock = 0xf26c, - KeyboardLeftDock = 0xf26d, - KeyboardRightDock = 0xf26e, - Ear = 0xf270, - PointerHand = 0xf271, - Bullseye = 0xf272, - DocumentApproval = 0xf28b, - LocaleLanguage = 0xf2b7, - PassiveAuthentication = 0xf32a, - ColorSolid = 0xf354, - NetworkOffline = 0xf384, - NetworkConnected = 0xf385, - NetworkConnectedCheckmark = 0xf386, - SignOut = 0xf3b1, - StatusInfo = 0xf3cc, - StatusInfoLeft = 0xf3cd, - NearbySharing = 0xf3e2, - CtrlSpatialLeft = 0xf3e7, - InteractiveDashboard = 0xf404, - DeclineCall = 0xf405, - ClippingTool = 0xf406, - RectangularClipping = 0xf407, - FreeFormClipping = 0xf408, - CopyTo = 0xf413, - IDBadge = 0xf427, - DynamicLock = 0xf439, - PenTips = 0xf45e, - PenTipsMirrored = 0xf45f, - HWPJoin = 0xf460, - HWPInsert = 0xf461, - HWPStrikeThrough = 0xf462, - HWPScratchOut = 0xf463, - HWPSplit = 0xf464, - HWPNewLine = 0xf465, - HWPOverwrite = 0xf466, - MobWifiWarning1 = 0xf473, - MobWifiWarning2 = 0xf474, - MobWifiWarning3 = 0xf475, - MobWifiWarning4 = 0xf476, - MicLocationCombo = 0xf47f, - Globe2 = 0xf49a, - SpecialEffectSize = 0xf4a5, - GIF = 0xf4a9, - Sticker2 = 0xf4aa, - SurfaceHubSelected = 0xf4be, - HoloLensSelected = 0xf4bf, - Earbud = 0xf4c0, - MixVolumes = 0xf4c3, - Safe = 0xf540, - LaptopSecure = 0xf552, - PrintDefault = 0xf56d, - PageMirrored = 0xf56e, - LandscapeOrientationMirrored = 0xf56f, - ColorOff = 0xf570, - PrintAllPages = 0xf571, - PrintCustomRange = 0xf572, - PageMarginPortraitNarrow = 0xf573, - PageMarginPortraitNormal = 0xf574, - PageMarginPortraitModerate = 0xf575, - PageMarginPortraitWide = 0xf576, - PageMarginLandscapeNarrow = 0xf577, - PageMarginLandscapeNormal = 0xf578, - PageMarginLandscapeModerate = 0xf579, - PageMarginLandscapeWide = 0xf57a, - CollateLandscape = 0xf57b, - CollatePortrait = 0xf57c, - CollatePortraitSeparated = 0xf57d, - DuplexLandscapeOneSided = 0xf57e, - DuplexLandscapeOneSidedMirrored = 0xf57f, - DuplexLandscapeTwoSidedLongEdge = 0xf580, - DuplexLandscapeTwoSidedLongEdgeMirrored = 0xf581, - DuplexLandscapeTwoSidedShortEdge = 0xf582, - DuplexLandscapeTwoSidedShortEdgeMirrored = 0xf583, - DuplexPortraitOneSided = 0xf584, - DuplexPortraitOneSidedMirrored = 0xf585, - DuplexPortraitTwoSidedLongEdge = 0xf586, - DuplexPortraitTwoSidedLongEdgeMirrored = 0xf587, - DuplexPortraitTwoSidedShortEdge = 0xf588, - DuplexPortraitTwoSidedShortEdgeMirrored = 0xf589, - PPSOneLandscape = 0xf58a, - PPSTwoLandscape = 0xf58b, - PPSTwoPortrait = 0xf58c, - PPSFourLandscape = 0xf58d, - PPSFourPortrait = 0xf58e, - HolePunchOff = 0xf58f, - HolePunchPortraitLeft = 0xf590, - HolePunchPortraitRight = 0xf591, - HolePunchPortraitTop = 0xf592, - HolePunchPortraitBottom = 0xf593, - HolePunchLandscapeLeft = 0xf594, - HolePunchLandscapeRight = 0xf595, - HolePunchLandscapeTop = 0xf596, - HolePunchLandscapeBottom = 0xf597, - StaplingOff = 0xf598, - StaplingPortraitTopLeft = 0xf599, - StaplingPortraitTopRight = 0xf59a, - StaplingPortraitBottomRight = 0xf59b, - StaplingPortraitTwoLeft = 0xf59c, - StaplingPortraitTwoRight = 0xf59d, - StaplingPortraitTwoTop = 0xf59e, - StaplingPortraitTwoBottom = 0xf59f, - StaplingPortraitBookBinding = 0xf5a0, - StaplingLandscapeTopLeft = 0xf5a1, - StaplingLandscapeTopRight = 0xf5a2, - StaplingLandscapeBottomLeft = 0xf5a3, - StaplingLandscapeBottomRight = 0xf5a4, - StaplingLandscapeTwoLeft = 0xf5a5, - StaplingLandscapeTwoRight = 0xf5a6, - StaplingLandscapeTwoTop = 0xf5a7, - StaplingLandscapeTwoBottom = 0xf5a8, - StaplingLandscapeBookBinding = 0xf5a9, - StatusDataTransferRoaming = 0xf5aa, - MobSIMError = 0xf5ab, - CollateLandscapeSeparated = 0xf5ac, - PPSOnePortrait = 0xf5ad, - StaplingPortraitBottomLeft = 0xf5ae, - PlaySolid = 0xf5b0, - RepeatOff = 0xf5e7, - Set = 0xf5ed, - SetSolid = 0xf5ee, - FuzzyReading = 0xf5ef, - VerticalBattery0 = 0xf5f2, - VerticalBattery1 = 0xf5f3, - VerticalBattery2 = 0xf5f4, - VerticalBattery3 = 0xf5f5, - VerticalBattery4 = 0xf5f6, - VerticalBattery5 = 0xf5f7, - VerticalBattery6 = 0xf5f8, - VerticalBattery7 = 0xf5f9, - VerticalBattery8 = 0xf5fa, - VerticalBattery9 = 0xf5fb, - VerticalBattery10 = 0xf5fc, - VerticalBatteryCharging0 = 0xf5fd, - VerticalBatteryCharging1 = 0xf5fe, - VerticalBatteryCharging2 = 0xf5ff, - VerticalBatteryCharging3 = 0xf600, - VerticalBatteryCharging4 = 0xf601, - VerticalBatteryCharging5 = 0xf602, - VerticalBatteryCharging6 = 0xf603, - VerticalBatteryCharging7 = 0xf604, - VerticalBatteryCharging8 = 0xf605, - VerticalBatteryCharging9 = 0xf606, - VerticalBatteryCharging10 = 0xf607, - VerticalBatteryUnknown = 0xf608, - SIMError = 0xf618, - SIMMissing = 0xf619, - SIMLock = 0xf61a, - eSIM = 0xf61b, - eSIMNoProfile = 0xf61c, - eSIMLocked = 0xf61d, - eSIMBusy = 0xf61e, - NoiseCancelation = 0xf61f, - NoiseCancelationOff = 0xf620, - MusicSharing = 0xf623, - MusicSharingOff = 0xf624, - CircleShapeSolid = 0xf63c, - WifiCallBars = 0xf657, - WifiCall0 = 0xf658, - WifiCall1 = 0xf659, - WifiCall2 = 0xf65a, - WifiCall3 = 0xf65b, - WifiCall4 = 0xf65c, - CHTLanguageBar = 0xf69e, - ComposeMode = 0xf6a9, - ExpressiveInputEntry = 0xf6b8, - EmojiTabMoreSymbols = 0xf6ba, - WebSearch = 0xf6fa, - Kiosk = 0xf712, - RTTLogo = 0xf714, - VoiceCall = 0xf715, - GoToMessage = 0xf716, - ReturnToCall = 0xf71a, - StartPresenting = 0xf71c, - StopPresenting = 0xf71d, - ProductivityMode = 0xf71e, - SetHistoryStatus = 0xf738, - SetHistoryStatus2 = 0xf739, - Keyboardsettings20 = 0xf73d, - OneHandedRight20 = 0xf73e, - OneHandedLeft20 = 0xf73f, - Split20 = 0xf740, - Full20 = 0xf741, - Handwriting20 = 0xf742, - ChevronLeft20 = 0xf743, - ChevronLeft32 = 0xf744, - ChevronRight20 = 0xf745, - ChevronRight32 = 0xf746, - Event12 = 0xf763, - MicOff2 = 0xf781, - DeliveryOptimization = 0xf785, - CancelMedium = 0xf78a, - SearchMedium = 0xf78b, - AcceptMedium = 0xf78c, - RevealPasswordMedium = 0xf78d, - DeleteWord = 0xf7ad, - DeleteWordFill = 0xf7ae, - DeleteLines = 0xf7af, - DeleteLinesFill = 0xf7b0, - InstertWords = 0xf7b1, - InstertWordsFill = 0xf7b2, - JoinWords = 0xf7b3, - JoinWordsFill = 0xf7b4, - OverwriteWords = 0xf7b5, - OverwriteWordsFill = 0xf7b6, - AddNewLine = 0xf7b7, - AddNewLineFill = 0xf7b8, - OverwriteWordsKorean = 0xf7b9, - OverwriteWordsFillKorean = 0xf7ba, - EducationIcon = 0xf7bb, - WindowSnipping = 0xf7ed, - VideoCapture = 0xf7ee, - StatusSecured = 0xf809, - NarratorApp = 0xf83b, - PowerButtonUpdate = 0xf83d, - RestartUpdate = 0xf83e, - UpdateStatusDot = 0xf83f, - Eject = 0xf847, - Spelling = 0xf87b, - SpellingKorean = 0xf87c, - SpellingSerbian = 0xf87d, - SpellingChinese = 0xf87e, - FolderSelect = 0xf89a, - SmartScreen = 0xf8a5, - ExploitProtection = 0xf8a6, - AddBold = 0xf8aa, - SubtractBold = 0xf8ab, - BackSolidBold = 0xf8ac, - ForwardSolidBold = 0xf8ad, - PauseBold = 0xf8ae, - ClickSolid = 0xf8af, - SettingsSolid = 0xf8b0, - MicrophoneSolidBold = 0xf8b1, - SpeechSolidBold = 0xf8b2, - ClickedOutLoudSolidBold = 0xf8b3, - }; - - Q_ENUM_NS(Fluent_AwesomeType) - - QML_NAMED_ELEMENT(FluentIcons) -} \ No newline at end of file diff --git a/src/FluCaptcha.h b/src/FluCaptcha.h index ea5b7e73..b0bc0e3d 100644 --- a/src/FluCaptcha.h +++ b/src/FluCaptcha.h @@ -22,7 +22,7 @@ public: Q_INVOKABLE void refresh(); - Q_INVOKABLE [[maybe_unused]] bool verify(const QString &code); + [[maybe_unused]] Q_INVOKABLE bool verify(const QString &code); private: QString _code; diff --git a/src/FluColors.cpp b/src/FluColors.cpp index b332f9d2..3a38044b 100644 --- a/src/FluColors.cpp +++ b/src/FluColors.cpp @@ -111,12 +111,12 @@ FluColors::FluColors(QObject *parent) : QObject{parent} { [[maybe_unused]] FluAccentColor *FluColors::createAccentColor(QColor primaryColor) { auto accentColor = new FluAccentColor(this); - accentColor->darkest(FluTools::getInstance()->withOpacity(primaryColor, 0.7)); - accentColor->darker(FluTools::getInstance()->withOpacity(primaryColor, 0.8)); - accentColor->dark(FluTools::getInstance()->withOpacity(primaryColor, 0.9)); accentColor->normal(primaryColor); + accentColor->dark(FluTools::getInstance()->withOpacity(primaryColor, 0.9)); accentColor->light(FluTools::getInstance()->withOpacity(primaryColor, 0.9)); - accentColor->lighter(FluTools::getInstance()->withOpacity(primaryColor, 0.8)); - accentColor->lightest(FluTools::getInstance()->withOpacity(primaryColor, 0.7)); + accentColor->darker(FluTools::getInstance()->withOpacity(accentColor->dark(), 0.8)); + accentColor->lighter(FluTools::getInstance()->withOpacity(accentColor->light(), 0.8)); + accentColor->darkest(FluTools::getInstance()->withOpacity(accentColor->darker(), 0.7)); + accentColor->lightest(FluTools::getInstance()->withOpacity(accentColor->lighter(), 0.7)); return accentColor; } diff --git a/src/FluColors.h b/src/FluColors.h index 8568ec5f..32ee84c6 100644 --- a/src/FluColors.h +++ b/src/FluColors.h @@ -55,7 +55,7 @@ private: public: SINGLETON(FluColors) - Q_INVOKABLE [[maybe_unused]] FluAccentColor *createAccentColor(QColor primaryColor); + [[maybe_unused]] Q_INVOKABLE FluAccentColor *createAccentColor(QColor primaryColor); static FluColors *create(QQmlEngine *, QJSEngine *) { return getInstance(); } -}; \ No newline at end of file +}; diff --git a/src/FluFrameless.h b/src/FluFrameless.h index 60afec2f..3917d131 100644 --- a/src/FluFrameless.h +++ b/src/FluFrameless.h @@ -33,17 +33,17 @@ public: [[maybe_unused]] bool nativeEventFilter(const QByteArray &eventType, void *message, QT_NATIVE_EVENT_RESULT_TYPE *result) override; - Q_INVOKABLE [[maybe_unused]] void showFullScreen(); + [[maybe_unused]] Q_INVOKABLE void showFullScreen(); Q_INVOKABLE void showMaximized(); - Q_INVOKABLE [[maybe_unused]] void showMinimized(); + [[maybe_unused]] Q_INVOKABLE void showMinimized(); Q_INVOKABLE void showNormal(); Q_INVOKABLE void setHitTestVisible(QQuickItem *); - Q_INVOKABLE [[maybe_unused]] void onDestruction(); + [[maybe_unused]] Q_INVOKABLE void onDestruction(); protected: bool eventFilter(QObject *obj, QEvent *event) override; @@ -73,4 +73,4 @@ private: int _margins = 8; quint64 _clickTimer = 0; QList> _hitTestList; -}; \ No newline at end of file +}; diff --git a/src/FluTableSortProxyModel.h b/src/FluTableSortProxyModel.h index 0cf27849..7a959f41 100644 --- a/src/FluTableSortProxyModel.h +++ b/src/FluTableSortProxyModel.h @@ -19,17 +19,17 @@ public: bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override; - Q_INVOKABLE [[maybe_unused]] QVariant getRow(int rowIndex); + [[maybe_unused]] Q_INVOKABLE QVariant getRow(int rowIndex); - Q_INVOKABLE [[maybe_unused]] void setRow(int rowIndex, const QVariant &val); + [[maybe_unused]] Q_INVOKABLE void setRow(int rowIndex, const QVariant &val); - Q_INVOKABLE [[maybe_unused]] void removeRow(int rowIndex, int rows); + [[maybe_unused]] Q_INVOKABLE void removeRow(int rowIndex, int rows); - Q_INVOKABLE [[maybe_unused]] [[maybe_unused]] void setComparator(const QJSValue &comparator); + [[maybe_unused]] Q_INVOKABLE void setComparator(const QJSValue &comparator); - Q_INVOKABLE [[maybe_unused]] void setFilter(const QJSValue &filter); + [[maybe_unused]] Q_INVOKABLE void setFilter(const QJSValue &filter); private: QJSValue _filter; QJSValue _comparator; -}; \ No newline at end of file +}; diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 45ece456..4948f3e8 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -3,6 +3,7 @@ #include #include #include "Def.h" +#include "FluentIconDef.h" #include "FluColors.h" bool systemDark() { @@ -54,7 +55,7 @@ bool FluTheme::eventFilter(QObject *, QEvent *event) { [[maybe_unused]] QJsonArray FluTheme::awesomeList(const QString &keyword) { QJsonArray arr; - QMetaEnum enumType = Fluent_Awesome::staticMetaObject.enumerator(Fluent_Awesome::staticMetaObject.indexOfEnumerator("Fluent_AwesomeType")); + QMetaEnum enumType = Fluent_Icons::staticMetaObject.enumerator(Fluent_Icons::staticMetaObject.indexOfEnumerator("Fluent_IconType")); for (int i = 0; i <= enumType.keyCount() - 1; ++i) { QString name = enumType.key(i); int icon = enumType.value(i); diff --git a/src/FluTheme.h b/src/FluTheme.h index 6b5cf5bc..e1b15ee8 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -45,7 +45,7 @@ private: public: SINGLETON(FluTheme) - Q_INVOKABLE [[maybe_unused]] static QJsonArray awesomeList(const QString &keyword = ""); + [[maybe_unused]] Q_INVOKABLE static QJsonArray awesomeList(const QString &keyword = ""); Q_SIGNAL void darkChanged(); diff --git a/src/FluentIconDef.h b/src/FluentIconDef.h new file mode 100644 index 00000000..300d23bd --- /dev/null +++ b/src/FluentIconDef.h @@ -0,0 +1,1417 @@ +#pragma once + +#include +#include + +namespace Fluent_Icons { + Q_NAMESPACE + enum class Fluent_IconType { + GlobalNavButton = 0xe700, + Wifi = 0xe701, + Bluetooth = 0xe702, + Connect = 0xe703, + InternetSharing = 0xe704, + VPN = 0xe705, + Brightness = 0xe706, + MapPin = 0xe707, + QuietHours = 0xe708, + Airplane = 0xe709, + Tablet = 0xe70a, + QuickNote = 0xe70b, + RememberedDevice = 0xe70c, + ChevronDown = 0xe70d, + ChevronUp = 0xe70e, + Edit = 0xe70f, + Add = 0xe710, + Cancel = 0xe711, + More = 0xe712, + Settings = 0xe713, + Video = 0xe714, + Mail = 0xe715, + People = 0xe716, + Phone = 0xe717, + Pin = 0xe718, + Shop = 0xe719, + Stop = 0xe71a, + Link = 0xe71b, + Filter = 0xe71c, + AllApps = 0xe71d, + Zoom = 0xe71e, + ZoomOut = 0xe71f, + Microphone = 0xe720, + Search = 0xe721, + Camera = 0xe722, + Attach = 0xe723, + Send = 0xe724, + SendFill = 0xe725, + WalkSolid = 0xe726, + InPrivate = 0xe727, + FavoriteList = 0xe728, + PageSolid = 0xe729, + Forward = 0xe72a, + Back = 0xe72b, + Refresh = 0xe72c, + Share = 0xe72d, + Lock = 0xe72e, + ReportHacked = 0xe730, + EMI = 0xe731, + FavoriteStar = 0xe734, + FavoriteStarFill = 0xe735, + ReadingMode = 0xe736, + Favicon = 0xe737, + Remove = 0xe738, + Checkbox = 0xe739, + CheckboxComposite = 0xe73a, + CheckboxFill = 0xe73b, + CheckboxIndeterminate = 0xe73c, + CheckboxCompositeReversed = 0xe73d, + CheckMark = 0xe73e, + BackToWindow = 0xe73f, + FullScreen = 0xe740, + ResizeTouchLarger = 0xe741, + ResizeTouchSmaller = 0xe742, + ResizeMouseSmall = 0xe743, + ResizeMouseMedium = 0xe744, + ResizeMouseWide = 0xe745, + ResizeMouseTall = 0xe746, + ResizeMouseLarge = 0xe747, + SwitchUser = 0xe748, + Print = 0xe749, + Up = 0xe74a, + Down = 0xe74b, + OEM = 0xe74c, + Delete = 0xe74d, + Save = 0xe74e, + Mute = 0xe74f, + BackSpaceQWERTY = 0xe750, + ReturnKey = 0xe751, + UpArrowShiftKey = 0xe752, + Cloud = 0xe753, + Flashlight = 0xe754, + RotationLock = 0xe755, + CommandPrompt = 0xe756, + SIPMove = 0xe759, + SIPUndock = 0xe75a, + SIPRedock = 0xe75b, + EraseTool = 0xe75c, + UnderscoreSpace = 0xe75d, + GripperTool = 0xe75e, + Dialpad = 0xe75f, + PageLeft = 0xe760, + PageRight = 0xe761, + MultiSelect = 0xe762, + KeyboardLeftHanded = 0xe763, + KeyboardRightHanded = 0xe764, + KeyboardClassic = 0xe765, + KeyboardSplit = 0xe766, + Volume = 0xe767, + Play = 0xe768, + Pause = 0xe769, + ChevronLeft = 0xe76b, + ChevronRight = 0xe76c, + InkingTool = 0xe76d, + Emoji2 = 0xe76e, + GripperBarHorizontal = 0xe76f, + System = 0xe770, + Personalize = 0xe771, + Devices = 0xe772, + SearchAndApps = 0xe773, + Globe = 0xe774, + TimeLanguage = 0xe775, + EaseOfAccess = 0xe776, + UpdateRestore = 0xe777, + HangUp = 0xe778, + ContactInfo = 0xe779, + Unpin = 0xe77a, + Contact = 0xe77b, + Memo = 0xe77c, + IncomingCall = 0xe77e, + Paste = 0xe77f, + PhoneBook = 0xe780, + LEDLight = 0xe781, + Error = 0xe783, + GripperBarVertical = 0xe784, + Unlock = 0xe785, + Slideshow = 0xe786, + Calendar = 0xe787, + GripperResize = 0xe788, + Megaphone = 0xe789, + Trim = 0xe78a, + NewWindow = 0xe78b, + SaveLocal = 0xe78c, + Color = 0xe790, + DataSense = 0xe791, + SaveAs = 0xe792, + Light = 0xe793, + AspectRatio = 0xe799, + DataSenseBar = 0xe7a5, + Redo = 0xe7a6, + Undo = 0xe7a7, + Crop = 0xe7a8, + OpenWith = 0xe7ac, + Rotate = 0xe7ad, + RedEye = 0xe7b3, + SetlockScreen = 0xe7b5, + MapPin2 = 0xe7b7, + Package = 0xe7b8, + Warning = 0xe7ba, + ReadingList = 0xe7bc, + Education = 0xe7be, + ShoppingCart = 0xe7bf, + Train = 0xe7c0, + Flag = 0xe7c1, + Move = 0xe7c2, + Page = 0xe7c3, + TaskView = 0xe7c4, + BrowsePhotos = 0xe7c5, + HalfStarLeft = 0xe7c6, + HalfStarRight = 0xe7c7, + Record = 0xe7c8, + TouchPointer = 0xe7c9, + LangJPN = 0xe7de, + Ferry = 0xe7e3, + Highlight = 0xe7e6, + ActionCenterNotification = 0xe7e7, + PowerButton = 0xe7e8, + ResizeTouchNarrower = 0xe7ea, + ResizeTouchShorter = 0xe7eb, + DrivingMode = 0xe7ec, + RingerSilent = 0xe7ed, + OtherUser = 0xe7ee, + Admin = 0xe7ef, + CC = 0xe7f0, + SDCard = 0xe7f1, + CallForwarding = 0xe7f2, + SettingsDisplaySound = 0xe7f3, + TVMonitor = 0xe7f4, + Speakers = 0xe7f5, + Headphone = 0xe7f6, + DeviceLaptopPic = 0xe7f7, + DeviceLaptopNoPic = 0xe7f8, + DeviceMonitorRightPic = 0xe7f9, + DeviceMonitorLeftPic = 0xe7fa, + DeviceMonitorNoPic = 0xe7fb, + Game = 0xe7fc, + HorizontalTabKey = 0xe7fd, + StreetsideSplitMinimize = 0xe802, + StreetsideSplitExpand = 0xe803, + Car = 0xe804, + Walk = 0xe805, + Bus = 0xe806, + TiltUp = 0xe809, + TiltDown = 0xe80a, + CallControl = 0xe80b, + RotateMapRight = 0xe80c, + RotateMapLeft = 0xe80d, + Home = 0xe80f, + ParkingLocation = 0xe811, + MapCompassTop = 0xe812, + MapCompassBottom = 0xe813, + IncidentTriangle = 0xe814, + Touch = 0xe815, + MapDirections = 0xe816, + StartPoint = 0xe819, + StopPoint = 0xe81a, + EndPoint = 0xe81b, + History = 0xe81c, + Location = 0xe81d, + MapLayers = 0xe81e, + Accident = 0xe81f, + Work = 0xe821, + Construction = 0xe822, + Recent = 0xe823, + Bank = 0xe825, + DownloadMap = 0xe826, + InkingToolFill2 = 0xe829, + HighlightFill2 = 0xe82a, + EraseToolFill = 0xe82b, + EraseToolFill2 = 0xe82c, + Dictionary = 0xe82d, + DictionaryAdd = 0xe82e, + ToolTip = 0xe82f, + ChromeBack = 0xe830, + ProvisioningPackage = 0xe835, + AddRemoteDevice = 0xe836, + FolderOpen = 0xe838, + Ethernet = 0xe839, + ShareBroadband = 0xe83a, + DirectAccess = 0xe83b, + DialUp = 0xe83c, + DefenderApp = 0xe83d, + BatteryCharging9 = 0xe83e, + Battery10 = 0xe83f, + Pinned = 0xe840, + PinFill = 0xe841, + PinnedFill = 0xe842, + PeriodKey = 0xe843, + PuncKey = 0xe844, + RevToggleKey = 0xe845, + RightArrowKeyTime1 = 0xe846, + RightArrowKeyTime2 = 0xe847, + LeftQuote = 0xe848, + RightQuote = 0xe849, + DownShiftKey = 0xe84a, + UpShiftKey = 0xe84b, + PuncKey0 = 0xe84c, + PuncKeyLeftBottom = 0xe84d, + RightArrowKeyTime3 = 0xe84e, + RightArrowKeyTime4 = 0xe84f, + Battery0 = 0xe850, + Battery1 = 0xe851, + Battery2 = 0xe852, + Battery3 = 0xe853, + Battery4 = 0xe854, + Battery5 = 0xe855, + Battery6 = 0xe856, + Battery7 = 0xe857, + Battery8 = 0xe858, + Battery9 = 0xe859, + BatteryCharging0 = 0xe85a, + BatteryCharging1 = 0xe85b, + BatteryCharging2 = 0xe85c, + BatteryCharging3 = 0xe85d, + BatteryCharging4 = 0xe85e, + BatteryCharging5 = 0xe85f, + BatteryCharging6 = 0xe860, + BatteryCharging7 = 0xe861, + BatteryCharging8 = 0xe862, + BatterySaver0 = 0xe863, + BatterySaver1 = 0xe864, + BatterySaver2 = 0xe865, + BatterySaver3 = 0xe866, + BatterySaver4 = 0xe867, + BatterySaver5 = 0xe868, + BatterySaver6 = 0xe869, + BatterySaver7 = 0xe86a, + BatterySaver8 = 0xe86b, + SignalBars1 = 0xe86c, + SignalBars2 = 0xe86d, + SignalBars3 = 0xe86e, + SignalBars4 = 0xe86f, + SignalBars5 = 0xe870, + SignalNotConnected = 0xe871, + Wifi1 = 0xe872, + Wifi2 = 0xe873, + Wifi3 = 0xe874, + MobSIMLock = 0xe875, + MobSIMMissing = 0xe876, + Vibrate = 0xe877, + RoamingInternational = 0xe878, + RoamingDomestic = 0xe879, + CallForwardInternational = 0xe87a, + CallForwardRoaming = 0xe87b, + JpnRomanji = 0xe87c, + JpnRomanjiLock = 0xe87d, + JpnRomanjiShift = 0xe87e, + JpnRomanjiShiftLock = 0xe87f, + StatusDataTransfer = 0xe880, + StatusDataTransferVPN = 0xe881, + StatusDualSIM2 = 0xe882, + StatusDualSIM2VPN = 0xe883, + StatusDualSIM1 = 0xe884, + StatusDualSIM1VPN = 0xe885, + StatusSGLTE = 0xe886, + StatusSGLTECell = 0xe887, + StatusSGLTEDataVPN = 0xe888, + StatusVPN = 0xe889, + WifiHotspot = 0xe88a, + LanguageKor = 0xe88b, + LanguageCht = 0xe88c, + LanguageChs = 0xe88d, + USB = 0xe88e, + InkingToolFill = 0xe88f, + View = 0xe890, + HighlightFill = 0xe891, + Previous = 0xe892, + Next = 0xe893, + Clear = 0xe894, + Sync = 0xe895, + Download = 0xe896, + Help = 0xe897, + Upload = 0xe898, + Emoji = 0xe899, + TwoPage = 0xe89a, + LeaveChat = 0xe89b, + MailForward = 0xe89c, + RotateCamera = 0xe89e, + ClosePane = 0xe89f, + OpenPane = 0xe8a0, + PreviewLink = 0xe8a1, + AttachCamera = 0xe8a2, + ZoomIn = 0xe8a3, + Bookmarks = 0xe8a4, + Document = 0xe8a5, + ProtectedDocument = 0xe8a6, + OpenInNewWindow = 0xe8a7, + MailFill = 0xe8a8, + ViewAll = 0xe8a9, + VideoChat = 0xe8aa, + Switch = 0xe8ab, + Rename = 0xe8ac, + Go = 0xe8ad, + SurfaceHub = 0xe8ae, + Remote = 0xe8af, + Click = 0xe8b0, + Shuffle = 0xe8b1, + Movies = 0xe8b2, + SelectAll = 0xe8b3, + Orientation = 0xe8b4, + Import = 0xe8b5, + ImportAll = 0xe8b6, + Folder = 0xe8b7, + Webcam = 0xe8b8, + Picture = 0xe8b9, + Caption = 0xe8ba, + ChromeClose = 0xe8bb, + ShowResults = 0xe8bc, + Message = 0xe8bd, + Leaf = 0xe8be, + CalendarDay = 0xe8bf, + CalendarWeek = 0xe8c0, + Characters = 0xe8c1, + MailReplyAll = 0xe8c2, + Read = 0xe8c3, + ShowBcc = 0xe8c4, + HideBcc = 0xe8c5, + Cut = 0xe8c6, + PaymentCard = 0xe8c7, + Copy = 0xe8c8, + Important = 0xe8c9, + MailReply = 0xe8ca, + Sort = 0xe8cb, + MobileTablet = 0xe8cc, + DisconnectDrive = 0xe8cd, + MapDrive = 0xe8ce, + ContactPresence = 0xe8cf, + Priority = 0xe8d0, + GotoToday = 0xe8d1, + Font = 0xe8d2, + FontColor = 0xe8d3, + Contact2 = 0xe8d4, + FolderFill = 0xe8d5, + Audio = 0xe8d6, + Permissions = 0xe8d7, + DisableUpdates = 0xe8d8, + Unfavorite = 0xe8d9, + OpenLocal = 0xe8da, + Italic = 0xe8db, + Underline = 0xe8dc, + Bold = 0xe8dd, + MoveToFolder = 0xe8de, + LikeDislike = 0xe8df, + Dislike = 0xe8e0, + Like = 0xe8e1, + AlignRight = 0xe8e2, + AlignCenter = 0xe8e3, + AlignLeft = 0xe8e4, + OpenFile = 0xe8e5, + ClearSelection = 0xe8e6, + FontDecrease = 0xe8e7, + FontIncrease = 0xe8e8, + FontSize = 0xe8e9, + CellPhone = 0xe8ea, + Reshare = 0xe8eb, + Tag = 0xe8ec, + RepeatOne = 0xe8ed, + RepeatAll = 0xe8ee, + Calculator = 0xe8ef, + Directions = 0xe8f0, + Library = 0xe8f1, + ChatBubbles = 0xe8f2, + PostUpdate = 0xe8f3, + NewFolder = 0xe8f4, + CalendarReply = 0xe8f5, + UnsyncFolder = 0xe8f6, + SyncFolder = 0xe8f7, + BlockContact = 0xe8f8, + SwitchApps = 0xe8f9, + AddFriend = 0xe8fa, + Accept = 0xe8fb, + GoToStart = 0xe8fc, + BulletedList = 0xe8fd, + Scan = 0xe8fe, + Preview = 0xe8ff, + Group = 0xe902, + ZeroBars = 0xe904, + OneBar = 0xe905, + TwoBars = 0xe906, + ThreeBars = 0xe907, + FourBars = 0xe908, + World = 0xe909, + Comment = 0xe90a, + MusicInfo = 0xe90b, + DockLeft = 0xe90c, + DockRight = 0xe90d, + DockBottom = 0xe90e, + Repair = 0xe90f, + Accounts = 0xe910, + DullSound = 0xe911, + Manage = 0xe912, + Street = 0xe913, + Printer3D = 0xe914, + RadioBullet = 0xe915, + Stopwatch = 0xe916, + Photo = 0xe91b, + ActionCenter = 0xe91c, + FullCircleMask = 0xe91f, + ChromeMinimize = 0xe921, + ChromeMaximize = 0xe922, + ChromeRestore = 0xe923, + Annotation = 0xe924, + BackSpaceQWERTYSm = 0xe925, + BackSpaceQWERTYMd = 0xe926, + Swipe = 0xe927, + Fingerprint = 0xe928, + Handwriting = 0xe929, + ChromeBackToWindow = 0xe92c, + ChromeFullScreen = 0xe92d, + KeyboardStandard = 0xe92e, + KeyboardDismiss = 0xe92f, + Completed = 0xe930, + ChromeAnnotate = 0xe931, + Label = 0xe932, + IBeam = 0xe933, + IBeamOutline = 0xe934, + FlickDown = 0xe935, + FlickUp = 0xe936, + FlickLeft = 0xe937, + FlickRight = 0xe938, + FeedbackApp = 0xe939, + MusicAlbum = 0xe93c, + Streaming = 0xe93e, + Code = 0xe943, + ReturnToWindow = 0xe944, + LightningBolt = 0xe945, + Info = 0xe946, + CalculatorMultiply = 0xe947, + CalculatorAddition = 0xe948, + CalculatorSubtract = 0xe949, + CalculatorDivide = 0xe94a, + CalculatorSquareroot = 0xe94b, + CalculatorPercentage = 0xe94c, + CalculatorNegate = 0xe94d, + CalculatorEqualTo = 0xe94e, + CalculatorBackspace = 0xe94f, + Component = 0xe950, + DMC = 0xe951, + Dock = 0xe952, + MultimediaDMS = 0xe953, + MultimediaDVR = 0xe954, + MultimediaPMP = 0xe955, + PrintfaxPrinterFile = 0xe956, + Sensor = 0xe957, + StorageOptical = 0xe958, + Communications = 0xe95a, + Headset = 0xe95b, + Projector = 0xe95d, + Health = 0xe95e, + Wire = 0xe95f, + Webcam2 = 0xe960, + Input = 0xe961, + Mouse = 0xe962, + Smartcard = 0xe963, + SmartcardVirtual = 0xe964, + MediaStorageTower = 0xe965, + ReturnKeySm = 0xe966, + GameConsole = 0xe967, + Network = 0xe968, + StorageNetworkWireless = 0xe969, + StorageTape = 0xe96a, + ChevronUpSmall = 0xe96d, + ChevronDownSmall = 0xe96e, + ChevronLeftSmall = 0xe96f, + ChevronRightSmall = 0xe970, + ChevronUpMed = 0xe971, + ChevronDownMed = 0xe972, + ChevronLeftMed = 0xe973, + ChevronRightMed = 0xe974, + Devices2 = 0xe975, + ExpandTile = 0xe976, + PC1 = 0xe977, + PresenceChicklet = 0xe978, + PresenceChickletVideo = 0xe979, + Reply = 0xe97a, + SetTile = 0xe97b, + Type = 0xe97c, + Korean = 0xe97d, + HalfAlpha = 0xe97e, + FullAlpha = 0xe97f, + Key12On = 0xe980, + ChineseChangjie = 0xe981, + QWERTYOn = 0xe982, + QWERTYOff = 0xe983, + ChineseQuick = 0xe984, + Japanese = 0xe985, + FullHiragana = 0xe986, + FullKatakana = 0xe987, + HalfKatakana = 0xe988, + ChineseBoPoMoFo = 0xe989, + ChinesePinyin = 0xe98a, + ConstructionCone = 0xe98f, + XboxOneConsole = 0xe990, + Volume0 = 0xe992, + Volume1 = 0xe993, + Volume2 = 0xe994, + Volume3 = 0xe995, + BatteryUnknown = 0xe996, + WifiAttentionOverlay = 0xe998, + Robot = 0xe99a, + TapAndSend = 0xe9a1, + FitPage = 0xe9a6, + PasswordKeyShow = 0xe9a8, + PasswordKeyHide = 0xe9a9, + BidiLtr = 0xe9aa, + BidiRtl = 0xe9ab, + ForwardSm = 0xe9ac, + CommaKey = 0xe9ad, + DashKey = 0xe9ae, + DullSoundKey = 0xe9af, + HalfDullSound = 0xe9b0, + RightDoubleQuote = 0xe9b1, + LeftDoubleQuote = 0xe9b2, + PuncKeyRightBottom = 0xe9b3, + PuncKey1 = 0xe9b4, + PuncKey2 = 0xe9b5, + PuncKey3 = 0xe9b6, + PuncKey4 = 0xe9b7, + PuncKey5 = 0xe9b8, + PuncKey6 = 0xe9b9, + PuncKey9 = 0xe9ba, + PuncKey7 = 0xe9bb, + PuncKey8 = 0xe9bc, + Frigid = 0xe9ca, + Unknown = 0xe9ce, + AreaChart = 0xe9d2, + CheckList = 0xe9d5, + Diagnostic = 0xe9d9, + Equalizer = 0xe9e9, + Process = 0xe9f3, + Processing = 0xe9f5, + ReportDocument = 0xe9f9, + VideoSolid = 0xea0c, + MixedMediaBadge = 0xea0d, + DisconnectDisplay = 0xea14, + Shield = 0xea18, + Info2 = 0xea1f, + ActionCenterAsterisk = 0xea21, + Beta = 0xea24, + SaveCopy = 0xea35, + List = 0xea37, + Asterisk = 0xea38, + ErrorBadge = 0xea39, + CircleRing = 0xea3a, + CircleFill = 0xea3b, + MergeCall = 0xea3c, + PrivateCall = 0xea3d, + Record2 = 0xea3f, + AllAppsMirrored = 0xea40, + BookmarksMirrored = 0xea41, + BulletedListMirrored = 0xea42, + CallForwardInternationalMirrored = 0xea43, + CallForwardRoamingMirrored = 0xea44, + ChromeBackMirrored = 0xea47, + ClearSelectionMirrored = 0xea48, + ClosePaneMirrored = 0xea49, + ContactInfoMirrored = 0xea4a, + DockRightMirrored = 0xea4b, + DockLeftMirrored = 0xea4c, + ExpandTileMirrored = 0xea4e, + GoMirrored = 0xea4f, + GripperResizeMirrored = 0xea50, + HelpMirrored = 0xea51, + ImportMirrored = 0xea52, + ImportAllMirrored = 0xea53, + LeaveChatMirrored = 0xea54, + ListMirrored = 0xea55, + MailForwardMirrored = 0xea56, + MailReplyMirrored = 0xea57, + MailReplyAllMirrored = 0xea58, + OpenPaneMirrored = 0xea5b, + OpenWithMirrored = 0xea5c, + ParkingLocationMirrored = 0xea5e, + ResizeMouseMediumMirrored = 0xea5f, + ResizeMouseSmallMirrored = 0xea60, + ResizeMouseTallMirrored = 0xea61, + ResizeTouchNarrowerMirrored = 0xea62, + SendMirrored = 0xea63, + SendFillMirrored = 0xea64, + ShowResultsMirrored = 0xea65, + Media = 0xea69, + SyncError = 0xea6a, + Devices3 = 0xea6c, + SlowMotionOn = 0xea79, + Lightbulb = 0xea80, + StatusCircle = 0xea81, + StatusTriangle = 0xea82, + StatusError = 0xea83, + StatusWarning = 0xea84, + Puzzle = 0xea86, + CalendarSolid = 0xea89, + HomeSolid = 0xea8a, + ParkingLocationSolid = 0xea8b, + ContactSolid = 0xea8c, + ConstructionSolid = 0xea8d, + AccidentSolid = 0xea8e, + Ringer = 0xea8f, + PDF = 0xea90, + ThoughtBubble = 0xea91, + HeartBroken = 0xea92, + BatteryCharging10 = 0xea93, + BatterySaver9 = 0xea94, + BatterySaver10 = 0xea95, + CallForwardingMirrored = 0xea97, + MultiSelectMirrored = 0xea98, + Broom = 0xea99, + ForwardCall = 0xeac2, + Trackers = 0xeadf, + Market = 0xeafc, + PieSingle = 0xeb05, + StockUp = 0xeb0f, + StockDown = 0xeb11, + Design = 0xeb3c, + Website = 0xeb41, + Drop = 0xeb42, + Radar = 0xeb44, + BusSolid = 0xeb47, + FerrySolid = 0xeb48, + StartPointSolid = 0xeb49, + StopPointSolid = 0xeb4a, + EndPointSolid = 0xeb4b, + AirplaneSolid = 0xeb4c, + TrainSolid = 0xeb4d, + WorkSolid = 0xeb4e, + ReminderFill = 0xeb4f, + Reminder = 0xeb50, + Heart = 0xeb51, + HeartFill = 0xeb52, + EthernetError = 0xeb55, + EthernetWarning = 0xeb56, + StatusConnecting1 = 0xeb57, + StatusConnecting2 = 0xeb58, + StatusUnsecure = 0xeb59, + WifiError0 = 0xeb5a, + WifiError1 = 0xeb5b, + WifiError2 = 0xeb5c, + WifiError3 = 0xeb5d, + WifiError4 = 0xeb5e, + WifiWarning0 = 0xeb5f, + WifiWarning1 = 0xeb60, + WifiWarning2 = 0xeb61, + WifiWarning3 = 0xeb62, + WifiWarning4 = 0xeb63, + Devices4 = 0xeb66, + NUIIris = 0xeb67, + NUIFace = 0xeb68, + GatewayRouter = 0xeb77, + EditMirrored = 0xeb7e, + NUIFPStartSlideHand = 0xeb82, + NUIFPStartSlideAction = 0xeb83, + NUIFPContinueSlideHand = 0xeb84, + NUIFPContinueSlideAction = 0xeb85, + NUIFPRollRightHand = 0xeb86, + NUIFPRollRightHandAction = 0xeb87, + NUIFPRollLeftHand = 0xeb88, + NUIFPRollLeftAction = 0xeb89, + NUIFPPressHand = 0xeb8a, + NUIFPPressAction = 0xeb8b, + NUIFPPressRepeatHand = 0xeb8c, + NUIFPPressRepeatAction = 0xeb8d, + StatusErrorFull = 0xeb90, + TaskViewExpanded = 0xeb91, + Certificate = 0xeb95, + BackSpaceQWERTYLg = 0xeb96, + ReturnKeyLg = 0xeb97, + FastForward = 0xeb9d, + Rewind = 0xeb9e, + Photo2 = 0xeb9f, + MobBattery0 = 0xeba0, + MobBattery1 = 0xeba1, + MobBattery2 = 0xeba2, + MobBattery3 = 0xeba3, + MobBattery4 = 0xeba4, + MobBattery5 = 0xeba5, + MobBattery6 = 0xeba6, + MobBattery7 = 0xeba7, + MobBattery8 = 0xeba8, + MobBattery9 = 0xeba9, + MobBattery10 = 0xebaa, + MobBatteryCharging0 = 0xebab, + MobBatteryCharging1 = 0xebac, + MobBatteryCharging2 = 0xebad, + MobBatteryCharging3 = 0xebae, + MobBatteryCharging4 = 0xebaf, + MobBatteryCharging5 = 0xebb0, + MobBatteryCharging6 = 0xebb1, + MobBatteryCharging7 = 0xebb2, + MobBatteryCharging8 = 0xebb3, + MobBatteryCharging9 = 0xebb4, + MobBatteryCharging10 = 0xebb5, + MobBatterySaver0 = 0xebb6, + MobBatterySaver1 = 0xebb7, + MobBatterySaver2 = 0xebb8, + MobBatterySaver3 = 0xebb9, + MobBatterySaver4 = 0xebba, + MobBatterySaver5 = 0xebbb, + MobBatterySaver6 = 0xebbc, + MobBatterySaver7 = 0xebbd, + MobBatterySaver8 = 0xebbe, + MobBatterySaver9 = 0xebbf, + MobBatterySaver10 = 0xebc0, + DictionaryCloud = 0xebc3, + ResetDrive = 0xebc4, + VolumeBars = 0xebc5, + Project = 0xebc6, + AdjustHologram = 0xebd2, + CloudDownload = 0xebd3, + MobWifiCallBars = 0xebd4, + MobWifiCall0 = 0xebd5, + MobWifiCall1 = 0xebd6, + MobWifiCall2 = 0xebd7, + MobWifiCall3 = 0xebd8, + MobWifiCall4 = 0xebd9, + Family = 0xebda, + LockFeedback = 0xebdb, + DeviceDiscovery = 0xebde, + WindDirection = 0xebe6, + RightArrowKeyTime0 = 0xebe7, + Bug = 0xebe8, + TabletMode = 0xebfc, + StatusCircleLeft = 0xebfd, + StatusTriangleLeft = 0xebfe, + StatusErrorLeft = 0xebff, + StatusWarningLeft = 0xec00, + MobBatteryUnknown = 0xec02, + NetworkTower = 0xec05, + CityNext = 0xec06, + CityNext2 = 0xec07, + Courthouse = 0xec08, + Groceries = 0xec09, + Sustainable = 0xec0a, + BuildingEnergy = 0xec0b, + ToggleFilled = 0xec11, + ToggleBorder = 0xec12, + SliderThumb = 0xec13, + ToggleThumb = 0xec14, + MiracastLogoSmall = 0xec15, + MiracastLogoLarge = 0xec16, + PLAP = 0xec19, + Badge = 0xec1b, + SignalRoaming = 0xec1e, + MobileLocked = 0xec20, + InsiderHubApp = 0xec24, + PersonalFolder = 0xec25, + HomeGroup = 0xec26, + MyNetwork = 0xec27, + KeyboardFull = 0xec31, + Cafe = 0xec32, + MobSignal1 = 0xec37, + MobSignal2 = 0xec38, + MobSignal3 = 0xec39, + MobSignal4 = 0xec3a, + MobSignal5 = 0xec3b, + MobWifi1 = 0xec3c, + MobWifi2 = 0xec3d, + MobWifi3 = 0xec3e, + MobWifi4 = 0xec3f, + MobAirplane = 0xec40, + MobBluetooth = 0xec41, + MobActionCenter = 0xec42, + MobLocation = 0xec43, + MobWifiHotspot = 0xec44, + LanguageJpn = 0xec45, + MobQuietHours = 0xec46, + MobDrivingMode = 0xec47, + SpeedOff = 0xec48, + SpeedMedium = 0xec49, + SpeedHigh = 0xec4a, + ThisPC = 0xec4e, + MusicNote = 0xec4f, + FileExplorer = 0xec50, + FileExplorerApp = 0xec51, + LeftArrowKeyTime0 = 0xec52, + MicOff = 0xec54, + MicSleep = 0xec55, + MicError = 0xec56, + PlaybackRate1x = 0xec57, + PlaybackRateOther = 0xec58, + CashDrawer = 0xec59, + BarcodeScanner = 0xec5a, + ReceiptPrinter = 0xec5b, + MagStripeReader = 0xec5c, + CompletedSolid = 0xec61, + CompanionApp = 0xec64, + Favicon2 = 0xec6c, + SwipeRevealArt = 0xec6d, + MicOn = 0xec71, + MicClipping = 0xec72, + TabletSelected = 0xec74, + MobileSelected = 0xec75, + LaptopSelected = 0xec76, + TVMonitorSelected = 0xec77, + DeveloperTools = 0xec7a, + MobCallForwarding = 0xec7e, + MobCallForwardingMirrored = 0xec7f, + BodyCam = 0xec80, + PoliceCar = 0xec81, + Draw = 0xec87, + DrawSolid = 0xec88, + LowerBrightness = 0xec8a, + ScrollUpDown = 0xec8f, + DateTime = 0xec92, + HoloLens = 0xec94, + Tiles = 0xeca5, + PartyLeader = 0xeca7, + AppIconDefault = 0xecaa, + Calories = 0xecad, + POI = 0xecaf, + BandBattery0 = 0xecb9, + BandBattery1 = 0xecba, + BandBattery2 = 0xecbb, + BandBattery3 = 0xecbc, + BandBattery4 = 0xecbd, + BandBattery5 = 0xecbe, + BandBattery6 = 0xecbf, + AddSurfaceHub = 0xecc4, + DevUpdate = 0xecc5, + Unit = 0xecc6, + AddTo = 0xecc8, + RemoveFrom = 0xecc9, + RadioBtnOff = 0xecca, + RadioBtnOn = 0xeccb, + RadioBullet2 = 0xeccc, + ExploreContent = 0xeccd, + Blocked2 = 0xece4, + ScrollMode = 0xece7, + ZoomMode = 0xece8, + PanMode = 0xece9, + WiredUSB = 0xecf0, + WirelessUSB = 0xecf1, + USBSafeConnect = 0xecf3, + ActionCenterNotificationMirrored = 0xed0c, + ActionCenterMirrored = 0xed0d, + SubscriptionAdd = 0xed0e, + ResetDevice = 0xed10, + SubscriptionAddMirrored = 0xed11, + QRCode = 0xed14, + Feedback = 0xed15, + Hide = 0xed1a, + Subtitles = 0xed1e, + SubtitlesAudio = 0xed1f, + OpenFolderHorizontal = 0xed25, + CalendarMirrored = 0xed28, + MobeSIM = 0xed2a, + MobeSIMNoProfile = 0xed2b, + MobeSIMLocked = 0xed2c, + MobeSIMBusy = 0xed2d, + SignalError = 0xed2e, + StreamingEnterprise = 0xed2f, + Headphone0 = 0xed30, + Headphone1 = 0xed31, + Headphone2 = 0xed32, + Headphone3 = 0xed33, + Apps = 0xed35, + KeyboardBrightness = 0xed39, + KeyboardLowerBrightness = 0xed3a, + SkipBack10 = 0xed3c, + SkipForward30 = 0xed3d, + TreeFolderFolder = 0xed41, + TreeFolderFolderFill = 0xed42, + TreeFolderFolderOpen = 0xed43, + TreeFolderFolderOpenFill = 0xed44, + MultimediaDMP = 0xed47, + KeyboardOneHanded = 0xed4c, + Narrator = 0xed4d, + EmojiTabPeople = 0xed53, + EmojiTabSmilesAnimals = 0xed54, + EmojiTabCelebrationObjects = 0xed55, + EmojiTabFoodPlants = 0xed56, + EmojiTabTransitPlaces = 0xed57, + EmojiTabSymbols = 0xed58, + EmojiTabTextSmiles = 0xed59, + EmojiTabFavorites = 0xed5a, + EmojiSwatch = 0xed5b, + ConnectApp = 0xed5c, + CompanionDeviceFramework = 0xed5d, + Ruler = 0xed5e, + FingerInking = 0xed5f, + StrokeErase = 0xed60, + PointErase = 0xed61, + ClearAllInk = 0xed62, + Pencil = 0xed63, + Marker = 0xed64, + InkingCaret = 0xed65, + InkingColorOutline = 0xed66, + InkingColorFill = 0xed67, + HardDrive = 0xeda2, + NetworkAdapter = 0xeda3, + Touchscreen = 0xeda4, + NetworkPrinter = 0xeda5, + CloudPrinter = 0xeda6, + KeyboardShortcut = 0xeda7, + BrushSize = 0xeda8, + NarratorForward = 0xeda9, + NarratorForwardMirrored = 0xedaa, + SyncBadge12 = 0xedab, + RingerBadge12 = 0xedac, + AsteriskBadge12 = 0xedad, + ErrorBadge12 = 0xedae, + CircleRingBadge12 = 0xedaf, + CircleFillBadge12 = 0xedb0, + ImportantBadge12 = 0xedb1, + MailBadge12 = 0xedb3, + PauseBadge12 = 0xedb4, + PlayBadge12 = 0xedb5, + PenWorkspace = 0xedc6, + CaretLeft8 = 0xedd5, + CaretRight8 = 0xedd6, + CaretUp8 = 0xedd7, + CaretDown8 = 0xedd8, + CaretLeftSolid8 = 0xedd9, + CaretRightSolid8 = 0xedda, + CaretUpSolid8 = 0xeddb, + CaretDownSolid8 = 0xeddc, + Strikethrough = 0xede0, + Export = 0xede1, + ExportMirrored = 0xede2, + ButtonMenu = 0xede3, + CloudSearch = 0xede4, + PinyinIMELogo = 0xede5, + CalligraphyPen = 0xedfb, + ReplyMirrored = 0xee35, + LockscreenDesktop = 0xee3f, + TaskViewSettings = 0xee40, + MiniExpand2Mirrored = 0xee47, + MiniContract2Mirrored = 0xee49, + Play36 = 0xee4a, + PenPalette = 0xee56, + GuestUser = 0xee57, + SettingsBattery = 0xee63, + TaskbarPhone = 0xee64, + LockScreenGlance = 0xee65, + GenericScan = 0xee6f, + ImageExport = 0xee71, + WifiEthernet = 0xee77, + ActionCenterQuiet = 0xee79, + ActionCenterQuietNotification = 0xee7a, + TrackersMirrored = 0xee92, + DateTimeMirrored = 0xee93, + Wheel = 0xee94, + VirtualMachineGroup = 0xeea3, + ButtonView2 = 0xeeca, + PenWorkspaceMirrored = 0xef15, + PenPaletteMirrored = 0xef16, + StrokeEraseMirrored = 0xef17, + PointEraseMirrored = 0xef18, + ClearAllInkMirrored = 0xef19, + BackgroundToggle = 0xef1f, + Marquee = 0xef20, + ChromeCloseContrast = 0xef2c, + ChromeMinimizeContrast = 0xef2d, + ChromeMaximizeContrast = 0xef2e, + ChromeRestoreContrast = 0xef2f, + TrafficLight = 0xef31, + Replay = 0xef3b, + Eyedropper = 0xef3c, + LineDisplay = 0xef3d, + PINPad = 0xef3e, + SignatureCapture = 0xef3f, + ChipCardCreditCardReader = 0xef40, + MarketDown = 0xef42, + PlayerSettings = 0xef58, + LandscapeOrientation = 0xef6b, + Flow = 0xef90, + Touchpad = 0xefa5, + Speech = 0xefa9, + KnowledgeArticle = 0xf000, + Relationship = 0xf003, + ZipFolder = 0xf012, + DefaultAPN = 0xf080, + UserAPN = 0xf081, + DoublePinyin = 0xf085, + BlueLight = 0xf08c, + CaretSolidLeft = 0xf08d, + CaretSolidDown = 0xf08e, + CaretSolidRight = 0xf08f, + CaretSolidUp = 0xf090, + ButtonA = 0xf093, + ButtonB = 0xf094, + ButtonY = 0xf095, + ButtonX = 0xf096, + ArrowUp8 = 0xf0ad, + ArrowDown8 = 0xf0ae, + ArrowRight8 = 0xf0af, + ArrowLeft8 = 0xf0b0, + QuarentinedItems = 0xf0b2, + QuarentinedItemsMirrored = 0xf0b3, + Protractor = 0xf0b4, + ChecklistMirrored = 0xf0b5, + StatusCircle7 = 0xf0b6, + StatusCheckmark7 = 0xf0b7, + StatusErrorCircle7 = 0xf0b8, + Connected = 0xf0b9, + PencilFill = 0xf0c6, + CalligraphyFill = 0xf0c7, + QuarterStarLeft = 0xf0ca, + QuarterStarRight = 0xf0cb, + ThreeQuarterStarLeft = 0xf0cc, + ThreeQuarterStarRight = 0xf0cd, + QuietHoursBadge12 = 0xf0ce, + BackMirrored = 0xf0d2, + ForwardMirrored = 0xf0d3, + ChromeBackContrast = 0xf0d5, + ChromeBackContrastMirrored = 0xf0d6, + ChromeBackToWindowContrast = 0xf0d7, + ChromeFullScreenContrast = 0xf0d8, + GridView = 0xf0e2, + ClipboardList = 0xf0e3, + ClipboardListMirrored = 0xf0e4, + OutlineQuarterStarLeft = 0xf0e5, + OutlineQuarterStarRight = 0xf0e6, + OutlineHalfStarLeft = 0xf0e7, + OutlineHalfStarRight = 0xf0e8, + OutlineThreeQuarterStarLeft = 0xf0e9, + OutlineThreeQuarterStarRight = 0xf0ea, + SpatialVolume0 = 0xf0eb, + SpatialVolume1 = 0xf0ec, + SpatialVolume2 = 0xf0ed, + SpatialVolume3 = 0xf0ee, + ApplicationGuard = 0xf0ef, + OutlineStarLeftHalf = 0xf0f7, + OutlineStarRightHalf = 0xf0f8, + ChromeAnnotateContrast = 0xf0f9, + DefenderBadge12 = 0xf0fb, + DetachablePC = 0xf103, + LeftStick = 0xf108, + RightStick = 0xf109, + TriggerLeft = 0xf10a, + TriggerRight = 0xf10b, + BumperLeft = 0xf10c, + BumperRight = 0xf10d, + Dpad = 0xf10e, + EnglishPunctuation = 0xf110, + ChinesePunctuation = 0xf111, + HMD = 0xf119, + CtrlSpatialRight = 0xf11b, + PaginationDotOutline10 = 0xf126, + PaginationDotSolid10 = 0xf127, + StrokeErase2 = 0xf128, + SmallErase = 0xf129, + LargeErase = 0xf12a, + FolderHorizontal = 0xf12b, + MicrophoneListening = 0xf12e, + StatusExclamationCircle7 = 0xf12f, + Video360 = 0xf131, + GiftboxOpen = 0xf133, + StatusCircleOuter = 0xf136, + StatusCircleInner = 0xf137, + StatusCircleRing = 0xf138, + StatusTriangleOuter = 0xf139, + StatusTriangleInner = 0xf13a, + StatusTriangleExclamation = 0xf13b, + StatusCircleExclamation = 0xf13c, + StatusCircleErrorX = 0xf13d, + StatusCircleCheckmark = 0xf13e, + StatusCircleInfo = 0xf13f, + StatusCircleBlock = 0xf140, + StatusCircleBlock2 = 0xf141, + StatusCircleQuestionMark = 0xf142, + StatusCircleSync = 0xf143, + Dial1 = 0xf146, + Dial2 = 0xf147, + Dial3 = 0xf148, + Dial4 = 0xf149, + Dial5 = 0xf14a, + Dial6 = 0xf14b, + Dial7 = 0xf14c, + Dial8 = 0xf14d, + Dial9 = 0xf14e, + Dial10 = 0xf14f, + Dial11 = 0xf150, + Dial12 = 0xf151, + Dial13 = 0xf152, + Dial14 = 0xf153, + Dial15 = 0xf154, + Dial16 = 0xf155, + DialShape1 = 0xf156, + DialShape2 = 0xf157, + DialShape3 = 0xf158, + DialShape4 = 0xf159, + ClosedCaptionsInternational = 0xf15f, + TollSolid = 0xf161, + TrafficCongestionSolid = 0xf163, + ExploreContentSingle = 0xf164, + CollapseContent = 0xf165, + CollapseContentSingle = 0xf166, + InfoSolid = 0xf167, + GroupList = 0xf168, + CaretBottomRightSolidCenter8 = 0xf169, + ProgressRingDots = 0xf16a, + Checkbox14 = 0xf16b, + CheckboxComposite14 = 0xf16c, + CheckboxIndeterminateCombo14 = 0xf16d, + CheckboxIndeterminateCombo = 0xf16e, + StatusPause7 = 0xf175, + CharacterAppearance = 0xf17f, + Lexicon = 0xf180, + ScreenTime = 0xf182, + HeadlessDevice = 0xf191, + NetworkSharing = 0xf193, + EyeGaze = 0xf19d, + ToggleLeft = 0xf19e, + ToggleRight = 0xf19f, + WindowsInsider = 0xf1ad, + ChromeSwitch = 0xf1cb, + ChromeSwitchContast = 0xf1cc, + StatusCheckmark = 0xf1d8, + StatusCheckmarkLeft = 0xf1d9, + KeyboardLeftAligned = 0xf20c, + KeyboardRightAligned = 0xf20d, + KeyboardSettings = 0xf210, + NetworkPhysical = 0xf211, + IOT = 0xf22c, + UnknownMirrored = 0xf22e, + ViewDashboard = 0xf246, + ExploitProtectionSettings = 0xf259, + KeyboardNarrow = 0xf260, + Keyboard12Key = 0xf261, + KeyboardDock = 0xf26b, + KeyboardUndock = 0xf26c, + KeyboardLeftDock = 0xf26d, + KeyboardRightDock = 0xf26e, + Ear = 0xf270, + PointerHand = 0xf271, + Bullseye = 0xf272, + DocumentApproval = 0xf28b, + LocaleLanguage = 0xf2b7, + PassiveAuthentication = 0xf32a, + ColorSolid = 0xf354, + NetworkOffline = 0xf384, + NetworkConnected = 0xf385, + NetworkConnectedCheckmark = 0xf386, + SignOut = 0xf3b1, + StatusInfo = 0xf3cc, + StatusInfoLeft = 0xf3cd, + NearbySharing = 0xf3e2, + CtrlSpatialLeft = 0xf3e7, + InteractiveDashboard = 0xf404, + DeclineCall = 0xf405, + ClippingTool = 0xf406, + RectangularClipping = 0xf407, + FreeFormClipping = 0xf408, + CopyTo = 0xf413, + IDBadge = 0xf427, + DynamicLock = 0xf439, + PenTips = 0xf45e, + PenTipsMirrored = 0xf45f, + HWPJoin = 0xf460, + HWPInsert = 0xf461, + HWPStrikeThrough = 0xf462, + HWPScratchOut = 0xf463, + HWPSplit = 0xf464, + HWPNewLine = 0xf465, + HWPOverwrite = 0xf466, + MobWifiWarning1 = 0xf473, + MobWifiWarning2 = 0xf474, + MobWifiWarning3 = 0xf475, + MobWifiWarning4 = 0xf476, + MicLocationCombo = 0xf47f, + Globe2 = 0xf49a, + SpecialEffectSize = 0xf4a5, + GIF = 0xf4a9, + Sticker2 = 0xf4aa, + SurfaceHubSelected = 0xf4be, + HoloLensSelected = 0xf4bf, + Earbud = 0xf4c0, + MixVolumes = 0xf4c3, + Safe = 0xf540, + LaptopSecure = 0xf552, + PrintDefault = 0xf56d, + PageMirrored = 0xf56e, + LandscapeOrientationMirrored = 0xf56f, + ColorOff = 0xf570, + PrintAllPages = 0xf571, + PrintCustomRange = 0xf572, + PageMarginPortraitNarrow = 0xf573, + PageMarginPortraitNormal = 0xf574, + PageMarginPortraitModerate = 0xf575, + PageMarginPortraitWide = 0xf576, + PageMarginLandscapeNarrow = 0xf577, + PageMarginLandscapeNormal = 0xf578, + PageMarginLandscapeModerate = 0xf579, + PageMarginLandscapeWide = 0xf57a, + CollateLandscape = 0xf57b, + CollatePortrait = 0xf57c, + CollatePortraitSeparated = 0xf57d, + DuplexLandscapeOneSided = 0xf57e, + DuplexLandscapeOneSidedMirrored = 0xf57f, + DuplexLandscapeTwoSidedLongEdge = 0xf580, + DuplexLandscapeTwoSidedLongEdgeMirrored = 0xf581, + DuplexLandscapeTwoSidedShortEdge = 0xf582, + DuplexLandscapeTwoSidedShortEdgeMirrored = 0xf583, + DuplexPortraitOneSided = 0xf584, + DuplexPortraitOneSidedMirrored = 0xf585, + DuplexPortraitTwoSidedLongEdge = 0xf586, + DuplexPortraitTwoSidedLongEdgeMirrored = 0xf587, + DuplexPortraitTwoSidedShortEdge = 0xf588, + DuplexPortraitTwoSidedShortEdgeMirrored = 0xf589, + PPSOneLandscape = 0xf58a, + PPSTwoLandscape = 0xf58b, + PPSTwoPortrait = 0xf58c, + PPSFourLandscape = 0xf58d, + PPSFourPortrait = 0xf58e, + HolePunchOff = 0xf58f, + HolePunchPortraitLeft = 0xf590, + HolePunchPortraitRight = 0xf591, + HolePunchPortraitTop = 0xf592, + HolePunchPortraitBottom = 0xf593, + HolePunchLandscapeLeft = 0xf594, + HolePunchLandscapeRight = 0xf595, + HolePunchLandscapeTop = 0xf596, + HolePunchLandscapeBottom = 0xf597, + StaplingOff = 0xf598, + StaplingPortraitTopLeft = 0xf599, + StaplingPortraitTopRight = 0xf59a, + StaplingPortraitBottomRight = 0xf59b, + StaplingPortraitTwoLeft = 0xf59c, + StaplingPortraitTwoRight = 0xf59d, + StaplingPortraitTwoTop = 0xf59e, + StaplingPortraitTwoBottom = 0xf59f, + StaplingPortraitBookBinding = 0xf5a0, + StaplingLandscapeTopLeft = 0xf5a1, + StaplingLandscapeTopRight = 0xf5a2, + StaplingLandscapeBottomLeft = 0xf5a3, + StaplingLandscapeBottomRight = 0xf5a4, + StaplingLandscapeTwoLeft = 0xf5a5, + StaplingLandscapeTwoRight = 0xf5a6, + StaplingLandscapeTwoTop = 0xf5a7, + StaplingLandscapeTwoBottom = 0xf5a8, + StaplingLandscapeBookBinding = 0xf5a9, + StatusDataTransferRoaming = 0xf5aa, + MobSIMError = 0xf5ab, + CollateLandscapeSeparated = 0xf5ac, + PPSOnePortrait = 0xf5ad, + StaplingPortraitBottomLeft = 0xf5ae, + PlaySolid = 0xf5b0, + RepeatOff = 0xf5e7, + Set = 0xf5ed, + SetSolid = 0xf5ee, + FuzzyReading = 0xf5ef, + VerticalBattery0 = 0xf5f2, + VerticalBattery1 = 0xf5f3, + VerticalBattery2 = 0xf5f4, + VerticalBattery3 = 0xf5f5, + VerticalBattery4 = 0xf5f6, + VerticalBattery5 = 0xf5f7, + VerticalBattery6 = 0xf5f8, + VerticalBattery7 = 0xf5f9, + VerticalBattery8 = 0xf5fa, + VerticalBattery9 = 0xf5fb, + VerticalBattery10 = 0xf5fc, + VerticalBatteryCharging0 = 0xf5fd, + VerticalBatteryCharging1 = 0xf5fe, + VerticalBatteryCharging2 = 0xf5ff, + VerticalBatteryCharging3 = 0xf600, + VerticalBatteryCharging4 = 0xf601, + VerticalBatteryCharging5 = 0xf602, + VerticalBatteryCharging6 = 0xf603, + VerticalBatteryCharging7 = 0xf604, + VerticalBatteryCharging8 = 0xf605, + VerticalBatteryCharging9 = 0xf606, + VerticalBatteryCharging10 = 0xf607, + VerticalBatteryUnknown = 0xf608, + SIMError = 0xf618, + SIMMissing = 0xf619, + SIMLock = 0xf61a, + eSIM = 0xf61b, + eSIMNoProfile = 0xf61c, + eSIMLocked = 0xf61d, + eSIMBusy = 0xf61e, + NoiseCancelation = 0xf61f, + NoiseCancelationOff = 0xf620, + MusicSharing = 0xf623, + MusicSharingOff = 0xf624, + CircleShapeSolid = 0xf63c, + WifiCallBars = 0xf657, + WifiCall0 = 0xf658, + WifiCall1 = 0xf659, + WifiCall2 = 0xf65a, + WifiCall3 = 0xf65b, + WifiCall4 = 0xf65c, + CHTLanguageBar = 0xf69e, + ComposeMode = 0xf6a9, + ExpressiveInputEntry = 0xf6b8, + EmojiTabMoreSymbols = 0xf6ba, + WebSearch = 0xf6fa, + Kiosk = 0xf712, + RTTLogo = 0xf714, + VoiceCall = 0xf715, + GoToMessage = 0xf716, + ReturnToCall = 0xf71a, + StartPresenting = 0xf71c, + StopPresenting = 0xf71d, + ProductivityMode = 0xf71e, + SetHistoryStatus = 0xf738, + SetHistoryStatus2 = 0xf739, + Keyboardsettings20 = 0xf73d, + OneHandedRight20 = 0xf73e, + OneHandedLeft20 = 0xf73f, + Split20 = 0xf740, + Full20 = 0xf741, + Handwriting20 = 0xf742, + ChevronLeft20 = 0xf743, + ChevronLeft32 = 0xf744, + ChevronRight20 = 0xf745, + ChevronRight32 = 0xf746, + Event12 = 0xf763, + MicOff2 = 0xf781, + DeliveryOptimization = 0xf785, + CancelMedium = 0xf78a, + SearchMedium = 0xf78b, + AcceptMedium = 0xf78c, + RevealPasswordMedium = 0xf78d, + DeleteWord = 0xf7ad, + DeleteWordFill = 0xf7ae, + DeleteLines = 0xf7af, + DeleteLinesFill = 0xf7b0, + InstertWords = 0xf7b1, + InstertWordsFill = 0xf7b2, + JoinWords = 0xf7b3, + JoinWordsFill = 0xf7b4, + OverwriteWords = 0xf7b5, + OverwriteWordsFill = 0xf7b6, + AddNewLine = 0xf7b7, + AddNewLineFill = 0xf7b8, + OverwriteWordsKorean = 0xf7b9, + OverwriteWordsFillKorean = 0xf7ba, + EducationIcon = 0xf7bb, + WindowSnipping = 0xf7ed, + VideoCapture = 0xf7ee, + StatusSecured = 0xf809, + NarratorApp = 0xf83b, + PowerButtonUpdate = 0xf83d, + RestartUpdate = 0xf83e, + UpdateStatusDot = 0xf83f, + Eject = 0xf847, + Spelling = 0xf87b, + SpellingKorean = 0xf87c, + SpellingSerbian = 0xf87d, + SpellingChinese = 0xf87e, + FolderSelect = 0xf89a, + SmartScreen = 0xf8a5, + ExploitProtection = 0xf8a6, + AddBold = 0xf8aa, + SubtractBold = 0xf8ab, + BackSolidBold = 0xf8ac, + ForwardSolidBold = 0xf8ad, + PauseBold = 0xf8ae, + ClickSolid = 0xf8af, + SettingsSolid = 0xf8b0, + MicrophoneSolidBold = 0xf8b1, + SpeechSolidBold = 0xf8b2, + ClickedOutLoudSolidBold = 0xf8b3 + }; + + Q_ENUM_NS(Fluent_IconType) + + QML_NAMED_ELEMENT(FluentIcons) +} diff --git a/src/FluentUI.cpp b/src/FluentUI.cpp index e4aa166e..a1704d39 100644 --- a/src/FluentUI.cpp +++ b/src/FluentUI.cpp @@ -2,6 +2,7 @@ #include #include "Def.h" +#include "FluentIconDef.h" #include "FluApp.h" #include "FluColors.h" #include "FluTheme.h" @@ -131,7 +132,7 @@ void FluentUI::registerTypes(const char *uri) const { qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRouter.qml"), uri, major, minor, "FluRouter"); qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEventBus.qml"), uri, major, minor, "FluEventBus"); - qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri, major, minor, "FluentIcons", "Access to enums & flags only"); + qmlRegisterUncreatableMetaObject(Fluent_Icons::staticMetaObject, uri, major, minor, "FluentIcons", "Access to enums & flags only"); qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri, major, minor, "FluThemeType", "Access to enums & flags only"); qmlRegisterUncreatableMetaObject(FluPageType::staticMetaObject, uri, major, minor, "FluPageType", "Access to enums & flags only"); qmlRegisterUncreatableMetaObject(FluWindowType::staticMetaObject, uri, major, minor, "FluWindowType", "Access to enums & flags only"); diff --git a/src/Qt5/imports/FluentUI/Controls/FluIcon.qml b/src/Qt5/imports/FluentUI/Controls/FluIcon.qml index 3a51b3f2..7b1f6098 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluIcon.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluIcon.qml @@ -7,13 +7,15 @@ Text { property int iconSize: 20 property color iconColor: FluTheme.dark ? "#FFFFFF" : "#000000" id:control - font.family: "Segoe Fluent Icons" + font.family: font_loader.name font.pixelSize: iconSize horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: iconColor text: (String.fromCharCode(iconSource).toString(16)) + opacity: iconSource>0 FontLoader{ - source: "../Font/Segoe_Fluent_Icons.ttf" + id: font_loader + source: "qrc:/qt/qml/FluentUI/Font/FluentIcons.ttf" } } diff --git a/src/Qt5/imports/FluentUI/Font/Segoe_Fluent_Icons.ttf b/src/Qt5/imports/FluentUI/Font/FluentIcons.ttf similarity index 100% rename from src/Qt5/imports/FluentUI/Font/Segoe_Fluent_Icons.ttf rename to src/Qt5/imports/FluentUI/Font/FluentIcons.ttf diff --git a/src/Qt5/imports/fluentui.qrc b/src/Qt5/imports/fluentui.qrc index 103c6152..e27840cc 100644 --- a/src/Qt5/imports/fluentui.qrc +++ b/src/Qt5/imports/fluentui.qrc @@ -2,7 +2,6 @@ FluentUI/JS/Chart.js FluentUI/Image/noise.png - FluentUI/Font/Segoe_Fluent_Icons.ttf FluentUI/Controls/FluAcrylic.qml FluentUI/Controls/FluAppBar.qml FluentUI/Controls/FluAutoSuggestBox.qml @@ -110,5 +109,6 @@ FluentUI/Controls/FluSheet.qml FluentUI/Controls/FluGroupBox.qml FluentUI/Controls/FluControlBackground.qml + FluentUI/Font/FluentIcons.ttf diff --git a/src/Qt6/imports/FluentUI/Controls/FluIcon.qml b/src/Qt6/imports/FluentUI/Controls/FluIcon.qml index edf17b61..a8bb3b2a 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluIcon.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluIcon.qml @@ -7,13 +7,15 @@ Text { property int iconSize: 20 property color iconColor: FluTheme.dark ? "#FFFFFF" : "#000000" id:control - font.family: "Segoe Fluent Icons" + font.family: font_loader.name font.pixelSize: iconSize horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: iconColor text: (String.fromCharCode(iconSource).toString(16)) + opacity: iconSource>0 FontLoader{ - source: "../Font/Segoe_Fluent_Icons.ttf" + id: font_loader + source: "qrc:/qt/qml/FluentUI/Font/FluentIcons.ttf" } } diff --git a/src/Qt6/imports/FluentUI/Font/Segoe_Fluent_Icons.ttf b/src/Qt6/imports/FluentUI/Font/FluentIcons.ttf similarity index 100% rename from src/Qt6/imports/FluentUI/Font/Segoe_Fluent_Icons.ttf rename to src/Qt6/imports/FluentUI/Font/FluentIcons.ttf From 44acdbcf7f861e1747875365659e71df5e83279a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Thu, 11 Apr 2024 20:29:59 +0800 Subject: [PATCH 07/29] update --- example/example_en_US.ts | 8 -------- example/example_zh_CN.ts | 8 -------- example/src/singleton.h | 2 +- src/CMakeLists.txt | 2 +- src/FluApp.cpp | 5 +++-- src/FluCaptcha.cpp | 3 +++ src/FluColors.cpp | 2 +- src/FluColors.h | 2 +- src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml | 1 + src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml | 1 + src/singleton.h | 2 +- 11 files changed, 13 insertions(+), 23 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 8d3c2fce..af16a652 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -87,29 +87,21 @@ InitializrHelper - - The name cannot be empty - - The creation path cannot be empty - - The path does not exist - - %1 folder already exists diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 659077c2..ce01e5a8 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -87,29 +87,21 @@ InitializrHelper - - The name cannot be empty 名称不能为空 - - The creation path cannot be empty 创建路径不能为空 - - The path does not exist 路径不存在 - - %1 folder already exists %1 文件夹已经存在 diff --git a/example/src/singleton.h b/example/src/singleton.h index 9583c687..466ce43c 100644 --- a/example/src/singleton.h +++ b/example/src/singleton.h @@ -21,4 +21,4 @@ private: \ public: \ static Class* getInstance() { \ return Singleton::getInstance(); \ -} +} \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb916ab9..0ed7b59a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,7 +13,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) #设置版本号 -add_definitions(-DFLUENTUI_VERSION=1,7,4,0) +add_definitions(-DFLUENTUI_VERSION=1,7,5,0) if (FLUENTUI_BUILD_STATIC_LIB) add_definitions(-DFLUENTUI_BUILD_STATIC_LIB) diff --git a/src/FluApp.cpp b/src/FluApp.cpp index 13bf6df7..f2c3c3b4 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -8,6 +8,7 @@ #include #include #include +#include FluApp::FluApp(QObject *parent) : QObject{parent} { _useSystemAppBar = false; @@ -16,10 +17,10 @@ FluApp::FluApp(QObject *parent) : QObject{parent} { FluApp::~FluApp() = default; void FluApp::init(QObject *target, QLocale locale) { - _locale = locale; + _locale = std::move(locale); _engine = qmlEngine(target); _translator = new QTranslator(this); - qApp->installTranslator(_translator); + QGuiApplication::installTranslator(_translator); const QStringList uiLanguages = _locale.uiLanguages(); for (const QString &name: uiLanguages) { const QString baseName = "fluentui_" + QLocale(name).name(); diff --git a/src/FluCaptcha.cpp b/src/FluCaptcha.cpp index bc849009..6dc4e94c 100644 --- a/src/FluCaptcha.cpp +++ b/src/FluCaptcha.cpp @@ -11,6 +11,9 @@ int generaNumber(int number) { FluCaptcha::FluCaptcha(QQuickItem *parent) : QQuickPaintedItem(parent) { _ignoreCase = false; QFont fontStyle; +#ifdef Q_OS_WIN + fontStyle.setFamily("微软雅黑"); +#endif fontStyle.setPixelSize(28); fontStyle.setBold(true); font(fontStyle); diff --git a/src/FluColors.cpp b/src/FluColors.cpp index 3a38044b..10cbe472 100644 --- a/src/FluColors.cpp +++ b/src/FluColors.cpp @@ -109,7 +109,7 @@ FluColors::FluColors(QObject *parent) : QObject{parent} { _Green = green; } -[[maybe_unused]] FluAccentColor *FluColors::createAccentColor(QColor primaryColor) { +[[maybe_unused]] FluAccentColor *FluColors::createAccentColor(const QColor& primaryColor) { auto accentColor = new FluAccentColor(this); accentColor->normal(primaryColor); accentColor->dark(FluTools::getInstance()->withOpacity(primaryColor, 0.9)); diff --git a/src/FluColors.h b/src/FluColors.h index 32ee84c6..16452654 100644 --- a/src/FluColors.h +++ b/src/FluColors.h @@ -55,7 +55,7 @@ private: public: SINGLETON(FluColors) - [[maybe_unused]] Q_INVOKABLE FluAccentColor *createAccentColor(QColor primaryColor); + [[maybe_unused]] Q_INVOKABLE FluAccentColor *createAccentColor(const QColor& primaryColor); static FluColors *create(QQmlEngine *, QJSEngine *) { return getInstance(); } }; diff --git a/src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml b/src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml index 299fb1ab..2f562e35 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml @@ -21,6 +21,7 @@ T.SpinBox { bottom: Math.min(control.from, control.to) top: Math.max(control.from, control.to) } + font: FluTextStyle.Body contentItem: TextInput { property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) diff --git a/src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml b/src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml index ea21bf97..7dcc6294 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml @@ -22,6 +22,7 @@ T.SpinBox { bottom: Math.min(control.from, control.to) top: Math.max(control.from, control.to) } + font: FluTextStyle.Body contentItem: TextInput { property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) diff --git a/src/singleton.h b/src/singleton.h index 9583c687..466ce43c 100644 --- a/src/singleton.h +++ b/src/singleton.h @@ -21,4 +21,4 @@ private: \ public: \ static Class* getInstance() { \ return Singleton::getInstance(); \ -} +} \ From 0ab315e258edd1470121010310a915e2758e2027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 12 Apr 2024 16:26:32 +0800 Subject: [PATCH 08/29] update --- example/example_en_US.ts | 5 ++ example/example_zh_CN.ts | 5 ++ example/qml/page/T_Theme.qml | 13 ++++- src/FluTheme.cpp | 29 ++++++++++- src/FluTheme.h | 17 ++++++- src/FluTools.cpp | 37 ++++++++++++++ src/FluTools.h | 6 ++- .../imports/FluentUI/Controls/FluAcrylic.qml | 5 +- .../FluentUI/Controls/FluCalendarPicker.qml | 3 +- .../imports/FluentUI/Controls/FluExpander.qml | 15 +++++- .../imports/FluentUI/Controls/FluFrame.qml | 7 ++- .../imports/FluentUI/Controls/FluGroupBox.qml | 9 +++- .../imports/FluentUI/Controls/FluWindow.qml | 49 ++++++++++++++++++- .../imports/FluentUI/Controls/FluAcrylic.qml | 5 +- .../FluentUI/Controls/FluCalendarPicker.qml | 3 +- .../imports/FluentUI/Controls/FluExpander.qml | 15 +++++- .../imports/FluentUI/Controls/FluFrame.qml | 7 ++- .../imports/FluentUI/Controls/FluGroupBox.qml | 9 +++- .../imports/FluentUI/Controls/FluWindow.qml | 49 ++++++++++++++++++- 19 files changed, 264 insertions(+), 24 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index af16a652..e49fa5ec 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -2190,6 +2190,11 @@ Some contents... Open Animation + + + Open Blur Window + + T_TimePicker diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index ce01e5a8..5f4c183e 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -2280,6 +2280,11 @@ Some contents... Open Animation 开启动画 + + + Open Blur Window + + T_TimePicker diff --git a/example/qml/page/T_Theme.qml b/example/qml/page/T_Theme.qml index a7e4a01d..308c1e92 100644 --- a/example/qml/page/T_Theme.qml +++ b/example/qml/page/T_Theme.qml @@ -13,7 +13,7 @@ FluScrollablePage{ FluFrame{ Layout.fillWidth: true - Layout.preferredHeight: 340 + Layout.preferredHeight: 400 padding: 10 ColumnLayout{ @@ -119,6 +119,17 @@ FluScrollablePage{ FluTheme.animationEnabled = !FluTheme.animationEnabled } } + FluText{ + text: qsTr("Open Blur Window") + Layout.topMargin: 20 + } + FluToggleSwitch{ + Layout.topMargin: 5 + checked: FluTheme.blurBehindWindowEnabled + onClicked: { + FluTheme.blurBehindWindowEnabled = !FluTheme.blurBehindWindowEnabled + } + } } } CodeExpander{ diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 4948f3e8..ff2b760b 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -2,9 +2,11 @@ #include #include +#include #include "Def.h" #include "FluentIconDef.h" #include "FluColors.h" +#include "FluTools.h" bool systemDark() { QPalette palette = QGuiApplication::palette(); @@ -18,13 +20,20 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} { _nativeText = false; _animationEnabled = true; _systemDark = systemDark(); + _desktopImagePath = ""; + _blurBehindWindowEnabled = false; QGuiApplication::instance()->installEventFilter(this); + refreshColors(); + updateDesktopImage(); connect(this, &FluTheme::darkModeChanged, this, [=] { Q_EMIT darkChanged(); }); connect(this, &FluTheme::darkChanged, this, [=] { refreshColors(); }); connect(this, &FluTheme::accentColorChanged, this, [=] { refreshColors(); }); - refreshColors(); + connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path){ + Q_EMIT desktopImagePathChanged(); + }); + startTimer(500); } void FluTheme::refreshColors() { @@ -38,6 +47,8 @@ void FluTheme::refreshColors() { fontSecondaryColor(isDark ? QColor(222, 222, 222, 255) : QColor(102, 102, 102, 255)); fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255)); itemNormalColor(isDark ? QColor(255, 255, 255, 0) : QColor(0, 0, 0, 0)); + frameColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); + frameActiveColor(isDark ? QColor(32, 32, 32, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.6))); itemHoverColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.06)) : QColor(0, 0, 0, qRound(255 * 0.03))); itemPressColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.09)) : QColor(0, 0, 0, qRound(255 * 0.06))); itemCheckColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); @@ -78,3 +89,19 @@ bool FluTheme::dark() const { return false; } } + +void FluTheme::updateDesktopImage(){ + auto path = FluTools::getInstance()->getWallpaperFilePath(); + if(_desktopImagePath != path){ + if(!_desktopImagePath.isEmpty()){ + _watcher.removePath(_desktopImagePath); + } + desktopImagePath(path); + _watcher.addPath(path); + } +} + +void FluTheme::timerEvent(QTimerEvent *event) +{ + updateDesktopImage(); +} diff --git a/src/FluTheme.h b/src/FluTheme.h index e1b15ee8..2d95a39b 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include "FluAccentColor.h" #include "stdafx.h" #include "singleton.h" @@ -15,7 +17,7 @@ */ class FluTheme : public QObject { Q_OBJECT - Q_PROPERTY(bool dark READ dark NOTIFY darkChanged) +Q_PROPERTY(bool dark READ dark NOTIFY darkChanged) Q_PROPERTY_AUTO_P(FluAccentColor*, accentColor); Q_PROPERTY_AUTO(QColor, primaryColor); Q_PROPERTY_AUTO(QColor, backgroundColor); @@ -26,12 +28,16 @@ Q_PROPERTY_AUTO(QColor, fontPrimaryColor); Q_PROPERTY_AUTO(QColor, fontSecondaryColor); Q_PROPERTY_AUTO(QColor, fontTertiaryColor); Q_PROPERTY_AUTO(QColor, itemNormalColor); +Q_PROPERTY_AUTO(QColor, frameColor); +Q_PROPERTY_AUTO(QColor, frameActiveColor); Q_PROPERTY_AUTO(QColor, itemHoverColor); Q_PROPERTY_AUTO(QColor, itemPressColor); Q_PROPERTY_AUTO(QColor, itemCheckColor); +Q_PROPERTY_AUTO(QString, desktopImagePath); Q_PROPERTY_AUTO(int, darkMode); Q_PROPERTY_AUTO(bool, nativeText); Q_PROPERTY_AUTO(bool, animationEnabled); +Q_PROPERTY_AUTO(bool, blurBehindWindowEnabled); QML_NAMED_ELEMENT(FluTheme) QML_SINGLETON @@ -42,6 +48,14 @@ private: void refreshColors(); + void updateBackgroundMainColor(); + +protected: + + void timerEvent(QTimerEvent *event) override; + + void updateDesktopImage(); + public: SINGLETON(FluTheme) @@ -55,6 +69,7 @@ SINGLETON(FluTheme) private: bool _systemDark; + QFileSystemWatcher _watcher; }; #endif // FLUTHEME_H diff --git a/src/FluTools.cpp b/src/FluTools.cpp index bed2f651..fbea119c 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -16,6 +16,14 @@ #include #include +#ifdef Q_OS_WIN +#pragma comment (lib, "user32.lib") + +#include +#include + +#endif + FluTools::FluTools(QObject *parent) : QObject{parent} { } @@ -244,3 +252,32 @@ bool FluTools::isWindows10OrGreater() { QRect FluTools::desktopAvailableGeometry(QQuickWindow *window) { return window->screen()->availableGeometry(); } + +QString FluTools::getWallpaperFilePath() { +#if defined(Q_OS_WIN) + wchar_t path[MAX_PATH] = {}; + if (::SystemParametersInfoW(SPI_GETDESKWALLPAPER, MAX_PATH, path, FALSE) == FALSE) { + return {}; + } + return QString::fromWCharArray(path); +#endif + return {}; +} + +QColor FluTools::imageMainColor(const QImage& image, double bright) { + int step = 20; + int t = 0; + int r = 0, g = 0, b = 0; + for (int i = 0; i < image.width(); i += step) { + for (int j = 0; j < image.height(); j += step) { + if (image.valid(i, j)) { + t++; + QColor c = image.pixel(i, j); + r += c.red(); + b += c.blue(); + g += c.green(); + } + } + } + return QColor(int(bright * r / t) > 255 ? 255 : int(bright * r / t), int(bright * g / t) > 255 ? 255 : int(bright * g / t), int(bright * b / t) > 255 ? 255 : int(bright * b / t)); +} diff --git a/src/FluTools.h b/src/FluTools.h index f1b4bb95..2ba82887 100644 --- a/src/FluTools.h +++ b/src/FluTools.h @@ -92,4 +92,8 @@ SINGLETON(FluTools) Q_INVOKABLE bool isWindows10OrGreater(); Q_INVOKABLE QRect desktopAvailableGeometry(QQuickWindow *window); -}; \ No newline at end of file + + Q_INVOKABLE QString getWallpaperFilePath(); + + Q_INVOKABLE QColor imageMainColor(const QImage& image, double bright = 1); +}; diff --git a/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml b/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml index 66d06fb1..58137df7 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml @@ -8,7 +8,7 @@ Item { property real tintOpacity: 0.65 property real luminosity: 0.01 property real noiseOpacity: 0.02 - property alias target: effect_source.sourceItem + property var target property int blurRadius: 32 property rect targetRect: Qt.rect(control.x, control.y, control.width,control.height) ShaderEffectSource { @@ -16,6 +16,7 @@ Item { anchors.fill: parent visible: false sourceRect: control.targetRect + sourceItem: control.target } FastBlur { id: fast_blur @@ -33,7 +34,7 @@ Item { } Image { anchors.fill: parent - source: "../Image/noise.png" + source: "qrc:/qt/qml/FluentUI/Image/noise.png" fillMode: Image.Tile opacity: control.noiseOpacity } diff --git a/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml b/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml index 8badce7a..5b1e932a 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml @@ -76,10 +76,11 @@ FluButton { } contentItem: Item{ clip: true - FluFrame{ + Rectangle{ id:container width: 300 height: 360 + color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) ColumnLayout { anchors.fill: parent spacing: 0 diff --git a/src/Qt5/imports/FluentUI/Controls/FluExpander.qml b/src/Qt5/imports/FluentUI/Controls/FluExpander.qml index d43d9991..b076b3f9 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluExpander.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluExpander.qml @@ -27,7 +27,12 @@ Item { height: 45 radius: 4 border.color: FluTheme.dividerColor - color: FluTheme.dark ? Window.active ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } MouseArea{ id:control_mouse anchors.fill: parent @@ -84,12 +89,18 @@ Item { height: contentHeight+container.anchors.topMargin width: parent.width z:-999 + clip: true Rectangle{ id:container anchors.fill: parent radius: 4 clip: true - color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } border.color: FluTheme.dividerColor anchors.topMargin: -contentHeight states: [ diff --git a/src/Qt5/imports/FluentUI/Controls/FluFrame.qml b/src/Qt5/imports/FluentUI/Controls/FluFrame.qml index 963b2af0..b18609d2 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluFrame.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluFrame.qml @@ -19,6 +19,11 @@ T.Frame { id:d radius: 4 border.color: FluTheme.dividerColor - color: FluTheme.dark ? Window.active ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluGroupBox.qml b/src/Qt5/imports/FluentUI/Controls/FluGroupBox.qml index 443651f1..f602a7b6 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluGroupBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluGroupBox.qml @@ -8,8 +8,13 @@ import FluentUI 1.0 T.GroupBox { id: control property int borderWidth : 1 - property color borderColor : FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) - property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + property color borderColor : FluTheme.dividerColor + property color color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } property int radius: 4 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, contentWidth + leftPadding + rightPadding, diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 4cfd90bb..3be637de 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -109,8 +109,53 @@ Window { } Component{ id:com_background - Rectangle{ - color: window.backgroundColor + Item{ + Rectangle{ + anchors.fill: parent + color: window.backgroundColor + } + Image{ + id:img_back + visible: false + cache: false + Component.onCompleted: { + var geometry = FluTools.desktopAvailableGeometry(window) + width = geometry.width + height = geometry.height + sourceSize = Qt.size(width,height) + source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath) + } + Connections{ + target: FluTheme + function onDesktopImagePathChanged(){ + timer_update_image.restart() + } + function onBlurBehindWindowEnabledChanged(){ + if(FluTheme.blurBehindWindowEnabled){ + img_back.source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath) + }else{ + img_back.source = "" + } + } + } + Timer{ + id:timer_update_image + interval: 500 + onTriggered: { + img_back.source = "" + img_back.source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath) + } + } + } + FluAcrylic{ + anchors.fill: parent + target: img_back + tintOpacity: FluTheme.dark ? 0.80 : 0.75 + blurRadius: 64 + visible: window.active && FluTheme.blurBehindWindowEnabled + tintColor: FluTheme.dark ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1) + targetRect: Qt.rect(window.x,window.y,window.width,window.height) + } } } Component{ diff --git a/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml b/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml index 7a76e91f..9dd417e7 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml @@ -8,7 +8,7 @@ Item { property real tintOpacity: 0.65 property real luminosity: 0.01 property real noiseOpacity: 0.02 - property alias target: effect_source.sourceItem + property var target property int blurRadius: 32 property rect targetRect: Qt.rect(control.x, control.y, control.width,control.height) ShaderEffectSource { @@ -16,6 +16,7 @@ Item { anchors.fill: parent visible: false sourceRect: control.targetRect + sourceItem: control.target } FastBlur { id: fast_blur @@ -33,7 +34,7 @@ Item { } Image { anchors.fill: parent - source: "../Image/noise.png" + source: "qrc:/qt/qml/FluentUI/Image/noise.png" fillMode: Image.Tile opacity: control.noiseOpacity } diff --git a/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml b/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml index ab11b054..444bdd7a 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml @@ -75,10 +75,11 @@ FluButton { } contentItem: Item{ clip: true - FluFrame{ + Rectangle{ id:container width: 300 height: 360 + color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) ColumnLayout { anchors.fill: parent spacing: 0 diff --git a/src/Qt6/imports/FluentUI/Controls/FluExpander.qml b/src/Qt6/imports/FluentUI/Controls/FluExpander.qml index 24018e34..4e6d8d86 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluExpander.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluExpander.qml @@ -27,7 +27,12 @@ Item { height: 45 radius: 4 border.color: FluTheme.dividerColor - color: FluTheme.dark ? Window.active ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } MouseArea{ id:control_mouse anchors.fill: parent @@ -84,12 +89,18 @@ Item { height: contentHeight+container.anchors.topMargin width: parent.width z:-999 + clip: true Rectangle{ id:container anchors.fill: parent radius: 4 clip: true - color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } border.color: FluTheme.dividerColor anchors.topMargin: -contentHeight states: [ diff --git a/src/Qt6/imports/FluentUI/Controls/FluFrame.qml b/src/Qt6/imports/FluentUI/Controls/FluFrame.qml index f830d529..a98edff7 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluFrame.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluFrame.qml @@ -17,6 +17,11 @@ T.Frame { id:d radius: 4 border.color: FluTheme.dividerColor - color: FluTheme.dark ? Window.active ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluGroupBox.qml b/src/Qt6/imports/FluentUI/Controls/FluGroupBox.qml index b93f576e..4ee5e444 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluGroupBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluGroupBox.qml @@ -8,8 +8,13 @@ import FluentUI T.GroupBox { id: control property int borderWidth : 1 - property color borderColor : FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) - property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + property color borderColor : FluTheme.dividerColor + property color color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } property int radius: 4 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, contentWidth + leftPadding + rightPadding, diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index ea046575..4474285a 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -108,8 +108,53 @@ Window { } Component{ id:com_background - Rectangle{ - color: window.backgroundColor + Item{ + Rectangle{ + anchors.fill: parent + color: window.backgroundColor + } + Image{ + id:img_back + visible: false + cache: false + Component.onCompleted: { + var geometry = FluTools.desktopAvailableGeometry(window) + width = geometry.width + height = geometry.height + sourceSize = Qt.size(width,height) + source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath) + } + Connections{ + target: FluTheme + function onDesktopImagePathChanged(){ + timer_update_image.restart() + } + function onBlurBehindWindowEnabledChanged(){ + if(FluTheme.blurBehindWindowEnabled){ + img_back.source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath) + }else{ + img_back.source = "" + } + } + } + Timer{ + id:timer_update_image + interval: 500 + onTriggered: { + img_back.source = "" + img_back.source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath) + } + } + } + FluAcrylic{ + anchors.fill: parent + target: img_back + tintOpacity: FluTheme.dark ? 0.80 : 0.75 + blurRadius: 64 + visible: window.active && FluTheme.blurBehindWindowEnabled + tintColor: FluTheme.dark ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1) + targetRect: Qt.rect(window.x,window.y,window.width,window.height) + } } } Component{ From 44f7948df32e750a890a9375634eca39f033a5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 12 Apr 2024 16:50:49 +0800 Subject: [PATCH 09/29] update --- example/src/singleton.h | 2 +- example/src/stdafx.h | 6 +++--- src/CMakeLists.txt | 6 +----- src/singleton.h | 2 +- src/stdafx.h | 6 +++--- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/example/src/singleton.h b/example/src/singleton.h index 466ce43c..9583c687 100644 --- a/example/src/singleton.h +++ b/example/src/singleton.h @@ -21,4 +21,4 @@ private: \ public: \ static Class* getInstance() { \ return Singleton::getInstance(); \ -} \ +} diff --git a/example/src/stdafx.h b/example/src/stdafx.h index b411a82a..f902bad0 100644 --- a/example/src/stdafx.h +++ b/example/src/stdafx.h @@ -14,7 +14,7 @@ Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) return _##M; \ } \ private: \ - TYPE _##M; \ + TYPE _##M; #define Q_PROPERTY_AUTO(TYPE, M) \ Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ @@ -30,7 +30,7 @@ Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) return _##M; \ } \ private: \ - TYPE _##M; \ + TYPE _##M; #define Q_PROPERTY_READONLY_AUTO(TYPE, M) \ @@ -47,4 +47,4 @@ Q_PROPERTY(TYPE M READ M NOTIFY M##Changed FINAL) return _##M; \ } \ private: \ - TYPE _##M; \ + TYPE _##M; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0ed7b59a..70040b5e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -143,11 +143,7 @@ if (QT_VERSION VERSION_GREATER_EQUAL "6.2") RESOURCE_PREFIX "/qt/qml" ) else () - #加快qrc编译 - set(QRC_FILE Qt5/imports/fluentui.qrc) - qt_add_big_resources(QRC_RESOURCES ${QRC_FILE}) - list(APPEND QRC_RESOURCES ${QRC_FILE}) - set_property(SOURCE ${QRC_FILE} PROPERTY SKIP_AUTORCC ON) + qt_add_resources(QRC_RESOURCES Qt5/imports/fluentui.qrc) #如果是Qt6.2版本以下,则使用add_qmlplugin函数添加资源文件,这是个自定义的函数,详情见.cmake/QmlPlugin.cmake include(QmlPlugin) add_qmlplugin(${PROJECT_NAME} diff --git a/src/singleton.h b/src/singleton.h index 466ce43c..9583c687 100644 --- a/src/singleton.h +++ b/src/singleton.h @@ -21,4 +21,4 @@ private: \ public: \ static Class* getInstance() { \ return Singleton::getInstance(); \ -} \ +} diff --git a/src/stdafx.h b/src/stdafx.h index b411a82a..f902bad0 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -14,7 +14,7 @@ Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) return _##M; \ } \ private: \ - TYPE _##M; \ + TYPE _##M; #define Q_PROPERTY_AUTO(TYPE, M) \ Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ @@ -30,7 +30,7 @@ Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) return _##M; \ } \ private: \ - TYPE _##M; \ + TYPE _##M; #define Q_PROPERTY_READONLY_AUTO(TYPE, M) \ @@ -47,4 +47,4 @@ Q_PROPERTY(TYPE M READ M NOTIFY M##Changed FINAL) return _##M; \ } \ private: \ - TYPE _##M; \ + TYPE _##M; From 481e19c8cc660ff0918fa5e413733b2a94865e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sat, 13 Apr 2024 10:50:27 +0800 Subject: [PATCH 10/29] update --- src/FluTheme.cpp | 2 +- src/FluTools.cpp | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index ff2b760b..6ac16cb3 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -33,7 +33,7 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} { connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path){ Q_EMIT desktopImagePathChanged(); }); - startTimer(500); + startTimer(1000); } void FluTheme::refreshColors() { diff --git a/src/FluTools.cpp b/src/FluTools.cpp index fbea119c..9bdb5174 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -260,11 +260,33 @@ QString FluTools::getWallpaperFilePath() { return {}; } return QString::fromWCharArray(path); -#endif +#elif defined(Q_OS_WIN) + auto type = QSysInfo::productType(); + if (type == "uos") { + QProcess process; + QStringList args; + args << "--session"; + args << "--type=method_call"; + args << "--print-reply"; + args << "--dest=com.deepin.wm"; + args << "/com/deepin/wm"; + args << "com.deepin.wm.GetCurrentWorkspaceBackgroundForMonitor"; + args << QString("string:'%1'").arg(currentTimestamp()); + process.start("dbus-send", args); + process.waitForFinished(); + QByteArray result = process.readAllStandardOutput().trimmed(); + int startIndex = result.indexOf("file:///"); + if (startIndex != -1) { + auto path = result.mid(startIndex + 7, result.length() - startIndex - 8); + return path; + } + } +#else return {}; +#endif } -QColor FluTools::imageMainColor(const QImage& image, double bright) { +QColor FluTools::imageMainColor(const QImage &image, double bright) { int step = 20; int t = 0; int r = 0, g = 0, b = 0; From 9296b186067df903b2797726bfede7cc60d3ba39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sat, 13 Apr 2024 10:51:24 +0800 Subject: [PATCH 11/29] update --- src/FluTools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FluTools.cpp b/src/FluTools.cpp index 9bdb5174..d6a8f680 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -260,7 +260,7 @@ QString FluTools::getWallpaperFilePath() { return {}; } return QString::fromWCharArray(path); -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_LINUX) auto type = QSysInfo::productType(); if (type == "uos") { QProcess process; From e8c47e0fd81152e2ce8a2a9bef2a6e108628b42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sat, 13 Apr 2024 21:30:23 +0800 Subject: [PATCH 12/29] update --- example/qml/page/T_Theme.qml | 2 +- src/FluTheme.cpp | 19 ++++++++++++------- src/FluTheme.h | 2 ++ src/FluTools.cpp | 12 ++++++++++++ 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/example/qml/page/T_Theme.qml b/example/qml/page/T_Theme.qml index 308c1e92..fbd255e6 100644 --- a/example/qml/page/T_Theme.qml +++ b/example/qml/page/T_Theme.qml @@ -13,7 +13,7 @@ FluScrollablePage{ FluFrame{ Layout.fillWidth: true - Layout.preferredHeight: 400 + Layout.preferredHeight: 420 padding: 10 ColumnLayout{ diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 6ac16cb3..d28b7e90 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "Def.h" #include "FluentIconDef.h" #include "FluColors.h" @@ -91,14 +92,18 @@ bool FluTheme::dark() const { } void FluTheme::updateDesktopImage(){ - auto path = FluTools::getInstance()->getWallpaperFilePath(); - if(_desktopImagePath != path){ - if(!_desktopImagePath.isEmpty()){ - _watcher.removePath(_desktopImagePath); + QThreadPool::globalInstance()->start([=]() { + _mutex.lock(); + auto path = FluTools::getInstance()->getWallpaperFilePath(); + if(_desktopImagePath != path){ + if(!_desktopImagePath.isEmpty()){ + _watcher.removePath(_desktopImagePath); + } + desktopImagePath(path); + _watcher.addPath(path); } - desktopImagePath(path); - _watcher.addPath(path); - } + _mutex.unlock(); + }); } void FluTheme::timerEvent(QTimerEvent *event) diff --git a/src/FluTheme.h b/src/FluTheme.h index 2d95a39b..a0f98814 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "FluAccentColor.h" #include "stdafx.h" #include "singleton.h" @@ -70,6 +71,7 @@ SINGLETON(FluTheme) private: bool _systemDark; QFileSystemWatcher _watcher; + QMutex _mutex; }; #endif // FLUTHEME_H diff --git a/src/FluTools.cpp b/src/FluTools.cpp index d6a8f680..bae664c3 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -281,6 +281,18 @@ QString FluTools::getWallpaperFilePath() { return path; } } +#elif defined(Q_OS_MACOS) + QProcess process; + QStringList args; + args << "-e"; + args << R"(tell application "Finder" to get POSIX path of (desktop picture as alias))"; + process.start("osascript", args); + process.waitForFinished(); + QByteArray result = process.readAllStandardOutput().trimmed(); + if(result.isEmpty()){ + return "/System/Library/CoreServices/DefaultDesktop.heic"; + } + return result; #else return {}; #endif From 2c4cf82f63526148ad793b6369ee83cb59bf8924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sat, 13 Apr 2024 22:00:15 +0800 Subject: [PATCH 13/29] update --- example/qml/page/T_Theme.qml | 2 +- src/FluTheme.cpp | 10 ++++++---- src/FluTheme.h | 2 +- src/Qt5/imports/FluentUI/Controls/FluWindow.qml | 2 ++ src/Qt6/imports/FluentUI/Controls/FluWindow.qml | 2 ++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/example/qml/page/T_Theme.qml b/example/qml/page/T_Theme.qml index fbd255e6..c1e5f280 100644 --- a/example/qml/page/T_Theme.qml +++ b/example/qml/page/T_Theme.qml @@ -13,7 +13,7 @@ FluScrollablePage{ FluFrame{ Layout.fillWidth: true - Layout.preferredHeight: 420 + Layout.preferredHeight: 408 padding: 10 ColumnLayout{ diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index d28b7e90..84e13c57 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -25,7 +25,7 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} { _blurBehindWindowEnabled = false; QGuiApplication::instance()->installEventFilter(this); refreshColors(); - updateDesktopImage(); + checkUpdateDesktopImage(); connect(this, &FluTheme::darkModeChanged, this, [=] { Q_EMIT darkChanged(); }); @@ -49,7 +49,7 @@ void FluTheme::refreshColors() { fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255)); itemNormalColor(isDark ? QColor(255, 255, 255, 0) : QColor(0, 0, 0, 0)); frameColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); - frameActiveColor(isDark ? QColor(32, 32, 32, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.6))); + frameActiveColor(isDark ? QColor(48, 48, 48, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.6))); itemHoverColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.06)) : QColor(0, 0, 0, qRound(255 * 0.03))); itemPressColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.09)) : QColor(0, 0, 0, qRound(255 * 0.06))); itemCheckColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); @@ -91,7 +91,7 @@ bool FluTheme::dark() const { } } -void FluTheme::updateDesktopImage(){ +void FluTheme::checkUpdateDesktopImage(){ QThreadPool::globalInstance()->start([=]() { _mutex.lock(); auto path = FluTools::getInstance()->getWallpaperFilePath(); @@ -108,5 +108,7 @@ void FluTheme::updateDesktopImage(){ void FluTheme::timerEvent(QTimerEvent *event) { - updateDesktopImage(); + if(_blurBehindWindowEnabled){ + checkUpdateDesktopImage(); + } } diff --git a/src/FluTheme.h b/src/FluTheme.h index a0f98814..2c6fb1a5 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -55,7 +55,7 @@ protected: void timerEvent(QTimerEvent *event) override; - void updateDesktopImage(); + void checkUpdateDesktopImage(); public: SINGLETON(FluTheme) diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 3be637de..a56fec54 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -118,6 +118,8 @@ Window { id:img_back visible: false cache: false + fillMode: Image.PreserveAspectCrop + asynchronous: true Component.onCompleted: { var geometry = FluTools.desktopAvailableGeometry(window) width = geometry.width diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 4474285a..a9b6cc2a 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -117,6 +117,8 @@ Window { id:img_back visible: false cache: false + fillMode: Image.PreserveAspectCrop + asynchronous: true Component.onCompleted: { var geometry = FluTools.desktopAvailableGeometry(window) width = geometry.width From f701f9775659ed43b96338cbcc82186c8c06b37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 14 Apr 2024 11:43:32 +0800 Subject: [PATCH 14/29] update --- src/FluFrameless.cpp | 12 ++++++------ src/FluTheme.cpp | 1 - src/Qt5/imports/FluentUI/Controls/FluAppBar.qml | 4 ++-- src/Qt6/imports/FluentUI/Controls/FluAppBar.qml | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 7448f8ea..0e445c26 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -164,15 +164,15 @@ void FluFrameless::componentComplete() { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) if (!isMaximum) { clientRect->top = originalTop + offsetSize; - clientRect->bottom = originalBottom - offsetSize; - clientRect->left = originalLeft + offsetSize; - clientRect->right = originalRight - offsetSize; + clientRect->bottom = originalBottom; + clientRect->left = originalLeft; + clientRect->right = originalRight; } #else clientRect->top = originalTop + offsetSize; - clientRect->bottom = originalBottom - offsetSize; - clientRect->left = originalLeft + offsetSize; - clientRect->right = originalRight - offsetSize; + clientRect->bottom = originalBottom; + clientRect->left = originalLeft; + clientRect->right = originalRight; #endif _setMaximizeHovered(false); *result = WVR_REDRAW; diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 84e13c57..1662aa7e 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -25,7 +25,6 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} { _blurBehindWindowEnabled = false; QGuiApplication::instance()->installEventFilter(this); refreshColors(); - checkUpdateDesktopImage(); connect(this, &FluTheme::darkModeChanged, this, [=] { Q_EMIT darkChanged(); }); diff --git a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml index 73e9b444..74e7fc20 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml @@ -14,7 +14,7 @@ Rectangle{ property string closeText : qsTr("Close") property string stayTopText : qsTr("Sticky on Top") property string stayTopCancelText : qsTr("Sticky on Top cancelled") - property color textColor: FluTheme.dark ? "#FFFFFF" : "#000000" + property color textColor: FluTheme.fontPrimaryColor property color minimizeNormalColor: FluTheme.itemNormalColor property color minimizeHoverColor: FluTheme.itemHoverColor property color minimizePressColor: FluTheme.itemPressColor @@ -22,7 +22,7 @@ Rectangle{ property color maximizeHoverColor: FluTheme.itemHoverColor property color maximizePressColor: FluTheme.itemPressColor property color closeNormalColor: Qt.rgba(0,0,0,0) - property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1) + property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1) property color closePressColor: Qt.rgba(251/255,115/255,115/255,0.8) property bool showDark: false property bool showClose: true diff --git a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml index 1724cc5f..8e4b6f13 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml @@ -14,7 +14,7 @@ Rectangle{ property string closeText : qsTr("Close") property string stayTopText : qsTr("Sticky on Top") property string stayTopCancelText : qsTr("Sticky on Top cancelled") - property color textColor: FluTheme.dark ? "#FFFFFF" : "#000000" + property color textColor: FluTheme.fontPrimaryColor property color minimizeNormalColor: FluTheme.itemNormalColor property color minimizeHoverColor: FluTheme.itemHoverColor property color minimizePressColor: FluTheme.itemPressColor @@ -22,7 +22,7 @@ Rectangle{ property color maximizeHoverColor: FluTheme.itemHoverColor property color maximizePressColor: FluTheme.itemPressColor property color closeNormalColor: Qt.rgba(0,0,0,0) - property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1) + property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1) property color closePressColor: Qt.rgba(251/255,115/255,115/255,0.8) property bool showDark: false property bool showClose: true From 295dcf02c41bcb3020eed1c6bf6f521ca5c4557a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 14 Apr 2024 23:09:41 +0800 Subject: [PATCH 15/29] update --- example/example_en_US.ts | 16 ++-- example/example_zh_CN.ts | 8 +- example/qml/page/T_TreeView.qml | 80 ++++--------------- src/FluFrameless.cpp | 7 -- .../imports/FluentUI/Controls/FluTreeView.qml | 4 +- .../imports/FluentUI/Controls/FluTreeView.qml | 4 +- 6 files changed, 31 insertions(+), 88 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index e49fa5ec..f67acf47 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -2394,25 +2394,25 @@ Some contents... - + Title - + + Name + + + + Avatar - + Address - - - Name - - T_Typography diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 5f4c183e..568ee1fe 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -2504,22 +2504,22 @@ Some contents... 共计选中%1条数据 - + Title 标题 - + Address 地址 - + Avatar 头像 - + Name 名称 diff --git a/example/qml/page/T_TreeView.qml b/example/qml/page/T_TreeView.qml index c1ead5f5..c98f68b2 100644 --- a/example/qml/page/T_TreeView.qml +++ b/example/qml/page/T_TreeView.qml @@ -10,7 +10,6 @@ FluContentPage { title: qsTr("TreeView") - function treeData(){ const names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"] function getRandomName(){ @@ -48,67 +47,6 @@ FluContentPage { return dig(); } - // Row{ - // id: layout_column - // spacing: 12 - // width: 340 - // anchors{ - // top:parent.top - // left: parent.left - // leftMargin: 10 - // bottom:parent.bottom - // bottomMargin: 20 - // } - // RowLayout{ - // spacing: 10 - // FluText{ - // text: "cellHeight:" - // Layout.alignment: Qt.AlignVCenter - // } - // FluSlider{ - // id: slider_cell_height - // value: 30 - // from: 30 - // to:100 - // } - // } - // RowLayout{ - // spacing: 10 - // FluText{ - // text: "depthPadding:" - // Layout.alignment: Qt.AlignVCenter - // } - // FluSlider{ - // id: slider_depth_padding - // value: 15 - // from: 15 - // to:100 - // } - // } - // FluToggleSwitch{ - // id: switch_showline - // text:"showLine" - // checked: false - // } - // FluToggleSwitch{ - // id: switch_checkable - // text:"checkable" - // checked: false - // } - // FluButton{ - // text: "all expand" - // onClicked: { - // tree_view.allExpand() - // } - // } - // FluButton{ - // text: "all collapse" - // onClicked: { - // tree_view.allCollapse() - // } - // } - // } - Component{ id:com_avatar Item{ @@ -206,7 +144,20 @@ FluContentPage { } } } - + FluButton{ + text: "print selection model" + onClicked: { + var printData = [] + var data = tree_view.selectionModel + for(var i = 0; i <= data.length-1 ; i++){ + const newObj = Object.assign({}, data[i].data); + delete newObj["__parent"]; + delete newObj["children"]; + printData.push(newObj) + } + console.debug(JSON.stringify(printData)) + } + } } } @@ -225,6 +176,9 @@ FluContentPage { showLine: switch_showline.checked checkable:switch_checkable.checked depthPadding: slider_depth_padding.value + onCurrentChanged: { + showInfo(current.data.title) + } columnSource:[ { title: qsTr("Title"), diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 0e445c26..0dd19e39 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -161,19 +161,12 @@ void FluFrameless::componentComplete() { if (!isCompositionEnabled()) { offsetSize = 0; } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) if (!isMaximum) { clientRect->top = originalTop + offsetSize; clientRect->bottom = originalBottom; clientRect->left = originalLeft; clientRect->right = originalRight; } -#else - clientRect->top = originalTop + offsetSize; - clientRect->bottom = originalBottom; - clientRect->left = originalLeft; - clientRect->right = originalRight; -#endif _setMaximizeHovered(false); *result = WVR_REDRAW; return true; diff --git a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml index 6fb81008..765d3793 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml @@ -12,6 +12,7 @@ Rectangle { property int cellHeight: 30 property int depthPadding: 15 property bool checkable: false + property alias selectionModel: tree_model.selectionModel property color lineColor: FluTheme.dividerColor property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) property color selectedBorderColor: FluTheme.primaryColor @@ -710,9 +711,6 @@ Rectangle { } } } - function selectionModel(){ - return tree_model.selectionModel - } function count(){ return tree_model.dataSourceSize } diff --git a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml index d698deea..c504b25e 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml @@ -12,6 +12,7 @@ Rectangle { property int cellHeight: 30 property int depthPadding: 15 property bool checkable: false + property alias selectionModel: tree_model.selectionModel property color lineColor: FluTheme.dividerColor property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) property color selectedBorderColor: FluTheme.primaryColor @@ -710,9 +711,6 @@ Rectangle { } } } - function selectionModel(){ - return tree_model.selectionModel - } function count(){ return tree_model.dataSourceSize } From 17bfff23464efad94a712a603842709bc78073c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 14 Apr 2024 23:58:15 +0800 Subject: [PATCH 16/29] update --- example/example_en_US.ts | 8 ++++---- example/example_zh_CN.ts | 8 ++++---- example/qml/page/T_TreeView.qml | 5 +++-- src/FluTreeModel.cpp | 20 ++++++++++--------- src/FluTreeModel.h | 3 ++- .../imports/FluentUI/Controls/FluTreeView.qml | 4 +++- .../imports/FluentUI/Controls/FluTreeView.qml | 4 +++- 7 files changed, 30 insertions(+), 22 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index f67acf47..72fff7c3 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -2394,22 +2394,22 @@ Some contents... - + Title - + Name - + Avatar - + Address diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 568ee1fe..8ec55285 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -2504,22 +2504,22 @@ Some contents... 共计选中%1条数据 - + Title 标题 - + Address 地址 - + Avatar 头像 - + Name 名称 diff --git a/example/qml/page/T_TreeView.qml b/example/qml/page/T_TreeView.qml index c98f68b2..a42010f1 100644 --- a/example/qml/page/T_TreeView.qml +++ b/example/qml/page/T_TreeView.qml @@ -28,7 +28,7 @@ FluContentPage { } const dig = (path = '0', level = 5) => { const list = []; - for (let i = 0; i < 5; i += 1) { + for (let i = 0; i < 4; i += 1) { const key = `${path}-${i}`; const treeNode = { title: key, @@ -148,7 +148,8 @@ FluContentPage { text: "print selection model" onClicked: { var printData = [] - var data = tree_view.selectionModel + var data = tree_view.selectionModel(); + console.debug(data.length) for(var i = 0; i <= data.length-1 ; i++){ const newObj = Object.assign({}, data[i].data); delete newObj["__parent"]; diff --git a/src/FluTreeModel.cpp b/src/FluTreeModel.cpp index aada5733..020e8af8 100644 --- a/src/FluTreeModel.cpp +++ b/src/FluTreeModel.cpp @@ -113,15 +113,7 @@ void FluTreeModel::checkRow(int row, bool checked) { itemData->_checked = checked; } Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0)); - QList data; - foreach (auto item, _dataSource) { - if (!item->hasChildren()) { - if (item->_checked) { - data.append(item); - } - } - } - selectionModel(data); + } void FluTreeModel::setDataSource(QList> data) { @@ -272,3 +264,13 @@ void FluTreeModel::allCollapse() { _rows = _root->_children; endResetModel(); } + +QVariant FluTreeModel::selectionModel(){ + QList data; + foreach (auto item, _dataSource) { + if (item->checked()) { + data.append(item); + } + } + return QVariant::fromValue(data); +} diff --git a/src/FluTreeModel.h b/src/FluTreeModel.h index 07eb6ed6..d8eda4f5 100644 --- a/src/FluTreeModel.h +++ b/src/FluTreeModel.h @@ -89,7 +89,6 @@ public: class FluTreeModel : public QAbstractItemModel { Q_OBJECT Q_PROPERTY_AUTO(int, dataSourceSize) -Q_PROPERTY_AUTO(QList, selectionModel) Q_PROPERTY_AUTO(QList, columnSource) QML_NAMED_ELEMENT(FluTreeModel) QML_ADDED_IN_MINOR_VERSION(1) @@ -141,6 +140,8 @@ public: Q_INVOKABLE void allCollapse(); + Q_INVOKABLE QVariant selectionModel(); + private: QList _rows; QList _dataSource; diff --git a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml index 765d3793..c74872a9 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml @@ -12,7 +12,6 @@ Rectangle { property int cellHeight: 30 property int depthPadding: 15 property bool checkable: false - property alias selectionModel: tree_model.selectionModel property color lineColor: FluTheme.dividerColor property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) property color selectedBorderColor: FluTheme.primaryColor @@ -739,4 +738,7 @@ Rectangle { d.editPosition = undefined d.editDelegate = undefined } + function selectionModel(){ + return tree_model.selectionModel() + } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml index c504b25e..47fbb0a1 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml @@ -12,7 +12,6 @@ Rectangle { property int cellHeight: 30 property int depthPadding: 15 property bool checkable: false - property alias selectionModel: tree_model.selectionModel property color lineColor: FluTheme.dividerColor property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) property color selectedBorderColor: FluTheme.primaryColor @@ -739,4 +738,7 @@ Rectangle { d.editPosition = undefined d.editDelegate = undefined } + function selectionModel(){ + return tree_model.selectionModel() + } } From ecd13a9cca59c18096b938a0731fb95fb3519d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Mon, 15 Apr 2024 00:11:41 +0800 Subject: [PATCH 17/29] update --- src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml | 3 ++- src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml b/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml index 5b1e932a..8d31b79c 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml @@ -80,6 +80,7 @@ FluButton { id:container width: 300 height: 360 + radius: 4 color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) ColumnLayout { anchors.fill: parent @@ -613,7 +614,7 @@ FluButton { } background: Item{ FluShadow{ - radius: 5 + radius: 4 } } function showPopup() { diff --git a/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml b/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml index 444bdd7a..496021db 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml @@ -79,6 +79,7 @@ FluButton { id:container width: 300 height: 360 + radius: 4 color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) ColumnLayout { anchors.fill: parent @@ -612,7 +613,7 @@ FluButton { } background: Item{ FluShadow{ - radius: 5 + radius: 4 } } function showPopup() { From c9c737f2fcd9a134f0693aa6dbf890bde3d9ad35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 16 Apr 2024 12:36:41 +0800 Subject: [PATCH 18/29] update --- src/FluFrameless.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 0dd19e39..95687548 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -161,11 +161,11 @@ void FluFrameless::componentComplete() { if (!isCompositionEnabled()) { offsetSize = 0; } - if (!isMaximum) { + if (!isMaximum || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) { clientRect->top = originalTop + offsetSize; - clientRect->bottom = originalBottom; - clientRect->left = originalLeft; - clientRect->right = originalRight; + clientRect->bottom = originalBottom - offsetSize; + clientRect->left = originalLeft + offsetSize; + clientRect->right = originalRight - offsetSize; } _setMaximizeHovered(false); *result = WVR_REDRAW; @@ -243,6 +243,12 @@ void FluFrameless::componentComplete() { return true; } else if (uMsg == WM_GETMINMAXINFO) { auto *minmaxInfo = reinterpret_cast(lParam); +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + minmaxInfo->ptMaxPosition.x = 0; + minmaxInfo->ptMaxPosition.y = 0; + minmaxInfo->ptMaxSize.x = 0; + minmaxInfo->ptMaxSize.y = 0; +#else auto pixelRatio = window()->devicePixelRatio(); auto geometry = window()->screen()->availableGeometry(); RECT rect; @@ -251,6 +257,7 @@ void FluFrameless::componentComplete() { minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x(); minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2; minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio) + offsetXY.y() * 2; +#endif return false; } else if (uMsg == WM_NCRBUTTONDOWN) { if (wParam == HTCAPTION) { From 1a0f2afee0b47cbe406e47fc40dfaa0371b93a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Wed, 17 Apr 2024 15:11:14 +0800 Subject: [PATCH 19/29] update --- example/example_en_US.ts | 58 +++++++++++++++---------------- example/example_zh_CN.ts | 58 +++++++++++++++---------------- example/qml/page/T_Home.qml | 4 --- example/qml/window/MainWindow.qml | 6 +++- src/FluFrameless.cpp | 8 +++++ src/FluFrameless.h | 1 + 6 files changed, 72 insertions(+), 63 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 72fff7c3..3301be2d 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -551,104 +551,104 @@ MainWindow - - + + Quit - + Are you sure you want to exit the program? - + Minimize - + Friendly Reminder - + FluentUI is hidden from the tray, click on the tray to activate the window again - - + + Cancel - + Open in Separate Window - + Click Time - + Search - + Finish - + Next - + Previous - + Dark Mode - + Here you can switch to night mode. - + Hide Easter eggs - + Try a few more clicks!! - + Upgrade Tips - + FluentUI is currently up to date - + -- The current app version - + Now go and download the new version? @@ -657,17 +657,17 @@ Updated content: - + OK - + The current version is already the latest - + The network is abnormal @@ -1343,22 +1343,22 @@ My only desire is to be permitted to drive out the traitors and restore the Han. T_Home - + FluentUI GitHub - + The latest FluentUI controls and styles for your applications. - + FluentUI Initializr - + FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options. diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 8ec55285..a1871548 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -551,104 +551,104 @@ MainWindow - + Dark Mode 夜间模式 - - + + Quit 退出 - + Are you sure you want to exit the program? 您确定要退出程序吗 - + Minimize 最小化 - + Friendly Reminder 友情提示 - + FluentUI is hidden from the tray, click on the tray to activate the window again FluentUI 在托盘中处于隐藏状态,单击托盘以再次激活窗口 - - + + Cancel 取消 - + Open in Separate Window 在独立窗口中打开 - + Click Time 点击次数 - + Search 搜索 - + Finish 完成 - + Next 下一步 - + Previous 上一步 - + Here you can switch to night mode. 在这里,您可以切换到夜间模式。 - + Hide Easter eggs 隐藏彩蛋 - + Try a few more clicks!! 再试几下!! - + Upgrade Tips 升级提示 - + FluentUI is currently up to date FluentUI 目前最新版本 - + -- The current app version -- 当前应用版本 - + Now go and download the new version? @@ -661,17 +661,17 @@ Updated content: - + OK 确定 - + The current version is already the latest 当前版本已经是最新版本 - + The network is abnormal 网络异常 @@ -1393,22 +1393,22 @@ My only desire is to be permitted to drive out the traitors and restore the Han. T_Home - + FluentUI GitHub FluentUI GitHub - + The latest FluentUI controls and styles for your applications. 最新的 FluentUI 控件和样式 - + FluentUI Initializr FluentUI脚手架 - + FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options. FluentUI 脚手架是一个快速创建项目工具,可帮助您创建和自定义具有各种选项的 Fluent UI 项目 diff --git a/example/qml/page/T_Home.qml b/example/qml/page/T_Home.qml index f291e8e7..596bb55c 100644 --- a/example/qml/page/T_Home.qml +++ b/example/qml/page/T_Home.qml @@ -12,10 +12,6 @@ FluScrollablePage{ animationEnabled: false header: Item{} - FluentInitializrWindow{ - id:fluent_Initializr - } - ListModel{ id: model_header ListElement{ diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 0e393dc8..4fff0309 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -15,7 +15,7 @@ FluWindow { title: "FluentUI" width: 1000 height: 680 - minimumWidth: 520 + minimumWidth: 1000 minimumHeight: 200 launchMode: FluWindowType.SingleTask fitsAppBarWindows: true @@ -28,6 +28,10 @@ FluWindow { z:7 } + FluentInitializrWindow{ + id:fluent_Initializr + } + FluEvent{ name: "checkUpdate" onTriggered: { diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 95687548..753ce22a 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -67,6 +67,8 @@ void FluFrameless::componentComplete() { if (_disabled) { return; } + int w = window()->width(); + int h = window()->height(); _current = window()->winId(); window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) @@ -107,6 +109,12 @@ void FluFrameless::componentComplete() { ::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); }); #endif + h = h + _appbar->height(); + if(_fixSize){ + window()->setMaximumSize(QSize(w,h)); + window()->setMinimumSize(QSize(w,h)); + } + window()->resize(QSize(w,h)); connect(this, &FluFrameless::topmostChanged, this, [this] { _setWindowTopmost(topmost()); }); diff --git a/src/FluFrameless.h b/src/FluFrameless.h index 3917d131..6ccf79fb 100644 --- a/src/FluFrameless.h +++ b/src/FluFrameless.h @@ -3,6 +3,7 @@ #include #include #include +#include #include "stdafx.h" #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) From a443f3a9baa9df047c29cbde2e2a81b9da9bf9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Wed, 17 Apr 2024 21:39:55 +0800 Subject: [PATCH 20/29] update --- .github/workflows/windows-mingw.yml | 4 +- .github/workflows/windows-qt5.yml | 4 +- .github/workflows/windows.yml | 4 +- .gitignore | 4 +- example/CMakeLists.txt | 2 +- example/example_en_US.ts | 8 +- example/example_zh_CN.ts | 8 +- example/qml/page/T_Icons.qml | 2 +- example/qml/page/T_TreeView.qml | 65 ++++++++------- src/FluApp.cpp | 17 ++++ src/FluApp.h | 5 +- src/FluTextStyle.h | 2 +- src/FluTheme.cpp | 20 +---- src/FluTheme.h | 2 - .../imports/FluentUI/Controls/FluAcrylic.qml | 3 +- src/Qt5/imports/FluentUI/Controls/FluMenu.qml | 4 +- .../FluentUI/Controls/FluTableView.qml | 8 +- .../imports/FluentUI/Controls/FluTreeView.qml | 29 ++++--- src/Qt5/imports/FluentUI/plugins.qmltypes | 79 +++++++++++++------ src/Qt6/imports/FluentUI/Controls/FluMenu.qml | 4 +- .../FluentUI/Controls/FluTableView.qml | 7 +- .../imports/FluentUI/Controls/FluTreeView.qml | 7 +- 22 files changed, 169 insertions(+), 119 deletions(-) diff --git a/.github/workflows/windows-mingw.yml b/.github/workflows/windows-mingw.yml index cd67f8b7..82b8f395 100644 --- a/.github/workflows/windows-mingw.yml +++ b/.github/workflows/windows-mingw.yml @@ -91,14 +91,14 @@ jobs: if: startsWith(github.event.ref, 'refs/tags/') uses: zhuzichu520/inno-setup-action@v1.0.1 with: - filepath: ./action-cli/InstallerScript.iss + filepath: ./package/InstallerScript.iss - name: uploadRelease if: startsWith(github.event.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./action-cli/installer.exe + file: ./package/installer.exe asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.qt_arch }}_Qt${{ matrix.qt_ver }}.exe tag: ${{ github.ref }} overwrite: true diff --git a/.github/workflows/windows-qt5.yml b/.github/workflows/windows-qt5.yml index 3d9bca90..b5006776 100644 --- a/.github/workflows/windows-qt5.yml +++ b/.github/workflows/windows-qt5.yml @@ -78,14 +78,14 @@ jobs: if: startsWith(github.event.ref, 'refs/tags/') uses: zhuzichu520/inno-setup-action@v1.0.1 with: - filepath: ./action-cli/InstallerScript.iss + filepath: ./package/InstallerScript.iss - name: uploadRelease if: startsWith(github.event.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./action-cli/installer.exe + file: ./package/installer.exe asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.qt_arch }}_Qt${{ matrix.qt_ver }}.exe tag: ${{ github.ref }} overwrite: true diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c4d2339f..8bbdf0d6 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -85,14 +85,14 @@ jobs: if: startsWith(github.event.ref, 'refs/tags/') uses: zhuzichu520/inno-setup-action@v1.0.1 with: - filepath: ./action-cli/InstallerScript.iss + filepath: ./package/InstallerScript.iss - name: uploadRelease if: startsWith(github.event.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./action-cli/installer.exe + file: ./package/installer.exe asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.qt_arch }}_Qt${{ matrix.qt_ver }}.exe tag: ${{ github.ref }} overwrite: true diff --git a/.gitignore b/.gitignore index 628dcf16..ebfb74a5 100644 --- a/.gitignore +++ b/.gitignore @@ -36,10 +36,8 @@ bin build cmake-build-* .idea - +package example/Version.h - -action-cli dist *.qm \ No newline at end of file diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 0fc53fe1..149f0065 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -69,7 +69,7 @@ if (WIN32) ) configure_file( ${CMAKE_SOURCE_DIR}/.cmake/InstallerScript.iss.in - ${CMAKE_SOURCE_DIR}/action-cli/InstallerScript.iss + ${CMAKE_SOURCE_DIR}/package/InstallerScript.iss ) endif () diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 3301be2d..a47dc335 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -2394,22 +2394,22 @@ Some contents... - + Title - + Name - + Avatar - + Address diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index a1871548..dd7776bd 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -2504,22 +2504,22 @@ Some contents... 共计选中%1条数据 - + Title 标题 - + Address 地址 - + Avatar 头像 - + Name 名称 diff --git a/example/qml/page/T_Icons.qml b/example/qml/page/T_Icons.qml index 7e48bcd5..43d80442 100644 --- a/example/qml/page/T_Icons.qml +++ b/example/qml/page/T_Icons.qml @@ -33,7 +33,7 @@ FluContentPage { cellHeight: 110 clip: true boundsBehavior: GridView.StopAtBounds - model:FluTheme.awesomeList() + model: FluApp.iconDatas() ScrollBar.vertical: FluScrollBar {} anchors{ topMargin: 10 diff --git a/example/qml/page/T_TreeView.qml b/example/qml/page/T_TreeView.qml index a42010f1..928677de 100644 --- a/example/qml/page/T_TreeView.qml +++ b/example/qml/page/T_TreeView.qml @@ -162,7 +162,8 @@ FluContentPage { } } - FluFrame{ + FluTreeView{ + id:tree_view anchors{ left: parent.left top: layout_controls.bottom @@ -170,39 +171,35 @@ FluContentPage { bottom: parent.bottom right: parent.right } - FluTreeView{ - id:tree_view - anchors.fill: parent - cellHeight: slider_cell_height.value - showLine: switch_showline.checked - checkable:switch_checkable.checked - depthPadding: slider_depth_padding.value - onCurrentChanged: { - showInfo(current.data.title) - } - columnSource:[ - { - title: qsTr("Title"), - dataIndex: 'title', - width: 300 - },{ - title: qsTr("Name"), - dataIndex: 'name', - width: 100 - },{ - title: qsTr("Avatar"), - dataIndex: 'avatar', - width: 100 - },{ - title: qsTr("Address"), - dataIndex: 'address', - width: 200 - }, - ] - Component.onCompleted: { - var data = treeData() - dataSource = data - } + cellHeight: slider_cell_height.value + showLine: switch_showline.checked + checkable:switch_checkable.checked + depthPadding: slider_depth_padding.value + onCurrentChanged: { + showInfo(current.data.title) + } + columnSource:[ + { + title: qsTr("Title"), + dataIndex: 'title', + width: 300 + },{ + title: qsTr("Name"), + dataIndex: 'name', + width: 100 + },{ + title: qsTr("Avatar"), + dataIndex: 'avatar', + width: 100 + },{ + title: qsTr("Address"), + dataIndex: 'address', + width: 200 + }, + ] + Component.onCompleted: { + var data = treeData() + dataSource = data } } } diff --git a/src/FluApp.cpp b/src/FluApp.cpp index f2c3c3b4..36bfd3fa 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "FluentIconDef.h" FluApp::FluApp(QObject *parent) : QObject{parent} { _useSystemAppBar = false; @@ -30,3 +31,19 @@ void FluApp::init(QObject *target, QLocale locale) { } } } + +[[maybe_unused]] QJsonArray FluApp::iconDatas(const QString &keyword) { + QJsonArray arr; + QMetaEnum enumType = Fluent_Icons::staticMetaObject.enumerator(Fluent_Icons::staticMetaObject.indexOfEnumerator("Fluent_IconType")); + for (int i = 0; i <= enumType.keyCount() - 1; ++i) { + QString name = enumType.key(i); + int icon = enumType.value(i); + if (keyword.isEmpty() || name.contains(keyword)) { + QJsonObject obj; + obj.insert("name", name); + obj.insert("icon", icon); + arr.append(obj); + } + } + return arr; +} diff --git a/src/FluApp.h b/src/FluApp.h index c291dbfc..89934208 100644 --- a/src/FluApp.h +++ b/src/FluApp.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "stdafx.h" #include "singleton.h" @@ -35,7 +36,9 @@ SINGLETON(FluApp) Q_INVOKABLE void init(QObject *target, QLocale locale = QLocale::system()); + [[maybe_unused]] Q_INVOKABLE static QJsonArray iconDatas(const QString &keyword = ""); + private: QQmlEngine *_engine{}; QTranslator *_translator = nullptr; -}; \ No newline at end of file +}; diff --git a/src/FluTextStyle.h b/src/FluTextStyle.h index defa9d1e..8143ce1e 100644 --- a/src/FluTextStyle.h +++ b/src/FluTextStyle.h @@ -30,4 +30,4 @@ public: SINGLETON(FluTextStyle) static FluTextStyle *create(QQmlEngine *, QJSEngine *) { return getInstance(); } -}; \ No newline at end of file +}; diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 1662aa7e..e0efe346 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -47,8 +47,8 @@ void FluTheme::refreshColors() { fontSecondaryColor(isDark ? QColor(222, 222, 222, 255) : QColor(102, 102, 102, 255)); fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255)); itemNormalColor(isDark ? QColor(255, 255, 255, 0) : QColor(0, 0, 0, 0)); - frameColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); - frameActiveColor(isDark ? QColor(48, 48, 48, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.6))); + frameColor(isDark ? QColor(56, 56, 56, qRound(255 * 0.8)) : QColor(233, 233, 233, qRound(255 * 0.8))); + frameActiveColor(isDark ? QColor(48, 48, 48, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.8))); itemHoverColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.06)) : QColor(0, 0, 0, qRound(255 * 0.03))); itemPressColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.09)) : QColor(0, 0, 0, qRound(255 * 0.06))); itemCheckColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); @@ -64,22 +64,6 @@ bool FluTheme::eventFilter(QObject *, QEvent *event) { return false; } -[[maybe_unused]] QJsonArray FluTheme::awesomeList(const QString &keyword) { - QJsonArray arr; - QMetaEnum enumType = Fluent_Icons::staticMetaObject.enumerator(Fluent_Icons::staticMetaObject.indexOfEnumerator("Fluent_IconType")); - for (int i = 0; i <= enumType.keyCount() - 1; ++i) { - QString name = enumType.key(i); - int icon = enumType.value(i); - if (keyword.isEmpty() || name.contains(keyword)) { - QJsonObject obj; - obj.insert("name", name); - obj.insert("icon", icon); - arr.append(obj); - } - } - return arr; -} - bool FluTheme::dark() const { if (_darkMode == FluThemeType::DarkMode::Dark) { return true; diff --git a/src/FluTheme.h b/src/FluTheme.h index 2c6fb1a5..b26cdb6c 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -60,8 +60,6 @@ protected: public: SINGLETON(FluTheme) - [[maybe_unused]] Q_INVOKABLE static QJsonArray awesomeList(const QString &keyword = ""); - Q_SIGNAL void darkChanged(); static FluTheme *create(QQmlEngine *, QJSEngine *) { return getInstance(); } diff --git a/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml b/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml index 58137df7..a432c32c 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml @@ -8,7 +8,7 @@ Item { property real tintOpacity: 0.65 property real luminosity: 0.01 property real noiseOpacity: 0.02 - property var target + property alias target : effect_source.sourceItem property int blurRadius: 32 property rect targetRect: Qt.rect(control.x, control.y, control.width,control.height) ShaderEffectSource { @@ -16,7 +16,6 @@ Item { anchors.fill: parent visible: false sourceRect: control.targetRect - sourceItem: control.target } FastBlur { id: fast_blur diff --git a/src/Qt5/imports/FluentUI/Controls/FluMenu.qml b/src/Qt5/imports/FluentUI/Controls/FluMenu.qml index 332bce1c..c0c7cf1b 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluMenu.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluMenu.qml @@ -44,8 +44,8 @@ T.Menu { background: Rectangle { implicitWidth: 150 implicitHeight: 36 - color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(240/255,240/255,240/255,1) - border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) + color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(252/255,252/255,252/255,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) border.width: 1 radius: 5 FluShadow{} diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 3a6d429c..8cb9c66b 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -1,4 +1,5 @@ import QtQuick 2.15 +import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import Qt.labs.qmlmodels 1.0 @@ -17,7 +18,12 @@ Rectangle { property color selectedBorderColor: FluTheme.primaryColor property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3) id:control - color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } onColumnSourceChanged: { if(columnSource.length!==0){ var columns= [] diff --git a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml index c74872a9..df84c4d5 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml @@ -18,21 +18,28 @@ Rectangle { property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3) readonly property alias current: d.current id:control - color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } onDataSourceChanged: { tree_model.setDataSource(dataSource) } onColumnSourceChanged: { - var columns= [] - var headerRow = {} - columnSource.forEach(function(item){ - var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',control); - column.display = item.dataIndex - columns.push(column) - headerRow[item.dataIndex] = item.title - }) - header_column_model.columns = columns - header_column_model.rows = [headerRow] + if(columnSource.length !== 0){ + var columns= [] + var headerRow = {} + columnSource.forEach(function(item){ + var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',control); + column.display = item.dataIndex + columns.push(column) + headerRow[item.dataIndex] = item.title + }) + header_column_model.columns = columns + header_column_model.rows = [headerRow] + } } FluTreeModel{ id:tree_model diff --git a/src/Qt5/imports/FluentUI/plugins.qmltypes b/src/Qt5/imports/FluentUI/plugins.qmltypes index 365b380d..92a7e970 100644 --- a/src/Qt5/imports/FluentUI/plugins.qmltypes +++ b/src/Qt5/imports/FluentUI/plugins.qmltypes @@ -38,6 +38,12 @@ Module { name: "init" Parameter { name: "target"; type: "QObject"; isPointer: true } } + Method { + name: "iconDatas" + type: "QJsonArray" + Parameter { name: "keyword"; type: "string" } + } + Method { name: "iconDatas"; type: "QJsonArray" } } Component { name: "FluCalendarViewType" @@ -133,10 +139,10 @@ Module { exports: ["FluentUI/FluFrameless 1.0"] exportMetaObjectRevisions: [0] Property { name: "appbar"; type: "QQuickItem"; isPointer: true } - Property { name: "topmost"; type: "bool" } Property { name: "maximizeButton"; type: "QQuickItem"; isPointer: true } Property { name: "minimizedButton"; type: "QQuickItem"; isPointer: true } Property { name: "closeButton"; type: "QQuickItem"; isPointer: true } + Property { name: "topmost"; type: "bool" } Property { name: "disabled"; type: "bool" } Property { name: "fixSize"; type: "bool" } Method { name: "showFullScreen" } @@ -318,18 +324,16 @@ Module { Property { name: "fontSecondaryColor"; type: "QColor" } Property { name: "fontTertiaryColor"; type: "QColor" } Property { name: "itemNormalColor"; type: "QColor" } + Property { name: "frameColor"; type: "QColor" } + Property { name: "frameActiveColor"; type: "QColor" } Property { name: "itemHoverColor"; type: "QColor" } Property { name: "itemPressColor"; type: "QColor" } Property { name: "itemCheckColor"; type: "QColor" } + Property { name: "desktopImagePath"; type: "string" } Property { name: "darkMode"; type: "int" } Property { name: "nativeText"; type: "bool" } Property { name: "animationEnabled"; type: "bool" } - Method { - name: "awesomeList" - type: "QJsonArray" - Parameter { name: "keyword"; type: "string" } - } - Method { name: "awesomeList"; type: "QJsonArray" } + Property { name: "blurBehindWindowEnabled"; type: "bool" } } Component { name: "FluThemeType" @@ -480,6 +484,18 @@ Module { type: "QRect" Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } } + Method { name: "getWallpaperFilePath"; type: "string" } + Method { + name: "imageMainColor" + type: "QColor" + Parameter { name: "image"; type: "QImage" } + Parameter { name: "bright"; type: "double" } + } + Method { + name: "imageMainColor" + type: "QColor" + Parameter { name: "image"; type: "QImage" } + } } Component { name: "FluTreeModel" @@ -487,7 +503,6 @@ Module { exports: ["FluentUI/FluTreeModel 1.0"] exportMetaObjectRevisions: [0] Property { name: "dataSourceSize"; type: "int" } - Property { name: "selectionModel"; type: "QList" } Property { name: "columnSource"; type: "QList" } Method { name: "removeRows" @@ -504,6 +519,11 @@ Module { type: "QObject*" Parameter { name: "row"; type: "int" } } + Method { + name: "setRow" + Parameter { name: "row"; type: "int" } + Parameter { name: "data"; type: "QVariantMap" } + } Method { name: "setData" Parameter { name: "data"; type: "QList" } @@ -541,6 +561,7 @@ Module { } Method { name: "allExpand" } Method { name: "allCollapse" } + Method { name: "selectionModel"; type: "QVariant" } } Component { name: "FluTreeViewType" @@ -584,12 +605,12 @@ Module { } } Component { - name: "Fluent_Awesome" + name: "Fluent_Icons" exports: ["FluentUI/FluentIcons 1.0"] isCreatable: false exportMetaObjectRevisions: [0] Enum { - name: "Fluent_AwesomeType" + name: "Fluent_IconType" values: { "GlobalNavButton": 59136, "Wifi": 59137, @@ -2421,37 +2442,37 @@ Module { Property { name: "darkClickListener"; type: "QVariant" } Property { name: "buttonStayTop" - type: "FluIconButton_QMLTYPE_19" + type: "FluIconButton_QMLTYPE_20" isReadonly: true isPointer: true } Property { name: "buttonMinimize" - type: "FluIconButton_QMLTYPE_19" + type: "FluIconButton_QMLTYPE_20" isReadonly: true isPointer: true } Property { name: "buttonMaximize" - type: "FluIconButton_QMLTYPE_19" + type: "FluIconButton_QMLTYPE_20" isReadonly: true isPointer: true } Property { name: "buttonClose" - type: "FluIconButton_QMLTYPE_19" + type: "FluIconButton_QMLTYPE_20" isReadonly: true isPointer: true } Property { name: "buttonDark" - type: "FluIconButton_QMLTYPE_19" + type: "FluIconButton_QMLTYPE_20" isReadonly: true isPointer: true } Property { name: "layoutMacosButtons" - type: "FluLoader_QMLTYPE_12" + type: "FluLoader_QMLTYPE_14" isReadonly: true isPointer: true } @@ -3148,8 +3169,8 @@ Module { Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true } Property { name: "topPadding"; type: "int" } Property { name: "pageMode"; type: "int" } - Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_42"; isPointer: true } - Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_42"; isPointer: true } + Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_33"; isPointer: true } + Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_33"; isPointer: true } Property { name: "navCompactWidth"; type: "int" } Property { name: "navTopMargin"; type: "int" } Property { name: "cellHeight"; type: "int" } @@ -3157,13 +3178,13 @@ Module { Property { name: "hideNavAppBar"; type: "bool" } Property { name: "buttonMenu" - type: "FluIconButton_QMLTYPE_19" + type: "FluIconButton_QMLTYPE_20" isReadonly: true isPointer: true } Property { name: "buttonBack" - type: "FluIconButton_QMLTYPE_19" + type: "FluIconButton_QMLTYPE_20" isReadonly: true isPointer: true } @@ -3975,21 +3996,23 @@ Module { Property { name: "previousText"; type: "string" } } Component { - prototype: "QQuickItem" + prototype: "QQuickRectangle" name: "FluentUI/FluTreeView 1.0" exports: ["FluentUI/FluTreeView 1.0"] exportMetaObjectRevisions: [0] isComposite: true defaultProperty: "data" - Property { name: "currentIndex"; type: "int" } Property { name: "dataSource"; type: "QVariant" } + Property { name: "columnSource"; type: "QVariant" } Property { name: "showLine"; type: "bool" } - Property { name: "draggable"; type: "bool" } Property { name: "cellHeight"; type: "int" } Property { name: "depthPadding"; type: "int" } Property { name: "checkable"; type: "bool" } Property { name: "lineColor"; type: "QColor" } - Method { name: "selectionModel"; type: "QVariant" } + Property { name: "borderColor"; type: "QColor" } + Property { name: "selectedBorderColor"; type: "QColor" } + Property { name: "selectedColor"; type: "QColor" } + Property { name: "current"; type: "QVariant"; isReadonly: true } Method { name: "count"; type: "QVariant" } Method { name: "visibleCount"; type: "QVariant" } Method { @@ -4004,6 +4027,14 @@ Module { } Method { name: "allExpand"; type: "QVariant" } Method { name: "allCollapse"; type: "QVariant" } + Method { + name: "customItem" + type: "QVariant" + Parameter { name: "comId"; type: "QVariant" } + Parameter { name: "options"; type: "QVariant" } + } + Method { name: "closeEditor"; type: "QVariant" } + Method { name: "selectionModel"; type: "QVariant" } } Component { prototype: "QQuickWindowQmlImpl" diff --git a/src/Qt6/imports/FluentUI/Controls/FluMenu.qml b/src/Qt6/imports/FluentUI/Controls/FluMenu.qml index 92dd2e7d..4298d725 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluMenu.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluMenu.qml @@ -44,8 +44,8 @@ T.Menu { background: Rectangle { implicitWidth: 150 implicitHeight: 36 - color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(240/255,240/255,240/255,1) - border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) + color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(252/255,252/255,252/255,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) border.width: 1 radius: 5 FluShadow{} diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index a8634eb6..90b027a0 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -18,7 +18,12 @@ Rectangle { property color selectedBorderColor: FluTheme.primaryColor property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3) id:control - color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } onColumnSourceChanged: { if(columnSource.length!==0){ var columns= [] diff --git a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml index 47fbb0a1..432f1b74 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml @@ -18,7 +18,12 @@ Rectangle { property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3) readonly property alias current: d.current id:control - color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + color: { + if(Window.active){ + return FluTheme.frameActiveColor + } + return FluTheme.frameColor + } onDataSourceChanged: { tree_model.setDataSource(dataSource) } From 8fe4e3b0476605a0e3f2f5c8d977300cc021f237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Wed, 17 Apr 2024 22:05:49 +0800 Subject: [PATCH 21/29] update --- src/FluTheme.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index e0efe346..2880580c 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -5,7 +5,6 @@ #include #include #include "Def.h" -#include "FluentIconDef.h" #include "FluColors.h" #include "FluTools.h" From 179bc8b21f14931a3ed5869f392b04bcbd123acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 19 Apr 2024 00:42:35 +0800 Subject: [PATCH 22/29] update --- example/example_en_US.ts | 40 - example/example_zh_CN.ts | 24 +- example/qml/page/T_ColorPicker.qml | 11 +- .../FluentUI/Controls/FluCalendarPicker.qml | 941 +++++++++--------- .../FluentUI/Controls/FluColorPicker.qml | 19 +- .../FluentUI/Controls/FluDatePicker.qml | 394 ++++---- .../FluentUI/Controls/FluTimePicker.qml | 383 ++++--- .../FluentUI/Controls/FluCalendarPicker.qml | 941 +++++++++--------- .../FluentUI/Controls/FluColorPicker.qml | 19 +- .../FluentUI/Controls/FluDatePicker.qml | 397 ++++---- .../FluentUI/Controls/FluTimePicker.qml | 387 ++++--- src/fluentui_en_US.ts | 71 +- src/fluentui_zh_CN.ts | 71 +- 13 files changed, 1855 insertions(+), 1843 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index a47dc335..8cc746c7 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -1089,46 +1089,6 @@ Updated content: Click to Select a Color - > - - - Cancel - - - - - OK - - - - - Color Picker - - - - - Edit Color - - - - - Red - - - - - Green - - - - - Blue - - - - - Opacity - - T_ComboBox diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index dd7776bd..21da450f 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -1113,44 +1113,36 @@ Updated content: 点击选中颜色 - > - Cancel - 取消 + 取消 - OK - 确定 + 确定 - Color Picker - 颜色选择器 + 颜色选择器 - Edit Color - 编辑颜色 + 编辑颜色 - Red - 红色 + 红色 - Green - 绿色 + 绿色 - Blue - 蓝色 + 蓝色 - Opacity - 透明度 + 透明度 diff --git a/example/qml/page/T_ColorPicker.qml b/example/qml/page/T_ColorPicker.qml index 8733f288..0fc22811 100644 --- a/example/qml/page/T_ColorPicker.qml +++ b/example/qml/page/T_ColorPicker.qml @@ -18,16 +18,7 @@ FluScrollablePage{ text: qsTr("Click to Select a Color - >") Layout.alignment: Qt.AlignVCenter } - FluColorPicker{ - cancelText: qsTr("Cancel") - okText: qsTr("OK") - titleText: qsTr("Color Picker") - editText: qsTr("Edit Color") - redText: qsTr("Red") - greenText: qsTr("Green") - blueText: qsTr("Blue") - opacityText: qsTr("Opacity") - } + FluColorPicker{} } } CodeExpander{ diff --git a/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml b/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml index 8d31b79c..5cf03217 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml @@ -53,8 +53,6 @@ FluButton { } Menu{ id:popup - height: container.height - width: container.width modal: true Overlay.modal: Item {} enter: Transition { @@ -75,458 +73,318 @@ FluButton { } } contentItem: Item{ - clip: true - Rectangle{ - id:container - width: 300 - height: 360 - radius: 4 - color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) - ColumnLayout { - anchors.fill: parent - spacing: 0 - Item{ - Layout.fillWidth: true - Layout.preferredHeight: 50 - RowLayout{ - anchors.fill: parent - spacing: 10 - Item{ - Layout.leftMargin: parent.spacing - Layout.fillWidth: true - Layout.fillHeight: true - FluTextButton{ - width: parent.width + id:container + implicitWidth: 300 + implicitHeight: 360 + ColumnLayout { + anchors.fill: parent + spacing: 0 + Item{ + Layout.fillWidth: true + Layout.preferredHeight: 50 + RowLayout{ + anchors.fill: parent + spacing: 10 + Item{ + Layout.leftMargin: parent.spacing + Layout.fillWidth: true + Layout.fillHeight: true + FluTextButton{ + width: parent.width + anchors.centerIn: parent + contentItem: FluText { + text: d.displayDate.toLocaleString(FluApp.locale, "MMMM yyyy") + verticalAlignment: Text.AlignVCenter + } + visible: d.pageIndex === 0 + onClicked: { + d.pageIndex = 1 + } + } + FluTextButton{ + width: parent.width + anchors.centerIn: parent + contentItem: FluText { + text: d.displayDate.toLocaleString(FluApp.locale, "yyyy") + verticalAlignment: Text.AlignVCenter + } + visible: d.pageIndex === 1 + onClicked: { + d.pageIndex = 2 + } + } + FluTextButton{ + width: parent.width + anchors.centerIn: parent + contentItem: FluText { + text: "%1-%2".arg(d.yearRing.x).arg(d.yearRing.y) + verticalAlignment: Text.AlignVCenter + textColor: FluTheme.fontTertiaryColor + } + visible: d.pageIndex === 2 + } + } + FluIconButton{ + id:icon_up + iconSource: FluentIcons.CaretUpSolid8 + iconSize: 10 + onClicked: { + d.previousButton() + } + } + FluIconButton{ + id:icon_down + iconSource: FluentIcons.CaretDownSolid8 + iconSize: 10 + Layout.rightMargin: parent.spacing + onClicked: { + d.nextButton() + } + } + } + FluDivider{ + width: parent.width + height: 1 + anchors.bottom: parent.bottom + } + } + Item{ + Layout.fillWidth: true + Layout.fillHeight: true + StackView{ + id:stack_view + anchors.fill: parent + initialItem: com_page_one + replaceEnter : Transition{ + OpacityAnimator{ + from: 0 + to: 1 + duration: 83 + } + ScaleAnimator{ + from: 0.5 + to: 1 + duration: 167 + easing.type: Easing.OutCubic + } + } + replaceExit : Transition{ + OpacityAnimator{ + from: 1 + to: 0 + duration: 83 + } + ScaleAnimator{ + from: 1.0 + to: 0.5 + duration: 167 + easing.type: Easing.OutCubic + } + } + } + Connections{ + target: d + function onPageIndexChanged(){ + if(d.pageIndex === 0){ + stack_view.replace(com_page_one) + } + if(d.pageIndex === 1){ + stack_view.replace(com_page_two) + } + if(d.pageIndex === 2){ + stack_view.replace(com_page_three) + } + } + } + Component{ + id:com_page_three + GridView{ + id:grid_view + cellHeight: 75 + cellWidth: 75 + clip: true + boundsBehavior: GridView.StopAtBounds + ScrollBar.vertical: FluScrollBar {} + model: { + var fromYear = calender_model.from.getFullYear() + var toYear = calender_model.to.getFullYear() + return toYear-fromYear+1 + } + highlightRangeMode: GridView.StrictlyEnforceRange + onCurrentIndexChanged:{ + var year = currentIndex + calender_model.from.getFullYear() + var start = Math.ceil(year / 10) * 10 + var end = start+10 + d.yearRing = Qt.point(start,end) + } + highlightMoveDuration: 100 + Component.onCompleted: { + grid_view.highlightMoveDuration = 0 + currentIndex = d.displayDate.getFullYear()-calender_model.from.getFullYear() + timer_delay.restart() + } + Connections{ + target: d + function onNextButton(){ + grid_view.currentIndex = Math.min(grid_view.currentIndex+16,grid_view.count-1) + } + function onPreviousButton(){ + grid_view.currentIndex = Math.max(grid_view.currentIndex-16,0) + } + } + Timer{ + id:timer_delay + interval: 100 + onTriggered: { + grid_view.highlightMoveDuration = 100 + } + } + currentIndex: -1 + delegate: Item{ + property int year : calender_model.from.getFullYear()+modelData + property bool toYear: year === d.toDay.getFullYear() + implicitHeight: 75 + implicitWidth: 75 + FluControl{ + id:control_delegate + width: 60 + height: 60 anchors.centerIn: parent - contentItem: FluText { - text: d.displayDate.toLocaleString(FluApp.locale, "MMMM yyyy") - verticalAlignment: Text.AlignVCenter + Rectangle{ + width: 48 + height: 48 + radius: width/2 + color: { + if(toYear){ + if(control_delegate.pressed){ + return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) + } + if(control_delegate.hovered){ + return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.1) : Qt.lighter(FluTheme.primaryColor,1.1) + } + return FluTheme.primaryColor + }else{ + if(control_delegate.pressed){ + return FluTheme.itemPressColor + } + if(control_delegate.hovered){ + return FluTheme.itemHoverColor + } + return FluColors.Transparent + } + } + anchors.centerIn: parent + } + + FluText{ + text: year + anchors.centerIn: parent + opacity: { + if(year >= d.yearRing.x && year <= d.yearRing.y){ + return 1 + } + if(control_delegate.hovered){ + return 1 + } + return 0.3 + } + color: { + if(toYear){ + return FluColors.White + } + if(control_delegate.pressed){ + return FluTheme.dark ? FluColors.Grey100 : FluColors.Grey100 + } + if(control_delegate.hovered){ + return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 + } + return FluTheme.dark ? FluColors.White : FluColors.Grey220 + } } - visible: d.pageIndex === 0 onClicked: { + d.displayDate = new Date(year,0,1) d.pageIndex = 1 } } - FluTextButton{ - width: parent.width - anchors.centerIn: parent - contentItem: FluText { - text: d.displayDate.toLocaleString(FluApp.locale, "yyyy") - verticalAlignment: Text.AlignVCenter - } - visible: d.pageIndex === 1 - onClicked: { - d.pageIndex = 2 - } - } - FluTextButton{ - width: parent.width - anchors.centerIn: parent - contentItem: FluText { - text: "%1-%2".arg(d.yearRing.x).arg(d.yearRing.y) - verticalAlignment: Text.AlignVCenter - textColor: FluTheme.fontTertiaryColor - } - visible: d.pageIndex === 2 - } } - FluIconButton{ - id:icon_up - iconSource: FluentIcons.CaretUpSolid8 - iconSize: 10 - onClicked: { - d.previousButton() - } - } - FluIconButton{ - id:icon_down - iconSource: FluentIcons.CaretDownSolid8 - iconSize: 10 - Layout.rightMargin: parent.spacing - onClicked: { - d.nextButton() - } - } - } - FluDivider{ - width: parent.width - height: 1 - anchors.bottom: parent.bottom } } - Item{ - Layout.fillWidth: true - Layout.fillHeight: true - StackView{ - id:stack_view - anchors.fill: parent - initialItem: com_page_one - replaceEnter : Transition{ - OpacityAnimator{ - from: 0 - to: 1 - duration: 83 - } - ScaleAnimator{ - from: 0.5 - to: 1 - duration: 167 - easing.type: Easing.OutCubic - } - } - replaceExit : Transition{ - OpacityAnimator{ - from: 1 - to: 0 - duration: 83 - } - ScaleAnimator{ - from: 1.0 - to: 0.5 - duration: 167 - easing.type: Easing.OutCubic - } - } - } - Connections{ - target: d - function onPageIndexChanged(){ - if(d.pageIndex === 0){ - stack_view.replace(com_page_one) - } - if(d.pageIndex === 1){ - stack_view.replace(com_page_two) - } - if(d.pageIndex === 2){ - stack_view.replace(com_page_three) - } - } - } - Component{ - id:com_page_three - GridView{ - id:grid_view - cellHeight: 75 - cellWidth: 75 - clip: true - boundsBehavior: GridView.StopAtBounds - ScrollBar.vertical: FluScrollBar {} - model: { - var fromYear = calender_model.from.getFullYear() - var toYear = calender_model.to.getFullYear() - return toYear-fromYear+1 - } - highlightRangeMode: GridView.StrictlyEnforceRange - onCurrentIndexChanged:{ - var year = currentIndex + calender_model.from.getFullYear() - var start = Math.ceil(year / 10) * 10 - var end = start+10 - d.yearRing = Qt.point(start,end) - } - highlightMoveDuration: 100 - Component.onCompleted: { - grid_view.highlightMoveDuration = 0 - currentIndex = d.displayDate.getFullYear()-calender_model.from.getFullYear() - timer_delay.restart() - } - Connections{ - target: d - function onNextButton(){ - grid_view.currentIndex = Math.min(grid_view.currentIndex+16,grid_view.count-1) - } - function onPreviousButton(){ - grid_view.currentIndex = Math.max(grid_view.currentIndex-16,0) - } - } - Timer{ - id:timer_delay - interval: 100 - onTriggered: { - grid_view.highlightMoveDuration = 100 - } - } - currentIndex: -1 - delegate: Item{ - property int year : calender_model.from.getFullYear()+modelData - property bool toYear: year === d.toDay.getFullYear() - implicitHeight: 75 - implicitWidth: 75 - FluControl{ - id:control_delegate - width: 60 - height: 60 - anchors.centerIn: parent - Rectangle{ - width: 48 - height: 48 - radius: width/2 - color: { - if(toYear){ - if(control_delegate.pressed){ - return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) - } - if(control_delegate.hovered){ - return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.1) : Qt.lighter(FluTheme.primaryColor,1.1) - } - return FluTheme.primaryColor - }else{ - if(control_delegate.pressed){ - return FluTheme.itemPressColor - } - if(control_delegate.hovered){ - return FluTheme.itemHoverColor - } - return FluColors.Transparent - } - } - anchors.centerIn: parent - } + Component{ + id:com_page_two - FluText{ - text: year - anchors.centerIn: parent - opacity: { - if(year >= d.yearRing.x && year <= d.yearRing.y){ - return 1 - } - if(control_delegate.hovered){ - return 1 - } - return 0.3 - } - color: { - if(toYear){ - return FluColors.White - } - if(control_delegate.pressed){ - return FluTheme.dark ? FluColors.Grey100 : FluColors.Grey100 - } - if(control_delegate.hovered){ - return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 - } - return FluTheme.dark ? FluColors.White : FluColors.Grey220 - } - } - onClicked: { - d.displayDate = new Date(year,0,1) - d.pageIndex = 1 - } - } + ListView{ + id:listview + ScrollBar.vertical: FluScrollBar {} + highlightRangeMode: ListView.StrictlyEnforceRange + clip: true + boundsBehavior: ListView.StopAtBounds + spacing: 0 + highlightMoveDuration: 100 + model: { + var fromYear = calender_model.from.getFullYear() + var toYear = calender_model.to.getFullYear() + var yearsArray = [] + for (var i = fromYear; i <= toYear; i++) { + yearsArray.push(i) + } + return yearsArray + } + currentIndex: -1 + onCurrentIndexChanged:{ + var year = model[currentIndex] + var month = d.displayDate.getMonth() + d.displayDate = new Date(year,month,1) + } + Connections{ + target: d + function onNextButton(){ + listview.currentIndex = Math.min(listview.currentIndex+1,listview.count-1) + } + function onPreviousButton(){ + listview.currentIndex = Math.max(listview.currentIndex-1,0) } } - } - Component{ - id:com_page_two - - ListView{ - id:listview - ScrollBar.vertical: FluScrollBar {} - highlightRangeMode: ListView.StrictlyEnforceRange - clip: true - boundsBehavior: ListView.StopAtBounds - spacing: 0 - highlightMoveDuration: 100 - model: { - var fromYear = calender_model.from.getFullYear() - var toYear = calender_model.to.getFullYear() - var yearsArray = [] - for (var i = fromYear; i <= toYear; i++) { - yearsArray.push(i) - } - return yearsArray - } - currentIndex: -1 - onCurrentIndexChanged:{ - var year = model[currentIndex] - var month = d.displayDate.getMonth() - d.displayDate = new Date(year,month,1) - } - Connections{ - target: d - function onNextButton(){ - listview.currentIndex = Math.min(listview.currentIndex+1,listview.count-1) - } - function onPreviousButton(){ - listview.currentIndex = Math.max(listview.currentIndex-1,0) - } - } - Component.onCompleted: { - listview.highlightMoveDuration = 0 - currentIndex = model.indexOf(d.displayDate.getFullYear()) - timer_delay.restart() - } - Timer{ - id:timer_delay - interval: 100 - onTriggered: { - listview.highlightMoveDuration = 100 - } - } - delegate: Item{ - id:layout_congrol - property int year : modelData - width: listview.width - height: 75*3 - GridView{ - anchors.fill: parent - cellHeight: 75 - cellWidth: 75 - clip: true - interactive: false - boundsBehavior: GridView.StopAtBounds - model: 12 - delegate: Item{ - property int month : modelData - property bool toMonth: layout_congrol.year === d.toDay.getFullYear() && month === d.toDay.getMonth() - implicitHeight: 75 - implicitWidth: 75 - FluControl{ - id:control_delegate - width: 60 - height: 60 - anchors.centerIn: parent - Rectangle{ - width: 48 - height: 48 - radius: width/2 - color: { - if(toMonth){ - if(control_delegate.pressed){ - return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) - } - if(control_delegate.hovered){ - return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.1) : Qt.lighter(FluTheme.primaryColor,1.1) - } - return FluTheme.primaryColor - }else{ - if(control_delegate.pressed){ - return FluTheme.itemPressColor - } - if(control_delegate.hovered){ - return FluTheme.itemHoverColor - } - return FluColors.Transparent - } - } - anchors.centerIn: parent - } - FluText{ - text: new Date(layout_congrol.year,month).toLocaleString(FluApp.locale, "MMMM") - anchors.centerIn: parent - opacity: { - if(layout_congrol.year === d.displayDate.getFullYear()){ - return 1 - } - if(control_delegate.hovered){ - return 1 - } - return 0.3 - } - color: { - if(toMonth){ - return FluColors.White - } - if(control_delegate.pressed){ - return FluTheme.dark ? FluColors.Grey100 : FluColors.Grey100 - } - if(control_delegate.hovered){ - return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 - } - return FluTheme.dark ? FluColors.White : FluColors.Grey220 - } - } - onClicked: { - d.displayDate = new Date(layout_congrol.year,month) - d.pageIndex = 0 - } - } - } - } + Component.onCompleted: { + listview.highlightMoveDuration = 0 + currentIndex = model.indexOf(d.displayDate.getFullYear()) + timer_delay.restart() + } + Timer{ + id:timer_delay + interval: 100 + onTriggered: { + listview.highlightMoveDuration = 100 } } - } - Component{ - id:com_page_one - ColumnLayout { - DayOfWeekRow { - id: dayOfWeekRow - locale: FluApp.locale - font: FluTextStyle.Body - delegate: Label { - text: model.shortName - font: dayOfWeekRow.font - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - Layout.column: 1 - Layout.fillWidth: true - } - ListView{ - id:listview - property bool isCompleted: false - Layout.fillWidth: true - Layout.fillHeight: true - highlightRangeMode: ListView.StrictlyEnforceRange + delegate: Item{ + id:layout_congrol + property int year : modelData + width: listview.width + height: 75*3 + GridView{ + anchors.fill: parent + cellHeight: 75 + cellWidth: 75 clip: true - boundsBehavior: ListView.StopAtBounds - spacing: 0 - highlightMoveDuration: 100 - currentIndex: -1 - ScrollBar.vertical: FluScrollBar {} - onCurrentIndexChanged:{ - if(isCompleted){ - var month = calender_model.monthAt(currentIndex) - var year = calender_model.yearAt(currentIndex) - d.displayDate = new Date(year,month,1) - } - } - Component.onCompleted: { - listview.model = calender_model - listview.highlightMoveDuration = 0 - currentIndex = calender_model.indexOf(d.displayDate) - timer_delay.restart() - isCompleted = true - } - Timer{ - id:timer_delay - interval: 100 - onTriggered: { - listview.highlightMoveDuration = 100 - } - } - Connections{ - target: d - function onNextButton(){ - listview.currentIndex = Math.min(listview.currentIndex+1,listview.count-1) - } - function onPreviousButton(){ - listview.currentIndex = Math.max(listview.currentIndex-1,0) - } - } - delegate: MonthGrid { - id: grid - width: listview.width - height: listview.height - month: model.month - year: model.year - spacing: 0 - locale: FluApp.locale - delegate: FluControl { - required property bool today - required property int year - required property int month - required property int day - required property int visibleMonth - id: control_delegate - visibleMonth: grid.month - implicitHeight: 40 - implicitWidth: 40 + interactive: false + boundsBehavior: GridView.StopAtBounds + model: 12 + delegate: Item{ + property int month : modelData + property bool toMonth: layout_congrol.year === d.toDay.getFullYear() && month === d.toDay.getMonth() + implicitHeight: 75 + implicitWidth: 75 + FluControl{ + id:control_delegate + width: 60 + height: 60 + anchors.centerIn: parent Rectangle{ - width: 34 - height: 34 + width: 48 + height: 48 radius: width/2 color: { - if(today){ + if(toMonth){ if(control_delegate.pressed){ return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) } @@ -546,31 +404,11 @@ FluButton { } anchors.centerIn: parent } - Rectangle{ - width: 40 - height: 40 - border.width: 1 - anchors.centerIn: parent - radius: width/2 - border.color: FluTheme.primaryColor - color: FluColors.Transparent - visible: { - if(control.current){ - var y = control.current.getFullYear() - var m = control.current.getMonth() - var d = control.current.getDate() - if(y === year && m === month && d === day){ - return true - } - return false - } - return false - } - } FluText{ - text: day + text: new Date(layout_congrol.year,month).toLocaleString(FluApp.locale, "MMMM") + anchors.centerIn: parent opacity: { - if(month === grid.month){ + if(layout_congrol.year === d.displayDate.getFullYear()){ return 1 } if(control_delegate.hovered){ @@ -578,9 +416,8 @@ FluButton { } return 0.3 } - anchors.centerIn: parent color: { - if(today){ + if(toMonth){ return FluColors.White } if(control_delegate.pressed){ @@ -593,17 +430,173 @@ FluButton { } } onClicked: { - control.current = new Date(year,month,day) - control.accepted() - popup.close() + d.displayDate = new Date(layout_congrol.year,month) + d.pageIndex = 0 } } - background: Item { - x: grid.leftPadding - y: grid.topPadding - width: grid.availableWidth - height: grid.availableHeight + } + } + } + } + } + Component{ + id:com_page_one + ColumnLayout { + DayOfWeekRow { + id: dayOfWeekRow + locale: FluApp.locale + font: FluTextStyle.Body + delegate: Label { + text: model.shortName + font: dayOfWeekRow.font + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + Layout.column: 1 + Layout.fillWidth: true + } + ListView{ + id:listview + property bool isCompleted: false + Layout.fillWidth: true + Layout.fillHeight: true + highlightRangeMode: ListView.StrictlyEnforceRange + clip: true + boundsBehavior: ListView.StopAtBounds + spacing: 0 + highlightMoveDuration: 100 + currentIndex: -1 + ScrollBar.vertical: FluScrollBar {} + onCurrentIndexChanged:{ + if(isCompleted){ + var month = calender_model.monthAt(currentIndex) + var year = calender_model.yearAt(currentIndex) + d.displayDate = new Date(year,month,1) + } + } + Component.onCompleted: { + listview.model = calender_model + listview.highlightMoveDuration = 0 + currentIndex = calender_model.indexOf(d.displayDate) + timer_delay.restart() + isCompleted = true + } + Timer{ + id:timer_delay + interval: 100 + onTriggered: { + listview.highlightMoveDuration = 100 + } + } + Connections{ + target: d + function onNextButton(){ + listview.currentIndex = Math.min(listview.currentIndex+1,listview.count-1) + } + function onPreviousButton(){ + listview.currentIndex = Math.max(listview.currentIndex-1,0) + } + } + delegate: MonthGrid { + id: grid + width: listview.width + height: listview.height + month: model.month + year: model.year + spacing: 0 + locale: FluApp.locale + delegate: FluControl { + required property bool today + required property int year + required property int month + required property int day + required property int visibleMonth + id: control_delegate + visibleMonth: grid.month + implicitHeight: 40 + implicitWidth: 40 + Rectangle{ + width: 34 + height: 34 + radius: width/2 + color: { + if(today){ + if(control_delegate.pressed){ + return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) + } + if(control_delegate.hovered){ + return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.1) : Qt.lighter(FluTheme.primaryColor,1.1) + } + return FluTheme.primaryColor + }else{ + if(control_delegate.pressed){ + return FluTheme.itemPressColor + } + if(control_delegate.hovered){ + return FluTheme.itemHoverColor + } + return FluColors.Transparent + } + } + anchors.centerIn: parent } + Rectangle{ + width: 40 + height: 40 + border.width: 1 + anchors.centerIn: parent + radius: width/2 + border.color: FluTheme.primaryColor + color: FluColors.Transparent + visible: { + if(control.current){ + var y = control.current.getFullYear() + var m = control.current.getMonth() + var d = control.current.getDate() + if(y === year && m === month && d === day){ + return true + } + return false + } + return false + } + } + FluText{ + text: day + opacity: { + if(month === grid.month){ + return 1 + } + if(control_delegate.hovered){ + return 1 + } + return 0.3 + } + anchors.centerIn: parent + color: { + if(today){ + return FluColors.White + } + if(control_delegate.pressed){ + return FluTheme.dark ? FluColors.Grey100 : FluColors.Grey100 + } + if(control_delegate.hovered){ + return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 + } + return FluTheme.dark ? FluColors.White : FluColors.Grey220 + } + } + onClicked: { + control.current = new Date(year,month,day) + control.accepted() + popup.close() + } + } + background: Item { + x: grid.leftPadding + y: grid.topPadding + width: grid.availableWidth + height: grid.availableHeight } } } @@ -612,21 +605,23 @@ FluButton { } } } - background: Item{ + background:Rectangle{ + radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) FluShadow{ - radius: 4 + radius: 5 } } function showPopup() { var pos = control.mapToItem(null, 0, 0) if(d.window.height>pos.y+control.height+container.height){ - popup.y = control.height + popup.y = control.height - 1 } else if(pos.y>container.height){ popup.y = -container.height } else { popup.y = d.window.height-(pos.y+container.height) } - popup.x = -(popup.width-control.width)/2 popup.open() } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluColorPicker.qml b/src/Qt5/imports/FluentUI/Controls/FluColorPicker.qml index c809cfc6..bdac72d9 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluColorPicker.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluColorPicker.qml @@ -13,16 +13,15 @@ Button{ property color current : Qt.rgba(1,1,1,1) signal accepted() property int colorHandleRadius: 8 - property string cancelText: "取消" - property string okText: "确定" - property string titleText: "颜色选择器" - property string editText: "编辑颜色" - property string redText: "红色" - property string greenText: "绿色" - property string blueText: "蓝色" - property string opacityText: "透明度" - background: - Rectangle{ + property string cancelText: qsTr("Cancel") + property string okText: qsTr("OK") + property string titleText: qsTr("Color Picker") + property string editText: qsTr("Edit Color") + property string redText: qsTr("Red") + property string greenText: qsTr("Green") + property string blueText: qsTr("Blue") + property string opacityText: qsTr("Opacity") + background: Rectangle{ id:layout_color radius: 5 color:"#00000000" diff --git a/src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml b/src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml index 1f03ae30..1ba43afa 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml @@ -4,7 +4,6 @@ import QtQuick.Layouts 1.15 import QtQuick.Window 2.15 import FluentUI 1.0 - FluButton { property bool showYear: true property var current @@ -96,8 +95,6 @@ FluButton { Menu{ id:popup modal: true - width: container.width - height: container.height Overlay.modal: Item {} enter: Transition { reversible: true @@ -116,227 +113,220 @@ FluButton { duration: FluTheme.animationEnabled ? 83 : 0 } } - background:Item{ + background:Rectangle{ + radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) FluShadow{ - radius: 4 + radius: 5 } } contentItem: Item{ - clip: true - Rectangle{ - id:container - radius: 4 - width: 300 - height: 340 - color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) - MouseArea{ - anchors.fill: parent - } - FluShadow{ - radius: 4 - } - RowLayout{ - id:layout_content - spacing: 0 - width: parent.width - height: 300 - Component{ - id:list_delegate - Item{ - height:38 - width:getListView().width - function getListView(){ - if(type === 0) - return list_view_1 - if(type === 1) - return list_view_2 - if(type === 2) - return list_view_3 + id:container + implicitHeight: 340 + implicitWidth: 300 + MouseArea{ + anchors.fill: parent + } + RowLayout{ + id:layout_content + spacing: 0 + width: parent.width + height: 280 + Component{ + id:list_delegate + Item{ + height: 38 + width: getListView().width + function getListView(){ + if(type === 0) + return list_view_1 + if(type === 1) + return list_view_2 + if(type === 2) + return list_view_3 + } + Rectangle{ + anchors.fill: parent + anchors.topMargin: 2 + anchors.bottomMargin: 2 + anchors.leftMargin: 5 + anchors.rightMargin: 5 + color: { + if(getListView().currentIndex === position){ + return item_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor,1.1): FluTheme.primaryColor + } + if(item_mouse.containsMouse){ + return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) + } + return Qt.rgba(0,0,0,0) } - Rectangle{ + radius: 3 + MouseArea{ + id:item_mouse anchors.fill: parent - anchors.topMargin: 2 - anchors.bottomMargin: 2 - anchors.leftMargin: 5 - anchors.rightMargin: 5 - color: { + hoverEnabled: true + onClicked: { + getListView().currentIndex = position + if(type === 0){ + text_year.text = model + list_view_2.model = generateMonthArray(1,12) + text_month.text = list_view_2.model[list_view_2.currentIndex] + + list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) + text_day.text = list_view_3.model[list_view_3.currentIndex] + } + if(type === 1){ + text_month.text = model + list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) + text_day.text = list_view_3.model[list_view_3.currentIndex] + + } + if(type === 2){ + text_day.text = model + } + } + } + FluText{ + text:model + color: { if(getListView().currentIndex === position){ - return item_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor,1.1): FluTheme.primaryColor - } - if(item_mouse.containsMouse){ - return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) - } - return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0) - } - radius: 3 - MouseArea{ - id:item_mouse - anchors.fill: parent - hoverEnabled: true - onClicked: { - getListView().currentIndex = position - if(type === 0){ - text_year.text = model - list_view_2.model = generateMonthArray(1,12) - text_month.text = list_view_2.model[list_view_2.currentIndex] - - list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) - text_day.text = list_view_3.model[list_view_3.currentIndex] - } - if(type === 1){ - text_month.text = model - list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) - text_day.text = list_view_3.model[list_view_3.currentIndex] - - } - if(type === 2){ - text_day.text = model - } - } - } - FluText{ - text:model - color: { - if(getListView().currentIndex === position){ - if(FluTheme.dark){ - return Qt.rgba(0,0,0,1) - }else{ - return Qt.rgba(1,1,1,1) - } + if(FluTheme.dark){ + return Qt.rgba(0,0,0,1) }else{ - return FluTheme.dark ? "#FFFFFF" : "#1A1A1A" + return Qt.rgba(1,1,1,1) } + }else{ + return FluTheme.dark ? "#FFFFFF" : "#1A1A1A" } - anchors.centerIn: parent } + anchors.centerIn: parent } } } - ListView{ - id:list_view_1 - width: 100 - height: parent.height - boundsBehavior:Flickable.StopAtBounds - ScrollBar.vertical: FluScrollBar {} - model: generateYearArray(1924,2048) - clip: true - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - visible: showYear - delegate: FluLoader{ - property var model: modelData - property int type:0 - property int position:index - sourceComponent: list_delegate - } - } - Rectangle{ - width: 1 - height: parent.height - color: control.dividerColor - } - ListView{ - id:list_view_2 - width: showYear ? 100 : 150 - height: parent.height - clip: true - ScrollBar.vertical: FluScrollBar {} - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - boundsBehavior:Flickable.StopAtBounds - delegate: FluLoader{ - property var model: modelData - property int type:1 - property int position:index - sourceComponent: list_delegate - } - } - Rectangle{ - width: 1 - height: parent.height - color: control.dividerColor - } - ListView{ - id:list_view_3 - width: showYear ? 100 : 150 - height: parent.height - clip: true - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - ScrollBar.vertical: FluScrollBar {} - Layout.alignment: Qt.AlignVCenter - boundsBehavior:Flickable.StopAtBounds - delegate: FluLoader{ - property var model: modelData - property int type:2 - property int position:index - sourceComponent: list_delegate - } + } + ListView{ + id:list_view_1 + Layout.preferredWidth: 100 + Layout.preferredHeight: parent.height - 2 + Layout.alignment: Qt.AlignVCenter + boundsBehavior:Flickable.StopAtBounds + ScrollBar.vertical: FluScrollBar {} + model: generateYearArray(1924,2048) + clip: true + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + visible: showYear + delegate: FluLoader{ + property var model: modelData + property int type:0 + property int position:index + sourceComponent: list_delegate } } Rectangle{ - width: parent.width - height: 1 - anchors.top: layout_content.bottom + Layout.preferredWidth: 1 + Layout.preferredHeight: parent.height + color: control.dividerColor + visible: showYear + } + ListView{ + id:list_view_2 + Layout.preferredWidth: showYear ? 99 : 150 + Layout.preferredHeight: parent.height - 2 + Layout.alignment: Qt.AlignVCenter + clip: true + ScrollBar.vertical: FluScrollBar {} + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + boundsBehavior:Flickable.StopAtBounds + delegate: FluLoader{ + property var model: modelData + property int type:1 + property int position:index + sourceComponent: list_delegate + } + } + Rectangle{ + Layout.preferredWidth: 1 + Layout.preferredHeight: parent.height color: control.dividerColor } - Rectangle{ - id:layout_actions - height: 40 - radius: 5 - color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + ListView{ + id:list_view_3 + Layout.preferredWidth: showYear ? 99 : 150 + Layout.preferredHeight: parent.height - 2 + Layout.alignment: Qt.AlignVCenter + clip: true + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + ScrollBar.vertical: FluScrollBar {} + boundsBehavior:Flickable.StopAtBounds + delegate: FluLoader{ + property var model: modelData + property int type:2 + property int position:index + sourceComponent: list_delegate + } + } + } + Rectangle{ + id:layout_actions + height: 60 + color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) + radius: 5 + anchors{ + bottom:parent.bottom + left: parent.left + right: parent.right + } + Item { + id:divider + width: 1 + height: parent.height + anchors.centerIn: parent + } + FluButton{ anchors{ - bottom:parent.bottom left: parent.left + leftMargin: 20 + rightMargin: 10 + right: divider.left + verticalCenter: parent.verticalCenter + } + text: control.cancelText + onClicked: { + popup.close() + } + } + FluFilledButton{ + anchors{ right: parent.right + left: divider.right + rightMargin: 20 + leftMargin: 10 + verticalCenter: parent.verticalCenter } - Item { - id:divider - width: 1 - height: parent.height - anchors.centerIn: parent - } - FluButton{ - anchors{ - left: parent.left - leftMargin: 20 - rightMargin: 10 - right: divider.left - verticalCenter: parent.verticalCenter - } - text: control.cancelText - onClicked: { - popup.close() - } - } - FluFilledButton{ - anchors{ - right: parent.right - left: divider.right - rightMargin: 20 - leftMargin: 10 - verticalCenter: parent.verticalCenter - } - text: control.okText - onClicked: { - d.changeFlag = false - popup.close() - const year = text_year.text - const month = text_month.text - const day = text_day.text - const date = new Date() - date.setFullYear(parseInt(year)); - date.setMonth(parseInt(month) - 1); - date.setDate(parseInt(day)); - date.setHours(0); - date.setMinutes(0); - date.setSeconds(0); - current = date - control.accepted() - } + text: control.okText + onClicked: { + d.changeFlag = false + popup.close() + const year = text_year.text + const month = text_month.text + const day = text_day.text + const date = new Date() + date.setFullYear(parseInt(year)); + date.setMonth(parseInt(month) - 1); + date.setDate(parseInt(day)); + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + current = date + control.accepted() } } } @@ -361,7 +351,7 @@ FluButton { text_day.text = day var pos = control.mapToItem(null, 0, 0) if(d.window.height>pos.y+control.height+container.height){ - popup.y = control.height + popup.y = control.height-1 } else if(pos.y>container.height){ popup.y = -container.height } else { diff --git a/src/Qt5/imports/FluentUI/Controls/FluTimePicker.qml b/src/Qt5/imports/FluentUI/Controls/FluTimePicker.qml index 70d79f01..21b88b6c 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTimePicker.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTimePicker.qml @@ -111,8 +111,6 @@ FluButton { } Menu{ id:popup - width: container.width - height: container.height modal: true Overlay.modal: Item {} enter: Transition { @@ -132,224 +130,219 @@ FluButton { duration: FluTheme.animationEnabled ? 83 : 0 } } - background:Item{ + background:Rectangle{ + radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) FluShadow{ - radius: 4 + radius: 5 } } contentItem: Item{ - clip: true - Rectangle{ - id:container - height: 340 - width: 300 - radius: 4 - color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) - MouseArea{ - anchors.fill: parent - } - RowLayout{ - id:layout_content - spacing: 0 - width: parent.width - height: 300 - Component{ - id:list_delegate - Item{ - height:38 - width:getListView().width - function getListView(){ - if(type === 0) - return list_view_1 - if(type === 1) - return list_view_2 - if(type === 2) - return list_view_3 + id:container + implicitHeight: 340 + implicitWidth: 300 + MouseArea{ + anchors.fill: parent + } + RowLayout{ + id:layout_content + spacing: 0 + width: parent.width + height: 280 + Component{ + id:list_delegate + Item{ + height:38 + width:getListView().width + function getListView(){ + if(type === 0) + return list_view_1 + if(type === 1) + return list_view_2 + if(type === 2) + return list_view_3 + } + Rectangle{ + anchors.fill: parent + anchors.topMargin: 2 + anchors.bottomMargin: 2 + anchors.leftMargin: 5 + anchors.rightMargin: 5 + color: { + if(getListView().currentIndex === position){ + return item_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor,1.1) : FluTheme.primaryColor + } + if(item_mouse.containsMouse){ + return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) + } + return Qt.rgba(0,0,0,0) } - Rectangle{ + radius: 3 + MouseArea{ + id:item_mouse anchors.fill: parent - anchors.topMargin: 2 - anchors.bottomMargin: 2 - anchors.leftMargin: 5 - anchors.rightMargin: 5 - color: { + hoverEnabled: true + onClicked: { + getListView().currentIndex = position + if(type === 0){ + text_hour.text = model + } + if(type === 1){ + text_minute.text = model + } + if(type === 2){ + text_ampm.text = model + } + } + } + FluText{ + text:model + color: { if(getListView().currentIndex === position){ - return item_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor,1.1) : FluTheme.primaryColor - } - if(item_mouse.containsMouse){ - return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) - } - return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0) - } - radius: 3 - MouseArea{ - id:item_mouse - anchors.fill: parent - hoverEnabled: true - onClicked: { - getListView().currentIndex = position - if(type === 0){ - text_hour.text = model - } - if(type === 1){ - text_minute.text = model - } - if(type === 2){ - text_ampm.text = model - } - } - } - FluText{ - text:model - color: { - if(getListView().currentIndex === position){ - if(FluTheme.dark){ - return Qt.rgba(0,0,0,1) - }else{ - return Qt.rgba(1,1,1,1) - } + if(FluTheme.dark){ + return Qt.rgba(0,0,0,1) }else{ - return FluTheme.dark ? "#FFFFFF" : "#1A1A1A" + return Qt.rgba(1,1,1,1) } + }else{ + return FluTheme.dark ? "#FFFFFF" : "#1A1A1A" } - anchors.centerIn: parent } + anchors.centerIn: parent } } } - ListView{ - id:list_view_1 - width: isH ? 100 : 150 - height: parent.height - boundsBehavior:Flickable.StopAtBounds - ScrollBar.vertical: FluScrollBar {} - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - model: isH ? generateArray(1,12) : generateArray(0,23) - clip: true - delegate: FluLoader{ - property var model: modelData - property int type:0 - property int position:index - sourceComponent: list_delegate - } - } - Rectangle{ - width: 1 - height: parent.height - color: control.dividerColor - } - ListView{ - id:list_view_2 - width: isH ? 100 : 150 - height: parent.height - model: generateArray(0,59) - clip: true - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - ScrollBar.vertical: FluScrollBar {} - boundsBehavior:Flickable.StopAtBounds - delegate: FluLoader{ - property var model: modelData - property int type:1 - property int position:index - sourceComponent: list_delegate - } - } - Rectangle{ - width: 1 - height: parent.height - color: control.dividerColor - visible: isH - } - ListView{ - id:list_view_3 - width: 100 - height: 76 - model: [control.amText,control.pmText] - clip: true - visible: isH - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - ScrollBar.vertical: FluScrollBar {} - Layout.alignment: Qt.AlignVCenter - boundsBehavior:Flickable.StopAtBounds - delegate: FluLoader{ - property var model: modelData - property int type:2 - property int position:index - sourceComponent: list_delegate - } + } + ListView{ + id:list_view_1 + Layout.preferredWidth: isH ? 100 : 150 + Layout.preferredHeight: parent.height-2 + Layout.alignment: Qt.AlignVCenter + boundsBehavior:Flickable.StopAtBounds + ScrollBar.vertical: FluScrollBar {} + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + model: isH ? generateArray(1,12) : generateArray(0,23) + clip: true + delegate: FluLoader{ + property var model: modelData + property int type:0 + property int position:index + sourceComponent: list_delegate } } Rectangle{ - width: parent.width - height: 1 - anchors.top: layout_content.bottom + Layout.preferredWidth: 1 + Layout.preferredHeight: parent.height color: control.dividerColor } + ListView{ + id:list_view_2 + Layout.preferredWidth: isH ? 99 : 150 + Layout.preferredHeight: parent.height-2 + Layout.alignment: Qt.AlignVCenter + model: generateArray(0,59) + clip: true + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + ScrollBar.vertical: FluScrollBar {} + boundsBehavior:Flickable.StopAtBounds + delegate: FluLoader{ + property var model: modelData + property int type:1 + property int position:index + sourceComponent: list_delegate + } + } Rectangle{ - id:layout_actions - height: 40 - radius: 5 - color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + width: 1 + height: parent.height + color: control.dividerColor + visible: isH + } + ListView{ + id:list_view_3 + Layout.preferredWidth: 100 + Layout.preferredHeight: 76 + model: [control.amText,control.pmText] + clip: true + visible: isH + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + ScrollBar.vertical: FluScrollBar {} + Layout.alignment: Qt.AlignVCenter + boundsBehavior:Flickable.StopAtBounds + delegate: FluLoader{ + property var model: modelData + property int type:2 + property int position:index + sourceComponent: list_delegate + } + } + } + Rectangle{ + id:layout_actions + height: 60 + color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) + radius: 5 + anchors{ + bottom:parent.bottom + left: parent.left + right: parent.right + } + Item { + id:divider + width: 1 + height: parent.height + anchors.centerIn: parent + } + FluButton{ anchors{ - bottom:parent.bottom left: parent.left + leftMargin: 20 + rightMargin: 10 + right: divider.left + verticalCenter: parent.verticalCenter + } + text: control.cancelText + onClicked: { + popup.close() + } + } + FluFilledButton{ + anchors{ right: parent.right + left: divider.right + rightMargin: 20 + leftMargin: 10 + verticalCenter: parent.verticalCenter } - Item { - id:divider - width: 1 - height: parent.height - anchors.centerIn: parent - } - FluButton{ - anchors{ - left: parent.left - leftMargin: 20 - rightMargin: 10 - right: divider.left - verticalCenter: parent.verticalCenter - } - text: control.cancelText - onClicked: { - popup.close() - } - } - FluFilledButton{ - anchors{ - right: parent.right - left: divider.right - rightMargin: 20 - leftMargin: 10 - verticalCenter: parent.verticalCenter - } - text: control.okText - onClicked: { - d.changeFlag = false - popup.close() - const hours = text_hour.text - const minutes = text_minute.text - const period = text_ampm.text - const date = new Date() - var hours24 = parseInt(hours); - if(control.hourFormat === FluTimePickerType.H){ - if (hours === "12") { - hours24 = (period === control.amText) ? 0 : 12; - } else { - hours24 = (period === control.pmText) ? hours24 : hours24 + 12; - } + text: control.okText + onClicked: { + d.changeFlag = false + popup.close() + const hours = text_hour.text + const minutes = text_minute.text + const period = text_ampm.text + const date = new Date() + var hours24 = parseInt(hours); + if(control.hourFormat === FluTimePickerType.H){ + if (hours === "12") { + hours24 = (period === control.amText) ? 0 : 12; + } else { + hours24 = (period === control.pmText) ? hours24 : hours24 + 12; } - date.setHours(hours24); - date.setMinutes(parseInt(minutes)); - date.setSeconds(0); - current = date - control.accepted() } + date.setHours(hours24); + date.setMinutes(parseInt(minutes)); + date.setSeconds(0); + current = date + control.accepted() } } } @@ -387,7 +380,7 @@ FluButton { } var pos = control.mapToItem(null, 0, 0) if(d.window.height>pos.y+control.height+container.height){ - popup.y = control.height + popup.y = control.height-1 } else if(pos.y>container.height){ popup.y = -container.height } else { diff --git a/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml b/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml index 496021db..f6d7c39d 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml @@ -52,8 +52,6 @@ FluButton { } Menu{ id:popup - height: container.height - width: container.width modal: true Overlay.modal: Item {} enter: Transition { @@ -74,458 +72,318 @@ FluButton { } } contentItem: Item{ - clip: true - Rectangle{ - id:container - width: 300 - height: 360 - radius: 4 - color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) - ColumnLayout { - anchors.fill: parent - spacing: 0 - Item{ - Layout.fillWidth: true - Layout.preferredHeight: 50 - RowLayout{ - anchors.fill: parent - spacing: 10 - Item{ - Layout.leftMargin: parent.spacing - Layout.fillWidth: true - Layout.fillHeight: true - FluTextButton{ - width: parent.width + id:container + implicitWidth: 300 + implicitHeight: 360 + ColumnLayout { + anchors.fill: parent + spacing: 0 + Item{ + Layout.fillWidth: true + Layout.preferredHeight: 50 + RowLayout{ + anchors.fill: parent + spacing: 10 + Item{ + Layout.leftMargin: parent.spacing + Layout.fillWidth: true + Layout.fillHeight: true + FluTextButton{ + width: parent.width + anchors.centerIn: parent + contentItem: FluText { + text: d.displayDate.toLocaleString(FluApp.locale, "MMMM yyyy") + verticalAlignment: Text.AlignVCenter + } + visible: d.pageIndex === 0 + onClicked: { + d.pageIndex = 1 + } + } + FluTextButton{ + width: parent.width + anchors.centerIn: parent + contentItem: FluText { + text: d.displayDate.toLocaleString(FluApp.locale, "yyyy") + verticalAlignment: Text.AlignVCenter + } + visible: d.pageIndex === 1 + onClicked: { + d.pageIndex = 2 + } + } + FluTextButton{ + width: parent.width + anchors.centerIn: parent + contentItem: FluText { + text: "%1-%2".arg(d.yearRing.x).arg(d.yearRing.y) + verticalAlignment: Text.AlignVCenter + textColor: FluTheme.fontTertiaryColor + } + visible: d.pageIndex === 2 + } + } + FluIconButton{ + id:icon_up + iconSource: FluentIcons.CaretUpSolid8 + iconSize: 10 + onClicked: { + d.previousButton() + } + } + FluIconButton{ + id:icon_down + iconSource: FluentIcons.CaretDownSolid8 + iconSize: 10 + Layout.rightMargin: parent.spacing + onClicked: { + d.nextButton() + } + } + } + FluDivider{ + width: parent.width + height: 1 + anchors.bottom: parent.bottom + } + } + Item{ + Layout.fillWidth: true + Layout.fillHeight: true + StackView{ + id:stack_view + anchors.fill: parent + initialItem: com_page_one + replaceEnter : Transition{ + OpacityAnimator{ + from: 0 + to: 1 + duration: 83 + } + ScaleAnimator{ + from: 0.5 + to: 1 + duration: 167 + easing.type: Easing.OutCubic + } + } + replaceExit : Transition{ + OpacityAnimator{ + from: 1 + to: 0 + duration: 83 + } + ScaleAnimator{ + from: 1.0 + to: 0.5 + duration: 167 + easing.type: Easing.OutCubic + } + } + } + Connections{ + target: d + function onPageIndexChanged(){ + if(d.pageIndex === 0){ + stack_view.replace(com_page_one) + } + if(d.pageIndex === 1){ + stack_view.replace(com_page_two) + } + if(d.pageIndex === 2){ + stack_view.replace(com_page_three) + } + } + } + Component{ + id:com_page_three + GridView{ + id:grid_view + cellHeight: 75 + cellWidth: 75 + clip: true + boundsBehavior: GridView.StopAtBounds + ScrollBar.vertical: FluScrollBar {} + model: { + var fromYear = calender_model.from.getFullYear() + var toYear = calender_model.to.getFullYear() + return toYear-fromYear+1 + } + highlightRangeMode: GridView.StrictlyEnforceRange + onCurrentIndexChanged:{ + var year = currentIndex + calender_model.from.getFullYear() + var start = Math.ceil(year / 10) * 10 + var end = start+10 + d.yearRing = Qt.point(start,end) + } + highlightMoveDuration: 100 + Component.onCompleted: { + grid_view.highlightMoveDuration = 0 + currentIndex = d.displayDate.getFullYear()-calender_model.from.getFullYear() + timer_delay.restart() + } + Connections{ + target: d + function onNextButton(){ + grid_view.currentIndex = Math.min(grid_view.currentIndex+16,grid_view.count-1) + } + function onPreviousButton(){ + grid_view.currentIndex = Math.max(grid_view.currentIndex-16,0) + } + } + Timer{ + id:timer_delay + interval: 100 + onTriggered: { + grid_view.highlightMoveDuration = 100 + } + } + currentIndex: -1 + delegate: Item{ + property int year : calender_model.from.getFullYear()+modelData + property bool toYear: year === d.toDay.getFullYear() + implicitHeight: 75 + implicitWidth: 75 + FluControl{ + id:control_delegate + width: 60 + height: 60 anchors.centerIn: parent - contentItem: FluText { - text: d.displayDate.toLocaleString(FluApp.locale, "MMMM yyyy") - verticalAlignment: Text.AlignVCenter + Rectangle{ + width: 48 + height: 48 + radius: width/2 + color: { + if(toYear){ + if(control_delegate.pressed){ + return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) + } + if(control_delegate.hovered){ + return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.1) : Qt.lighter(FluTheme.primaryColor,1.1) + } + return FluTheme.primaryColor + }else{ + if(control_delegate.pressed){ + return FluTheme.itemPressColor + } + if(control_delegate.hovered){ + return FluTheme.itemHoverColor + } + return FluColors.Transparent + } + } + anchors.centerIn: parent + } + + FluText{ + text: year + anchors.centerIn: parent + opacity: { + if(year >= d.yearRing.x && year <= d.yearRing.y){ + return 1 + } + if(control_delegate.hovered){ + return 1 + } + return 0.3 + } + color: { + if(toYear){ + return FluColors.White + } + if(control_delegate.pressed){ + return FluTheme.dark ? FluColors.Grey100 : FluColors.Grey100 + } + if(control_delegate.hovered){ + return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 + } + return FluTheme.dark ? FluColors.White : FluColors.Grey220 + } } - visible: d.pageIndex === 0 onClicked: { + d.displayDate = new Date(year,0,1) d.pageIndex = 1 } } - FluTextButton{ - width: parent.width - anchors.centerIn: parent - contentItem: FluText { - text: d.displayDate.toLocaleString(FluApp.locale, "yyyy") - verticalAlignment: Text.AlignVCenter - } - visible: d.pageIndex === 1 - onClicked: { - d.pageIndex = 2 - } - } - FluTextButton{ - width: parent.width - anchors.centerIn: parent - contentItem: FluText { - text: "%1-%2".arg(d.yearRing.x).arg(d.yearRing.y) - verticalAlignment: Text.AlignVCenter - textColor: FluTheme.fontTertiaryColor - } - visible: d.pageIndex === 2 - } } - FluIconButton{ - id:icon_up - iconSource: FluentIcons.CaretUpSolid8 - iconSize: 10 - onClicked: { - d.previousButton() - } - } - FluIconButton{ - id:icon_down - iconSource: FluentIcons.CaretDownSolid8 - iconSize: 10 - Layout.rightMargin: parent.spacing - onClicked: { - d.nextButton() - } - } - } - FluDivider{ - width: parent.width - height: 1 - anchors.bottom: parent.bottom } } - Item{ - Layout.fillWidth: true - Layout.fillHeight: true - StackView{ - id:stack_view - anchors.fill: parent - initialItem: com_page_one - replaceEnter : Transition{ - OpacityAnimator{ - from: 0 - to: 1 - duration: 83 - } - ScaleAnimator{ - from: 0.5 - to: 1 - duration: 167 - easing.type: Easing.OutCubic - } - } - replaceExit : Transition{ - OpacityAnimator{ - from: 1 - to: 0 - duration: 83 - } - ScaleAnimator{ - from: 1.0 - to: 0.5 - duration: 167 - easing.type: Easing.OutCubic - } - } - } - Connections{ - target: d - function onPageIndexChanged(){ - if(d.pageIndex === 0){ - stack_view.replace(com_page_one) - } - if(d.pageIndex === 1){ - stack_view.replace(com_page_two) - } - if(d.pageIndex === 2){ - stack_view.replace(com_page_three) - } - } - } - Component{ - id:com_page_three - GridView{ - id:grid_view - cellHeight: 75 - cellWidth: 75 - clip: true - boundsBehavior: GridView.StopAtBounds - ScrollBar.vertical: FluScrollBar {} - model: { - var fromYear = calender_model.from.getFullYear() - var toYear = calender_model.to.getFullYear() - return toYear-fromYear+1 - } - highlightRangeMode: GridView.StrictlyEnforceRange - onCurrentIndexChanged:{ - var year = currentIndex + calender_model.from.getFullYear() - var start = Math.ceil(year / 10) * 10 - var end = start+10 - d.yearRing = Qt.point(start,end) - } - highlightMoveDuration: 100 - Component.onCompleted: { - grid_view.highlightMoveDuration = 0 - currentIndex = d.displayDate.getFullYear()-calender_model.from.getFullYear() - timer_delay.restart() - } - Connections{ - target: d - function onNextButton(){ - grid_view.currentIndex = Math.min(grid_view.currentIndex+16,grid_view.count-1) - } - function onPreviousButton(){ - grid_view.currentIndex = Math.max(grid_view.currentIndex-16,0) - } - } - Timer{ - id:timer_delay - interval: 100 - onTriggered: { - grid_view.highlightMoveDuration = 100 - } - } - currentIndex: -1 - delegate: Item{ - property int year : calender_model.from.getFullYear()+modelData - property bool toYear: year === d.toDay.getFullYear() - implicitHeight: 75 - implicitWidth: 75 - FluControl{ - id:control_delegate - width: 60 - height: 60 - anchors.centerIn: parent - Rectangle{ - width: 48 - height: 48 - radius: width/2 - color: { - if(toYear){ - if(control_delegate.pressed){ - return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) - } - if(control_delegate.hovered){ - return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.1) : Qt.lighter(FluTheme.primaryColor,1.1) - } - return FluTheme.primaryColor - }else{ - if(control_delegate.pressed){ - return FluTheme.itemPressColor - } - if(control_delegate.hovered){ - return FluTheme.itemHoverColor - } - return FluColors.Transparent - } - } - anchors.centerIn: parent - } + Component{ + id:com_page_two - FluText{ - text: year - anchors.centerIn: parent - opacity: { - if(year >= d.yearRing.x && year <= d.yearRing.y){ - return 1 - } - if(control_delegate.hovered){ - return 1 - } - return 0.3 - } - color: { - if(toYear){ - return FluColors.White - } - if(control_delegate.pressed){ - return FluTheme.dark ? FluColors.Grey100 : FluColors.Grey100 - } - if(control_delegate.hovered){ - return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 - } - return FluTheme.dark ? FluColors.White : FluColors.Grey220 - } - } - onClicked: { - d.displayDate = new Date(year,0,1) - d.pageIndex = 1 - } - } + ListView{ + id:listview + ScrollBar.vertical: FluScrollBar {} + highlightRangeMode: ListView.StrictlyEnforceRange + clip: true + boundsBehavior: ListView.StopAtBounds + spacing: 0 + highlightMoveDuration: 100 + model: { + var fromYear = calender_model.from.getFullYear() + var toYear = calender_model.to.getFullYear() + var yearsArray = [] + for (var i = fromYear; i <= toYear; i++) { + yearsArray.push(i) + } + return yearsArray + } + currentIndex: -1 + onCurrentIndexChanged:{ + var year = model[currentIndex] + var month = d.displayDate.getMonth() + d.displayDate = new Date(year,month,1) + } + Connections{ + target: d + function onNextButton(){ + listview.currentIndex = Math.min(listview.currentIndex+1,listview.count-1) + } + function onPreviousButton(){ + listview.currentIndex = Math.max(listview.currentIndex-1,0) } } - } - Component{ - id:com_page_two - - ListView{ - id:listview - ScrollBar.vertical: FluScrollBar {} - highlightRangeMode: ListView.StrictlyEnforceRange - clip: true - boundsBehavior: ListView.StopAtBounds - spacing: 0 - highlightMoveDuration: 100 - model: { - var fromYear = calender_model.from.getFullYear() - var toYear = calender_model.to.getFullYear() - var yearsArray = [] - for (var i = fromYear; i <= toYear; i++) { - yearsArray.push(i) - } - return yearsArray - } - currentIndex: -1 - onCurrentIndexChanged:{ - var year = model[currentIndex] - var month = d.displayDate.getMonth() - d.displayDate = new Date(year,month,1) - } - Connections{ - target: d - function onNextButton(){ - listview.currentIndex = Math.min(listview.currentIndex+1,listview.count-1) - } - function onPreviousButton(){ - listview.currentIndex = Math.max(listview.currentIndex-1,0) - } - } - Component.onCompleted: { - listview.highlightMoveDuration = 0 - currentIndex = model.indexOf(d.displayDate.getFullYear()) - timer_delay.restart() - } - Timer{ - id:timer_delay - interval: 100 - onTriggered: { - listview.highlightMoveDuration = 100 - } - } - delegate: Item{ - id:layout_congrol - property int year : modelData - width: listview.width - height: 75*3 - GridView{ - anchors.fill: parent - cellHeight: 75 - cellWidth: 75 - clip: true - interactive: false - boundsBehavior: GridView.StopAtBounds - model: 12 - delegate: Item{ - property int month : modelData - property bool toMonth: layout_congrol.year === d.toDay.getFullYear() && month === d.toDay.getMonth() - implicitHeight: 75 - implicitWidth: 75 - FluControl{ - id:control_delegate - width: 60 - height: 60 - anchors.centerIn: parent - Rectangle{ - width: 48 - height: 48 - radius: width/2 - color: { - if(toMonth){ - if(control_delegate.pressed){ - return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) - } - if(control_delegate.hovered){ - return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.1) : Qt.lighter(FluTheme.primaryColor,1.1) - } - return FluTheme.primaryColor - }else{ - if(control_delegate.pressed){ - return FluTheme.itemPressColor - } - if(control_delegate.hovered){ - return FluTheme.itemHoverColor - } - return FluColors.Transparent - } - } - anchors.centerIn: parent - } - FluText{ - text: new Date(layout_congrol.year,month).toLocaleString(FluApp.locale, "MMMM") - anchors.centerIn: parent - opacity: { - if(layout_congrol.year === d.displayDate.getFullYear()){ - return 1 - } - if(control_delegate.hovered){ - return 1 - } - return 0.3 - } - color: { - if(toMonth){ - return FluColors.White - } - if(control_delegate.pressed){ - return FluTheme.dark ? FluColors.Grey100 : FluColors.Grey100 - } - if(control_delegate.hovered){ - return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 - } - return FluTheme.dark ? FluColors.White : FluColors.Grey220 - } - } - onClicked: { - d.displayDate = new Date(layout_congrol.year,month) - d.pageIndex = 0 - } - } - } - } + Component.onCompleted: { + listview.highlightMoveDuration = 0 + currentIndex = model.indexOf(d.displayDate.getFullYear()) + timer_delay.restart() + } + Timer{ + id:timer_delay + interval: 100 + onTriggered: { + listview.highlightMoveDuration = 100 } } - } - Component{ - id:com_page_one - ColumnLayout { - DayOfWeekRow { - id: dayOfWeekRow - locale: FluApp.locale - font: FluTextStyle.Body - delegate: Label { - text: model.shortName - font: dayOfWeekRow.font - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - Layout.column: 1 - Layout.fillWidth: true - } - ListView{ - id:listview - property bool isCompleted: false - Layout.fillWidth: true - Layout.fillHeight: true - highlightRangeMode: ListView.StrictlyEnforceRange + delegate: Item{ + id:layout_congrol + property int year : modelData + width: listview.width + height: 75*3 + GridView{ + anchors.fill: parent + cellHeight: 75 + cellWidth: 75 clip: true - boundsBehavior: ListView.StopAtBounds - spacing: 0 - highlightMoveDuration: 100 - currentIndex: -1 - ScrollBar.vertical: FluScrollBar {} - onCurrentIndexChanged:{ - if(isCompleted){ - var month = calender_model.monthAt(currentIndex) - var year = calender_model.yearAt(currentIndex) - d.displayDate = new Date(year,month,1) - } - } - Component.onCompleted: { - listview.model = calender_model - listview.highlightMoveDuration = 0 - currentIndex = calender_model.indexOf(d.displayDate) - timer_delay.restart() - isCompleted = true - } - Timer{ - id:timer_delay - interval: 100 - onTriggered: { - listview.highlightMoveDuration = 100 - } - } - Connections{ - target: d - function onNextButton(){ - listview.currentIndex = Math.min(listview.currentIndex+1,listview.count-1) - } - function onPreviousButton(){ - listview.currentIndex = Math.max(listview.currentIndex-1,0) - } - } - delegate: MonthGrid { - id: grid - width: listview.width - height: listview.height - month: model.month - year: model.year - spacing: 0 - locale: FluApp.locale - delegate: FluControl { - required property bool today - required property int year - required property int month - required property int day - required property int visibleMonth - id: control_delegate - visibleMonth: grid.month - implicitHeight: 40 - implicitWidth: 40 + interactive: false + boundsBehavior: GridView.StopAtBounds + model: 12 + delegate: Item{ + property int month : modelData + property bool toMonth: layout_congrol.year === d.toDay.getFullYear() && month === d.toDay.getMonth() + implicitHeight: 75 + implicitWidth: 75 + FluControl{ + id:control_delegate + width: 60 + height: 60 + anchors.centerIn: parent Rectangle{ - width: 34 - height: 34 + width: 48 + height: 48 radius: width/2 color: { - if(today){ + if(toMonth){ if(control_delegate.pressed){ return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) } @@ -545,31 +403,11 @@ FluButton { } anchors.centerIn: parent } - Rectangle{ - width: 40 - height: 40 - border.width: 1 - anchors.centerIn: parent - radius: width/2 - border.color: FluTheme.primaryColor - color: FluColors.Transparent - visible: { - if(control.current){ - var y = control.current.getFullYear() - var m = control.current.getMonth() - var d = control.current.getDate() - if(y === year && m === month && d === day){ - return true - } - return false - } - return false - } - } FluText{ - text: day + text: new Date(layout_congrol.year,month).toLocaleString(FluApp.locale, "MMMM") + anchors.centerIn: parent opacity: { - if(month === grid.month){ + if(layout_congrol.year === d.displayDate.getFullYear()){ return 1 } if(control_delegate.hovered){ @@ -577,9 +415,8 @@ FluButton { } return 0.3 } - anchors.centerIn: parent color: { - if(today){ + if(toMonth){ return FluColors.White } if(control_delegate.pressed){ @@ -592,17 +429,173 @@ FluButton { } } onClicked: { - control.current = new Date(year,month,day) - control.accepted() - popup.close() + d.displayDate = new Date(layout_congrol.year,month) + d.pageIndex = 0 } } - background: Item { - x: grid.leftPadding - y: grid.topPadding - width: grid.availableWidth - height: grid.availableHeight + } + } + } + } + } + Component{ + id:com_page_one + ColumnLayout { + DayOfWeekRow { + id: dayOfWeekRow + locale: FluApp.locale + font: FluTextStyle.Body + delegate: Label { + text: model.shortName + font: dayOfWeekRow.font + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + Layout.column: 1 + Layout.fillWidth: true + } + ListView{ + id:listview + property bool isCompleted: false + Layout.fillWidth: true + Layout.fillHeight: true + highlightRangeMode: ListView.StrictlyEnforceRange + clip: true + boundsBehavior: ListView.StopAtBounds + spacing: 0 + highlightMoveDuration: 100 + currentIndex: -1 + ScrollBar.vertical: FluScrollBar {} + onCurrentIndexChanged:{ + if(isCompleted){ + var month = calender_model.monthAt(currentIndex) + var year = calender_model.yearAt(currentIndex) + d.displayDate = new Date(year,month,1) + } + } + Component.onCompleted: { + listview.model = calender_model + listview.highlightMoveDuration = 0 + currentIndex = calender_model.indexOf(d.displayDate) + timer_delay.restart() + isCompleted = true + } + Timer{ + id:timer_delay + interval: 100 + onTriggered: { + listview.highlightMoveDuration = 100 + } + } + Connections{ + target: d + function onNextButton(){ + listview.currentIndex = Math.min(listview.currentIndex+1,listview.count-1) + } + function onPreviousButton(){ + listview.currentIndex = Math.max(listview.currentIndex-1,0) + } + } + delegate: MonthGrid { + id: grid + width: listview.width + height: listview.height + month: model.month + year: model.year + spacing: 0 + locale: FluApp.locale + delegate: FluControl { + required property bool today + required property int year + required property int month + required property int day + required property int visibleMonth + id: control_delegate + visibleMonth: grid.month + implicitHeight: 40 + implicitWidth: 40 + Rectangle{ + width: 34 + height: 34 + radius: width/2 + color: { + if(today){ + if(control_delegate.pressed){ + return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.2) : Qt.lighter(FluTheme.primaryColor,1.2) + } + if(control_delegate.hovered){ + return FluTheme.dark ? Qt.darker(FluTheme.primaryColor,1.1) : Qt.lighter(FluTheme.primaryColor,1.1) + } + return FluTheme.primaryColor + }else{ + if(control_delegate.pressed){ + return FluTheme.itemPressColor + } + if(control_delegate.hovered){ + return FluTheme.itemHoverColor + } + return FluColors.Transparent + } + } + anchors.centerIn: parent } + Rectangle{ + width: 40 + height: 40 + border.width: 1 + anchors.centerIn: parent + radius: width/2 + border.color: FluTheme.primaryColor + color: FluColors.Transparent + visible: { + if(control.current){ + var y = control.current.getFullYear() + var m = control.current.getMonth() + var d = control.current.getDate() + if(y === year && m === month && d === day){ + return true + } + return false + } + return false + } + } + FluText{ + text: day + opacity: { + if(month === grid.month){ + return 1 + } + if(control_delegate.hovered){ + return 1 + } + return 0.3 + } + anchors.centerIn: parent + color: { + if(today){ + return FluColors.White + } + if(control_delegate.pressed){ + return FluTheme.dark ? FluColors.Grey100 : FluColors.Grey100 + } + if(control_delegate.hovered){ + return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 + } + return FluTheme.dark ? FluColors.White : FluColors.Grey220 + } + } + onClicked: { + control.current = new Date(year,month,day) + control.accepted() + popup.close() + } + } + background: Item { + x: grid.leftPadding + y: grid.topPadding + width: grid.availableWidth + height: grid.availableHeight } } } @@ -611,21 +604,23 @@ FluButton { } } } - background: Item{ + background:Rectangle{ + radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) FluShadow{ - radius: 4 + radius: 5 } } function showPopup() { var pos = control.mapToItem(null, 0, 0) if(d.window.height>pos.y+control.height+container.height){ - popup.y = control.height + popup.y = control.height - 1 } else if(pos.y>container.height){ popup.y = -container.height } else { popup.y = d.window.height-(pos.y+container.height) } - popup.x = -(popup.width-control.width)/2 popup.open() } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluColorPicker.qml b/src/Qt6/imports/FluentUI/Controls/FluColorPicker.qml index 72728a56..c22eb090 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluColorPicker.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluColorPicker.qml @@ -13,16 +13,15 @@ Button{ property color current : Qt.rgba(1,1,1,1) signal accepted() property int colorHandleRadius: 8 - property string cancelText: "取消" - property string okText: "确定" - property string titleText: "颜色选择器" - property string editText: "编辑颜色" - property string redText: "红色" - property string greenText: "绿色" - property string blueText: "蓝色" - property string opacityText: "透明度" - background: - Rectangle{ + property string cancelText: qsTr("Cancel") + property string okText: qsTr("OK") + property string titleText: qsTr("Color Picker") + property string editText: qsTr("Edit Color") + property string redText: qsTr("Red") + property string greenText: qsTr("Green") + property string blueText: qsTr("Blue") + property string opacityText: qsTr("Opacity") + background: Rectangle{ id:layout_color radius: 5 color:"#00000000" diff --git a/src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml b/src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml index bcd984bc..7afd1ca3 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml @@ -41,7 +41,7 @@ FluButton { id:divider_1 width: 1 x: parent.width/3 - height: parent.height-1 + height: parent.height - 1 color: control.dividerColor visible: showYear } @@ -49,7 +49,7 @@ FluButton { id:divider_2 width: 1 x: showYear ? parent.width*2/3 : parent.width/2 - height: parent.height-1 + height: parent.height - 1 color: control.dividerColor } FluText{ @@ -95,8 +95,6 @@ FluButton { Menu{ id:popup modal: true - width: container.width - height: container.height Overlay.modal: Item {} enter: Transition { reversible: true @@ -115,227 +113,220 @@ FluButton { duration: FluTheme.animationEnabled ? 83 : 0 } } - background:Item{ + background:Rectangle{ + radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) FluShadow{ - radius: 4 + radius: 5 } } contentItem: Item{ - clip: true - Rectangle{ - id:container - radius: 4 - width: 300 - height: 340 - color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) - MouseArea{ - anchors.fill: parent - } - FluShadow{ - radius: 4 - } - RowLayout{ - id:layout_content - spacing: 0 - width: parent.width - height: 300 - Component{ - id:list_delegate - Item{ - height:38 - width:getListView().width - function getListView(){ - if(type === 0) - return list_view_1 - if(type === 1) - return list_view_2 - if(type === 2) - return list_view_3 + id:container + implicitHeight: 340 + implicitWidth: 300 + MouseArea{ + anchors.fill: parent + } + RowLayout{ + id:layout_content + spacing: 0 + width: parent.width + height: 280 + Component{ + id:list_delegate + Item{ + height: 38 + width: getListView().width + function getListView(){ + if(type === 0) + return list_view_1 + if(type === 1) + return list_view_2 + if(type === 2) + return list_view_3 + } + Rectangle{ + anchors.fill: parent + anchors.topMargin: 2 + anchors.bottomMargin: 2 + anchors.leftMargin: 5 + anchors.rightMargin: 5 + color: { + if(getListView().currentIndex === position){ + return item_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor,1.1): FluTheme.primaryColor + } + if(item_mouse.containsMouse){ + return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) + } + return Qt.rgba(0,0,0,0) } - Rectangle{ + radius: 3 + MouseArea{ + id:item_mouse anchors.fill: parent - anchors.topMargin: 2 - anchors.bottomMargin: 2 - anchors.leftMargin: 5 - anchors.rightMargin: 5 - color: { + hoverEnabled: true + onClicked: { + getListView().currentIndex = position + if(type === 0){ + text_year.text = model + list_view_2.model = generateMonthArray(1,12) + text_month.text = list_view_2.model[list_view_2.currentIndex] + + list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) + text_day.text = list_view_3.model[list_view_3.currentIndex] + } + if(type === 1){ + text_month.text = model + list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) + text_day.text = list_view_3.model[list_view_3.currentIndex] + + } + if(type === 2){ + text_day.text = model + } + } + } + FluText{ + text:model + color: { if(getListView().currentIndex === position){ - return item_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor,1.1): FluTheme.primaryColor - } - if(item_mouse.containsMouse){ - return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) - } - return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0) - } - radius: 3 - MouseArea{ - id:item_mouse - anchors.fill: parent - hoverEnabled: true - onClicked: { - getListView().currentIndex = position - if(type === 0){ - text_year.text = model - list_view_2.model = generateMonthArray(1,12) - text_month.text = list_view_2.model[list_view_2.currentIndex] - - list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) - text_day.text = list_view_3.model[list_view_3.currentIndex] - } - if(type === 1){ - text_month.text = model - list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) - text_day.text = list_view_3.model[list_view_3.currentIndex] - - } - if(type === 2){ - text_day.text = model - } - } - } - FluText{ - text:model - color: { - if(getListView().currentIndex === position){ - if(FluTheme.dark){ - return Qt.rgba(0,0,0,1) - }else{ - return Qt.rgba(1,1,1,1) - } + if(FluTheme.dark){ + return Qt.rgba(0,0,0,1) }else{ - return FluTheme.dark ? "#FFFFFF" : "#1A1A1A" + return Qt.rgba(1,1,1,1) } + }else{ + return FluTheme.dark ? "#FFFFFF" : "#1A1A1A" } - anchors.centerIn: parent } + anchors.centerIn: parent } } } - ListView{ - id:list_view_1 - width: 100 - height: parent.height - boundsBehavior:Flickable.StopAtBounds - ScrollBar.vertical: FluScrollBar {} - model: generateYearArray(1924,2048) - clip: true - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - visible: showYear - delegate: FluLoader{ - property var model: modelData - property int type:0 - property int position:index - sourceComponent: list_delegate - } - } - Rectangle{ - width: 1 - height: parent.height - color: control.dividerColor - } - ListView{ - id:list_view_2 - width: showYear ? 100 : 150 - height: parent.height - clip: true - ScrollBar.vertical: FluScrollBar {} - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - boundsBehavior:Flickable.StopAtBounds - delegate: FluLoader{ - property var model: modelData - property int type:1 - property int position:index - sourceComponent: list_delegate - } - } - Rectangle{ - width: 1 - height: parent.height - color: control.dividerColor - } - ListView{ - id:list_view_3 - width: showYear ? 100 : 150 - height: parent.height - clip: true - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - ScrollBar.vertical: FluScrollBar {} - Layout.alignment: Qt.AlignVCenter - boundsBehavior:Flickable.StopAtBounds - delegate: FluLoader{ - property var model: modelData - property int type:2 - property int position:index - sourceComponent: list_delegate - } + } + ListView{ + id:list_view_1 + Layout.preferredWidth: 100 + Layout.preferredHeight: parent.height - 2 + Layout.alignment: Qt.AlignVCenter + boundsBehavior:Flickable.StopAtBounds + ScrollBar.vertical: FluScrollBar {} + model: generateYearArray(1924,2048) + clip: true + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + visible: showYear + delegate: FluLoader{ + property var model: modelData + property int type:0 + property int position:index + sourceComponent: list_delegate } } Rectangle{ - width: parent.width - height: 1 - anchors.top: layout_content.bottom + Layout.preferredWidth: 1 + Layout.preferredHeight: parent.height + color: control.dividerColor + visible: showYear + } + ListView{ + id:list_view_2 + Layout.preferredWidth: showYear ? 99 : 150 + Layout.preferredHeight: parent.height - 2 + Layout.alignment: Qt.AlignVCenter + clip: true + ScrollBar.vertical: FluScrollBar {} + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + boundsBehavior:Flickable.StopAtBounds + delegate: FluLoader{ + property var model: modelData + property int type:1 + property int position:index + sourceComponent: list_delegate + } + } + Rectangle{ + Layout.preferredWidth: 1 + Layout.preferredHeight: parent.height color: control.dividerColor } - Rectangle{ - id:layout_actions - height: 40 - radius: 5 - color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + ListView{ + id:list_view_3 + Layout.preferredWidth: showYear ? 99 : 150 + Layout.preferredHeight: parent.height - 2 + Layout.alignment: Qt.AlignVCenter + clip: true + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + ScrollBar.vertical: FluScrollBar {} + boundsBehavior:Flickable.StopAtBounds + delegate: FluLoader{ + property var model: modelData + property int type:2 + property int position:index + sourceComponent: list_delegate + } + } + } + Rectangle{ + id:layout_actions + height: 60 + color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) + radius: 5 + anchors{ + bottom:parent.bottom + left: parent.left + right: parent.right + } + Item { + id:divider + width: 1 + height: parent.height + anchors.centerIn: parent + } + FluButton{ anchors{ - bottom:parent.bottom left: parent.left + leftMargin: 20 + rightMargin: 10 + right: divider.left + verticalCenter: parent.verticalCenter + } + text: control.cancelText + onClicked: { + popup.close() + } + } + FluFilledButton{ + anchors{ right: parent.right + left: divider.right + rightMargin: 20 + leftMargin: 10 + verticalCenter: parent.verticalCenter } - Item { - id:divider - width: 1 - height: parent.height - anchors.centerIn: parent - } - FluButton{ - anchors{ - left: parent.left - leftMargin: 20 - rightMargin: 10 - right: divider.left - verticalCenter: parent.verticalCenter - } - text: control.cancelText - onClicked: { - popup.close() - } - } - FluFilledButton{ - anchors{ - right: parent.right - left: divider.right - rightMargin: 20 - leftMargin: 10 - verticalCenter: parent.verticalCenter - } - text: control.okText - onClicked: { - d.changeFlag = false - popup.close() - const year = text_year.text - const month = text_month.text - const day = text_day.text - const date = new Date() - date.setFullYear(parseInt(year)); - date.setMonth(parseInt(month) - 1); - date.setDate(parseInt(day)); - date.setHours(0); - date.setMinutes(0); - date.setSeconds(0); - current = date - control.accepted() - } + text: control.okText + onClicked: { + d.changeFlag = false + popup.close() + const year = text_year.text + const month = text_month.text + const day = text_day.text + const date = new Date() + date.setFullYear(parseInt(year)); + date.setMonth(parseInt(month) - 1); + date.setDate(parseInt(day)); + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + current = date + control.accepted() } } } @@ -360,7 +351,7 @@ FluButton { text_day.text = day var pos = control.mapToItem(null, 0, 0) if(d.window.height>pos.y+control.height+container.height){ - popup.y = control.height + popup.y = control.height-1 } else if(pos.y>container.height){ popup.y = -container.height } else { diff --git a/src/Qt6/imports/FluentUI/Controls/FluTimePicker.qml b/src/Qt6/imports/FluentUI/Controls/FluTimePicker.qml index e32212b4..7b70229b 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTimePicker.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTimePicker.qml @@ -58,14 +58,14 @@ FluButton { id: divider_1 width: 1 x: isH ? parent.width/3 : parent.width/2 - height: parent.height-1 + height: parent.height - 1 color: dividerColor } Rectangle{ id: divider_2 width: 1 x: parent.width*2/3 - height: parent.height-1 + height: parent.height - 1 color: dividerColor visible: isH } @@ -111,8 +111,6 @@ FluButton { } Menu{ id:popup - width: container.width - height: container.height modal: true Overlay.modal: Item {} enter: Transition { @@ -132,224 +130,219 @@ FluButton { duration: FluTheme.animationEnabled ? 83 : 0 } } - background:Item{ + background:Rectangle{ + radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) FluShadow{ - radius: 4 + radius: 5 } } contentItem: Item{ - clip: true - Rectangle{ - id:container - height: 340 - width: 300 - radius: 4 - color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) - MouseArea{ - anchors.fill: parent - } - RowLayout{ - id:layout_content - spacing: 0 - width: parent.width - height: 300 - Component{ - id:list_delegate - Item{ - height:38 - width:getListView().width - function getListView(){ - if(type === 0) - return list_view_1 - if(type === 1) - return list_view_2 - if(type === 2) - return list_view_3 + id:container + implicitHeight: 340 + implicitWidth: 300 + MouseArea{ + anchors.fill: parent + } + RowLayout{ + id:layout_content + spacing: 0 + width: parent.width + height: 280 + Component{ + id:list_delegate + Item{ + height:38 + width:getListView().width + function getListView(){ + if(type === 0) + return list_view_1 + if(type === 1) + return list_view_2 + if(type === 2) + return list_view_3 + } + Rectangle{ + anchors.fill: parent + anchors.topMargin: 2 + anchors.bottomMargin: 2 + anchors.leftMargin: 5 + anchors.rightMargin: 5 + color: { + if(getListView().currentIndex === position){ + return item_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor,1.1) : FluTheme.primaryColor + } + if(item_mouse.containsMouse){ + return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) + } + return Qt.rgba(0,0,0,0) } - Rectangle{ + radius: 3 + MouseArea{ + id:item_mouse anchors.fill: parent - anchors.topMargin: 2 - anchors.bottomMargin: 2 - anchors.leftMargin: 5 - anchors.rightMargin: 5 - color: { + hoverEnabled: true + onClicked: { + getListView().currentIndex = position + if(type === 0){ + text_hour.text = model + } + if(type === 1){ + text_minute.text = model + } + if(type === 2){ + text_ampm.text = model + } + } + } + FluText{ + text:model + color: { if(getListView().currentIndex === position){ - return item_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor,1.1) : FluTheme.primaryColor - } - if(item_mouse.containsMouse){ - return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) - } - return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0) - } - radius: 3 - MouseArea{ - id:item_mouse - anchors.fill: parent - hoverEnabled: true - onClicked: { - getListView().currentIndex = position - if(type === 0){ - text_hour.text = model - } - if(type === 1){ - text_minute.text = model - } - if(type === 2){ - text_ampm.text = model - } - } - } - FluText{ - text:model - color: { - if(getListView().currentIndex === position){ - if(FluTheme.dark){ - return Qt.rgba(0,0,0,1) - }else{ - return Qt.rgba(1,1,1,1) - } + if(FluTheme.dark){ + return Qt.rgba(0,0,0,1) }else{ - return FluTheme.dark ? "#FFFFFF" : "#1A1A1A" + return Qt.rgba(1,1,1,1) } + }else{ + return FluTheme.dark ? "#FFFFFF" : "#1A1A1A" } - anchors.centerIn: parent } + anchors.centerIn: parent } } } - ListView{ - id:list_view_1 - width: isH ? 100 : 150 - height: parent.height - boundsBehavior:Flickable.StopAtBounds - ScrollBar.vertical: FluScrollBar {} - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - model: isH ? generateArray(1,12) : generateArray(0,23) - clip: true - delegate: FluLoader{ - property var model: modelData - property int type:0 - property int position:index - sourceComponent: list_delegate - } - } - Rectangle{ - width: 1 - height: parent.height - color: control.dividerColor - } - ListView{ - id:list_view_2 - width: isH ? 100 : 150 - height: parent.height - model: generateArray(0,59) - clip: true - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - ScrollBar.vertical: FluScrollBar {} - boundsBehavior:Flickable.StopAtBounds - delegate: FluLoader{ - property var model: modelData - property int type:1 - property int position:index - sourceComponent: list_delegate - } - } - Rectangle{ - width: 1 - height: parent.height - color: control.dividerColor - visible: isH - } - ListView{ - id:list_view_3 - width: 100 - height: 76 - model: [control.amText,control.pmText] - clip: true - visible: isH - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 0 - ScrollBar.vertical: FluScrollBar {} - Layout.alignment: Qt.AlignVCenter - boundsBehavior:Flickable.StopAtBounds - delegate: FluLoader{ - property var model: modelData - property int type:2 - property int position:index - sourceComponent: list_delegate - } + } + ListView{ + id:list_view_1 + Layout.preferredWidth: isH ? 100 : 150 + Layout.preferredHeight: parent.height-2 + Layout.alignment: Qt.AlignVCenter + boundsBehavior:Flickable.StopAtBounds + ScrollBar.vertical: FluScrollBar {} + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + model: isH ? generateArray(1,12) : generateArray(0,23) + clip: true + delegate: FluLoader{ + property var model: modelData + property int type:0 + property int position:index + sourceComponent: list_delegate } } Rectangle{ - width: parent.width - height: 1 - anchors.top: layout_content.bottom + Layout.preferredWidth: 1 + Layout.preferredHeight: parent.height color: control.dividerColor } + ListView{ + id:list_view_2 + Layout.preferredWidth: isH ? 99 : 150 + Layout.preferredHeight: parent.height-2 + Layout.alignment: Qt.AlignVCenter + model: generateArray(0,59) + clip: true + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + ScrollBar.vertical: FluScrollBar {} + boundsBehavior:Flickable.StopAtBounds + delegate: FluLoader{ + property var model: modelData + property int type:1 + property int position:index + sourceComponent: list_delegate + } + } Rectangle{ - id:layout_actions - height: 40 - radius: 5 - color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + width: 1 + height: parent.height + color: control.dividerColor + visible: isH + } + ListView{ + id:list_view_3 + Layout.preferredWidth: 100 + Layout.preferredHeight: 76 + model: [control.amText,control.pmText] + clip: true + visible: isH + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 0 + ScrollBar.vertical: FluScrollBar {} + Layout.alignment: Qt.AlignVCenter + boundsBehavior:Flickable.StopAtBounds + delegate: FluLoader{ + property var model: modelData + property int type:2 + property int position:index + sourceComponent: list_delegate + } + } + } + Rectangle{ + id:layout_actions + height: 60 + color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) + radius: 5 + anchors{ + bottom:parent.bottom + left: parent.left + right: parent.right + } + Item { + id:divider + width: 1 + height: parent.height + anchors.centerIn: parent + } + FluButton{ anchors{ - bottom:parent.bottom left: parent.left + leftMargin: 20 + rightMargin: 10 + right: divider.left + verticalCenter: parent.verticalCenter + } + text: control.cancelText + onClicked: { + popup.close() + } + } + FluFilledButton{ + anchors{ right: parent.right + left: divider.right + rightMargin: 20 + leftMargin: 10 + verticalCenter: parent.verticalCenter } - Item { - id:divider - width: 1 - height: parent.height - anchors.centerIn: parent - } - FluButton{ - anchors{ - left: parent.left - leftMargin: 20 - rightMargin: 10 - right: divider.left - verticalCenter: parent.verticalCenter - } - text: control.cancelText - onClicked: { - popup.close() - } - } - FluFilledButton{ - anchors{ - right: parent.right - left: divider.right - rightMargin: 20 - leftMargin: 10 - verticalCenter: parent.verticalCenter - } - text: control.okText - onClicked: { - d.changeFlag = false - popup.close() - const hours = text_hour.text - const minutes = text_minute.text - const period = text_ampm.text - const date = new Date() - var hours24 = parseInt(hours); - if(control.hourFormat === FluTimePickerType.H){ - if (hours === "12") { - hours24 = (period === control.amText) ? 0 : 12; - } else { - hours24 = (period === control.pmText) ? hours24 : hours24 + 12; - } + text: control.okText + onClicked: { + d.changeFlag = false + popup.close() + const hours = text_hour.text + const minutes = text_minute.text + const period = text_ampm.text + const date = new Date() + var hours24 = parseInt(hours); + if(control.hourFormat === FluTimePickerType.H){ + if (hours === "12") { + hours24 = (period === control.amText) ? 0 : 12; + } else { + hours24 = (period === control.pmText) ? hours24 : hours24 + 12; } - date.setHours(hours24); - date.setMinutes(parseInt(minutes)); - date.setSeconds(0); - current = date - control.accepted() } + date.setHours(hours24); + date.setMinutes(parseInt(minutes)); + date.setSeconds(0); + current = date + control.accepted() } } } @@ -387,7 +380,7 @@ FluButton { } var pos = control.mapToItem(null, 0, 0) if(d.window.height>pos.y+control.height+container.height){ - popup.y = control.height + popup.y = control.height-1 } else if(pos.y>container.height){ popup.y = -container.height } else { diff --git a/src/fluentui_en_US.ts b/src/fluentui_en_US.ts index 1164cf23..79c2709b 100644 --- a/src/fluentui_en_US.ts +++ b/src/fluentui_en_US.ts @@ -70,6 +70,57 @@ + + FluColorPicker + + + + Cancel + + + + + + OK + + + + + + Color Picker + + + + + + Edit Color + + + + + + Red + + + + + + Green + + + + + + Blue + + + + + + Opacity + + + FluContentDialog @@ -94,31 +145,31 @@ FluDatePicker - + Year - + Month - + Day - + Cancel - + OK @@ -212,31 +263,37 @@ FluTimePicker + AM + PM + Hour + Minute + Cancel + OK @@ -265,8 +322,8 @@ FluWindow - - + + Loading... diff --git a/src/fluentui_zh_CN.ts b/src/fluentui_zh_CN.ts index d46cba0d..d76b222b 100644 --- a/src/fluentui_zh_CN.ts +++ b/src/fluentui_zh_CN.ts @@ -70,6 +70,57 @@ 选择日期 + + FluColorPicker + + + + Cancel + 取消 + + + + + OK + 确定 + + + + + Color Picker + 颜色选择器 + + + + + Edit Color + 编辑颜色 + + + + + Red + 红色 + + + + + Green + 绿色 + + + + + Blue + 蓝色 + + + + + Opacity + 透明度 + + FluContentDialog @@ -94,31 +145,31 @@ FluDatePicker - + Year - + Month - + Day - + Cancel 取消 - + OK 确定 @@ -212,31 +263,37 @@ FluTimePicker + AM 上午 + PM 下午 + Hour + Minute + Cancel 取消 + OK 确定 @@ -265,8 +322,8 @@ FluWindow - - + + Loading... 加载中... From bc4510077f04c1df8f1df64f1b3a2d2595312f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 19 Apr 2024 01:04:13 +0800 Subject: [PATCH 23/29] update --- src/Qt5/imports/FluentUI/Controls/FluComboBox.qml | 5 ++--- src/Qt5/imports/FluentUI/Controls/FluTableView.qml | 6 +++--- src/Qt6/imports/FluentUI/Controls/FluComboBox.qml | 5 ++--- src/Qt6/imports/FluentUI/Controls/FluTableView.qml | 6 +++--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml b/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml index bf0c955a..4618f2fd 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml @@ -134,10 +134,9 @@ T.ComboBox { } } background:Rectangle{ - color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1) - border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) - border.width: 1 radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) FluShadow{ radius: 5 } diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 8cb9c66b..97703723 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -778,9 +778,9 @@ Rectangle { timer_vertical_force_layout.restart() } Connections{ - target: table_model - function onRowCountChanged(){ - header_row_model.rows = Array.from({length: table_model.rows.length}, (_, i) => ({rowIndex:i+1})) + target: table_view + function onRowsChanged(){ + header_row_model.rows = Array.from({length: table_view.rows}, (_, i) => ({rowIndex:i+1})) } } Timer{ diff --git a/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml b/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml index 5c3c940a..6a89782b 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml @@ -134,10 +134,9 @@ T.ComboBox { } } background:Rectangle{ - color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1) - border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) - border.width: 1 radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) FluShadow{ radius: 5 } diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index 90b027a0..9f0b36c0 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -778,9 +778,9 @@ Rectangle { timer_vertical_force_layout.restart() } Connections{ - target: table_model - function onRowCountChanged(){ - header_row_model.rows = Array.from({length: table_model.rows.length}, (_, i) => ({rowIndex:i+1})) + target: table_view + function onRowsChanged(){ + header_row_model.rows = Array.from({length: table_view.rows}, (_, i) => ({rowIndex:i+1})) } } Timer{ From e8d79e3c7b8d023557da87ff0037afbdb2bbd334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 23 Apr 2024 00:31:20 +0800 Subject: [PATCH 24/29] update --- example/example_en_US.ts | 20 -------------- example/example_zh_CN.ts | 12 +++------ example/qml/App.qml | 1 + example/qml/page/T_StatusLayout.qml | 6 +---- example/qml/window/FluentInitializrWindow.qml | 2 +- example/src/helper/InitializrHelper.cpp | 2 +- example/src/main.cpp | 2 +- src/FluTheme.cpp | 8 +++--- .../FluentUI/Controls/FluBreadcrumbBar.qml | 6 ++--- .../FluentUI/Controls/FluStatusLayout.qml | 10 +++---- .../FluentUI/Controls/FluBreadcrumbBar.qml | 6 ++--- .../FluentUI/Controls/FluStatusLayout.qml | 10 +++---- src/fluentui_en_US.ts | 27 +++++++++++++++++++ src/fluentui_zh_CN.ts | 27 +++++++++++++++++++ 14 files changed, 84 insertions(+), 55 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 8cc746c7..7f61aa64 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -1930,26 +1930,6 @@ Some contents... StatusLayout - - - Loading... - - - - - Empty - - - - - The page went wrong... - - - - - Reload - - T_TabView diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 21da450f..950a363d 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -2053,24 +2053,20 @@ Some contents... 状态布局 - Loading... - 正在加载... + 正在加载... - Empty - 空空如也 + 空空如也 - The page went wrong... - 页面出错了... + 页面出错了... - Reload - 重新加载 + 重新加载 diff --git a/example/qml/App.qml b/example/qml/App.qml index 6d33206d..71cc09ca 100644 --- a/example/qml/App.qml +++ b/example/qml/App.qml @@ -34,6 +34,7 @@ FluLauncher { FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.animationEnabled = true + FluTheme.blurBehindWindowEnabled = true FluRouter.routes = { "/":"qrc:/example/qml/window/MainWindow.qml", "/about":"qrc:/example/qml/window/AboutWindow.qml", diff --git a/example/qml/page/T_StatusLayout.qml b/example/qml/page/T_StatusLayout.qml index bf5ffbf1..0ee85c81 100644 --- a/example/qml/page/T_StatusLayout.qml +++ b/example/qml/page/T_StatusLayout.qml @@ -60,12 +60,8 @@ FluScrollablePage{ FluStatusLayout{ id:status_view anchors.fill: parent - loadingText: qsTr("Loading...") - emptyText: qsTr("Empty") - errorText: qsTr("The page went wrong...") - errorButtonText: qsTr("Reload") onErrorClicked:{ - showError("Click Reload") + status_view.statusMode = FluStatusLayoutType.Loading } Rectangle { anchors.fill: parent diff --git a/example/qml/window/FluentInitializrWindow.qml b/example/qml/window/FluentInitializrWindow.qml index 7f4f8e9d..5ee9cff2 100644 --- a/example/qml/window/FluentInitializrWindow.qml +++ b/example/qml/window/FluentInitializrWindow.qml @@ -20,7 +20,7 @@ FluWindowDialog { showError(message) } function onSuccess(path){ - FluTools.showFileInFolder(path+"/CMakeLists.txt") + FluTools.showFileInFolder(path) window.close() } } diff --git a/example/src/helper/InitializrHelper.cpp b/example/src/helper/InitializrHelper.cpp index 59904bbd..39d54e37 100644 --- a/example/src/helper/InitializrHelper.cpp +++ b/example/src/helper/InitializrHelper.cpp @@ -97,5 +97,5 @@ void InitializrHelper::copyFile(const QString &source, const QString &dest) { copyFile(":/example/res/template/src/qml.qrc.in", projectDir.filePath("src/qml.qrc")); copyFile(":/example/res/template/src/logo.ico.in", projectDir.filePath("src/logo.ico")); copyFile(":/example/res/template/src/README.md.in", projectDir.filePath("src/README.md")); - return this->success(projectPath); + return this->success(projectPath+"/CMakeLists.txt"); } diff --git a/example/src/main.cpp b/example/src/main.cpp index e652ac85..bd80267c 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) QGuiApplication::setOrganizationName("ZhuZiChu"); QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QGuiApplication::setApplicationName("FluentUI"); - QGuiApplication::setApplicationDisplayName("FluentUI Exmaple"); + QGuiApplication::setApplicationDisplayName("FluentUI Example"); QGuiApplication::setApplicationVersion(APPLICATION_VERSION); QGuiApplication::setQuitOnLastWindowClosed(false); SettingsHelper::getInstance()->init(argv); diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 2880580c..cd1b5cb1 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -32,6 +32,7 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} { connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path){ Q_EMIT desktopImagePathChanged(); }); + connect(this, &FluTheme::blurBehindWindowEnabledChanged, this, [=] {checkUpdateDesktopImage();}); startTimer(1000); } @@ -74,6 +75,9 @@ bool FluTheme::dark() const { } void FluTheme::checkUpdateDesktopImage(){ + if(!_blurBehindWindowEnabled){ + return; + } QThreadPool::globalInstance()->start([=]() { _mutex.lock(); auto path = FluTools::getInstance()->getWallpaperFilePath(); @@ -90,7 +94,5 @@ void FluTheme::checkUpdateDesktopImage(){ void FluTheme::timerEvent(QTimerEvent *event) { - if(_blurBehindWindowEnabled){ - checkUpdateDesktopImage(); - } + checkUpdateDesktopImage(); } diff --git a/src/Qt5/imports/FluentUI/Controls/FluBreadcrumbBar.qml b/src/Qt5/imports/FluentUI/Controls/FluBreadcrumbBar.qml index 9efee0dd..1da7494b 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluBreadcrumbBar.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluBreadcrumbBar.qml @@ -57,12 +57,12 @@ Item { Layout.alignment: Qt.AlignVCenter color: { if(item_mouse.pressed){ - return FluTheme.dark ? Qt.rgba(150/255,150/255,150/235,1) : Qt.rgba(134/255,134/255,134/235,1) + return FluTheme.dark ? Qt.rgba(150/255,150/255,150/255,1) : Qt.rgba(134/255,134/255,134/255,1) } if(item_mouse.containsMouse){ - return FluTheme.dark ? Qt.rgba(204/255,204/255,204/235,1) : Qt.rgba(92/255,92/255,92/235,1) + return FluTheme.dark ? Qt.rgba(204/255,204/255,204/255,1) : Qt.rgba(92/255,92/255,92/255,1) } - return FluTheme.dark ? Qt.rgba(255/255,255/255,255/235,1) : Qt.rgba(26/255,26/255,26/235,1) + return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(26/255,26/255,26/255,1) } MouseArea{ id:item_mouse diff --git a/src/Qt5/imports/FluentUI/Controls/FluStatusLayout.qml b/src/Qt5/imports/FluentUI/Controls/FluStatusLayout.qml index 12d70a22..46c7292a 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluStatusLayout.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluStatusLayout.qml @@ -8,11 +8,11 @@ Item{ id:control default property alias content: container.data property int statusMode: FluStatusLayoutType.Loading - property string loadingText:"正在加载..." - property string emptyText: "空空如也" - property string errorText: "页面出错了.." - property string errorButtonText: "重新加载" - property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + property string loadingText: qsTr("Loading...") + property string emptyText: qsTr("Empty") + property string errorText: qsTr("Error") + property string errorButtonText: qsTr("Reload") + property color color: Qt.rgba(0,0,0,0) signal errorClicked property Component loadingItem : com_loading property Component emptyItem : com_empty diff --git a/src/Qt6/imports/FluentUI/Controls/FluBreadcrumbBar.qml b/src/Qt6/imports/FluentUI/Controls/FluBreadcrumbBar.qml index 0733e436..d08c4d21 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluBreadcrumbBar.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluBreadcrumbBar.qml @@ -57,12 +57,12 @@ Item { Layout.alignment: Qt.AlignVCenter color: { if(item_mouse.pressed){ - return FluTheme.dark ? Qt.rgba(150/255,150/255,150/235,1) : Qt.rgba(134/255,134/255,134/235,1) + return FluTheme.dark ? Qt.rgba(150/255,150/255,150/255,1) : Qt.rgba(134/255,134/255,134/255,1) } if(item_mouse.containsMouse){ - return FluTheme.dark ? Qt.rgba(204/255,204/255,204/235,1) : Qt.rgba(92/255,92/255,92/235,1) + return FluTheme.dark ? Qt.rgba(204/255,204/255,204/255,1) : Qt.rgba(92/255,92/255,92/255,1) } - return FluTheme.dark ? Qt.rgba(255/255,255/255,255/235,1) : Qt.rgba(26/255,26/255,26/235,1) + return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(26/255,26/255,26/255,1) } MouseArea{ id:item_mouse diff --git a/src/Qt6/imports/FluentUI/Controls/FluStatusLayout.qml b/src/Qt6/imports/FluentUI/Controls/FluStatusLayout.qml index e5df19bf..ad784893 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluStatusLayout.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluStatusLayout.qml @@ -7,11 +7,11 @@ Item{ id:control default property alias content: container.data property int statusMode: FluStatusLayoutType.Loading - property string loadingText:"正在加载..." - property string emptyText: "空空如也" - property string errorText: "页面出错了.." - property string errorButtonText: "重新加载" - property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) + property string loadingText: qsTr("Loading...") + property string emptyText: qsTr("Empty") + property string errorText: qsTr("Error") + property string errorButtonText: qsTr("Reload") + property color color: Qt.rgba(0,0,0,0) signal errorClicked property Component loadingItem : com_loading property Component emptyItem : com_empty diff --git a/src/fluentui_en_US.ts b/src/fluentui_en_US.ts index 79c2709b..e4622fe4 100644 --- a/src/fluentui_en_US.ts +++ b/src/fluentui_en_US.ts @@ -232,6 +232,33 @@ + + FluStatusLayout + + + + Loading... + + + + + + Empty + + + + + + Error + + + + + + Reload + + + FluTextBoxMenu diff --git a/src/fluentui_zh_CN.ts b/src/fluentui_zh_CN.ts index d76b222b..4cd85268 100644 --- a/src/fluentui_zh_CN.ts +++ b/src/fluentui_zh_CN.ts @@ -232,6 +232,33 @@ 重置 + + FluStatusLayout + + + + Loading... + 加载中... + + + + + Empty + 空空如也 + + + + + Error + 似乎出了点问题 + + + + + Reload + 重新加载 + + FluTextBoxMenu From 2ddb7e32902b36a60d5e4798b71e72cf31125904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 23 Apr 2024 00:32:15 +0800 Subject: [PATCH 25/29] update --- example/qml/App.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/example/qml/App.qml b/example/qml/App.qml index 71cc09ca..6d33206d 100644 --- a/example/qml/App.qml +++ b/example/qml/App.qml @@ -34,7 +34,6 @@ FluLauncher { FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.animationEnabled = true - FluTheme.blurBehindWindowEnabled = true FluRouter.routes = { "/":"qrc:/example/qml/window/MainWindow.qml", "/about":"qrc:/example/qml/window/AboutWindow.qml", From c7de653ba21d8d9e541e13ebebc4071316ab1673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 23 Apr 2024 13:41:26 +0800 Subject: [PATCH 26/29] update --- example/qml/page/T_Icons.qml | 2 +- src/FluFrameless.cpp | 58 ++++++++++++------- src/FluFrameless.h | 1 + .../FluentUI/Controls/FluAutoSuggestBox.qml | 35 ++++++----- .../Controls/FluTextBoxBackground.qml | 19 ++++-- .../imports/FluentUI/Controls/FluWindow.qml | 6 ++ .../FluentUI/Controls/FluAutoSuggestBox.qml | 35 ++++++----- .../Controls/FluTextBoxBackground.qml | 19 ++++-- .../imports/FluentUI/Controls/FluWindow.qml | 6 ++ 9 files changed, 121 insertions(+), 60 deletions(-) diff --git a/example/qml/page/T_Icons.qml b/example/qml/page/T_Icons.qml index 43d80442..8cf6a584 100644 --- a/example/qml/page/T_Icons.qml +++ b/example/qml/page/T_Icons.qml @@ -24,7 +24,7 @@ FluContentPage { leftMargin: 14 } onClicked: { - grid_view.model = FluTheme.awesomeList(text_box.text) + grid_view.model = FluApp.iconDatas(text_box.text) } } GridView{ diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 753ce22a..d4f6117c 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "FluTools.h" #ifdef Q_OS_WIN #pragma comment (lib, "user32.lib") @@ -13,6 +14,7 @@ #include #include + static inline QByteArray qtNativeEventType() { static const auto result = "windows_generic_MSG"; return result; @@ -55,6 +57,7 @@ FluFrameless::FluFrameless(QQuickItem *parent) : QQuickItem{parent} { _closeButton = nullptr; _topmost = false; _disabled = false; + _isWindows11OrGreater = FluTools::getInstance()->isWindows11OrGreater(); } FluFrameless::~FluFrameless() = default; @@ -110,11 +113,11 @@ void FluFrameless::componentComplete() { }); #endif h = h + _appbar->height(); - if(_fixSize){ - window()->setMaximumSize(QSize(w,h)); - window()->setMinimumSize(QSize(w,h)); + if (_fixSize) { + window()->setMaximumSize(QSize(w, h)); + window()->setMinimumSize(QSize(w, h)); } - window()->resize(QSize(w,h)); + window()->resize(QSize(w, h)); connect(this, &FluFrameless::topmostChanged, this, [this] { _setWindowTopmost(topmost()); }); @@ -160,7 +163,10 @@ void FluFrameless::componentComplete() { } int offsetSize; bool isMaximum = ::IsZoomed(hwnd); - offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop)); + auto _offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop)); + if (_offsetXY.x() != 0) { + offsetXY = _offsetXY; + } if (isMaximum || _isFullScreen()) { offsetSize = 0; } else { @@ -179,15 +185,17 @@ void FluFrameless::componentComplete() { *result = WVR_REDRAW; return true; } else if (uMsg == WM_NCHITTEST) { - if (_hitMaximizeButton()) { - if (*result == HTNOWHERE) { - *result = HTZOOM; + if (_isWindows11OrGreater) { + if (_hitMaximizeButton()) { + if (*result == HTNOWHERE) { + *result = HTZOOM; + } + _setMaximizeHovered(true); + return true; } - _setMaximizeHovered(true); - return true; + _setMaximizeHovered(false); + _setMaximizePressed(false); } - _setMaximizeHovered(false); - _setMaximizePressed(false); *result = 0; POINT nativeGlobalPos{GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; POINT nativeLocalPos = nativeGlobalPos; @@ -229,14 +237,14 @@ void FluFrameless::componentComplete() { } *result = HTCLIENT; return true; - } else if (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN) { + } else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) { if (_hitMaximizeButton()) { QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QGuiApplication::sendEvent(_maximizeButton, &event); _setMaximizePressed(true); return true; } - } else if (uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP) { + } else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP)) { if (_hitMaximizeButton()) { QMouseEvent event = QMouseEvent(QEvent::MouseButtonRelease, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QGuiApplication::sendEvent(_maximizeButton, &event); @@ -251,11 +259,12 @@ void FluFrameless::componentComplete() { return true; } else if (uMsg == WM_GETMINMAXINFO) { auto *minmaxInfo = reinterpret_cast(lParam); -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) minmaxInfo->ptMaxPosition.x = 0; minmaxInfo->ptMaxPosition.y = 0; minmaxInfo->ptMaxSize.x = 0; minmaxInfo->ptMaxSize.y = 0; + return false; #else auto pixelRatio = window()->devicePixelRatio(); auto geometry = window()->screen()->availableGeometry(); @@ -265,8 +274,8 @@ void FluFrameless::componentComplete() { minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x(); minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2; minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio) + offsetXY.y() * 2; + return true; #endif - return false; } else if (uMsg == WM_NCRBUTTONDOWN) { if (wParam == HTCAPTION) { _showSystemMenu(QCursor::pos()); @@ -281,9 +290,11 @@ void FluFrameless::componentComplete() { } else if (uMsg == WM_SYSCOMMAND) { if (wParam == SC_MINIMIZE) { if (window()->transientParent()) { - window()->transientParent()->showMinimized(); + HWND hwnd = reinterpret_cast(window()->transientParent()->winId()); + ::ShowWindow(hwnd, 2); } else { - window()->showMinimized(); + HWND hwnd = reinterpret_cast(window()->winId()); + ::ShowWindow(hwnd, 2); } return true; } @@ -395,16 +406,21 @@ void FluFrameless::showMaximized() { HWND hwnd = reinterpret_cast(window()->winId()); ::ShowWindow(hwnd, 3); #else - window()->showMaximized(); + window()->setVisibility(QQuickWindow::Maximized); #endif } [[maybe_unused]] void FluFrameless::showMinimized() { - window()->showMinimized(); +#ifdef Q_OS_WIN + HWND hwnd = reinterpret_cast(window()->winId()); + ::ShowWindow(hwnd, 2); +#else + window()->setVisibility(QQuickWindow::Minimized); +#endif } void FluFrameless::showNormal() { - window()->showNormal(); + window()->setVisibility(QQuickWindow::Windowed); } void FluFrameless::setHitTestVisible(QQuickItem *val) { diff --git a/src/FluFrameless.h b/src/FluFrameless.h index 6ccf79fb..e57fc447 100644 --- a/src/FluFrameless.h +++ b/src/FluFrameless.h @@ -73,5 +73,6 @@ private: int _edges = 0; int _margins = 8; quint64 _clickTimer = 0; + bool _isWindows11OrGreater = false; QList> _hitTestList; }; diff --git a/src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml b/src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml index 3cd525fb..bfa5a147 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml @@ -59,12 +59,8 @@ FluTextBox{ duration: FluTheme.animationEnabled ? 83 : 0 } } - contentItem: FluRectangle{ - radius: [4,4,4,4] - FluShadow{ - radius: 4 - } - color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) + contentItem: FluClip{ + radius: [5,5,5,5] ListView{ id:list_view anchors.fill: parent @@ -97,10 +93,13 @@ FluTextBox{ radius:4 } color: { - if(hovered){ - return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) + if(pressed){ + return FluTheme.itemPressColor } - return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0) + if(hovered){ + return FluTheme.itemHoverColor + } + return FluTheme.itemNormalColor } } contentItem: FluText{ @@ -112,22 +111,28 @@ FluTextBox{ } } } - background: Item{ - id:container + background:Rectangle{ + id: rect_background implicitWidth: control.width implicitHeight: 38*Math.min(Math.max(list_view.count,1),8) + radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) + FluShadow{ + radius: 5 + } } } onTextChanged: { d.loadData() if(d.flagVisible){ var pos = control.mapToItem(null, 0, 0) - if(d.window.height>pos.y+control.height+container.implicitHeight){ + if(d.window.height>pos.y+control.height+rect_background.implicitHeight){ control_popup.y = control.height - } else if(pos.y>container.implicitHeight){ - control_popup.y = -container.implicitHeight + } else if(pos.y>rect_background.implicitHeight){ + control_popup.y = -rect_background.implicitHeight } else { - control_popup.y = d.window.height-(pos.y+container.implicitHeight) + control_popup.y = d.window.height-(pos.y+rect_background.implicitHeight) - 1 } control_popup.visible = true } diff --git a/src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml b/src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml index 024ce7e2..ef82bd13 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml @@ -23,16 +23,27 @@ FluControlBackground{ GradientStop { position: 1 - d.offsetSize/control.height; color: d.startColor } GradientStop { position: 1.0; color: d.endColor } } - bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1 + bottomMargin: 1 QtObject{ id:d - property int offsetSize : inputItem && inputItem.activeFocus ? 2 : 3 - property color startColor: FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1) + property int offsetSize : 3 + property color startColor : FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1) property color endColor: { if(!control.enabled){ return d.startColor } - return inputItem && inputItem.activeFocus ? FluTheme.primaryColor : FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1) + return FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1) + } + } + FluClip{ + anchors.fill: parent + radius: [control.radius,control.radius,control.radius,control.radius] + visible: inputItem && inputItem.activeFocus + Rectangle{ + width: parent.width + height: 2 + anchors.bottom: parent.bottom + color: FluTheme.primaryColor } } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index a56fec54..10a099d5 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -330,6 +330,12 @@ Window { function showMaximized(){ frameless.showMaximized() } + function showMinimized(){ + frameless.showMinimized() + } + function showNormal(){ + frameless.showNormal() + } function showLoading(text = "",cancel = true){ if(text===""){ text = qsTr("Loading...") diff --git a/src/Qt6/imports/FluentUI/Controls/FluAutoSuggestBox.qml b/src/Qt6/imports/FluentUI/Controls/FluAutoSuggestBox.qml index cb37c970..bd5c2d25 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAutoSuggestBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAutoSuggestBox.qml @@ -58,12 +58,8 @@ FluTextBox{ duration: FluTheme.animationEnabled ? 83 : 0 } } - contentItem: FluRectangle{ - radius: [4,4,4,4] - FluShadow{ - radius: 4 - } - color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) + contentItem: FluClip{ + radius: [5,5,5,5] ListView{ id:list_view anchors.fill: parent @@ -96,10 +92,13 @@ FluTextBox{ radius:4 } color: { - if(hovered){ - return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) + if(pressed){ + return FluTheme.itemPressColor } - return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0) + if(hovered){ + return FluTheme.itemHoverColor + } + return FluTheme.itemNormalColor } } contentItem: FluText{ @@ -111,22 +110,28 @@ FluTextBox{ } } } - background: Item{ - id:container + background:Rectangle{ + id: rect_background implicitWidth: control.width implicitHeight: 38*Math.min(Math.max(list_view.count,1),8) + radius: 5 + color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1) + border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1) + FluShadow{ + radius: 5 + } } } onTextChanged: { d.loadData() if(d.flagVisible){ var pos = control.mapToItem(null, 0, 0) - if(d.window.height>pos.y+control.height+container.implicitHeight){ + if(d.window.height>pos.y+control.height+rect_background.implicitHeight){ control_popup.y = control.height - } else if(pos.y>container.implicitHeight){ - control_popup.y = -container.implicitHeight + } else if(pos.y>rect_background.implicitHeight){ + control_popup.y = -rect_background.implicitHeight } else { - control_popup.y = d.window.height-(pos.y+container.implicitHeight) + control_popup.y = d.window.height-(pos.y+rect_background.implicitHeight) - 1 } control_popup.visible = true } diff --git a/src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml b/src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml index d2ce9955..a57cff5a 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml @@ -23,16 +23,27 @@ FluControlBackground{ GradientStop { position: 1 - d.offsetSize/control.height; color: d.startColor } GradientStop { position: 1.0; color: d.endColor } } - bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1 + bottomMargin: 1 QtObject{ id:d - property int offsetSize : inputItem && inputItem.activeFocus ? 2 : 3 - property color startColor: FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1) + property int offsetSize : 3 + property color startColor : FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1) property color endColor: { if(!control.enabled){ return d.startColor } - return inputItem && inputItem.activeFocus ? FluTheme.primaryColor : FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1) + return FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1) + } + } + FluClip{ + anchors.fill: parent + radius: [control.radius,control.radius,control.radius,control.radius] + visible: inputItem && inputItem.activeFocus + Rectangle{ + width: parent.width + height: 2 + anchors.bottom: parent.bottom + color: FluTheme.primaryColor } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index a9b6cc2a..16dd0a33 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -329,6 +329,12 @@ Window { function showMaximized(){ frameless.showMaximized() } + function showMinimized(){ + frameless.showMinimized() + } + function showNormal(){ + frameless.showNormal() + } function showLoading(text = "",cancel = true){ if(text===""){ text = qsTr("Loading...") From b8ef9169b93391e6d600ff1f6a9e79d4d16aa67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 23 Apr 2024 19:33:05 +0800 Subject: [PATCH 27/29] update --- src/FluFrameless.cpp | 3 ++- src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml | 6 +++--- src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index d4f6117c..4f3ba47f 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -270,6 +270,8 @@ void FluFrameless::componentComplete() { auto geometry = window()->screen()->availableGeometry(); RECT rect; SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); + minmaxInfo->ptMinTrackSize.x = window()->minimumWidth() * pixelRatio + offsetXY.x(); + minmaxInfo->ptMinTrackSize.y = window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio; minmaxInfo->ptMaxPosition.x = rect.left - offsetXY.x(); minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x(); minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2; @@ -429,7 +431,6 @@ void FluFrameless::setHitTestVisible(QQuickItem *val) { } } - void FluFrameless::_setWindowTopmost(bool topmost) { #ifdef Q_OS_WIN HWND hwnd = reinterpret_cast(window()->winId()); diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml b/src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml index 7446fee2..918e77aa 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml @@ -32,9 +32,9 @@ FluWindow { } } } - function showDialog(){ - var x = transientParent.x + (transientParent.width - width)/2 - var y = transientParent.y + (transientParent.height - height)/2 + function showDialog(offsetX=0,offsetY=0){ + var x = transientParent.x + (transientParent.width - width)/2 + offsetX + var y = transientParent.y + (transientParent.height - height)/2 + offsetY control.stayTop = Qt.binding(function(){return transientParent.stayTop}) control.setGeometry(x,y,width,height) control.visibility = Window.Windowed diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml b/src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml index 57a27586..fbc1edb6 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml @@ -32,9 +32,9 @@ FluWindow { } } } - function showDialog(){ - var x = transientParent.x + (transientParent.width - width)/2 - var y = transientParent.y + (transientParent.height - height)/2 + function showDialog(offsetX=0,offsetY=0){ + var x = transientParent.x + (transientParent.width - width)/2 + offsetX + var y = transientParent.y + (transientParent.height - height)/2 + offsetY control.stayTop = Qt.binding(function(){return transientParent.stayTop}) control.setGeometry(x,y,width,height) control.visibility = Window.Windowed From 04c52b1b25a93284baea366ab9c594f2f875b072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 23 Apr 2024 21:19:32 +0800 Subject: [PATCH 28/29] fix bug --- src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml | 8 ++++++-- src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml b/src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml index 60335194..18f7383d 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml @@ -19,16 +19,20 @@ FluButton { } iconColor:control.textColor } + Item{ + id: d + property var window: Window.window + } onClicked: { if(menu.count !==0){ var pos = control.mapToItem(null, 0, 0) var containerHeight = menu.count*36 - if(window.height>pos.y+control.height+containerHeight){ + if(d.window.height>pos.y+control.height+containerHeight){ menu.y = control.height }else if(pos.y>containerHeight){ menu.y = -containerHeight }else{ - menu.y = window.height-(pos.y+containerHeight) + menu.y = d.window.height-(pos.y+containerHeight) } menu.open() } diff --git a/src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml b/src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml index 537c1604..79cd5502 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml @@ -20,16 +20,20 @@ FluButton { } iconColor:control.textColor } + Item{ + id: d + property var window: Window.window + } onClicked: { if(menu.count !==0){ var pos = control.mapToItem(null, 0, 0) var containerHeight = menu.count*36 - if(window.height>pos.y+control.height+containerHeight){ + if(d.window.height>pos.y+control.height+containerHeight){ menu.y = control.height }else if(pos.y>containerHeight){ menu.y = -containerHeight }else{ - menu.y = window.height-(pos.y+containerHeight) + menu.y = d.window.height-(pos.y+containerHeight) } menu.open() } From cb4475997828d3c8d28572cbc569e2aa3a8533f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 23 Apr 2024 22:38:39 +0800 Subject: [PATCH 29/29] update --- example/example.qrc | 1 - example/example_en_US.ts | 5 -- example/example_zh_CN.ts | 5 +- example/qml/global/ItemsOriginal.qml | 6 -- example/qml/page/T_3D.qml | 116 --------------------------- src/FluFrameless.cpp | 6 +- 6 files changed, 6 insertions(+), 133 deletions(-) delete mode 100644 example/qml/page/T_3D.qml diff --git a/example/example.qrc b/example/example.qrc index 696c79bc..f69b7c55 100644 --- a/example/example.qrc +++ b/example/example.qrc @@ -180,7 +180,6 @@ qml/window/PageWindow.qml qml/page/T_StaggeredLayout.qml qml/page/T_Clip.qml - qml/page/T_3D.qml qml/page/T_Network.qml qml/page/T_ShortcutPicker.qml qml/chart/T_BarChart.qml diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 7f61aa64..cc03fbcc 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -515,11 +515,6 @@ - 3D - - - - Test Crash diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 950a363d..ab387f56 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -514,12 +514,11 @@ 热加载 - 3D - 3D + 3D - + Test Crash 测试崩溃 diff --git a/example/qml/global/ItemsOriginal.qml b/example/qml/global/ItemsOriginal.qml index 522b91b5..0479b746 100644 --- a/example/qml/global/ItemsOriginal.qml +++ b/example/qml/global/ItemsOriginal.qml @@ -483,12 +483,6 @@ FluObject{ FluRouter.navigate("/hotload") } } - FluPaneItem{ - title: qsTr("3D") - menuDelegate: paneItemMenu - url: "qrc:/example/qml/page/T_3D.qml" - onTap: { navigationView.push(url) } - } FluPaneItem{ title: qsTr("Test Crash") onTapListener: function(){ diff --git a/example/qml/page/T_3D.qml b/example/qml/page/T_3D.qml deleted file mode 100644 index 2757decd..00000000 --- a/example/qml/page/T_3D.qml +++ /dev/null @@ -1,116 +0,0 @@ -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 -import QtQuick.Window 2.15 -import Qt3D.Core 2.15 -import Qt3D.Render 2.15 -import Qt3D.Input 2.12 -import Qt3D.Extras 2.15 -import QtQuick.Scene3D 2.15 -import Qt.labs.platform 1.1 -import FluentUI 1.0 -import "../component" - -FluContentPage{ - - id:root - title:"3D" - - Scene3D{ - id:scene_3d - anchors.fill: parent - focus: true - aspects: ["input", "logic"] - cameraAspectRatioMode: Scene3D.AutomaticAspectRatio - Entity { - Camera { - id: camera - projectionType: CameraLens.PerspectiveProjection - fieldOfView: 22.5 - aspectRatio: scene_3d.width / scene_3d.height - nearPlane: 1 - farPlane: 1000.0 - viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) - upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) - position: Qt.vector3d( 0.0, 0.0, 15.0 ) - } - FirstPersonCameraController { - linearSpeed: 100 - lookSpeed: 50 - camera: camera - } - components: [ - RenderSettings{ - activeFrameGraph: ForwardRenderer{ - clearColor: Qt.rgba(0,0,0,0); - camera: camera - } - }, - InputSettings{} - ] - Mesh { - id: mesh - source: "https://zhu-zichu.gitee.io/test.obj" - } - PhongMaterial { - id: material - ambient: color_picker.current - } - Transform{ - id:transform - scale: 1.0 - translation: Qt.vector3d(0, 0, 0) - rotation: fromEulerAngles(0, 0, 0) - property real hAngle:0.0 - NumberAnimation on hAngle{ - from:0 - to:360.0 - duration: 5000 - loops: Animation.Infinite - } - matrix:{ - var m=Qt.matrix4x4(); - m.rotate(hAngle,Qt.vector3d(0,1,0)); - m.translate(Qt.vector3d(0,0,0)); - return m; - } - } - Entity { - id: entity - components: [mesh, material,transform] - } - } - } - ColumnLayout{ - RowLayout{ - spacing: 10 - Layout.topMargin: 20 - FluText{ - text:"tintColor:" - Layout.alignment: Qt.AlignVCenter - } - FluColorPicker{ - id:color_picker - current: "gray" - } - } - - FluButton{ - text:"选择obj资源" - onClicked: { - file_dialog.open() - } - } - } - - FileDialog { - id: file_dialog - nameFilters: ["Obj files (*.obj)"] - folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) - onAccepted: { - var fileUrl = file_dialog.currentFile - mesh.source = fileUrl - } - } - -} diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 4f3ba47f..e7737804 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -270,8 +270,10 @@ void FluFrameless::componentComplete() { auto geometry = window()->screen()->availableGeometry(); RECT rect; SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); - minmaxInfo->ptMinTrackSize.x = window()->minimumWidth() * pixelRatio + offsetXY.x(); - minmaxInfo->ptMinTrackSize.y = window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio; + if(!_fixSize){ + minmaxInfo->ptMinTrackSize.x = window()->minimumWidth() * pixelRatio + offsetXY.x(); + minmaxInfo->ptMinTrackSize.y = window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio; + } minmaxInfo->ptMaxPosition.x = rect.left - offsetXY.x(); minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x(); minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2;