update
parent
2aef114969
commit
c15470f723
|
@ -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
|
||||||
|
|
|
@ -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,22 +40,32 @@ 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
|
||||||
|
@ -60,12 +73,12 @@ jobs:
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
|
|
@ -1,65 +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文件
|
||||||
src/controller/ChatController.cpp
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
src/AppInfo.cpp
|
foreach(filepath ${CPP_FILES})
|
||||||
src/main.cpp
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
src/lang/Lang.cpp
|
list(APPEND sources_files ${filename})
|
||||||
src/lang/Zh.cpp
|
endforeach(filepath)
|
||||||
src/lang/En.cpp
|
|
||||||
src/tool/IPC.cpp
|
#遍历所有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
|
#复制动态库到可执行文件同级目录下
|
||||||
src/controller/ChatController.h
|
|
||||||
src/AppInfo.h
|
|
||||||
src/stdafx.h
|
|
||||||
src/lang/Lang.h
|
|
||||||
src/lang/Zh.h
|
|
||||||
src/lang/En.h
|
|
||||||
src/tool/IPC.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})
|
||||||
|
@ -70,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,59 +0,0 @@
|
||||||
QT += quick concurrent network multimedia
|
|
||||||
CONFIG += c++17
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
src/lang/En.h \
|
|
||||||
src/lang/Lang.h \
|
|
||||||
src/lang/Zh.h \
|
|
||||||
src/stdafx.h \
|
|
||||||
src/controller/ChatController.h \
|
|
||||||
src/AppInfo.h \
|
|
||||||
src/tool/IPC.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
src/controller/ChatController.cpp \
|
|
||||||
src/AppInfo.cpp \
|
|
||||||
src/lang/En.cpp \
|
|
||||||
src/lang/Lang.cpp \
|
|
||||||
src/lang/Zh.cpp \
|
|
||||||
src/main.cpp \
|
|
||||||
src/tool/IPC.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
|
|
||||||
}
|
|
||||||
|
|
||||||
#### 如果你正在使用静态库,请将将下面的配置注释取消掉。
|
|
||||||
#DEFINES += STATICLIB
|
|
||||||
#INCLUDEPATH += $$OUT_PWD/../bin/FluentUI/
|
|
||||||
#LIBS += -L$$OUT_PWD/../bin/FluentUI/ -lFluentUI
|
|
Binary file not shown.
Before Width: | Height: | Size: 116 KiB |
173
example/qml.qrc
173
example/qml.qrc
|
@ -1,173 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<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>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>res/image/favicon.ico</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>res/svg/home.svg</file>
|
|
||||||
<file>res/svg/home_dark.svg</file>
|
|
||||||
<file>res/image/qrcode_wx.jpg</file>
|
|
||||||
<file>res/image/qrcode_zfb.jpg</file>
|
|
||||||
<file>qml/component/CodeExpander.qml</file>
|
|
||||||
<file>qml/global/ItemsFooter.qml</file>
|
|
||||||
<file>qml/global/ItemsOriginal.qml</file>
|
|
||||||
<file>qml/global/MainEvent.qml</file>
|
|
||||||
<file>qml/global/qmldir</file>
|
|
||||||
<file>qml/App.qml</file>
|
|
||||||
<file>qml/window/AboutWindow.qml</file>
|
|
||||||
<file>qml/window/ChatWindow.qml</file>
|
|
||||||
<file>qml/window/LoginWindow.qml</file>
|
|
||||||
<file>qml/window/MainWindow.qml</file>
|
|
||||||
<file>qml/window/MediaWindow.qml</file>
|
|
||||||
<file>qml/window/SingleInstanceWindow.qml</file>
|
|
||||||
<file>qml/window/SingleTaskWindow.qml</file>
|
|
||||||
<file>qml/window/StandardWindow.qml</file>
|
|
||||||
<file>qml/page/T_Awesome.qml</file>
|
|
||||||
<file>qml/page/T_Badge.qml</file>
|
|
||||||
<file>qml/page/T_Buttons.qml</file>
|
|
||||||
<file>qml/page/T_CalendarPicker.qml</file>
|
|
||||||
<file>qml/page/T_Carousel.qml</file>
|
|
||||||
<file>qml/page/T_CheckBox.qml</file>
|
|
||||||
<file>qml/page/T_ColorPicker.qml</file>
|
|
||||||
<file>qml/page/T_DatePicker.qml</file>
|
|
||||||
<file>qml/page/T_Dialog.qml</file>
|
|
||||||
<file>qml/page/T_Expander.qml</file>
|
|
||||||
<file>qml/page/T_FlipView.qml</file>
|
|
||||||
<file>qml/page/T_Home.qml</file>
|
|
||||||
<file>qml/page/T_InfoBar.qml</file>
|
|
||||||
<file>qml/page/T_MediaPlayer.qml</file>
|
|
||||||
<file>qml/page/T_Menu.qml</file>
|
|
||||||
<file>qml/page/T_MultiWindow.qml</file>
|
|
||||||
<file>qml/page/T_Pivot.qml</file>
|
|
||||||
<file>qml/page/T_Progress.qml</file>
|
|
||||||
<file>qml/page/T_RatingControl.qml</file>
|
|
||||||
<file>qml/page/T_Rectangle.qml</file>
|
|
||||||
<file>qml/page/T_Settings.qml</file>
|
|
||||||
<file>qml/page/T_Slider.qml</file>
|
|
||||||
<file>qml/page/T_StatusView.qml</file>
|
|
||||||
<file>qml/page/T_TableView.qml</file>
|
|
||||||
<file>qml/page/T_TabView.qml</file>
|
|
||||||
<file>qml/page/T_TextBox.qml</file>
|
|
||||||
<file>qml/page/T_Theme.qml</file>
|
|
||||||
<file>qml/page/T_TimePicker.qml</file>
|
|
||||||
<file>qml/page/T_ToggleSwitch.qml</file>
|
|
||||||
<file>qml/page/T_Tooltip.qml</file>
|
|
||||||
<file>qml/page/T_TreeView.qml</file>
|
|
||||||
<file>qml/page/T_Typography.qml</file>
|
|
||||||
<file>qml/page/T_BreadcrumbBar.qml</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
|
@ -11,14 +11,14 @@ Window {
|
||||||
FluTheme.frameless = ("windows" === Qt.platform.os)
|
FluTheme.frameless = ("windows" === Qt.platform.os)
|
||||||
FluTheme.darkMode = FluDarkMode.System
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
FluApp.routes = {
|
FluApp.routes = {
|
||||||
"/":"qrc:/qml/window/MainWindow.qml",
|
"/":"qrc:/example/qml/window/MainWindow.qml",
|
||||||
"/about":"qrc:/qml/window/AboutWindow.qml",
|
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||||
"/login":"qrc:/qml/window/LoginWindow.qml",
|
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||||
"/chat":"qrc:/qml/window/ChatWindow.qml",
|
"/chat":"qrc:/example/qml/window/ChatWindow.qml",
|
||||||
"/media":"qrc:/qml/window/MediaWindow.qml",
|
"/media":"qrc:/example/qml/window/MediaWindow.qml",
|
||||||
"/singleTaskWindow":"qrc:/qml/window/SingleTaskWindow.qml",
|
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||||
"/standardWindow":"qrc:/qml/window/StandardWindow.qml",
|
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||||
"/singleInstanceWindow":"qrc:/qml/window/SingleInstanceWindow.qml"
|
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml"
|
||||||
}
|
}
|
||||||
FluApp.initialRoute = "/"
|
FluApp.initialRoute = "/"
|
||||||
FluApp.run()
|
FluApp.run()
|
||||||
|
|
|
@ -20,7 +20,7 @@ FluObject{
|
||||||
title:lang.settings
|
title:lang.settings
|
||||||
icon:FluentIcons.Settings
|
icon:FluentIcons.Settings
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/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:/qml/page/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:/qml/page/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:/qml/page/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:/qml/page/T_CheckBox.qml")
|
navigationView.push("qrc:/example/qml/page/T_CheckBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/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:/qml/page/T_TextBox.qml")
|
navigationView.push("qrc:/example/qml/page/T_TextBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_TimePicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_TimePicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"DatePicker"
|
title:"DatePicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_DatePicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_DatePicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"CalendarPicker"
|
title:"CalendarPicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_CalendarPicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_CalendarPicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ColorPicker"
|
title:"ColorPicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/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:/qml/page/T_InfoBar.qml")
|
navigationView.push("qrc:/example/qml/page/T_InfoBar.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Progress"
|
title:"Progress"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Progress.qml")
|
navigationView.push("qrc:/example/qml/page/T_Progress.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"RatingControl"
|
title:"RatingControl"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_RatingControl.qml")
|
navigationView.push("qrc:/example/qml/page/T_RatingControl.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Badge"
|
title:"Badge"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Badge.qml")
|
navigationView.push("qrc:/example/qml/page/T_Badge.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Rectangle"
|
title:"Rectangle"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Rectangle.qml")
|
navigationView.push("qrc:/example/qml/page/T_Rectangle.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_StatusView.qml")
|
navigationView.push("qrc:/example/qml/page/T_StatusView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Carousel"
|
title:"Carousel"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Carousel.qml")
|
navigationView.push("qrc:/example/qml/page/T_Carousel.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Expander"
|
title:"Expander"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/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:/qml/page/T_Dialog.qml")
|
navigationView.push("qrc:/example/qml/page/T_Dialog.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Tooltip"
|
title:"Tooltip"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Tooltip.qml")
|
navigationView.push("qrc:/example/qml/page/T_Tooltip.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Menu"
|
title:"Menu"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Menu.qml")
|
navigationView.push("qrc:/example/qml/page/T_Menu.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,60 +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:/qml/page/T_Pivot.qml")
|
navigationView.push("qrc:/example/qml/page/T_Pivot.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"BreadcrumbBar"
|
title:"BreadcrumbBar"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_BreadcrumbBar.qml")
|
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:/qml/page/T_TabView.qml")
|
navigationView.push("qrc:/example/qml/page/T_TabView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TreeView"
|
title:"TreeView"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/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:/qml/page/T_TableView.qml")
|
navigationView.push("qrc:/example/qml/page/T_TableView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/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:/qml/page/T_FlipView.qml")
|
navigationView.push("qrc:/example/qml/page/T_FlipView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,19 +243,19 @@ FluObject{
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Theme"
|
title:"Theme"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Theme.qml")
|
navigationView.push("qrc:/example/qml/page/T_Theme.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Typography"
|
title:"Typography"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Typography.qml")
|
navigationView.push("qrc:/example/qml/page/T_Typography.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Awesome"
|
title:"Awesome"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/qml/page/T_Awesome.qml")
|
navigationView.push("qrc:/example/qml/page/T_Awesome.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,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:/qml/page/T_MediaPlayer.qml")
|
navigationView.push("qrc:/example/qml/page/T_MediaPlayer.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"}])
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
|
@ -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:///qml/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
|
||||||
|
|
|
@ -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,7 +3,7 @@ import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///qml/global/"
|
import "qrc:///example/qml/global/"
|
||||||
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
|
|
|
@ -128,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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@ import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///qml/global/"
|
import example
|
||||||
|
import "qrc:///example/qml/global/"
|
||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
|
@ -41,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 {
|
||||||
|
@ -88,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
|
||||||
|
|
|
@ -52,7 +52,7 @@ 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:/qml/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)
|
||||||
|
|
|
@ -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(-DURI_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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
|
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
#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"
|
||||||
|
@ -24,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());
|
||||||
|
@ -66,7 +77,6 @@ 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) {
|
||||||
|
@ -88,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();
|
||||||
|
|
121
src/Fluent.cpp
121
src/Fluent.cpp
|
@ -1,121 +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/FluBreadcrumbBar.qml"),uri,major,minor,"FluBreadcrumbBar");
|
|
||||||
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,15 +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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluentUI::initialize(QQmlEngine *engine){
|
|
||||||
Fluent::getInstance()->registerTypes(URI_STR);
|
|
||||||
Fluent::getInstance()->initializeEngine(engine,URI_STR);
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
#ifndef FLUENTUI_H
|
|
||||||
#define FLUENTUI_H
|
|
||||||
|
|
||||||
#include <QQmlEngine>
|
|
||||||
|
|
||||||
class Q_DECL_EXPORT FluentUI
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
static void registerTypes(const char *uri) ;
|
|
||||||
static void initializeEngine(QQmlEngine *engine, const char *uri);
|
|
||||||
static void initialize(QQmlEngine *engine);
|
|
||||||
};
|
|
||||||
|
|
||||||
#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)
|
|
||||||
}
|
|
|
@ -11,11 +11,11 @@
|
||||||
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::getInstance()->wnds.contains((WId)msg->hwnd)){
|
if(!FluApp::fluApp->wnds.contains((WId)msg->hwnd)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch(msg->message) {
|
switch(msg->message) {
|
||||||
|
@ -27,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;
|
||||||
|
|
|
@ -30,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 };
|
||||||
|
@ -54,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:
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
module FluentUI
|
|
||||||
plugin FluentUI
|
|
||||||
classname FluentUIQmlPlugin
|
|
||||||
typeinfo plugin.qmltypes
|
|
|
@ -1,32 +0,0 @@
|
||||||
set(OUTP ${CMAKE_BINARY_DIR}/bin/FluentUI/)
|
|
||||||
|
|
||||||
add_definitions(-DMACOS)
|
|
||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX ${OUTP})
|
|
||||||
set(CMAKE_INSTALL_DESTDIR ${OUTP})
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
|
||||||
set(QMAKE_MOC_OPTIONS -Muri=${uri})
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
TARGET ${PROJECT_NAME} POST_BUILD
|
|
||||||
COMMAND chmod -R 777 ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
TARGET ${PROJECT_NAME} POST_BUILD
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh PRESET ${CMAKE_CURRENT_SOURCE_DIR}/ ${OUTP}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(${TARGET_TYPE} STREQUAL "SHARED")
|
|
||||||
|
|
||||||
set(INST_QMLPATH ${QT_INSTALL_QML}/FluentUI)
|
|
||||||
add_custom_command(
|
|
||||||
TARGET ${PROJECT_NAME} POST_BUILD
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/ ${OUTP} ${INST_QMLPATH}
|
|
||||||
)
|
|
||||||
|
|
||||||
endif()
|
|
|
@ -1,17 +0,0 @@
|
||||||
OUTP = $$OUT_PWD/../bin/FluentUI/
|
|
||||||
|
|
||||||
DESTDIR += $$OUTP
|
|
||||||
|
|
||||||
QMAKE_MOC_OPTIONS += -Muri=$$uri
|
|
||||||
QMAKE_PRE_LINK += chmod -R 777 $$PWD/macos_install.sh;
|
|
||||||
QMAKE_PRE_LINK += $$PWD/macos_install.sh PRESET $$PWD/ $$OUTP;
|
|
||||||
|
|
||||||
CONFIG(sharedlib){
|
|
||||||
INST_QMLPATH = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
|
|
||||||
|
|
||||||
QMAKE_POST_LINK += $$PWD/macos_install.sh INSTALL $$PWD/ $$OUTP $$INST_QMLPATH;
|
|
||||||
|
|
||||||
exists($$PWD/../../dev.pri){
|
|
||||||
include($$PWD/../../dev.pri)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
set(OUTP "${CMAKE_BINARY_DIR}/bin/FluentUI")
|
|
||||||
set(BUILDBIN_PATH "${OUTP}")
|
|
||||||
set(QTQMLFLUENT_PATH "${QT_INSTALL_QML}/FluentUI")
|
|
||||||
set(PRESET_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build-preset")
|
|
||||||
set(SOLIBFILE_PATH "${CMAKE_BINARY_DIR}/libFluentUI.so")
|
|
||||||
set(ANDROID NO)
|
|
||||||
if (ANDROID)
|
|
||||||
set(ANDROID YES)
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTP})
|
|
||||||
else()
|
|
||||||
set(CMAKE_INSTALL_PREFIX "${OUTP}")
|
|
||||||
endif()
|
|
||||||
set(SHAREDSCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/win_install.bat SHARED ${CMAKE_CURRENT_SOURCE_DIR} ${PRESET_PATH} ${BUILDBIN_PATH} ${QTQMLFLUENT_PATH} ${ANDROID} ${SOLIBFILE_PATH})
|
|
||||||
set(STATICSCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/win_install.bat STATIC ${CMAKE_CURRENT_SOURCE_DIR} ${PRESET_PATH} ${BUILDBIN_PATH} ${QTQMLFLUENT_PATH} ${ANDROID} ${SOLIBFILE_PATH})
|
|
||||||
string(REPLACE "/" "\\" SHAREDSCRIPT "${SHAREDSCRIPT}")
|
|
||||||
string(REPLACE "/" "\\" STATICSCRIPT "${STATICSCRIPT}")
|
|
||||||
if (${TARGET_TYPE} STREQUAL "SHARED")
|
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
||||||
COMMAND ${SHAREDSCRIPT}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
||||||
COMMAND ${STATICSCRIPT}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
|
@ -1,20 +0,0 @@
|
||||||
OUTP = $$OUT_PWD/../bin/FluentUI
|
|
||||||
BUILDBIN_PATH = $$replace(OUTP, src/../bin, bin)
|
|
||||||
QTQMLFLUENT_PATH = $$[QT_INSTALL_QML]/FluentUI
|
|
||||||
PRESET_PATH = $$PWD/build-preset
|
|
||||||
SOLIBFILE_PATH = $$OUT_PWD/libFluentUI.so
|
|
||||||
ANDROID = NO
|
|
||||||
android{
|
|
||||||
ANDROID=YES
|
|
||||||
QMAKE_PRE_LINK *= md $$replace(OUTP, /, \\)
|
|
||||||
}else{
|
|
||||||
DESTDIR += $$OUTP
|
|
||||||
}
|
|
||||||
SHAREDSCRIPT = "$$PWD\win_install.bat" SHARED "$$PWD" "$$PRESET_PATH" "$$BUILDBIN_PATH" "$$QTQMLFLUENT_PATH" $$ANDROID "$$SOLIBFILE_PATH"
|
|
||||||
STATICSCRIPT = "$$PWD\win_install.bat" STATIC "$$PWD" "$$PRESET_PATH" "$$BUILDBIN_PATH" "$$QTQMLFLUENT_PATH" $$ANDROID "$$SOLIBFILE_PATH"
|
|
||||||
CONFIG(sharedlib){
|
|
||||||
QMAKE_POST_LINK *= $$replace(SHAREDSCRIPT, /, \\)
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
QMAKE_POST_LINK *= $$replace(STATICSCRIPT, /, \\)
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import "content"
|
import "Content"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: colorPicker
|
id: colorPicker
|
|
@ -1,4 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import "../colorpicker"
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "ColorPicker"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
Item {
|
|
@ -2,6 +2,7 @@
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
id: popup
|
id: popup
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
Item {
|
|
@ -1,4 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluObject {
|
FluObject {
|
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
||||||
|
@ -16,7 +17,6 @@ Item {
|
||||||
}
|
}
|
||||||
height: 32
|
height: 32
|
||||||
|
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: control.width-40
|
width: control.width-40
|
|
@ -1,4 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id:flu_object;
|
id:flu_object;
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
|
@ -1,4 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluApp.uuid()
|
readonly property string key : FluApp.uuid()
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluObject {
|
FluObject {
|
|
@ -1,4 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluApp.uuid()
|
readonly property string key : FluApp.uuid()
|
|
@ -1,4 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluApp.uuid()
|
readonly property string key : FluApp.uuid()
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue