mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-07 12:07:40 +08:00
Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
430fac2f77 | |||
c15470f723 | |||
2aef114969 | |||
c0e470d78e | |||
c8f2d7c926 | |||
b032e0306f | |||
36ac017e3d | |||
981445630b | |||
9494ec4ac6 | |||
d71441e7c5 | |||
9f0b8c5ec5 | |||
94c0356c25 | |||
9e73f33877 | |||
adc8040604 | |||
82d1edc43c | |||
da17b31be7 | |||
67518fb4e6 | |||
2bd03ad9d8 | |||
e16a8d6b09 | |||
9e0050be63 | |||
a4398d1a2f | |||
a27e5db032 | |||
f7c17a27b6 | |||
020a75ac93 | |||
1b0cdd6152 | |||
1a9cca4300 | |||
d939546f31 |
38
.github/workflows/macos.yml
vendored
38
.github/workflows/macos.yml
vendored
@ -2,14 +2,19 @@ name: MacOS
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
|
- 'example/**'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/macos.yml'
|
- '.github/workflows/macos.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
|
- 'example/**'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/macos.yml'
|
- '.github/workflows/macos.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@ -22,12 +27,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
targetName: example
|
targetName: example
|
||||||
steps:
|
steps:
|
||||||
- name: '⚙️ Cache Qt'
|
- name: Check out repository
|
||||||
id: cache-qt
|
uses: actions/checkout@v3
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ runner.workspace }}/Qt
|
submodules: recursive
|
||||||
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
@ -35,24 +39,30 @@ jobs:
|
|||||||
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
- name: Set up Ninja
|
||||||
|
uses: seanmiddleditch/gha-setup-ninja@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
version: 1.10.2
|
||||||
|
|
||||||
- name: build macos
|
- name: build macos
|
||||||
run: |
|
run: |
|
||||||
qmake
|
cmake --version
|
||||||
make
|
mkdir build
|
||||||
# 打包
|
cd build
|
||||||
|
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
||||||
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: package
|
- name: package
|
||||||
run: |
|
run: |
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
macdeployqt bin/release/${targetName}.app -qmldir=. -verbose=1 -dmg
|
macdeployqt bin/release/${targetName}.app -qmldir=. -verbose=1 -dmg
|
||||||
# 上传artifacts
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
|
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
|
||||||
path: bin/release/${{ env.targetName }}.app
|
path: bin/release/${{ env.targetName }}.app
|
||||||
# tag 上传Release
|
|
||||||
- name: uploadRelease
|
- name: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
47
.github/workflows/ubuntu.yml
vendored
47
.github/workflows/ubuntu.yml
vendored
@ -1,17 +1,21 @@
|
|||||||
name: Ubuntu
|
name: Ubuntu
|
||||||
# Qt官方没有linux平台的x86包
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'example/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/ubuntu.yml'
|
- '.github/workflows/ubuntu.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'example/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/ubuntu.yml'
|
- '.github/workflows/ubuntu.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@ -24,12 +28,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
targetName: example
|
targetName: example
|
||||||
steps:
|
steps:
|
||||||
- name: '⚙️ Cache Qt'
|
- name: Check out repository
|
||||||
id: cache-qt
|
uses: actions/checkout@v3
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ runner.workspace }}/Qt
|
submodules: recursive
|
||||||
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
@ -37,35 +40,45 @@ jobs:
|
|||||||
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
|
|
||||||
|
- name: Set up Ninja
|
||||||
|
uses: seanmiddleditch/gha-setup-ninja@v3
|
||||||
|
with:
|
||||||
|
version: 1.10.2
|
||||||
|
|
||||||
- name: ubuntu install GL library
|
- name: ubuntu install GL library
|
||||||
run: sudo apt-get install -y libxkbcommon-x11-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-shm0-dev
|
run: sudo apt-get install -y libxkbcommon-x11-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-shm0-dev
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
- name: build ubuntu
|
- name: build ubuntu
|
||||||
run: |
|
run: |
|
||||||
qmake
|
ninja --version
|
||||||
make
|
cmake --version
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
||||||
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: install QT linux deploy
|
- name: install QT linux deploy
|
||||||
uses: miurahr/install-linuxdeploy-action@v1
|
uses: miurahr/install-linuxdeploy-action@v1
|
||||||
with:
|
with:
|
||||||
plugins: qt appimage
|
plugins: qt appimage
|
||||||
|
|
||||||
- name: Check if svg file exists
|
- name: Check if svg file exists
|
||||||
run: if [ ! -f "${targetName}.svg" ]; then echo "File not found, creating..."; touch ${targetName}.svg; fi
|
run: if [ ! -f "${targetName}.svg" ]; then echo "File not found, creating..."; touch ${targetName}.svg; fi
|
||||||
# 打包
|
|
||||||
- name: package
|
- name: package
|
||||||
run: |
|
run: |
|
||||||
# make sure Qt plugin finds QML sources so it can deploy the imported files
|
# make sure Qt plugin finds QML sources so it can deploy the imported files
|
||||||
export QML_SOURCES_PATHS=src
|
export QML_SOURCES_PATHS=./
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
|
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
|
||||||
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
|
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
|
||||||
# 上传artifacts
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}
|
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}
|
||||||
path: ${{ env.targetName }}.AppImage
|
path: ${{ env.targetName }}.AppImage
|
||||||
# tag 上传Release
|
|
||||||
- name: uploadRelease
|
- name: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
33
.github/workflows/windows-mingw.yml
vendored
33
.github/workflows/windows-mingw.yml
vendored
@ -2,14 +2,19 @@ name: Windows MinGW
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'example/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/windows-mingw.yml'
|
- '.github/workflows/windows-mingw.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
|
- 'example/**'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/windows-mingw.yml'
|
- '.github/workflows/windows-mingw.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@ -25,6 +30,11 @@ jobs:
|
|||||||
targetName: example.exe
|
targetName: example.exe
|
||||||
fileName: example
|
fileName: example
|
||||||
steps:
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
@ -32,26 +42,29 @@ jobs:
|
|||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
- name: Qt6 environment configuration
|
- name: Qt6 environment configuration
|
||||||
if: ${{ startsWith( matrix.qt_ver, 6 ) }}
|
if: ${{ startsWith( matrix.qt_ver, 6 ) }}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
Write-Output "${{ env.Qt6_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
Write-Output "${{ env.Qt6_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
Write-Output "${{ env.Qt6_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
Write-Output "${{ env.Qt6_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
- name: where is qmake & where is mingw32-make
|
|
||||||
|
- name: where is cmake & where is mingw32-make
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
Get-Command -Name 'qmake' | Format-List
|
Get-Command -Name 'cmake' | Format-List
|
||||||
Get-Command -Name 'mingw32-make' | Format-List
|
Get-Command -Name 'mingw32-make' | Format-List
|
||||||
|
|
||||||
- name: mingw-build
|
- name: mingw-build
|
||||||
id: build
|
id: build
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
qmake
|
mkdir build
|
||||||
mingw32-make
|
cd build
|
||||||
|
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
||||||
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: package
|
- name: package
|
||||||
id: package
|
id: package
|
||||||
env:
|
env:
|
||||||
@ -61,10 +74,12 @@ jobs:
|
|||||||
& scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:targetName}
|
& scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:targetName}
|
||||||
$name = ${env:archiveName}
|
$name = ${env:archiveName}
|
||||||
echo "::set-output name=packageName::$name"
|
echo "::set-output name=packageName::$name"
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.package.outputs.packageName }}
|
name: ${{ steps.package.outputs.packageName }}
|
||||||
path: ${{ steps.package.outputs.packageName }}
|
path: ${{ steps.package.outputs.packageName }}
|
||||||
|
|
||||||
- name: uploadRelease
|
- name: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
44
.github/workflows/windows.yml
vendored
44
.github/workflows/windows.yml
vendored
@ -1,24 +1,25 @@
|
|||||||
name: Windows
|
name: Windows
|
||||||
on:
|
on:
|
||||||
# push代码时触发workflow
|
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'example/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/windows.yml'
|
- '.github/workflows/windows.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
|
- 'example/**'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/windows.yml'
|
- '.github/workflows/windows.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
# 运行平台, windows-latest目前是windows server 2019
|
|
||||||
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
# 矩阵配置
|
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-2019]
|
os: [windows-2019]
|
||||||
include:
|
include:
|
||||||
@ -29,40 +30,34 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
targetName: example.exe
|
targetName: example.exe
|
||||||
fileName: example
|
fileName: example
|
||||||
# 步骤
|
|
||||||
steps:
|
steps:
|
||||||
- name: '⚙️ Cache Qt'
|
- name: Check out repository
|
||||||
id: cache-qt
|
uses: actions/checkout@v3
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ runner.workspace }}\Qt
|
submodules: recursive
|
||||||
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
|
|
||||||
# 安装Qt
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
# 使用外部action。这个action专门用来安装Qt
|
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.qt_ver }}
|
version: ${{ matrix.qt_ver }}
|
||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
# 拉取代码
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
# msvc编译
|
|
||||||
- name: msvc-build
|
- name: msvc-build
|
||||||
id: build
|
id: build
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
|
||||||
qmake
|
mkdir build
|
||||||
nmake
|
cd build
|
||||||
|
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
||||||
|
cmake --build . --target all --config Release --parallel
|
||||||
echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV%
|
echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV%
|
||||||
echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV%
|
echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV%
|
||||||
echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV%
|
echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV%
|
||||||
echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV%
|
echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV%
|
||||||
# 打包
|
|
||||||
- name: package
|
- name: package
|
||||||
id: package
|
id: package
|
||||||
env:
|
env:
|
||||||
@ -74,13 +69,12 @@ jobs:
|
|||||||
# 记录packageName给后续step
|
# 记录packageName给后续step
|
||||||
$name = ${env:archiveName}
|
$name = ${env:archiveName}
|
||||||
echo "::set-output name=packageName::$name"
|
echo "::set-output name=packageName::$name"
|
||||||
# tag 查询github-Release
|
|
||||||
# 上传artifacts
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.package.outputs.packageName }}
|
name: ${{ steps.package.outputs.packageName }}
|
||||||
path: ${{ steps.package.outputs.packageName }}
|
path: ${{ steps.package.outputs.packageName }}
|
||||||
# tag 上传Release
|
|
||||||
- name: uploadRelease
|
- name: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -34,3 +34,4 @@ CMakeLists.txt.user*
|
|||||||
src/build-preset/plugins.qmltypes
|
src/build-preset/plugins.qmltypes
|
||||||
bin
|
bin
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
build
|
@ -1,6 +0,0 @@
|
|||||||
TEMPLATE = subdirs
|
|
||||||
|
|
||||||
SUBDIRS += \
|
|
||||||
src/FluentUI.pro \
|
|
||||||
example
|
|
||||||
example.depends = src/FluentUI.pro
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
|
|
||||||
这是一个漂亮的Fluent组件库,使用QML插件开发的。main分支是Qt6.4.3,如果需要qt5的请切换至qt5分支
|
这是一个漂亮的Fluent组件库,使用QML插件开发的。main分支是Qt6.4.3,如果需要qt5的请切换至qt5分支,<a href="https://github.com/zhuzichu520/FluentUI/wiki/%E6%96%B0%E6%89%8B%E5%85%A5%E9%97%A8" target="_blank">如何使用?</a>
|
||||||
|
|
||||||
## 编译状态
|
## 编译状态
|
||||||
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|
|
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Window
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import FluentUI
|
|
||||||
|
|
||||||
Window {
|
|
||||||
id:app
|
|
||||||
Component.onCompleted: {
|
|
||||||
FluApp.init(app)
|
|
||||||
FluTheme.frameless = ("windows" === Qt.platform.os)
|
|
||||||
FluTheme.darkMode = FluDarkMode.System
|
|
||||||
FluApp.routes = {
|
|
||||||
"/":"qrc:/page/MainPage.qml",
|
|
||||||
"/about":"qrc:/page/AboutPage.qml",
|
|
||||||
"/login":"qrc:/page/LoginPage.qml",
|
|
||||||
"/chat":"qrc:/page/ChatPage.qml",
|
|
||||||
"/media":"qrc:/page/MediaPage.qml",
|
|
||||||
"/singleTaskWindow":"qrc:/page/SingleTaskWindow.qml",
|
|
||||||
"/standardWindow":"qrc:/page/StandardWindow.qml",
|
|
||||||
"/singleInstanceWindow":"qrc:/page/SingleInstanceWindow.qml"
|
|
||||||
}
|
|
||||||
FluApp.initialRoute = "/"
|
|
||||||
FluApp.run()
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +1,54 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(example)
|
|
||||||
|
project(example VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
|
|
||||||
|
#获取文件路径分隔符(解决执行命令的时候有些平台会报错)
|
||||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
#设置可执行文件输出目录
|
||||||
set(platform 64)
|
|
||||||
else()
|
|
||||||
set(platform 32)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/debug)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/release)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multimedia REQUIRED)
|
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED)
|
||||||
|
|
||||||
set(SOURCES
|
#遍历所有Cpp文件
|
||||||
ChatController.cpp
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
AppInfo.cpp
|
foreach(filepath ${CPP_FILES})
|
||||||
main.cpp
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
|
list(APPEND sources_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
|
#遍历所有qml文件
|
||||||
|
file(GLOB_RECURSE QML_PATHS *.qml)
|
||||||
|
foreach(filepath ${QML_PATHS})
|
||||||
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
|
list(APPEND qml_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
|
#遍历所有资源文件
|
||||||
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp)
|
||||||
|
foreach(filepath ${RES_PATHS})
|
||||||
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
|
list(APPEND resource_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
|
#添加可执行文件
|
||||||
|
qt_add_executable(example
|
||||||
|
${sources_files}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADERS
|
#复制动态库到可执行文件同级目录下
|
||||||
ChatController.h
|
|
||||||
AppInfo.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(RESOURCES
|
|
||||||
qml.qrc
|
|
||||||
)
|
|
||||||
|
|
||||||
set(RC_ICONS
|
|
||||||
favicon.ico
|
|
||||||
)
|
|
||||||
|
|
||||||
qt_add_resources(QT_RESOURCES ${RESOURCES})
|
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${QT_RESOURCES} ${RC_ICONS})
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||||
set(DLLPATH ${CMAKE_CURRENT_SOURCE_DIR}/../third/msvc/*.dll)
|
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/msvc/*.dll)
|
||||||
else()
|
else()
|
||||||
set(DLLPATH ${CMAKE_CURRENT_SOURCE_DIR}/../third/mingw/*.dll)
|
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll)
|
||||||
endif()
|
endif()
|
||||||
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
|
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
|
||||||
file(GLOB DLL_FILES ${DLLPATH})
|
file(GLOB DLL_FILES ${DLLPATH})
|
||||||
@ -61,27 +59,29 @@ if(WIN32)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
#添加qml模块
|
||||||
QT_DEPRECATED_WARNINGS
|
qt_add_qml_module(example
|
||||||
QT_NO_WARNING_OUTPUT
|
URI example
|
||||||
|
VERSION 1.0
|
||||||
|
QML_FILES ${qml_files} qml/global/qmldir
|
||||||
|
RESOURCES ${resource_files}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
#设置属性
|
||||||
Qt6::Core
|
set_target_properties(example PROPERTIES
|
||||||
Qt6::Quick
|
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||||
Qt6::QuickControls2
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
Qt6::Concurrent
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
Qt6::Network
|
MACOSX_BUNDLE TRUE
|
||||||
Qt6::Multimedia
|
WIN32_EXECUTABLE TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
#链接库
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE UNICODE WIN32 _WINDOWS)
|
target_link_libraries(example
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32)
|
PRIVATE Qt6::Quick
|
||||||
endif()
|
)
|
||||||
|
|
||||||
if(APPLE)
|
#安装
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
install(TARGETS example
|
||||||
MACOSX_BUNDLE_INFO_PLIST Info.plist
|
BUNDLE DESTINATION .
|
||||||
)
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif()
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>NSAppTransportSecurity</key>
|
|
||||||
<dict>
|
|
||||||
<key>NSAllowsArbitraryLoads</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>example</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string></string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.zhuzichu.example</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
|
||||||
<string>10.13</string>
|
|
||||||
<key>NOTE</key>
|
|
||||||
<string>This file was generated by Qt/QMake.</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string>NSApplication</string>
|
|
||||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
@ -1,52 +0,0 @@
|
|||||||
QT += quick concurrent network multimedia
|
|
||||||
CONFIG += c++17
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
lang/En.h \
|
|
||||||
lang/Lang.h \
|
|
||||||
lang/Zh.h \
|
|
||||||
stdafx.h \
|
|
||||||
ChatController.h \
|
|
||||||
AppInfo.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
ChatController.cpp \
|
|
||||||
AppInfo.cpp \
|
|
||||||
lang/En.cpp \
|
|
||||||
lang/Lang.cpp \
|
|
||||||
lang/Zh.cpp \
|
|
||||||
main.cpp
|
|
||||||
|
|
||||||
RESOURCES += qml.qrc
|
|
||||||
|
|
||||||
RC_ICONS = favicon.ico
|
|
||||||
|
|
||||||
QML_IMPORT_PATH =
|
|
||||||
QML_DESIGNER_IMPORT_PATH =
|
|
||||||
|
|
||||||
CONFIG(debug,debug|release) {
|
|
||||||
DESTDIR = $$absolute_path($${_PRO_FILE_PWD_}/../bin/debug)
|
|
||||||
} else {
|
|
||||||
DESTDIR = $$absolute_path($${_PRO_FILE_PWD_}/../bin/release)
|
|
||||||
}
|
|
||||||
|
|
||||||
win32 {
|
|
||||||
|
|
||||||
contains(QMAKE_CC, cl) {
|
|
||||||
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/msvc/*.dll) $$DESTDIR
|
|
||||||
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
|
|
||||||
} else {
|
|
||||||
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/mingw/*.dll) $$DESTDIR
|
|
||||||
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|
||||||
!isEmpty(target.path): INSTALLS += target
|
|
||||||
|
|
||||||
mac: {
|
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 116 KiB |
172
example/qml.qrc
172
example/qml.qrc
@ -1,172 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>App.qml</file>
|
|
||||||
<file>res/image/image_huoyin.webp</file>
|
|
||||||
<file>res/svg/avatar_1.svg</file>
|
|
||||||
<file>res/svg/avatar_2.svg</file>
|
|
||||||
<file>res/svg/avatar_3.svg</file>
|
|
||||||
<file>res/svg/avatar_4.svg</file>
|
|
||||||
<file>res/svg/avatar_5.svg</file>
|
|
||||||
<file>res/svg/avatar_6.svg</file>
|
|
||||||
<file>res/svg/avatar_7.svg</file>
|
|
||||||
<file>res/svg/avatar_8.svg</file>
|
|
||||||
<file>res/svg/avatar_9.svg</file>
|
|
||||||
<file>res/svg/avatar_10.svg</file>
|
|
||||||
<file>res/svg/avatar_11.svg</file>
|
|
||||||
<file>res/svg/avatar_12.svg</file>
|
|
||||||
<file>page/AboutPage.qml</file>
|
|
||||||
<file>page/MainPage.qml</file>
|
|
||||||
<file>page/LoginPage.qml</file>
|
|
||||||
<file>T_ToggleSwitch.qml</file>
|
|
||||||
<file>T_Typography.qml</file>
|
|
||||||
<file>T_Awesome.qml</file>
|
|
||||||
<file>T_Buttons.qml</file>
|
|
||||||
<file>T_Rectangle.qml</file>
|
|
||||||
<file>T_InfoBar.qml</file>
|
|
||||||
<file>T_Progress.qml</file>
|
|
||||||
<file>T_Slider.qml</file>
|
|
||||||
<file>T_TextBox.qml</file>
|
|
||||||
<file>T_Theme.qml</file>
|
|
||||||
<file>T_Dialog.qml</file>
|
|
||||||
<file>T_TreeView.qml</file>
|
|
||||||
<file>T_Expander.qml</file>
|
|
||||||
<file>T_TimePicker.qml</file>
|
|
||||||
<file>T_DatePicker.qml</file>
|
|
||||||
<file>T_MultiWindow.qml</file>
|
|
||||||
<file>T_Menu.qml</file>
|
|
||||||
<file>res/image/banner_1.jpg</file>
|
|
||||||
<file>res/image/banner_2.jpg</file>
|
|
||||||
<file>res/image/banner_3.jpg</file>
|
|
||||||
<file>res/image/logo_openai.png</file>
|
|
||||||
<file>page/ChatPage.qml</file>
|
|
||||||
<file>T_Tooltip.qml</file>
|
|
||||||
<file>T_Badge.qml</file>
|
|
||||||
<file>T_CalendarPicker.qml</file>
|
|
||||||
<file>T_ColorPicker.qml</file>
|
|
||||||
<file>T_Carousel.qml</file>
|
|
||||||
<file>T_MediaPlayer.qml</file>
|
|
||||||
<file>T_TabView.qml</file>
|
|
||||||
<file>res/image/favicon.ico</file>
|
|
||||||
<file>T_Home.qml</file>
|
|
||||||
<file>res/image/bg_home_header.png</file>
|
|
||||||
<file>res/image/ic_home_github.png</file>
|
|
||||||
<file>res/image/control/Acrylic.png</file>
|
|
||||||
<file>res/image/control/AnimatedIcon.png</file>
|
|
||||||
<file>res/image/control/AnimatedVisualPlayer.png</file>
|
|
||||||
<file>res/image/control/AnimationInterop.png</file>
|
|
||||||
<file>res/image/control/AppBarButton.png</file>
|
|
||||||
<file>res/image/control/AppBarSeparator.png</file>
|
|
||||||
<file>res/image/control/AppBarToggleButton.png</file>
|
|
||||||
<file>res/image/control/AutomationProperties.png</file>
|
|
||||||
<file>res/image/control/AutoSuggestBox.png</file>
|
|
||||||
<file>res/image/control/Border.png</file>
|
|
||||||
<file>res/image/control/BreadcrumbBar.png</file>
|
|
||||||
<file>res/image/control/Button.png</file>
|
|
||||||
<file>res/image/control/CalendarDatePicker.png</file>
|
|
||||||
<file>res/image/control/CalendarView.png</file>
|
|
||||||
<file>res/image/control/Canvas.png</file>
|
|
||||||
<file>res/image/control/Checkbox.png</file>
|
|
||||||
<file>res/image/control/Clipboard.png</file>
|
|
||||||
<file>res/image/control/ColorPaletteResources.png</file>
|
|
||||||
<file>res/image/control/ColorPicker.png</file>
|
|
||||||
<file>res/image/control/ComboBox.png</file>
|
|
||||||
<file>res/image/control/CommandBar.png</file>
|
|
||||||
<file>res/image/control/CommandBarFlyout.png</file>
|
|
||||||
<file>res/image/control/CompactSizing.png</file>
|
|
||||||
<file>res/image/control/ConnectedAnimation.png</file>
|
|
||||||
<file>res/image/control/ContentDialog.png</file>
|
|
||||||
<file>res/image/control/CreateMultipleWindows.png</file>
|
|
||||||
<file>res/image/control/DataGrid.png</file>
|
|
||||||
<file>res/image/control/DatePicker.png</file>
|
|
||||||
<file>res/image/control/DropDownButton.png</file>
|
|
||||||
<file>res/image/control/EasingFunction.png</file>
|
|
||||||
<file>res/image/control/Expander.png</file>
|
|
||||||
<file>res/image/control/FilePicker.png</file>
|
|
||||||
<file>res/image/control/FlipView.png</file>
|
|
||||||
<file>res/image/control/Flyout.png</file>
|
|
||||||
<file>res/image/control/Grid.png</file>
|
|
||||||
<file>res/image/control/GridView.png</file>
|
|
||||||
<file>res/image/control/HyperlinkButton.png</file>
|
|
||||||
<file>res/image/control/IconElement.png</file>
|
|
||||||
<file>res/image/control/Image.png</file>
|
|
||||||
<file>res/image/control/ImplicitTransition.png</file>
|
|
||||||
<file>res/image/control/InfoBadge.png</file>
|
|
||||||
<file>res/image/control/InfoBar.png</file>
|
|
||||||
<file>res/image/control/InkCanvas.png</file>
|
|
||||||
<file>res/image/control/InkToolbar.png</file>
|
|
||||||
<file>res/image/control/InputValidation.png</file>
|
|
||||||
<file>res/image/control/ItemsRepeater.png</file>
|
|
||||||
<file>res/image/control/Line.png</file>
|
|
||||||
<file>res/image/control/ListBox.png</file>
|
|
||||||
<file>res/image/control/ListView.png</file>
|
|
||||||
<file>res/image/control/MediaPlayerElement.png</file>
|
|
||||||
<file>res/image/control/MenuBar.png</file>
|
|
||||||
<file>res/image/control/MenuFlyout.png</file>
|
|
||||||
<file>res/image/control/NavigationView.png</file>
|
|
||||||
<file>res/image/control/NumberBox.png</file>
|
|
||||||
<file>res/image/control/PageTransition.png</file>
|
|
||||||
<file>res/image/control/ParallaxView.png</file>
|
|
||||||
<file>res/image/control/PasswordBox.png</file>
|
|
||||||
<file>res/image/control/PersonPicture.png</file>
|
|
||||||
<file>res/image/control/PipsPager.png</file>
|
|
||||||
<file>res/image/control/Pivot.png</file>
|
|
||||||
<file>res/image/control/ProgressBar.png</file>
|
|
||||||
<file>res/image/control/ProgressRing.png</file>
|
|
||||||
<file>res/image/control/PullToRefresh.png</file>
|
|
||||||
<file>res/image/control/RadialGradientBrush.png</file>
|
|
||||||
<file>res/image/control/RadioButton.png</file>
|
|
||||||
<file>res/image/control/RadioButtons.png</file>
|
|
||||||
<file>res/image/control/RatingControl.png</file>
|
|
||||||
<file>res/image/control/RelativePanel.png</file>
|
|
||||||
<file>res/image/control/RepeatButton.png</file>
|
|
||||||
<file>res/image/control/RevealFocus.png</file>
|
|
||||||
<file>res/image/control/RichEditBox.png</file>
|
|
||||||
<file>res/image/control/RichTextBlock.png</file>
|
|
||||||
<file>res/image/control/ScrollViewer.png</file>
|
|
||||||
<file>res/image/control/SemanticZoom.png</file>
|
|
||||||
<file>res/image/control/Shape.png</file>
|
|
||||||
<file>res/image/control/Slider.png</file>
|
|
||||||
<file>res/image/control/Sound.png</file>
|
|
||||||
<file>res/image/control/SplitButton.png</file>
|
|
||||||
<file>res/image/control/SplitView.png</file>
|
|
||||||
<file>res/image/control/StackPanel.png</file>
|
|
||||||
<file>res/image/control/StandardUICommand.png</file>
|
|
||||||
<file>res/image/control/SwipeControl.png</file>
|
|
||||||
<file>res/image/control/TabView.png</file>
|
|
||||||
<file>res/image/control/TeachingTip.png</file>
|
|
||||||
<file>res/image/control/TextBlock.png</file>
|
|
||||||
<file>res/image/control/TextBox.png</file>
|
|
||||||
<file>res/image/control/ThemeTransition.png</file>
|
|
||||||
<file>res/image/control/TimePicker.png</file>
|
|
||||||
<file>res/image/control/TitleBar.png</file>
|
|
||||||
<file>res/image/control/ToggleButton.png</file>
|
|
||||||
<file>res/image/control/ToggleSplitButton.png</file>
|
|
||||||
<file>res/image/control/ToggleSwitch.png</file>
|
|
||||||
<file>res/image/control/ToolTip.png</file>
|
|
||||||
<file>res/image/control/TreeView.png</file>
|
|
||||||
<file>res/image/control/VariableSizedWrapGrid.png</file>
|
|
||||||
<file>res/image/control/Viewbox.png</file>
|
|
||||||
<file>res/image/control/WebView.png</file>
|
|
||||||
<file>res/image/control/XamlUICommand.png</file>
|
|
||||||
<file>T_CheckBox.qml</file>
|
|
||||||
<file>global/ItemsOriginal.qml</file>
|
|
||||||
<file>global/qmldir</file>
|
|
||||||
<file>global/ItemsFooter.qml</file>
|
|
||||||
<file>page/MediaPage.qml</file>
|
|
||||||
<file>T_FlipView.qml</file>
|
|
||||||
<file>T_Pivot.qml</file>
|
|
||||||
<file>component/CodeExpander.qml</file>
|
|
||||||
<file>T_TableView.qml</file>
|
|
||||||
<file>T_StatusView.qml</file>
|
|
||||||
<file>T_Settings.qml</file>
|
|
||||||
<file>global/MainEvent.qml</file>
|
|
||||||
<file>res/svg/home.svg</file>
|
|
||||||
<file>res/svg/home_dark.svg</file>
|
|
||||||
<file>page/StandardWindow.qml</file>
|
|
||||||
<file>page/SingleTaskWindow.qml</file>
|
|
||||||
<file>page/SingleInstanceWindow.qml</file>
|
|
||||||
<file>T_RatingControl.qml</file>
|
|
||||||
<file>res/image/qrcode_wx.jpg</file>
|
|
||||||
<file>res/image/qrcode_zfb.jpg</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
26
example/qml/App.qml
Normal file
26
example/qml/App.qml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Window {
|
||||||
|
id:app
|
||||||
|
Component.onCompleted: {
|
||||||
|
FluApp.init(app)
|
||||||
|
FluTheme.frameless = ("windows" === Qt.platform.os)
|
||||||
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
|
FluApp.routes = {
|
||||||
|
"/":"qrc:/example/qml/window/MainWindow.qml",
|
||||||
|
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||||
|
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||||
|
"/chat":"qrc:/example/qml/window/ChatWindow.qml",
|
||||||
|
"/media":"qrc:/example/qml/window/MediaWindow.qml",
|
||||||
|
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||||
|
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||||
|
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml"
|
||||||
|
}
|
||||||
|
FluApp.initialRoute = "/"
|
||||||
|
FluApp.run()
|
||||||
|
}
|
||||||
|
}
|
@ -119,7 +119,8 @@ FluExpander{
|
|||||||
"FluTheme",
|
"FluTheme",
|
||||||
"FluStatusView",
|
"FluStatusView",
|
||||||
"FluRatingControl",
|
"FluRatingControl",
|
||||||
"FluPasswordBox"
|
"FluPasswordBox",
|
||||||
|
"FluBreadcrumbBar"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
@ -20,7 +20,7 @@ FluObject{
|
|||||||
title:lang.settings
|
title:lang.settings
|
||||||
icon:FluentIcons.Settings
|
icon:FluentIcons.Settings
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Settings.qml")
|
navigationView.push("qrc:/example/qml/page/T_Settings.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,13 +12,13 @@ FluObject{
|
|||||||
// icon:FluentIcons.Home
|
// icon:FluentIcons.Home
|
||||||
cusIcon: Image{
|
cusIcon: Image{
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
source: FluTheme.dark ? "qrc:/res/svg/home_dark.svg" : "qrc:/res/svg/home.svg"
|
source: FluTheme.dark ? "qrc:/example/res/svg/home_dark.svg" : "qrc:/example/res/svg/home.svg"
|
||||||
sourceSize: Qt.size(30,30)
|
sourceSize: Qt.size(30,30)
|
||||||
width: 18
|
width: 18
|
||||||
height: 18
|
height: 18
|
||||||
}
|
}
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Home.qml")
|
navigationView.push("qrc:/example/qml/page/T_Home.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,35 +27,35 @@ FluObject{
|
|||||||
icon:FluentIcons.CheckboxComposite
|
icon:FluentIcons.CheckboxComposite
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Buttons"
|
title:"Buttons"
|
||||||
image:"qrc:/res/image/control/Button.png"
|
image:"qrc:/example/res/image/control/Button.png"
|
||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that responds to user input and raisesa Click event."
|
desc:"A control that responds to user input and raisesa Click event."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Buttons.qml")
|
navigationView.push("qrc:/example/qml/page/T_Buttons.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Slider"
|
title:"Slider"
|
||||||
image:"qrc:/res/image/control/Slider.png"
|
image:"qrc:/example/res/image/control/Slider.png"
|
||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack."
|
desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Slider.qml")
|
navigationView.push("qrc:/example/qml/page/T_Slider.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"CheckBox"
|
title:"CheckBox"
|
||||||
image:"qrc:/res/image/control/Checkbox.png"
|
image:"qrc:/example/res/image/control/Checkbox.png"
|
||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that a user can select or clear."
|
desc:"A control that a user can select or clear."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_CheckBox.qml")
|
navigationView.push("qrc:/example/qml/page/T_CheckBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_ToggleSwitch.qml")
|
navigationView.push("qrc:/example/qml/page/T_ToggleSwitch.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,31 +66,31 @@ FluObject{
|
|||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TextBox"
|
title:"TextBox"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TextBox.qml")
|
navigationView.push("qrc:/example/qml/page/T_TextBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TimePicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_TimePicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"DatePicker"
|
title:"DatePicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_DatePicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_DatePicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"CalendarPicker"
|
title:"CalendarPicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_CalendarPicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_CalendarPicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ColorPicker"
|
title:"ColorPicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_ColorPicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_ColorPicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,53 +100,53 @@ FluObject{
|
|||||||
icon:FluentIcons.SurfaceHub
|
icon:FluentIcons.SurfaceHub
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"InfoBar"
|
title:"InfoBar"
|
||||||
image:"qrc:/res/image/control/InfoBar.png"
|
image:"qrc:/example/res/image/control/InfoBar.png"
|
||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"An inline message to display app-wide statuschange information."
|
desc:"An inline message to display app-wide statuschange information."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_InfoBar.qml")
|
navigationView.push("qrc:/example/qml/page/T_InfoBar.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Progress"
|
title:"Progress"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Progress.qml")
|
navigationView.push("qrc:/example/qml/page/T_Progress.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"RatingControl"
|
title:"RatingControl"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_RatingControl.qml")
|
navigationView.push("qrc:/example/qml/page/T_RatingControl.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Badge"
|
title:"Badge"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Badge.qml")
|
navigationView.push("qrc:/example/qml/page/T_Badge.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Rectangle"
|
title:"Rectangle"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Rectangle.qml")
|
navigationView.push("qrc:/example/qml/page/T_Rectangle.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_StatusView.qml")
|
navigationView.push("qrc:/example/qml/page/T_StatusView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Carousel"
|
title:"Carousel"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Carousel.qml")
|
navigationView.push("qrc:/example/qml/page/T_Carousel.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Expander"
|
title:"Expander"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Expander.qml")
|
navigationView.push("qrc:/example/qml/page/T_Expander.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,19 +157,19 @@ FluObject{
|
|||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Dialog"
|
title:"Dialog"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Dialog.qml")
|
navigationView.push("qrc:/example/qml/page/T_Dialog.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Tooltip"
|
title:"Tooltip"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Tooltip.qml")
|
navigationView.push("qrc:/example/qml/page/T_Tooltip.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Menu"
|
title:"Menu"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Menu.qml")
|
navigationView.push("qrc:/example/qml/page/T_Menu.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,54 +179,60 @@ FluObject{
|
|||||||
icon:FluentIcons.AllApps
|
icon:FluentIcons.AllApps
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Pivot"
|
title:"Pivot"
|
||||||
image:"qrc:/res/image/control/Pivot.png"
|
image:"qrc:/example/res/image/control/Pivot.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:3
|
order:3
|
||||||
desc:"Presents information from different sources in atabbed view."
|
desc:"Presents information from different sources in atabbed view."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Pivot.qml")
|
navigationView.push("qrc:/example/qml/page/T_Pivot.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"BreadcrumbBar"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_BreadcrumbBar.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TabView"
|
title:"TabView"
|
||||||
image:"qrc:/res/image/control/TabView.png"
|
image:"qrc:/example/res/image/control/TabView.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:1
|
order:1
|
||||||
desc:"A control that displays a collection of tabs thatcan be used to display several documents."
|
desc:"A control that displays a collection of tabs thatcan be used to display several documents."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TabView.qml")
|
navigationView.push("qrc:/example/qml/page/T_TabView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TreeView"
|
title:"TreeView"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TreeView.qml")
|
navigationView.push("qrc:/example/qml/page/T_TreeView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TableView"
|
title:"TableView"
|
||||||
image:"qrc:/res/image/control/DataGrid.png"
|
image:"qrc:/example/res/image/control/DataGrid.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:4
|
order:4
|
||||||
desc:"The TableView control provides a flexible way to display a collection of data in rows and columns"
|
desc:"The TableView control provides a flexible way to display a collection of data in rows and columns"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TableView.qml")
|
navigationView.push("qrc:/example/qml/page/T_TableView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_MultiWindow.qml")
|
navigationView.push("qrc:/example/qml/page/T_MultiWindow.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"FlipView"
|
title:"FlipView"
|
||||||
image:"qrc:/res/image/control/FlipView.png"
|
image:"qrc:/example/res/image/control/FlipView.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:2
|
order:2
|
||||||
desc:"Presents a collection of items that the user canflip through, one item at a time."
|
desc:"Presents a collection of items that the user canflip through, one item at a time."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_FlipView.qml")
|
navigationView.push("qrc:/example/qml/page/T_FlipView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,19 +243,19 @@ FluObject{
|
|||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Theme"
|
title:"Theme"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Theme.qml")
|
navigationView.push("qrc:/example/qml/page/T_Theme.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Typography"
|
title:"Typography"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Typography.qml")
|
navigationView.push("qrc:/example/qml/page/T_Typography.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Awesome"
|
title:"Awesome"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Awesome.qml")
|
navigationView.push("qrc:/example/qml/page/T_Awesome.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,12 +265,12 @@ FluObject{
|
|||||||
icon:FluentIcons.Media
|
icon:FluentIcons.Media
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"MediaPlayer"
|
title:"MediaPlayer"
|
||||||
image:"qrc:/res/image/control/MediaPlayerElement.png"
|
image:"qrc:/example/res/image/control/MediaPlayerElement.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:0
|
order:0
|
||||||
desc:"A control to display video and image content."
|
desc:"A control to display video and image content."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_MediaPlayer.qml")
|
navigationView.push("qrc:/example/qml/page/T_MediaPlayer.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
98
example/qml/page/T_BreadcrumbBar.qml
Normal file
98
example/qml/page/T_BreadcrumbBar.qml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"BreadcurmbBar"
|
||||||
|
leftPadding:10
|
||||||
|
rightPadding:10
|
||||||
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
var items = []
|
||||||
|
for(var i=0;i<10;i++){
|
||||||
|
items.push({title:"Item_"+(i+1)})
|
||||||
|
}
|
||||||
|
breadcrumb_1.items = items
|
||||||
|
breadcrumb_2.items = items
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluBreadcrumbBar{
|
||||||
|
id:breadcrumb_1
|
||||||
|
width:parent.width
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onClickItem:
|
||||||
|
(model)=>{
|
||||||
|
showSuccess(model.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 100
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width:parent.width
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
|
FluFilledButton{
|
||||||
|
text:"Reset sample"
|
||||||
|
onClicked:{
|
||||||
|
var items = []
|
||||||
|
for(var i=0;i<10;i++){
|
||||||
|
items.push({title:"Item_"+(i+1)})
|
||||||
|
}
|
||||||
|
breadcrumb_2.items = items
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluBreadcrumbBar{
|
||||||
|
id:breadcrumb_2
|
||||||
|
separator:">"
|
||||||
|
spacing:8
|
||||||
|
textSize:18
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onClickItem:
|
||||||
|
(model)=>{
|
||||||
|
//不是点击最后一个item元素
|
||||||
|
if(model.index+1!==count()){
|
||||||
|
breadcrumb_2.remove(model.index+1,count()-model.index-1)
|
||||||
|
}
|
||||||
|
showSuccess(model.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluBreadcrumbBar{
|
||||||
|
width:parent.width
|
||||||
|
separator:">"
|
||||||
|
spacing:8
|
||||||
|
textSize:18
|
||||||
|
onClickItem: (model)=>{
|
||||||
|
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -4,7 +4,7 @@ import QtQuick.Window
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Controls.Basic
|
import QtQuick.Controls.Basic
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
title:"Buttons"
|
title:"Buttons"
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 5
|
Layout.leftMargin: 5
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
carousel.setData([{url:"qrc:/res/image/banner_1.jpg"},{url:"qrc:/res/image/banner_2.jpg"},{url:"qrc:/res/image/banner_3.jpg"}])
|
carousel.setData([{url:"qrc:/example/res/image/banner_1.jpg"},{url:"qrc:/example/res/image/banner_2.jpg"},{url:"qrc:/example/res/image/banner_3.jpg"}])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ FluScrollablePage{
|
|||||||
width: 400
|
width: 400
|
||||||
height: 300
|
height: 300
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
setData([{url:"qrc:/res/image/banner_1.jpg"},{url:"qrc:/res/image/banner_2.jpg"},{url:"qrc:/res/image/banner_3.jpg"}])
|
setData([{url:"qrc:/example/res/image/banner_1.jpg"},{url:"qrc:/example/res/image/banner_2.jpg"},{url:"qrc:/example/res/image/banner_3.jpg"}])
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -25,17 +25,17 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluFlipView{
|
FluFlipView{
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_2.jpg"
|
source: "qrc:/example/res/image/banner_2.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_3.jpg"
|
source: "qrc:/example/res/image/banner_3.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
@ -47,17 +47,17 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: -1
|
Layout.topMargin: -1
|
||||||
code:'FluFlipView{
|
code:'FluFlipView{
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
@ -78,18 +78,18 @@ FluScrollablePage{
|
|||||||
FluFlipView{
|
FluFlipView{
|
||||||
vertical:true
|
vertical:true
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
sourceSize: Qt.size(400,300)
|
sourceSize: Qt.size(400,300)
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_2.jpg"
|
source: "qrc:/example/res/image/banner_2.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_3.jpg"
|
source: "qrc:/example/res/image/banner_3.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
@ -102,17 +102,17 @@ FluScrollablePage{
|
|||||||
code:'FluFlipView{
|
code:'FluFlipView{
|
||||||
vertical:true
|
vertical:true
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import "qrc:///global/"
|
import "qrc:///example/qml/global/"
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
@ -15,7 +15,7 @@ FluScrollablePage{
|
|||||||
ListModel{
|
ListModel{
|
||||||
id:model_header
|
id:model_header
|
||||||
ListElement{
|
ListElement{
|
||||||
icon:"qrc:/res/image/ic_home_github.png"
|
icon:"qrc:/example/res/image/ic_home_github.png"
|
||||||
title:"FluentUI GitHub"
|
title:"FluentUI GitHub"
|
||||||
desc:"The latest FluentUI controls and styles for your applications."
|
desc:"The latest FluentUI controls and styles for your applications."
|
||||||
url:"https://github.com/zhuzichu520/FluentUI"
|
url:"https://github.com/zhuzichu520/FluentUI"
|
||||||
@ -30,7 +30,7 @@ FluScrollablePage{
|
|||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
verticalAlignment: Qt.AlignTop
|
verticalAlignment: Qt.AlignTop
|
||||||
source: "qrc:/res/image/bg_home_header.png"
|
source: "qrc:/example/res/image/bg_home_header.png"
|
||||||
}
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,12 +3,12 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
property string password: ""
|
property string password: ""
|
||||||
property var loginPageRegister: registerForPageResult("/login")
|
property var loginPageRegister: registerForWindowResult("/login")
|
||||||
|
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
leftPadding:10
|
leftPadding:10
|
||||||
@ -168,7 +168,7 @@ FluScrollablePage{
|
|||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: -1
|
Layout.topMargin: -1
|
||||||
code:'property var loginPageRegister: registerForPageResult("/login")
|
code:'property var loginPageRegister: registerForWindowResult("/login")
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: loginPageRegister
|
target: loginPageRegister
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ FluScrollablePage{
|
|||||||
Image {
|
Image {
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: "qrc:/res/svg/avatar_1.svg"
|
source: "qrc:/example/res/svg/avatar_1.svg"
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ FluScrollablePage{
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
source: "qrc:/res/svg/avatar_2.svg"
|
source: "qrc:/example/res/svg/avatar_2.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluRectangle{
|
FluRectangle{
|
||||||
@ -102,7 +102,7 @@ FluScrollablePage{
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
source: "qrc:/res/svg/avatar_3.svg"
|
source: "qrc:/example/res/svg/avatar_3.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluRectangle{
|
FluRectangle{
|
||||||
@ -113,7 +113,7 @@ FluScrollablePage{
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
source: "qrc:/res/svg/avatar_4.svg"
|
source: "qrc:/example/res/svg/avatar_4.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ FluScrollablePage{
|
|||||||
radius:[25,25,25,25]
|
radius:[25,25,25,25]
|
||||||
Image {
|
Image {
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
source: "qrc:/res/image/image_huoyin.webp"
|
source: "qrc:/example/res/image/image_huoyin.webp"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ FluScrollablePage{
|
|||||||
Image{
|
Image{
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: "qrc:/res/svg/avatar_4.svg"
|
source: "qrc:/example/res/svg/avatar_4.svg"
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
}
|
}
|
||||||
}'
|
}'
|
@ -3,8 +3,8 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///global/"
|
import "qrc:///example/qml/global/"
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import "./component"
|
import "../component"
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function newTab(){
|
function newTab(){
|
||||||
tab_view.appendTab("qrc:/res/image/favicon.ico","Document "+tab_view.count(),com_page,colors[Math.floor(Math.random() * 8)].dark)
|
tab_view.appendTab("qrc:/example/res/image/favicon.ico","Document "+tab_view.count(),com_page,colors[Math.floor(Math.random() * 8)].dark)
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@ -129,7 +129,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function newTab(){
|
function newTab(){
|
||||||
tab_view.appendTab("qrc:/res/image/favicon.ico","Document 1",com_page,argument)
|
tab_view.appendTab("qrc:/example/res/image/favicon.ico","Document 1",com_page,argument)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'
|
'
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ FluScrollablePage{
|
|||||||
text:"编辑"
|
text:"编辑"
|
||||||
topPadding:3
|
topPadding:3
|
||||||
bottomPadding:3
|
bottomPadding:3
|
||||||
leftPadding:3
|
leftPadding:6
|
||||||
rightPadding:3
|
rightPadding:6
|
||||||
onClicked:{
|
onClicked:{
|
||||||
console.debug(dataModel.index)
|
console.debug(dataModel.index)
|
||||||
showSuccess(JSON.stringify(dataObject))
|
showSuccess(JSON.stringify(dataObject))
|
||||||
@ -79,8 +79,8 @@ FluScrollablePage{
|
|||||||
text:"删除"
|
text:"删除"
|
||||||
topPadding:3
|
topPadding:3
|
||||||
bottomPadding:3
|
bottomPadding:3
|
||||||
leftPadding:3
|
leftPadding:6
|
||||||
rightPadding:3
|
rightPadding:6
|
||||||
onClicked:{
|
onClicked:{
|
||||||
showError(JSON.stringify(dataObject))
|
showError(JSON.stringify(dataObject))
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage {
|
FluScrollablePage {
|
||||||
|
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"关于"
|
||||||
width: 600
|
width: 600
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 600
|
minimumWidth: 600
|
||||||
@ -15,8 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
title:"关于"
|
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
title:"关于"
|
title:"关于"
|
||||||
@ -130,12 +128,12 @@ FluWindow {
|
|||||||
Image{
|
Image{
|
||||||
width: 164.55
|
width: 164.55
|
||||||
height: 224.25
|
height: 224.25
|
||||||
source: "qrc:/res/image/qrcode_wx.jpg"
|
source: "qrc:/example/res/image/qrcode_wx.jpg"
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
width: 162
|
width: 162
|
||||||
height: 252
|
height: 252
|
||||||
source: "qrc:/res/image/qrcode_zfb.jpg"
|
source: "qrc:/example/res/image/qrcode_zfb.jpg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,13 +7,12 @@ import QtQuick.Dialogs
|
|||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
|
title:"ChatGPT"
|
||||||
width: 680
|
width: 680
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
minimumHeight: 600
|
minimumHeight: 600
|
||||||
|
|
||||||
title:"ChatGPT"
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
||||||
scrollview.focus = true
|
scrollview.focus = true
|
||||||
@ -121,7 +120,7 @@ FluWindow {
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(100,100)
|
sourceSize: Qt.size(100,100)
|
||||||
source: isMy ? "qrc:/res/svg/avatar_2.svg" : "qrc:/res/image/logo_openai.png"
|
source: isMy ? "qrc:/example/res/svg/avatar_2.svg" : "qrc:/example/res/image/logo_openai.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,13 +6,13 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"登录"
|
||||||
width: 400
|
width: 400
|
||||||
height: 400
|
height: 400
|
||||||
minimumWidth: 400
|
minimumWidth: 400
|
||||||
minimumHeight: 400
|
minimumHeight: 400
|
||||||
maximumWidth: 400
|
maximumWidth: 400
|
||||||
maximumHeight: 400
|
maximumHeight: 400
|
||||||
title:"登录"
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
@ -4,13 +4,15 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///global/"
|
import example
|
||||||
|
import "qrc:///example/qml/global/"
|
||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title: "FluentUI"
|
||||||
width: 1000
|
width: 1000
|
||||||
height: 640
|
height: 640
|
||||||
title: "FluentUI"
|
|
||||||
closeDestory:false
|
closeDestory:false
|
||||||
minimumWidth: 520
|
minimumWidth: 520
|
||||||
minimumHeight: 460
|
minimumHeight: 460
|
||||||
@ -20,6 +22,15 @@ FluWindow {
|
|||||||
event.accepted = false
|
event.accepted = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections{
|
||||||
|
target: appInfo
|
||||||
|
function onActiveWindow(){
|
||||||
|
window.show()
|
||||||
|
window.raise()
|
||||||
|
window.requestActivate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
z:9
|
z:9
|
||||||
@ -31,7 +42,7 @@ FluWindow {
|
|||||||
SystemTrayIcon {
|
SystemTrayIcon {
|
||||||
id:system_tray
|
id:system_tray
|
||||||
visible: true
|
visible: true
|
||||||
icon.source: "qrc:/res/image/favicon.ico"
|
icon.source: "qrc:/example/res/image/favicon.ico"
|
||||||
tooltip: "FluentUI"
|
tooltip: "FluentUI"
|
||||||
menu: Menu {
|
menu: Menu {
|
||||||
MenuItem {
|
MenuItem {
|
||||||
@ -78,7 +89,7 @@ FluWindow {
|
|||||||
footerItems:ItemsFooter
|
footerItems:ItemsFooter
|
||||||
z:11
|
z:11
|
||||||
displayMode:MainEvent.displayMode
|
displayMode:MainEvent.displayMode
|
||||||
logo: "qrc:/res/image/favicon.ico"
|
logo: "qrc:/example/res/image/favicon.ico"
|
||||||
title:"FluentUI"
|
title:"FluentUI"
|
||||||
autoSuggestBox:FluAutoSuggestBox{
|
autoSuggestBox:FluAutoSuggestBox{
|
||||||
width: 280
|
width: 280
|
@ -5,13 +5,12 @@ import FluentUI
|
|||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
|
title:"视频播放器"
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
minimumWidth: 640
|
minimumWidth: 640
|
||||||
minimumHeight: 480
|
minimumHeight: 480
|
||||||
|
|
||||||
title:"视频播放器"
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
||||||
player.source = argument.source
|
player.source = argument.source
|
||||||
@ -23,7 +22,6 @@ FluWindow {
|
|||||||
width:parent.width
|
width:parent.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluMediaPlayer{
|
FluMediaPlayer{
|
||||||
id:player
|
id:player
|
||||||
anchors{
|
anchors{
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"SingleInstance"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,8 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleInstance
|
launchMode: FluWindow.SingleInstance
|
||||||
|
|
||||||
title:"SingleInstance"
|
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
title:"SingleInstance"
|
title:"SingleInstance"
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"SingleTask"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,8 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
title:"SingleTask"
|
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
title:"SingleTask"
|
title:"SingleTask"
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"Standard"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,8 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.Standard
|
launchMode: FluWindow.Standard
|
||||||
|
|
||||||
title:"Standard"
|
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
title:"Standard"
|
title:"Standard"
|
@ -2,11 +2,10 @@
|
|||||||
#include "lang/En.h"
|
#include "lang/En.h"
|
||||||
#include "lang/Zh.h"
|
#include "lang/Zh.h"
|
||||||
|
|
||||||
|
|
||||||
AppInfo::AppInfo(QObject *parent)
|
AppInfo::AppInfo(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
version("1.2.6");
|
version("1.2.8");
|
||||||
lang(new En());
|
lang(new En());
|
||||||
}
|
}
|
||||||
|
|
@ -13,6 +13,7 @@ class AppInfo : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit AppInfo(QObject *parent = nullptr);
|
explicit AppInfo(QObject *parent = nullptr);
|
||||||
Q_INVOKABLE void changeLang(const QString& locale);
|
Q_INVOKABLE void changeLang(const QString& locale);
|
||||||
|
Q_SIGNAL void activeWindow();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPINFO_H
|
#endif // APPINFO_H
|
@ -11,7 +11,7 @@
|
|||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include "stdafx.h"
|
#include "../stdafx.h"
|
||||||
|
|
||||||
class ChatController : public QObject
|
class ChatController : public QObject
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
#define LANG_H
|
#define LANG_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "stdafx.h"
|
#include "../stdafx.h"
|
||||||
|
|
||||||
class Lang : public QObject
|
class Lang : public QObject
|
||||||
{
|
{
|
@ -6,7 +6,11 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include "lang/Lang.h"
|
#include "lang/Lang.h"
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
#include "ChatController.h"
|
#include "controller/ChatController.h"
|
||||||
|
#include "tool/IPC.h"
|
||||||
|
#if defined(STATICLIB)
|
||||||
|
#include <FluentUI.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -19,12 +23,28 @@ int main(int argc, char *argv[])
|
|||||||
QGuiApplication::setOrganizationName("ZhuZiChu");
|
QGuiApplication::setOrganizationName("ZhuZiChu");
|
||||||
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||||
QGuiApplication::setApplicationName("FluentUI");
|
QGuiApplication::setApplicationName("FluentUI");
|
||||||
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
AppInfo* appInfo = new AppInfo();
|
||||||
|
IPC ipc(0);
|
||||||
|
QString activeWindowEvent = "activeWindow";
|
||||||
|
if(!ipc.isCurrentOwner()){
|
||||||
|
ipc.postEvent(activeWindowEvent,QString().toUtf8(),0);
|
||||||
|
delete appInfo;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(ipc.isAttached()){
|
||||||
|
ipc.registerEventHandler(activeWindowEvent,[&appInfo](const QByteArray&){
|
||||||
|
Q_EMIT appInfo->activeWindow();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
#if defined(STATICLIB)
|
||||||
|
FluentUI::initialize(&engine);
|
||||||
|
#endif
|
||||||
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
||||||
AppInfo* appInfo = new AppInfo();
|
|
||||||
QQmlContext * context = engine.rootContext();
|
QQmlContext * context = engine.rootContext();
|
||||||
Lang* lang = appInfo->lang();
|
Lang* lang = appInfo->lang();
|
||||||
context->setContextProperty("lang",lang);
|
context->setContextProperty("lang",lang);
|
||||||
@ -32,12 +52,12 @@ int main(int argc, char *argv[])
|
|||||||
context->setContextProperty("lang",appInfo->lang());
|
context->setContextProperty("lang",appInfo->lang());
|
||||||
});
|
});
|
||||||
context->setContextProperty("appInfo",appInfo);
|
context->setContextProperty("appInfo",appInfo);
|
||||||
const QUrl url(QStringLiteral("qrc:/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||||
if (!obj && url == objUrl)
|
if (!obj && url == objUrl)
|
||||||
QCoreApplication::exit(-1);
|
QCoreApplication::exit(-1);
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
engine.load(url);
|
engine.load(url);
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
250
example/src/tool/IPC.cpp
Normal file
250
example/src/tool/IPC.cpp
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
#include "IPC.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QThread>
|
||||||
|
#include <ctime>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
|
|
||||||
|
IPC::IPC(uint32_t profileId)
|
||||||
|
: profileId{profileId}
|
||||||
|
, globalMemory{"ipc-" IPC_PROTOCOL_VERSION}
|
||||||
|
{
|
||||||
|
qRegisterMetaType<IPCEventHandler>("IPCEventHandler");
|
||||||
|
timer.setInterval(EVENT_TIMER_MS);
|
||||||
|
timer.setSingleShot(true);
|
||||||
|
connect(&timer, &QTimer::timeout, this, &IPC::processEvents);
|
||||||
|
std::default_random_engine randEngine((std::random_device())());
|
||||||
|
std::uniform_int_distribution<uint64_t> distribution;
|
||||||
|
globalId = distribution(randEngine);
|
||||||
|
qDebug() << "Our global IPC ID is " << globalId;
|
||||||
|
if (globalMemory.create(sizeof(IPCMemory))) {
|
||||||
|
if (globalMemory.lock()) {
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
memset(mem, 0, sizeof(IPCMemory));
|
||||||
|
mem->globalId = globalId;
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
globalMemory.unlock();
|
||||||
|
} else {
|
||||||
|
qWarning() << "Couldn't lock to take ownership";
|
||||||
|
}
|
||||||
|
} else if (globalMemory.attach()) {
|
||||||
|
qDebug() << "Attaching to the global shared memory";
|
||||||
|
} else {
|
||||||
|
qDebug() << "Failed to attach to the global shared memory, giving up. Error:"
|
||||||
|
<< globalMemory.error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
processEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::~IPC()
|
||||||
|
{
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
qWarning() << "Failed to lock in ~IPC";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isCurrentOwnerNoLock()) {
|
||||||
|
global()->globalId = 0;
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t IPC::postEvent(const QString& name, const QByteArray& data, uint32_t dest)
|
||||||
|
{
|
||||||
|
QByteArray binName = name.toUtf8();
|
||||||
|
if (binName.length() > (int32_t)sizeof(IPCEvent::name)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.length() > (int32_t)sizeof(IPCEvent::data)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
qDebug() << "Failed to lock in postEvent()";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCEvent* evt = nullptr;
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
time_t result = 0;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; !evt && i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
if (mem->events[i].posted == 0) {
|
||||||
|
evt = &mem->events[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt) {
|
||||||
|
memset(evt, 0, sizeof(IPCEvent));
|
||||||
|
memcpy(evt->name, binName.constData(), binName.length());
|
||||||
|
memcpy(evt->data, data.constData(), data.length());
|
||||||
|
mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(nullptr));
|
||||||
|
evt->dest = dest;
|
||||||
|
evt->sender = qApp->applicationPid();
|
||||||
|
qDebug() << "postEvent " << name << "to" << dest;
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isCurrentOwner()
|
||||||
|
{
|
||||||
|
if (globalMemory.lock()) {
|
||||||
|
const bool isOwner = isCurrentOwnerNoLock();
|
||||||
|
globalMemory.unlock();
|
||||||
|
return isOwner;
|
||||||
|
} else {
|
||||||
|
qWarning() << "isCurrentOwner failed to lock, returning false";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::registerEventHandler(const QString& name, IPCEventHandler handler)
|
||||||
|
{
|
||||||
|
eventHandlers[name] = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isEventAccepted(time_t time)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (difftime(global()->lastProcessed, time) > 0) {
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
if (mem->events[i].posted == time && mem->events[i].processed) {
|
||||||
|
result = mem->events[i].accepted;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout /*=-1*/)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
time_t start = time(nullptr);
|
||||||
|
forever
|
||||||
|
{
|
||||||
|
result = isEventAccepted(postTime);
|
||||||
|
if (result || (timeout > 0 && difftime(time(nullptr), start) >= timeout)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
qApp->processEvents();
|
||||||
|
QThread::msleep(0);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isAttached() const
|
||||||
|
{
|
||||||
|
return globalMemory.isAttached();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::setProfileId(uint32_t profileId)
|
||||||
|
{
|
||||||
|
this->profileId = profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::IPCEvent* IPC::fetchEvent()
|
||||||
|
{
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
IPCEvent* evt = &mem->events[i];
|
||||||
|
if ((evt->processed && difftime(time(nullptr), evt->processed) > EVENT_GC_TIMEOUT)
|
||||||
|
|| (!evt->processed && difftime(time(nullptr), evt->posted) > EVENT_GC_TIMEOUT)) {
|
||||||
|
memset(evt, 0, sizeof(IPCEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt->posted && !evt->processed && evt->sender != qApp->applicationPid()
|
||||||
|
&& (evt->dest == profileId || (evt->dest == 0 && isCurrentOwnerNoLock()))) {
|
||||||
|
return evt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::runEventHandler(IPCEventHandler handler, const QByteArray& arg)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if (QThread::currentThread() == qApp->thread()) {
|
||||||
|
result = handler(arg);
|
||||||
|
} else {
|
||||||
|
QMetaObject::invokeMethod(this, "runEventHandler", Qt::BlockingQueuedConnection,
|
||||||
|
Q_RETURN_ARG(bool, result), Q_ARG(IPCEventHandler, handler),
|
||||||
|
Q_ARG(const QByteArray&, arg));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::processEvents()
|
||||||
|
{
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
timer.start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
|
||||||
|
if (mem->globalId == globalId) {
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
} else {
|
||||||
|
if (difftime(time(nullptr), mem->lastProcessed) >= OWNERSHIP_TIMEOUT_S) {
|
||||||
|
qDebug() << "Previous owner timed out, taking ownership" << mem->globalId << "->"
|
||||||
|
<< globalId;
|
||||||
|
memset(mem, 0, sizeof(IPCMemory));
|
||||||
|
mem->globalId = globalId;
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (IPCEvent* evt = fetchEvent()) {
|
||||||
|
QString name = QString::fromUtf8(evt->name);
|
||||||
|
auto it = eventHandlers.find(name);
|
||||||
|
if (it != eventHandlers.end()) {
|
||||||
|
evt->accepted = runEventHandler(it.value(), evt->data);
|
||||||
|
qDebug() << "Processed event:" << name << "posted:" << evt->posted
|
||||||
|
<< "accepted:" << evt->accepted;
|
||||||
|
if (evt->dest == 0) {
|
||||||
|
if (evt->accepted) {
|
||||||
|
evt->processed = time(nullptr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
evt->processed = time(nullptr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qDebug() << "Received event:" << name << "without handler";
|
||||||
|
qDebug() << "Available handlers:" << eventHandlers.keys();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
globalMemory.unlock();
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isCurrentOwnerNoLock()
|
||||||
|
{
|
||||||
|
const void* const data = globalMemory.data();
|
||||||
|
if (!data) {
|
||||||
|
qWarning() << "isCurrentOwnerNoLock failed to access the memory, returning false";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (*static_cast<const uint64_t*>(data) == globalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::IPCMemory* IPC::global()
|
||||||
|
{
|
||||||
|
return static_cast<IPCMemory*>(globalMemory.data());
|
||||||
|
}
|
75
example/src/tool/IPC.h
Normal file
75
example/src/tool/IPC.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#ifndef IPC_H
|
||||||
|
#define IPC_H
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QSharedMemory>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <ctime>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
using IPCEventHandler = std::function<bool(const QByteArray&)>;
|
||||||
|
|
||||||
|
#define IPC_PROTOCOL_VERSION "1"
|
||||||
|
|
||||||
|
class IPC : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static const int EVENT_TIMER_MS = 1000;
|
||||||
|
static const int EVENT_GC_TIMEOUT = 5;
|
||||||
|
static const int EVENT_QUEUE_SIZE = 32;
|
||||||
|
static const int OWNERSHIP_TIMEOUT_S = 5;
|
||||||
|
|
||||||
|
public:
|
||||||
|
IPC(uint32_t profileId);
|
||||||
|
~IPC();
|
||||||
|
|
||||||
|
struct IPCEvent
|
||||||
|
{
|
||||||
|
uint32_t dest;
|
||||||
|
int32_t sender;
|
||||||
|
char name[16];
|
||||||
|
char data[128];
|
||||||
|
time_t posted;
|
||||||
|
time_t processed;
|
||||||
|
uint32_t flags;
|
||||||
|
bool accepted;
|
||||||
|
bool global;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IPCMemory
|
||||||
|
{
|
||||||
|
uint64_t globalId;
|
||||||
|
time_t lastEvent;
|
||||||
|
time_t lastProcessed;
|
||||||
|
IPCEvent events[IPC::EVENT_QUEUE_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
time_t postEvent(const QString& name, const QByteArray& data = QByteArray(), uint32_t dest = 0);
|
||||||
|
bool isCurrentOwner();
|
||||||
|
void registerEventHandler(const QString& name, IPCEventHandler handler);
|
||||||
|
bool isEventAccepted(time_t time);
|
||||||
|
bool waitUntilAccepted(time_t time, int32_t timeout = -1);
|
||||||
|
bool isAttached() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setProfileId(uint32_t profileId);
|
||||||
|
|
||||||
|
private:
|
||||||
|
IPCMemory* global();
|
||||||
|
bool runEventHandler(IPCEventHandler handler, const QByteArray& arg);
|
||||||
|
IPCEvent* fetchEvent();
|
||||||
|
void processEvents();
|
||||||
|
bool isCurrentOwnerNoLock();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTimer timer;
|
||||||
|
uint64_t globalId;
|
||||||
|
uint32_t profileId;
|
||||||
|
QSharedMemory globalMemory;
|
||||||
|
QMap<QString, IPCEventHandler> eventHandlers;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IPC_H
|
@ -17,7 +17,7 @@ function Main() {
|
|||||||
|
|
||||||
New-Item -ItemType Directory $archiveName
|
New-Item -ItemType Directory $archiveName
|
||||||
# 拷贝exe
|
# 拷贝exe
|
||||||
Copy-Item bin\release\* $archiveName\
|
Copy-Item bin\release\* $archiveName\ -Force -Recurse | Out-Null
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
|
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
|
||||||
# 删除不必要的文件
|
# 删除不必要的文件
|
||||||
|
@ -27,7 +27,7 @@ function Main() {
|
|||||||
|
|
||||||
New-Item -ItemType Directory $archiveName
|
New-Item -ItemType Directory $archiveName
|
||||||
# 拷贝exe
|
# 拷贝exe
|
||||||
Copy-Item bin\release\* $archiveName\
|
Copy-Item bin\release\* $archiveName\ -Force -Recurse | Out-Null
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
|
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
|
||||||
# 删除不必要的文件
|
# 删除不必要的文件
|
||||||
|
@ -1,67 +1,59 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(FluentUI)
|
project(fluentui LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
|
|
||||||
find_package(Qt6 COMPONENTS Core Quick Svg REQUIRED)
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
set(QT_INSTALL_QML ${Qt6Core_DIR}/../../../qml)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||||
set(TARGET_TYPE SHARED)
|
else()
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(TARGET_RESOURCES res.qrc)
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
||||||
set(TARGET_SOURCES
|
|
||||||
Def.cpp
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
FluApp.cpp
|
foreach(filepath ${CPP_FILES})
|
||||||
FluColorSet.cpp
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
FluColors.cpp
|
list(APPEND sources_files ${filename})
|
||||||
FluRegister.cpp
|
endforeach(filepath)
|
||||||
FluTheme.cpp
|
|
||||||
Fluent.cpp
|
file(GLOB_RECURSE QML_PATHS *.qml)
|
||||||
FluentUI.cpp
|
foreach(filepath ${QML_PATHS})
|
||||||
NativeEventFilter.cpp
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
WindowHelper.cpp
|
list(APPEND qml_files ${filename})
|
||||||
qml_plugin.cpp
|
endforeach(filepath)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp)
|
||||||
|
foreach(filepath ${RES_PATHS})
|
||||||
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
|
list(APPEND resource_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
|
foreach(filepath IN LISTS qml_files resource_files)
|
||||||
|
string(REPLACE "imports/FluentUI/" "" filename ${filepath})
|
||||||
|
set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
qt_add_qml_module(fluentui
|
||||||
|
OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/FluentUI
|
||||||
|
VERSION 1.0
|
||||||
|
URI "FluentUI"
|
||||||
|
SOURCES ${sources_files}
|
||||||
|
QML_FILES ${qml_files}
|
||||||
|
RESOURCES ${resource_files}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TARGET_HEADERS
|
set_target_properties(fluentui PROPERTIES
|
||||||
Def.h
|
WIN32_EXECUTABLE TRUE
|
||||||
FluApp.h
|
MACOSX_BUNDLE TRUE
|
||||||
FluColorSet.h
|
|
||||||
FluColors.h
|
|
||||||
FluRegister.h
|
|
||||||
FluTheme.h
|
|
||||||
Fluent.h
|
|
||||||
FluentUI.h
|
|
||||||
NativeEventFilter.h
|
|
||||||
WindowHelper.h
|
|
||||||
qml_plugin.h
|
|
||||||
stdafx.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DVERSION_IN="1.0.0")
|
target_link_libraries(fluentui PUBLIC
|
||||||
add_definitions(-DVURI_STR="FluentUI")
|
Qt::Core
|
||||||
|
Qt::Quick
|
||||||
add_library(${PROJECT_NAME} ${TARGET_TYPE} ${TARGET_SOURCES} ${TARGET_HEADERS} ${TARGET_RESOURCES})
|
Qt::Qml
|
||||||
|
)
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32)
|
target_link_libraries(fluentui PRIVATE dwmapi user32)
|
||||||
else()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick Qt6::Svg)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
include(build_windows.cmake)
|
|
||||||
else()
|
|
||||||
include(build_macos.cmake)
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define DEF_H
|
#define DEF_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
|
||||||
namespace Fluent_DarkMode {
|
namespace Fluent_DarkMode {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
@ -10,6 +11,7 @@ Q_NAMESPACE
|
|||||||
Light = 0x1,
|
Light = 0x1,
|
||||||
Dark = 0x2,
|
Dark = 0x2,
|
||||||
};
|
};
|
||||||
|
QML_NAMED_ELEMENT(FluDarkMode)
|
||||||
Q_ENUMS(Fluent_DarkModeType);
|
Q_ENUMS(Fluent_DarkModeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1420,6 +1422,7 @@ enum class Fluent_AwesomeType {
|
|||||||
SpeechSolidBold=0xf8b2,
|
SpeechSolidBold=0xf8b2,
|
||||||
ClickedOutLoudSolidBold=0xf8b3,
|
ClickedOutLoudSolidBold=0xf8b3,
|
||||||
};
|
};
|
||||||
|
QML_NAMED_ELEMENT(FluentIcons)
|
||||||
Q_ENUMS(Fluent_AwesomeType)
|
Q_ENUMS(Fluent_AwesomeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,11 +6,14 @@
|
|||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <QFontDatabase>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#pragma comment(lib, "Dwmapi.lib")
|
||||||
|
#pragma comment(lib, "User32.lib")
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
@ -22,29 +25,39 @@ static bool isCompositionEnabled()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FluApp* FluApp::m_instance = nullptr;
|
FluApp* FluApp::fluApp = nullptr;
|
||||||
|
FluTheme* FluApp::fluTheme = nullptr;
|
||||||
|
FluColors* FluApp::flutColors = nullptr;
|
||||||
|
|
||||||
FluApp *FluApp::getInstance()
|
void FluApp::setFluApp(FluApp* val){
|
||||||
{
|
FluApp::fluApp = val;
|
||||||
if(FluApp::m_instance == nullptr){
|
}
|
||||||
FluApp::m_instance = new FluApp;
|
void FluApp::setFluTheme(FluTheme* val){
|
||||||
}
|
FluApp::fluTheme = val;
|
||||||
return FluApp::m_instance;
|
}
|
||||||
|
void FluApp::setFluColors(FluColors* val){
|
||||||
|
FluApp::flutColors = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluApp::FluApp(QObject *parent)
|
FluApp::FluApp(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
|
QFontDatabase::addApplicationFont(":/FluentUI/Font/Segoe_Fluent_Icons.ttf");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::init(QQuickWindow *window){
|
void FluApp::init(QQuickWindow *window){
|
||||||
this->appWindow = window;
|
this->appWindow = window;
|
||||||
|
QQmlEngine *engine = qmlEngine(appWindow);
|
||||||
|
QQmlComponent component(engine, ":/FluentUI/Controls/FluSingleton.qml");
|
||||||
|
component.create();
|
||||||
|
nativeEvent = new NativeEventFilter();
|
||||||
|
qApp->installNativeEventFilter(nativeEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::run(){
|
void FluApp::run(){
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if(!isCompositionEnabled()){
|
if(!isCompositionEnabled()){
|
||||||
FluTheme::getInstance()->frameless(false);
|
fluTheme->frameless(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
navigate(initialRoute());
|
navigate(initialRoute());
|
||||||
@ -64,12 +77,13 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
|||||||
}
|
}
|
||||||
properties.insert("argument",argument);
|
properties.insert("argument",argument);
|
||||||
QQuickWindow *view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
QQuickWindow *view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||||
|
|
||||||
int launchMode = view->property("launchMode").toInt();
|
int launchMode = view->property("launchMode").toInt();
|
||||||
if(launchMode==1){
|
if(launchMode==1){
|
||||||
for (auto& pair : wnds) {
|
for (auto& pair : wnds) {
|
||||||
QString r = pair->property("route").toString();
|
QString r = pair->property("route").toString();
|
||||||
if(r == route){
|
if(r == route){
|
||||||
|
pair->setProperty("argument",argument);
|
||||||
|
pair->raise();
|
||||||
pair->requestActivate();
|
pair->requestActivate();
|
||||||
view->deleteLater();
|
view->deleteLater();
|
||||||
return;
|
return;
|
||||||
@ -84,8 +98,7 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(fluTheme->frameless()){
|
||||||
if(FluTheme::getInstance()->frameless()){
|
|
||||||
view->setFlag(Qt::FramelessWindowHint,true);
|
view->setFlag(Qt::FramelessWindowHint,true);
|
||||||
}
|
}
|
||||||
wnds.insert(view->winId(),view);
|
wnds.insert(view->winId(),view);
|
||||||
|
30
src/FluApp.h
30
src/FluApp.h
@ -3,10 +3,14 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include "FluTheme.h"
|
||||||
|
#include "FluColors.h"
|
||||||
|
#include "NativeEventFilter.h"
|
||||||
#include "FluRegister.h"
|
#include "FluRegister.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
@ -15,31 +19,35 @@ class FluApp : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY_AUTO(QString,initialRoute);
|
Q_PROPERTY_AUTO(QString,initialRoute);
|
||||||
Q_PROPERTY_AUTO(QJsonObject,routes);
|
Q_PROPERTY_AUTO(QJsonObject,routes);
|
||||||
|
QML_NAMED_ELEMENT(FluApp)
|
||||||
|
QML_SINGLETON
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static FluApp *getInstance();
|
static FluApp *getInstance();
|
||||||
|
|
||||||
explicit FluApp(QObject *parent = nullptr);
|
explicit FluApp(QObject *parent = nullptr);
|
||||||
|
~FluApp(){
|
||||||
|
if (nativeEvent != Q_NULLPTR) {
|
||||||
|
delete nativeEvent;
|
||||||
|
nativeEvent = Q_NULLPTR;
|
||||||
|
}
|
||||||
|
}
|
||||||
Q_INVOKABLE void run();
|
Q_INVOKABLE void run();
|
||||||
|
|
||||||
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE void init(QQuickWindow *window);
|
Q_INVOKABLE void init(QQuickWindow *window);
|
||||||
|
|
||||||
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
||||||
|
|
||||||
Q_INVOKABLE void clipText(const QString& text);
|
Q_INVOKABLE void clipText(const QString& text);
|
||||||
|
|
||||||
Q_INVOKABLE QString uuid();
|
Q_INVOKABLE QString uuid();
|
||||||
|
|
||||||
Q_INVOKABLE void closeApp();
|
Q_INVOKABLE void closeApp();
|
||||||
|
Q_INVOKABLE void setFluApp(FluApp* val);
|
||||||
|
Q_INVOKABLE void setFluTheme(FluTheme* val);
|
||||||
|
Q_INVOKABLE void setFluColors(FluColors* val);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QMap<quint64, QQuickWindow*> wnds;
|
QMap<quint64, QQuickWindow*> wnds;
|
||||||
|
static FluApp* fluApp;
|
||||||
|
static FluTheme* fluTheme;
|
||||||
|
static FluColors* flutColors;
|
||||||
private:
|
private:
|
||||||
static FluApp* m_instance;
|
NativeEventFilter *nativeEvent = Q_NULLPTR;
|
||||||
QWindow *appWindow;
|
QWindow *appWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
|
|
||||||
FluColors* FluColors::m_instance = nullptr;
|
|
||||||
|
|
||||||
FluColors *FluColors::getInstance()
|
|
||||||
{
|
|
||||||
if(FluColors::m_instance == nullptr){
|
|
||||||
FluColors::m_instance = new FluColors;
|
|
||||||
}
|
|
||||||
return FluColors::m_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
FluColors::FluColors(QObject *parent)
|
FluColors::FluColors(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define FLUCOLORS_H
|
#define FLUCOLORS_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
#include "FluColorSet.h"
|
#include "FluColorSet.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
@ -41,13 +42,10 @@ class FluColors : public QObject
|
|||||||
Q_PROPERTY_AUTO(FluColorSet*,Blue);
|
Q_PROPERTY_AUTO(FluColorSet*,Blue);
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,Teal);
|
Q_PROPERTY_AUTO(FluColorSet*,Teal);
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
||||||
|
QML_NAMED_ELEMENT(FluColors)
|
||||||
|
QML_SINGLETON
|
||||||
public:
|
public:
|
||||||
explicit FluColors(QObject *parent = nullptr);
|
explicit FluColors(QObject *parent = nullptr);
|
||||||
static FluColors *getInstance();
|
|
||||||
private:
|
|
||||||
static FluColors* m_instance;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUCOLORS_H
|
#endif // FLUCOLORS_H
|
||||||
|
@ -12,7 +12,7 @@ FluRegister::FluRegister(QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FluRegister::launch(const QJsonObject& argument){
|
void FluRegister::launch(const QJsonObject& argument){
|
||||||
FluApp::getInstance()->navigate(path(),argument,this);
|
FluApp::fluApp->navigate(path(),argument,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluRegister::onResult(const QJsonObject& data){
|
void FluRegister::onResult(const QJsonObject& data){
|
||||||
|
@ -1,27 +1,17 @@
|
|||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
|
|
||||||
#include "FluColors.h"
|
|
||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
#include "FluApp.h"
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
FluTheme* FluTheme::m_instance = nullptr;
|
|
||||||
|
|
||||||
FluTheme *FluTheme::getInstance()
|
|
||||||
{
|
|
||||||
if(FluTheme::m_instance == nullptr){
|
|
||||||
FluTheme::m_instance = new FluTheme;
|
|
||||||
}
|
|
||||||
return FluTheme::m_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
FluTheme::FluTheme(QObject *parent)
|
FluTheme::FluTheme(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
||||||
Q_EMIT darkChanged();
|
Q_EMIT darkChanged();
|
||||||
});
|
});
|
||||||
primaryColor(FluColors::getInstance()->Blue());
|
primaryColor(FluApp::flutColors->Blue());
|
||||||
textSize(13);
|
textSize(13);
|
||||||
nativeText(false);
|
nativeText(false);
|
||||||
frameless(true);
|
frameless(true);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define FLUTHEME_H
|
#define FLUTHEME_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
#include "FluColorSet.h"
|
#include "FluColorSet.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
@ -14,13 +15,13 @@ class FluTheme : public QObject
|
|||||||
Q_PROPERTY_AUTO(int,darkMode);
|
Q_PROPERTY_AUTO(int,darkMode);
|
||||||
Q_PROPERTY_AUTO(bool,nativeText);
|
Q_PROPERTY_AUTO(bool,nativeText);
|
||||||
Q_PROPERTY_AUTO(int,textSize);
|
Q_PROPERTY_AUTO(int,textSize);
|
||||||
|
QML_NAMED_ELEMENT(FluTheme)
|
||||||
|
QML_SINGLETON
|
||||||
public:
|
public:
|
||||||
explicit FluTheme(QObject *parent = nullptr);
|
explicit FluTheme(QObject *parent = nullptr);
|
||||||
static FluTheme *getInstance();
|
|
||||||
bool dark();
|
bool dark();
|
||||||
Q_SIGNAL void darkChanged();
|
Q_SIGNAL void darkChanged();
|
||||||
private:
|
private:
|
||||||
static FluTheme* m_instance;
|
|
||||||
bool _dark;
|
bool _dark;
|
||||||
bool eventFilter(QObject *obj, QEvent *event);
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
bool systemDark();
|
bool systemDark();
|
||||||
|
120
src/Fluent.cpp
120
src/Fluent.cpp
@ -1,120 +0,0 @@
|
|||||||
#include "Fluent.h"
|
|
||||||
|
|
||||||
#include <QFontDatabase>
|
|
||||||
#include <QQmlContext>
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QQuickWindow>
|
|
||||||
#include "FluColors.h"
|
|
||||||
#include "NativeEventFilter.h"
|
|
||||||
#include "FluTheme.h"
|
|
||||||
#include "WindowHelper.h"
|
|
||||||
#include "FluApp.h"
|
|
||||||
#include "Def.h"
|
|
||||||
|
|
||||||
Fluent* Fluent::m_instance = nullptr;
|
|
||||||
|
|
||||||
Fluent *Fluent::getInstance()
|
|
||||||
{
|
|
||||||
if(Fluent::m_instance == nullptr){
|
|
||||||
Fluent::m_instance = new Fluent;
|
|
||||||
}
|
|
||||||
return Fluent::m_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Fluent::version() const
|
|
||||||
{
|
|
||||||
return QStringLiteral(VERSION_IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fluent::registerTypes(const char *uri){
|
|
||||||
Q_INIT_RESOURCE(res);
|
|
||||||
int major = 1;
|
|
||||||
int minor = 0;
|
|
||||||
|
|
||||||
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
|
||||||
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
|
||||||
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRatingControl.qml"),uri,major,minor,"FluRatingControl");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluStatusView.qml"),uri,major,minor,"FluStatusView");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPagination.qml"),uri,major,minor,"FluPagination");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleButton.qml"),uri,major,minor,"FluToggleButton");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTableView.qml"),uri,major,minor,"FluTableView");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivotItem.qml"),uri,major,minor,"FluPivotItem");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivot.qml"),uri,major,minor,"FluPivot");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFlipView.qml"),uri,major,minor,"FluFlipView");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItemExpander.qml"),uri,major,minor,"FluPaneItemExpander");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTabView.qml"),uri,major,minor,"FluTabView");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluArea.qml"),uri,major,minor,"FluArea");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluBadge.qml"),uri,major,minor,"FluBadge");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMediaPlayer.qml"),uri,major,minor,"FluMediaPlayer");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluContentPage.qml"),uri,major,minor,"FluContentPage");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluScrollablePage.qml"),uri,major,minor,"FluScrollablePage");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItemHeader.qml"),uri,major,minor,"FluPaneItemHeader");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItem.qml"),uri,major,minor,"FluPaneItem");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItemSeparator.qml"),uri,major,minor,"FluPaneItemSeparator");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluNavigationView.qml"),uri,major,minor,"FluNavigationView");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCalendarPicker.qml"),uri,major,minor,"FluCalendarPicker");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCalendarView.qml"),uri,major,minor,"FluCalendarView");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluDatePicker.qml"),uri,major,minor,"FluDatePicker");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTimePicker.qml"),uri,major,minor,"FluTimePicker");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluColorView.qml"),uri,major,minor,"FluColorView");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluColorPicker.qml"),uri,major,minor,"FluColorPicker");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCarousel.qml"),uri,major,minor,"FluCarousel");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluAutoSuggestBox.qml"),uri,major,minor,"FluAutoSuggestBox");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluExpander.qml"),uri,major,minor,"FluExpander");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTreeView.qml"),uri,major,minor,"FluTreeView");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluContentDialog.qml"),uri,major,minor,"FluContentDialog");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMenuItem.qml"),uri,major,minor,"FluMenuItem");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMenu.qml"),uri,major,minor,"FluMenu");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluScrollBar.qml"),uri,major,minor,"FluScrollBar");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTextButton.qml"),uri,major,minor,"FluTextButton");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMultilineTextBox.qml"),uri,major,minor,"FluMultilineTextBox");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTooltip.qml"),uri,major,minor,"FluTooltip");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluDivider.qml"),uri,major,minor,"FluDivider");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluIcon.qml"),uri,major,minor,"FluIcon");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluObject.qml"),uri,major,minor,"FluObject");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluInfoBar.qml"),uri,major,minor,"FluInfoBar");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluWindow.qml"),uri,major,minor,"FluWindow");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRectangle.qml"),uri,major,minor,"FluRectangle");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluAppBar.qml"),uri,major,minor,"FluAppBar");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluButton.qml"),uri,major,minor,"FluButton");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCheckBox.qml"),uri,major,minor,"FluCheckBox");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluComboBox.qml"),uri,major,minor,"FluComboBox");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluDropDownButton.qml"),uri,major,minor,"FluDropDownButton");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFilledButton.qml"),uri,major,minor,"FluFilledButton");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluIconButton.qml"),uri,major,minor,"FluIconButton");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluProgressBar.qml"),uri,major,minor,"FluProgressBar");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluProgressRing.qml"),uri,major,minor,"FluProgressRing");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRadioButton.qml"),uri,major,minor,"FluRadioButton");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluSlider.qml"),uri,major,minor,"FluSlider");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTextBox.qml"),uri,major,minor,"FluTextBox");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPasswordBox.qml"),uri,major,minor,"FluPasswordBox");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluText.qml"),uri,major,minor,"FluText");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFilledButton.qml"),uri,major,minor,"FluFilledButton");
|
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleSwitch.qml"),uri,major,minor,"FluToggleSwitch");
|
|
||||||
|
|
||||||
qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only");
|
|
||||||
qmlRegisterUncreatableMetaObject(Fluent_DarkMode::staticMetaObject, uri,major,minor,"FluDarkMode", "Access to enums & flags only");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fluent::initializeEngine(QQmlEngine *engine, const char *uri)
|
|
||||||
{
|
|
||||||
nativeEvent = new NativeEventFilter();
|
|
||||||
qApp->installNativeEventFilter(nativeEvent);
|
|
||||||
Q_UNUSED(engine)
|
|
||||||
Q_UNUSED(uri)
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
QFont font;
|
|
||||||
font.setFamily("Microsoft YaHei");
|
|
||||||
QGuiApplication::setFont(font);
|
|
||||||
// QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering);
|
|
||||||
#endif
|
|
||||||
QFontDatabase::addApplicationFont(":/com.zhuzichu/res/font/Segoe_Fluent_Icons.ttf");
|
|
||||||
FluApp* app = FluApp::getInstance();
|
|
||||||
engine->rootContext()->setContextProperty("FluApp",app);
|
|
||||||
FluColors* colors = FluColors::getInstance();
|
|
||||||
engine->rootContext()->setContextProperty("FluColors",colors);
|
|
||||||
FluTheme* theme = FluTheme::getInstance();
|
|
||||||
engine->rootContext()->setContextProperty("FluTheme",theme);
|
|
||||||
}
|
|
27
src/Fluent.h
27
src/Fluent.h
@ -1,27 +0,0 @@
|
|||||||
#ifndef FLUENT_H
|
|
||||||
#define FLUENT_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QQmlEngine>
|
|
||||||
#include "NativeEventFilter.h"
|
|
||||||
|
|
||||||
class Fluent: public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
Q_INVOKABLE QString version() const;
|
|
||||||
~Fluent(){
|
|
||||||
if (nativeEvent != Q_NULLPTR) {
|
|
||||||
delete nativeEvent;
|
|
||||||
nativeEvent = Q_NULLPTR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void registerTypes(const char *uri);
|
|
||||||
void initializeEngine(QQmlEngine *engine, const char *uri);
|
|
||||||
static Fluent *getInstance();
|
|
||||||
private:
|
|
||||||
static Fluent* m_instance;
|
|
||||||
NativeEventFilter *nativeEvent = Q_NULLPTR;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // FLUENT_H
|
|
@ -1,10 +0,0 @@
|
|||||||
#include "FluentUI.h"
|
|
||||||
#include "Fluent.h"
|
|
||||||
|
|
||||||
void FluentUI::registerTypes(const char *uri){
|
|
||||||
Fluent::getInstance()->registerTypes(uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
|
|
||||||
Fluent::getInstance()->initializeEngine(engine,uri);
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
#ifndef FLUENTUI_H
|
|
||||||
#define FLUENTUI_H
|
|
||||||
|
|
||||||
#include <QQmlEngine>
|
|
||||||
|
|
||||||
class FluentUI
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
static void registerTypes(const char *uri) ;
|
|
||||||
static void initializeEngine(QQmlEngine *engine, const char *uri);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // FLUENTUI_H
|
|
@ -1,51 +0,0 @@
|
|||||||
QT += qml quick svg
|
|
||||||
CONFIG += plugin c++17
|
|
||||||
TEMPLATE = lib
|
|
||||||
TARGET = FluentUI
|
|
||||||
TARGET = $$qtLibraryTarget($$TARGET)
|
|
||||||
uri = FluentUI
|
|
||||||
|
|
||||||
CONFIG += sharedlib # staticlib or sharedlib
|
|
||||||
|
|
||||||
RESOURCES += \
|
|
||||||
res.qrc
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
Def.h \
|
|
||||||
FluApp.h \
|
|
||||||
FluColorSet.h \
|
|
||||||
FluColors.h \
|
|
||||||
FluRegister.h \
|
|
||||||
FluTheme.h \
|
|
||||||
Fluent.h \
|
|
||||||
FluentUI.h \
|
|
||||||
NativeEventFilter.h \
|
|
||||||
WindowHelper.h \
|
|
||||||
qml_plugin.h \
|
|
||||||
stdafx.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
Def.cpp \
|
|
||||||
FluApp.cpp \
|
|
||||||
FluColorSet.cpp \
|
|
||||||
FluColors.cpp \
|
|
||||||
FluRegister.cpp \
|
|
||||||
FluTheme.cpp \
|
|
||||||
Fluent.cpp \
|
|
||||||
FluentUI.cpp \
|
|
||||||
NativeEventFilter.cpp \
|
|
||||||
WindowHelper.cpp \
|
|
||||||
qml_plugin.cpp \
|
|
||||||
|
|
||||||
win32 {
|
|
||||||
LIBS += -ldwmapi -luser32
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINES += VERSION_IN=\\\"1.0.0\\\"
|
|
||||||
DEFINES += URI_STR=\\\"$$uri\\\"
|
|
||||||
|
|
||||||
contains(QMAKE_HOST.os,Windows) {
|
|
||||||
include(./build_windows.pri)
|
|
||||||
}else{
|
|
||||||
include(./build_macos.pri)
|
|
||||||
}
|
|
@ -2,6 +2,8 @@
|
|||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#pragma comment(lib, "Dwmapi.lib")
|
||||||
|
#pragma comment(lib, "User32.lib")
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#endif
|
#endif
|
||||||
@ -9,10 +11,13 @@
|
|||||||
bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
|
bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (eventType == "windows_generic_MSG" && FluTheme::getInstance()->frameless()) {
|
if (eventType == "windows_generic_MSG" && FluApp::fluTheme->frameless()) {
|
||||||
MSG* msg = static_cast<MSG *>(message);
|
MSG* msg = static_cast<MSG *>(message);
|
||||||
if (msg == Q_NULLPTR)
|
if (msg == Q_NULLPTR)
|
||||||
return false;
|
return false;
|
||||||
|
if(!FluApp::fluApp->wnds.contains((WId)msg->hwnd)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
switch(msg->message) {
|
switch(msg->message) {
|
||||||
case WM_NCCALCSIZE:{
|
case WM_NCCALCSIZE:{
|
||||||
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||||
@ -22,7 +27,7 @@ bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *mes
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case WM_NCHITTEST: {
|
case WM_NCHITTEST: {
|
||||||
auto view = FluApp::getInstance()->wnds[(WId)msg->hwnd];
|
auto view = FluApp::fluApp->wnds[(WId)msg->hwnd];
|
||||||
bool isResize = !(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight());
|
bool isResize = !(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight());
|
||||||
const LONG borderWidth = 8;
|
const LONG borderWidth = 8;
|
||||||
RECT winrect;
|
RECT winrect;
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#pragma comment(lib, "Dwmapi.lib")
|
||||||
|
#pragma comment(lib, "User32.lib")
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
@ -28,7 +30,7 @@ void WindowHelper::initWindow(QQuickWindow* window){
|
|||||||
void WindowHelper::firstUpdate(){
|
void WindowHelper::firstUpdate(){
|
||||||
if(isFisrt){
|
if(isFisrt){
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if(FluTheme::getInstance()->frameless()){
|
if(FluApp::fluTheme->frameless()){
|
||||||
HWND wnd = (HWND)window->winId();
|
HWND wnd = (HWND)window->winId();
|
||||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
||||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
||||||
@ -52,7 +54,7 @@ QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
|||||||
|
|
||||||
void WindowHelper::destoryWindow(){
|
void WindowHelper::destoryWindow(){
|
||||||
if(this->window){
|
if(this->window){
|
||||||
FluApp::getInstance()->wnds.remove(this->window->winId());
|
FluApp::fluApp->wnds.remove(this->window->winId());
|
||||||
this->window->deleteLater();
|
this->window->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
@ -10,14 +11,13 @@
|
|||||||
class WindowHelper : public QObject
|
class WindowHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_NAMED_ELEMENT(WindowHelper)
|
||||||
public:
|
public:
|
||||||
explicit WindowHelper(QObject *parent = nullptr);
|
explicit WindowHelper(QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
||||||
Q_INVOKABLE void destoryWindow();
|
Q_INVOKABLE void destoryWindow();
|
||||||
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||||
|
|
||||||
Q_INVOKABLE void firstUpdate();
|
Q_INVOKABLE void firstUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user