...
 
Commits (23)
    https://gitcode.net/kl222/FaceRecognizer/-/commit/bf5d507894e7bcd0e3a5156abfb3cfb4d536c808 Use RabbitCommon v2 2023-04-23T16:55:22+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/fe814339c50a762f58e4fb9317372eec54f6170c Modify ci 2023-04-25T10:46:34+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/2138e35d4aa24272aff7881e91b41cc0dab83ac1 Modify log 2023-04-27T09:14:23+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/9849bfca18a3d433b43b18f132bb78b9743cf1e7 Fix: rename FrmBroweFile to FrmBrowseFile 2023-04-27T14:21:39+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/bca01fbe5ba42f0b3f0f3c4ccbf00deb7c3cef0a Modify translations 2023-04-28T11:25:14+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/a04390c6deaa52aae59d8cd94254284f54c7c961 App: modify start fail 2023-04-28T11:59:11+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/54979f88efd9b0a8d4cad9e752397ed560885f5d Modify log menu 2023-05-15T15:29:33+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/8b8f420e3b3abc1b417230d2213ccbc8f3223ad1 Modify about version 2023-06-22T16:09:34+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/f26ec3c86a962cf2dc6c0918149d22e471d42643 FFmpeg: update API avpicture_* to av_image_* 2023-06-23T11:40:12+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/ab30b31e07fdc0da5ac0e5229556efd9f05fbe4e CI: fix ubuntu.yml 2023-06-23T11:57:43+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/7981e95da7715b168e7dc560c9a2d725da2d2ead CI: modify appveyor.yml 2023-06-23T13:37:35+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/00fca012a691f8885ab972a7373bb0cbc997d7f9 OpenCV: use qDebug 2023-06-23T14:16:27+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/c671c7000cc60e10aeced3e48f785696cb4e6633 CI: modify ubuntu 2023-06-23T16:33:50+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/ad1d07d0dfc09fbc217538173fa1e60f80b4aee5 CI: vcpkg update to 1286cac8751e13bb289061b7e3b89eb4c3f613a2 2023-06-23T21:02:09+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/c8b68196701dae88b6f4dacb157ae723135519bd Rename tag.sh to deploy.sh 2023-06-24T06:42:58+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/0965722e9f152ccfa45c7a0e4b745fce0c7b3a0d FIX ENABLE_DOWNLOAD_MODUEL typo 2023-06-24T07:05:59+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/d7b95685373228fbd6e6bb24f527cfba0ad93482 Modify ci 2023-06-24T09:33:37+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/20657304e7a4e2403211c145363416d362eff2eb CI: add libfacedetection 2023-06-24T10:31:58+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/1e51d630f6d656429e80160d8b70391c8a1fdbd5 Modify etc/FaceRecognizer_logqt.ini 2023-06-24T10:39:47+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/21fa8cd3705610de978dd0923e4b78a073be65ac Add FaceRecognizer.sh 2023-06-24T13:09:18+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/681b877e1b530f37db505e40269631eb72de7564 CI: modify exe name 2023-06-24T15:27:46+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/21bf19f0175fea051dfce7525a4cac1fd5e10aab Modify ci 2023-06-24T17:37:09+08:00 Kang Lin kl222@126.com https://gitcode.net/kl222/FaceRecognizer/-/commit/54b5735caf197e47b59ca981450e6320da418d50 Modify README 2023-06-24T20:27:16+08:00 Kang Lin kl222@126.com
name: android
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_android.outputs.name }}
jobs:
build_android:
strategy:
matrix:
BUILD_TYPE: [Release]
qt_arch: [android_arm64_v8a, android_armv7, android_x86_64]
qt_version: [6.5.1]
include:
- BUILD_TYPE: Release
qt_arch: android_arm64_v8a
VCPKG_TARGET_TRIPLET: arm-android
- BUILD_TYPE: Release
qt_arch: android_armv7
VCPKG_TARGET_TRIPLET: arm-android
- BUILD_TYPE: Release
qt_arch: android_x86_64
VCPKG_TARGET_TRIPLET: x64-android
runs-on: ubuntu-latest
env:
artifact_name: build_android
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.BUILD_TYPE}}
FaceRecognizer_VERSION: v0.0.4
VCPKGGITCOMMITID: 1286cac8751e13bb289061b7e3b89eb4c3f613a2
ANDROID_PLATFORM: android-23
ANDROID_NATIVE_API_LEVEL: 23
qt_modules: 'qtimageformats qtmultimedia qtscxml'
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: make directory
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{github.workspace}}/build
- name: Cache installed
#if: false
uses: actions/cache@v2
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: cache-installed-android-qt${{matrix.qt_version}}-${{matrix.VCPKG_TARGET_TRIPLET}}-${{matrix.BUILD_TYPE}}
- name: Cache Qt
#if: false
id: cache-qt
uses: actions/cache@v1 # not v2!
with:
path: ${{env.TOOSL_DIR}}/qt
key: qt${{matrix.qt_version}}_${{matrix.qt_arch}}
- name: Install Qt of gcc_64
uses: jurplel/install-qt-action@v3
with:
dir: '${{env.TOOSL_DIR}}/qt' # optional
version: '${{matrix.qt_version}}'
#host: 'linux'
target: 'desktop'
arch: 'gcc_64'
set-env: false
cached: '${{ steps.cache-qt.outputs.cache-hit }}' # optional, default is false
- name: Install Qt of android
uses: jurplel/install-qt-action@v3
with:
# Directory to install Qt
dir: '${{env.TOOSL_DIR}}/qt' # optional
# Version of Qt to install
version: '${{matrix.qt_version}}'
# Host platform
#host: linux # optional
# Target platform for build
target: 'android' # optional, default is desktop
# Architecture for Windows/Android
arch: '${{matrix.qt_arch}}' # optional
# Additional Qt modules to install
modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/
cached: '${{ steps.cache-qt.outputs.cache-hit }}' # optional, default is false
- name: run-vcpkg
if: false
uses: lukka/run-vcpkg@v7.4
with:
# Indicates whether to only setup vcpkg (i.e. installing it and setting the environment variables VCPKG_ROOT, RUNVCPK_VCPKG_ROOT), without installing any port.
#setupOnly: # optional
#vcpkgGitURL: https://github.com/KangLin/vcpkg.git
vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}}
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
# Since the cache must be invalidated when content of the vcpkg.json file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: android_${{matrix.os}}-qt${{matrix.qt_version}}-${{matrix.VCPKG_TARGET_TRIPLET}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}}
additionalCachedPaths: $VCPKG_ROOT/installed
vcpkgTriplet: '${{ matrix.VCPKG_TARGET_TRIPLET }}'
vcpkgArguments: 'openssl '
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
- name: build FaceRecognizer
working-directory: ${{github.workspace}}/build
env:
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
sudo chmod 777 ${Qt6_DIR}/bin/qt-cmake
${Qt6_DIR}/bin/qt-cmake .. \
-DCMARK_SHARED=OFF \
-DCMARK_TESTS=OFF \
-DCMARK_STATIC=ON \
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \
-DQT_HOST_PATH=${Qt6_DIR}/../gcc_64 \
-DANDROID_PLATFORM=${{env.ANDROID_PLATFORM}} \
-DANDROID_NATIVE_API_LEVEL=${{env.ANDROID_NATIVE_API_LEVEL}} \
-DQt6LinguistTools_DIR=${Qt6_DIR}/../gcc_64/lib/cmake/Qt6LinguistTools \
-DCMAKE_INSTALL_PREFIX=`pwd`/install
cmake --build . --config ${{matrix.BUILD_TYPE}} --target all
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
APK_FILE=`find . -name "android-*.apk"`
cp $APK_FILE FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk
7z a FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.zip install/*
- name: Update xml file
if: ${{ matrix.BUILD_TYPE == 'Release' && matrix.qt_arch == 'android_armv7' }}
working-directory: ${{github.workspace}}/build
run: |
cp ${{github.workspace}}/Update/update_android.xml .
MD5=`md5sum FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk | awk '{print $1}'`
echo "MD5:${MD5}"
sed -i "s/<VERSION>.*</<VERSION>${{env.FaceRecognizer_VERSION}}</g" update_android.xml
sed -i "s/<INFO>.*</<INFO>Release FaceRecognizer ${{env.FaceRecognizer_VERSION}}</g" update_android.xml
sed -i "s/<TIME>.*</<TIME>`date`</g" update_android.xml
sed -i "s/<ARCHITECTURE>.*</<ARCHITECTURE>${{matrix.qt_arch}}</g" update_android.xml
sed -i "s/<MD5SUM>.*</<MD5SUM>${MD5}</g" update_android.xml
sed -i "s:<URL>.*<:<URL>https\://github.com/KangLin/FaceRecognizer/releases/download/${{env.FaceRecognizer_VERSION}}/FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk<:g" update_android.xml
sed -i "s/<MIN_UPDATE_VERSION>.*</<MIN_UPDATE_VERSION>${{env.FaceRecognizer_VERSION}}</g" update_android.xml
- name: Update artifact
if: ${{ matrix.BUILD_TYPE == 'Release' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}/build/FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk
${{github.workspace}}/build/update_android.xml
name: build
env:
artifact_path: artifact_path
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FaceRecognizer_VERSION: v0.0.4
on:
push:
jobs:
ubuntu:
uses: ./.github/workflows/ubuntu.yml
msvc:
uses: ./.github/workflows/msvc.yml
mingw:
uses: ./.github/workflows/mingw.yml
macos:
uses: ./.github/workflows/macos.yml
deploy:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
needs: [ubuntu, msvc, macos]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: false
- name: Download ubuntu
uses: actions/download-artifact@v3
with:
name: ${{ needs.ubuntu.outputs.name }}
path: ${{ env.artifact_path }}
- name: Download msvc
uses: actions/download-artifact@v3
with:
name: ${{ needs.msvc.outputs.name }}
path: ${{ env.artifact_path }}
- name: Download macos
uses: actions/download-artifact@v3
with:
name: ${{ needs.macos.outputs.name }}
path: ${{ env.artifact_path }}
- name: Make note file
run: |
echo "[:cn: 修改日志](ChangeLog_zh_CN.md) [:us: Change log](ChangeLog.md)" > NoteFile
cd ${{ env.artifact_path }}
echo "[:cn: 修改日志](https://github.com/KangLin/FaceRecognizer/blob/${{env.FaceRecognizer_VERSION}}/ChangeLog_zh_CN.md)" > ${{github.workspace}}/Release.md
echo "[:en: Change log](https://github.com/KangLin/FaceRecognizer/blob/${{env.FaceRecognizer_VERSION}}/ChangeLog.md)" >> ${{github.workspace}}/Release.md
echo "" >> ${{github.workspace}}/Release.md
echo "文件签名:" >> ${{github.workspace}}/Release.md
for file in *
do
echo $file
if [ -f $file ]; then
md5sum $file > $file.md5sum
cat $file.md5sum >> ${{github.workspace}}/Release.md
fi
done
- name: Upload To Github Release
run: |
gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-file ${{github.workspace}}/Release.md
gh release upload ${{ github.ref_name }} ${{github.workspace}}/${{ env.artifact_path }}/*
name: Codespell
on:
push:
pull_request:
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- uses: codespell-project/actions-codespell@master
with:
check_filenames: true
path: ${{github.workspace}}
skip: "*.lua,codespell.yml"
ignore_words_list: "doubleclick,msdos,rabits,eArch"
name: Doxygen
on: [push]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
strategy:
matrix:
os: [Ubuntu-20.04]
runs-on: ${{matrix.os}}
env:
BUILD_TYPE: Release
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_ubuntu
RabbitRemoteControl_VERSION: v0.0.27
DOXYGEN_VERSION: 1.9.5
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: make_directory
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
- name: Cache installed
uses: actions/cache@v2
id: cache-installed
with:
path: |
${{env.TOOSL_DIR}}
key: cache-installed-doxygen-${{matrix.os}}
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: git clone https://github.com/KangLin/RabbitCommon.git
- name: apt helper action
uses: ryankurte/action-apt@v0.2.0
with:
# architectures to pass to dpkg --add-architecture
#architectures: # optional
# apt packages to install
packages: cmake build-essential graphviz qttools5-dev qttools5-dev-tools qtbase5-dev qtbase5-dev-tools
- name: Download doxygen
run: |
if [ ! -d ${{env.TOOSL_DIR}}/doxygen-${{env.DOXYGEN_VERSION}} ]; then
cd ${{env.TOOSL_DIR}}
wget https://www.doxygen.nl/files/doxygen-${{env.DOXYGEN_VERSION}}.linux.bin.tar.gz
tar xzf doxygen-${{env.DOXYGEN_VERSION}}.linux.bin.tar.gz
fi
sudo cp ${{env.TOOSL_DIR}}/doxygen-${{env.DOXYGEN_VERSION}}/bin/doxygen /usr/bin/doxygen
- name: build doxygen
working-directory: ${{github.workspace}}
env:
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon
BUILD_DOCS: ON
run: |
cmake -E make_directory ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake ${{github.workspace}} \
-DBUILD_APP:BOOL=OF \
-DBUILD_CLIENT:BOOL=OFF \
-DBUILD_PLUGINS:BOOL=OFF \
-DBUILD_SERVICE:BOOL=OFF \
-DBUILD_ABOUT:BOOL=OFF \
-DBUILD_ADMINAUTHORISER:BOOL=OFF \
-DBUILD_UPDATE:BOOL=OFF \
-DCMARK_SHARED=OFF \
-DCMARK_TESTS=OFF \
-DCMARK_STATIC=ON \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install \
-DBUILD_DOCS=ON
cmake --build . --target doc_Chinese doc_English
- name: update
uses: actions/upload-artifact@v2
with:
name: rabbitremotecontrol_doxygen_${{ matrix.os }}
path: |
build/Doxygen
- name: Deploy to GitHub Pages
if: startsWith(github.ref, 'refs/tags/')
uses: crazy-max/ghaction-github-pages@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target_branch: gh-pages
build_dir: build/Doxygen
# - name: Upload Documentation to Wiki
# if: startsWith(github.ref, 'refs/tags/')
# uses: SwiftDocOrg/github-wiki-publish-action@v1
# with:
# path: build/Doxygen
# env:
# GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
name: build_macos
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_macos.outputs.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build_macos:
strategy:
matrix:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: [Release, Debug]
qt_version: [5.15.2, 5.12.12]
include:
# - qt_version: 6.4.2
# qt_modules: qtscxml qtpositioning qt5compat
- qt_version: 5.15.2
qt_modules: ""
- qt_version: 5.12.12
qt_modules: ""
runs-on: macos-latest
env:
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_macos
qt_modules: ${{matrix.qt_modules}}
FaceRecognizer_VERSION: v0.0.4
artifact_name: build_macos
VCPKGGITCOMMITID: 1286cac8751e13bb289061b7e3b89eb4c3f613a2
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Make directories
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{github.workspace}}/build
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: Cache-macos-installed-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}}
- name: Install application
run: |
brew install nasm
- name: run-vcpkg
uses: lukka/run-vcpkg@v7.4
with:
vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}}
vcpkgDirectory: ${{runner.workspace}}/vcpkg/
# Since the cache must be invalidated when content of the vcpkg.json file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: cache-vcpkg-msvc-${{matrix.os}}-vc${{matrix.VCPKG_PLATFORM_TOOLSET}}-${{matrix.triplet}}-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}}
vcpkgTriplet: '${{matrix.triplet}}'
vcpkgArguments: 'openssl libpng pixman libjpeg-turbo libyuv ffmpeg opencv' # dlib ncnn'
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1 # not v2!
with:
path: ${{env.TOOSL_DIR}}/qt
key: qt${{matrix.qt_version}}-${{matrix.qt_arch}}
- name: Install Qt
# You may pin to the exact commit or the version.
# uses: jurplel/install-qt-action@a962fb91949c8e846a3e4a944d50e7ef5cc3a28a
uses: jurplel/install-qt-action@v3
with:
# Directory to install Qt
dir: ${{env.TOOSL_DIR}}/qt # optional
# Version of Qt to install
version: ${{matrix.qt_version}} # optional, default is 5.15.2
modules: ${{env.qt_modules}} # optional
- name: build SeetaFace2
working-directory: ${{env.SOURCE_DIR}}
run: |
if [ ! -f ${{env.INSTALL_DIR}}/lib/cmake/SeetaFaceDetectorConfig.cmake ]; then
git clone https://github.com/KangLin/SeetaFace2.git
cd SeetaFace2
cmake -E make_directory build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}" \
-DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake"
cmake --build . --config ${{matrix.BUILD_TYPE}}
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
fi
- name: build libfacedetection
working-directory: ${{env.SOURCE_DIR}}
run: |
if [ ! -f ${{env.INSTALL_DIR}}/lib/cmake/facedetection/facedetectionConfig.cmake ]; then
git clone https://github.com/ShiqiYu/libfacedetection.git
cd libfacedetection
cmake -E make_directory build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}" \
-DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" \
-DBUILD_SHARED_LIBS=ON
cmake --build . --config ${{matrix.BUILD_TYPE}}
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
fi
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: git clone https://github.com/KangLin/RabbitCommon.git
- name: Compile FaceRecognizer
working-directory: ${{github.workspace}}/build
env:
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon
SeetaFace_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaNet_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaFaceDetector_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaFaceLandmarker_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaFaceRecognizer_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaFaceTracker_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaQualityAssessor_DIR: ${{env.INSTALL_DIR}}/lib/cmake
facedetection_DIR: ${{env.INSTALL_DIR}}/lib/cmake/facedetection
run: |
cmake ${{github.workspace}} \
-DCMARK_SHARED=OFF \
-DCMARK_TESTS=OFF \
-DCMARK_STATIC=ON \
-Dcmark-gfm_DIR=${{env.INSTALL_DIR}}/lib/cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install \
-DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}\scripts\buildsystems\vcpkg.cmake" \
-DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}}/lib/cmake
cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install
cmake --build . --config ${{ matrix.BUILD_TYPE }} --target package
7z a FaceRecognizer_${{env.FaceRecognizer_VERSION}}_macos_qt${{matrix.qt_version}}.zip ./install/*
- name: Update artifact
if: ${{ matrix.BUILD_TYPE == 'Release' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}/build/FaceRecognizer_${{env.FaceRecognizer_VERSION}}_macos_qt${{matrix.qt_version}}.zip
name: build_mingw
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_mingw.outputs.name }}
jobs:
build_mingw:
name: build mingw
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
defaults:
run:
shell: cmd
runs-on: windows-latest
env:
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
SOURCE_DIR: ${{github.workspace}}\.cache\source
TOOSL_DIR: ${{github.workspace}}\.cache\tools
INSTALL_DIR: ${{github.workspace}}\.cache\install_mingw
FaceRecognizer_VERSION: v0.0.4
artifact_name: build_mingw
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: pacman
env:
PATH: C:\msys64\usr\bin
run: |
C:\msys64\usr\bin\pacman.exe -S --noconfirm ^
git base-devel ^
mingw-w64-x86_64-cmake ^
mingw-w64-x86_64-make ^
mingw-w64-x86_64-nsis ^
mingw-w64-x86_64-gcc ^
mingw-w64-x86_64-qt5 ^
mingw-w64-x86_64-qtwebkit ^
mingw-w64-x86_64-zlib ^
mingw-w64-x86_64-openssl ^
mingw-w64-x86_64-cyrus-sasl ^
mingw-w64-x86_64-pixman ^
mingw-w64-x86_64-libjpeg-turbo ^
mingw-w64-x86_64-libpng ^
mingw-w64-x86_64-yasm ^
mingw-w64-x86_64-openh264 ^
mingw-w64-x86_64-ffmpeg ^
mingw-w64-x86_64-opencv ^
mingw-w64-x86_64-dlib ^
mingw-w64-x86_64-libyuv ^
mingw-w64-x86_64-sqlite3
- name: make_directory
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{github.workspace}}\build
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: cache-installed-mingw
- name: build SeetaFace2
working-directory: ${{env.SOURCE_DIR}}
env:
MSYSTEM: MINGW64
PATH: C:\msys64\mingw64\bin;C:\msys64\usr\bin
run: |
IF NOT EXIST ${{env.INSTALL_DIR}}\lib\cmake\SeetaFace2 (
git clone https://github.com/KangLin/SeetaFace2.git
cd SeetaFace2
cmake -E make_directory build
cd build
cmake .. -G"MinGW Makefiles" ^
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}"
cmake --build . --config ${{matrix.BUILD_TYPE}}
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
)
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: git clone https://github.com/KangLin/RabbitCommon.git
- name: build FaceRecognizer
working-directory: ${{github.workspace}}\build
env:
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon
MSYSTEM: MINGW64
PATH: C:\msys64\mingw64\bin;C:\msys64\usr\bin
run: |
cmake ${{github.workspace}} ^
-G"MinGW Makefiles" ^
-DCMARK_SHARED=OFF ^
-DCMARK_TESTS=OFF ^
-DCMARK_STATIC=ON ^
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}\build\install ^
-DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}} ^
-DSeetaFace_DIR=${{env.INSTALL_DIR}}\lib\cmake\SeetaFace2
cmake --build . --config ${{ matrix.BUILD_TYPE }}
cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install
- name: Package
# if: ${{ matrix.BUILD_TYPE == 'Release' }}
working-directory: ${{github.workspace}}\build
run: |
move /Y install\plugins\*crypto*.dll install\bin
move /Y install\plugins\*ssl*.dll install\bin
copy /Y ${{env.INSTALL_DIR}}\bin\*.dll install\bin
copy /Y ${{env.INSTALL_DIR}}\lib\*.dll install\bin
copy /Y C:\msys64\mingw64\bin\*.dll install\bin
makensis Install.nsi
- name: Update artifact
#if: ${{ matrix.BUILD_TYPE == 'Release' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}\build\FaceRecognizer_Setup_${{env.FaceRecognizer_VERSION}}.exe
name: build_msvc
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_msvc.outputs.name }}
jobs:
build_msvc:
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
qt_version: [5.15.2, 5.12.12]
include:
# - qt_version: 6.5.1
# triplet: x64-windows
# VCPKG_PLATFORM_TOOLSET: v142
# qt_arch: win64_msvc2019_64
# CMAKE_GENERATOR_PLATFORM: x64
# qt_modules: qtscxml qtpositioning qtwebchannel qtwebsockets qtwebview
- qt_version: 5.15.2
qt_arch: win64_msvc2019_64
triplet: x64-windows
VCPKG_PLATFORM_TOOLSET: v142
CMAKE_GENERATOR_PLATFORM: x64
- qt_version: 5.12.12
qt_arch: win32_msvc2017
triplet: x86-windows
VCPKG_PLATFORM_TOOLSET: v141
CMAKE_GENERATOR_PLATFORM: Win32
runs-on: windows-latest
env:
SOURCE_DIR: ${{github.workspace}}\.cache\source
TOOSL_DIR: ${{github.workspace}}\.cache\tools
INSTALL_DIR: ${{github.workspace}}\.cache\install_msvc_${{matrix.CMAKE_GENERATOR_PLATFORM}}_${{matrix.BUILD_TYPE}}
CMAKE_GENERATOR: "Visual Studio 17 2022"
VCPKG_PLATFORM_TOOLSET: ${{matrix.VCPKG_PLATFORM_TOOLSET}}
CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}}
FaceRecognizer_VERSION: v0.0.4
VCPKGGITCOMMITID: 1286cac8751e13bb289061b7e3b89eb4c3f613a2
qt_modules: qtwebengine ${{matrix.qt_modules}}
artifact_name: build_msvc
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
defaults:
run:
shell: cmd
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Make directories
run: |
cmake -E make_directory ${{github.workspace}}/build
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: FaceRecognizer_msvc_cache-installed-${{matrix.os}}-vc${{matrix.VCPKG_PLATFORM_TOOLSET}}-${{matrix.triplet}}-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}}_2033_03_02
- name: run-vcpkg
uses: lukka/run-vcpkg@v7.4
with:
vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}}
vcpkgDirectory: ${{runner.workspace}}/vcpkg/
# Since the cache must be invalidated when content of the vcpkg.json file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: cache-vcpkg-msvc-${{matrix.os}}-vc${{matrix.VCPKG_PLATFORM_TOOLSET}}-${{matrix.triplet}}-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}}
vcpkgTriplet: '${{matrix.triplet}}'
vcpkgArguments: 'openssl libpng pixman libjpeg-turbo libyuv ffmpeg opencv dlib' # ncnn'
- name: build SeetaFace2
working-directory: ${{env.SOURCE_DIR}}
run: |
IF NOT EXIST ${{env.INSTALL_DIR}}\lib\cmake\SeetaFaceDetectorConfig.cmake (
git clone https://github.com/KangLin/SeetaFace2.git
cd SeetaFace2
cmake -E make_directory build
cd build
cmake .. ^
-A ${{matrix.CMAKE_GENERATOR_PLATFORM}} ^
-T ${{matrix.VCPKG_PLATFORM_TOOLSET}} ^
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}" ^
-DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}\scripts\buildsystems\vcpkg.cmake"
cmake --build . --config ${{matrix.BUILD_TYPE}}
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
)
- name: build libfacedetection
working-directory: ${{env.SOURCE_DIR}}
run: |
IF NOT EXIST ${{env.INSTALL_DIR}}\lib\cmake\facedetection\facedetectionConfig.cmake (
git clone https://github.com/ShiqiYu/libfacedetection.git
cd libfacedetection
cmake -E make_directory build
cd build
cmake .. ^
-A ${{matrix.CMAKE_GENERATOR_PLATFORM}} ^
-T ${{matrix.VCPKG_PLATFORM_TOOLSET}} ^
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}" ^
-DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}\scripts\buildsystems\vcpkg.cmake" ^
-DBUILD_SHARED_LIBS=ON
cmake --build . --config ${{matrix.BUILD_TYPE}}
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
)
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1 # not v2!
with:
path: ${{env.TOOSL_DIR}}/qt
key: qt_${{matrix.qt_version}}_${{matrix.qt_arch}}
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
dir: '${{env.TOOSL_DIR}}/qt' # optional
version: '${{matrix.qt_version}}' # optional, default is 5.15.2
arch: '${{matrix.qt_arch}}' # optional
modules: '${{env.qt_modules}}' # optional
cached: '${{steps.cache-qt.outputs.cache-hit}}' # optional, default is false
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: git clone https://github.com/KangLin/RabbitCommon.git
- name: build FaceRecognizer
env:
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
cmake -E make_directory ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake ${{github.workspace}} ^
-A ${{matrix.CMAKE_GENERATOR_PLATFORM}} ^
-T ${{matrix.VCPKG_PLATFORM_TOOLSET}} ^
-DCMARK_SHARED=OFF ^
-DCMARK_TESTS=OFF ^
-DCMARK_STATIC=ON ^
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install ^
-DBUILD_QUIWidget=OFF ^
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake ^
-DSeetaFace_DIR=${{env.INSTALL_DIR}}/lib/cmake ^
-DSeetaNet_DIR=${{env.INSTALL_DIR}}/lib/cmake ^
-DSeetaFaceDetector_DIR=${{env.INSTALL_DIR}}/lib/cmake ^
-DSeetaFaceLandmarker_DIR=${{env.INSTALL_DIR}}/lib/cmake ^
-DSeetaFaceRecognizer_DIR=${{env.INSTALL_DIR}}/lib/cmake ^
-DSeetaFaceTracker_DIR=${{env.INSTALL_DIR}}/lib/cmake ^
-DSeetaQualityAssessor_DIR=${{env.INSTALL_DIR}}/lib/cmake ^
-Dfacedetection_DIR=${{env.INSTALL_DIR}}/lib/cmake/facedetection
cmake --build . --config ${{matrix.BUILD_TYPE}}
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
- name: Package
if: ${{ matrix.BUILD_TYPE == 'Release' }}
working-directory: ${{github.workspace}}\build
run: |
move /Y install\plugins\*crypto*.dll install\bin
move /Y install\plugins\*ssl*.dll install\bin
copy /Y ${{env.INSTALL_DIR}}\bin\*.dll install\bin
copy /Y ${{env.INSTALL_DIR}}\lib\*.dll install\bin
copy /Y ${{env.RUNVCPKG_VCPKG_ROOT}}\installed\${{env.RUNVCPKG_VCPKG_TRIPLET_OUT}}\bin\*.dll install\bin
7z a FaceRecognizer_windows_${{env.FaceRecognizer_VERSION}}.zip .\install\*
makensis Install.nsi
copy /Y FaceRecognizer_${{env.FaceRecognizer_VERSION}}_Setup.exe FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe
${{github.workspace}}\build\install\bin\FaceRecognizerApp.exe ^
-f "update_windows.xml" ^
-u https://github.com/KangLin/FaceRecognizer/releases/download/${{env.FaceRecognizer_VERSION}}/FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe;https://sourceforge.net/projects/FaceRecognizer/files/${{env.FaceRecognizer_VERSION}}/FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe ^
--pf FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe ^
-m "${{env.FaceRecognizer_VERSION}}"
- name: Update artifact
if: ${{ matrix.BUILD_TYPE == 'Release' && matrix.qt_version == '5.12.12' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}\build\FaceRecognizer_${{env.FaceRecognizer_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe
${{github.workspace}}\build\update_windows.xml
# - name: Upload To Github Release
# if: ${{ matrix.BUILD_TYPE == 'Release' && '5.12.12' == matrix.qt_version && startsWith(github.ref, 'refs/tags/') }}
# uses: softprops/action-gh-release@v0.1.14
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# prerelease: true
## body: |
## [:cn: 修改日志](ChangeLog_zh_CN.md) [:cn: 说明](README_zh_CN.md)
## [:us: Change log](ChangeLog.md) [:us: README](README.md)
# files: |
# ${{github.workspace}}\build\FaceRecognizer_windows_${{env.FaceRecognizer_VERSION}}.zip
# ${{github.workspace}}\build\FaceRecognizer_windows_${{env.FaceRecognizer_VERSION}}.zip.md5sum
# ${{github.workspace}}\build\FaceRecognizer_Setup_${{env.FaceRecognizer_VERSION}}.exe
# ${{github.workspace}}\build\FaceRecognizer_Setup_${{env.FaceRecognizer_VERSION}}.exe.md5sum
# ${{github.workspace}}\build\update_windows.xml
name: ubuntu
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_ubuntu.outputs.name }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
build_ubuntu:
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
runs-on: ubuntu-20.04
env:
BUILD_TYPE: ${{matrix.BUILD_TYPE}}
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.BUILD_TYPE}}
FaceRecognizer_VERSION: 0.0.4
artifact_name: build_ubuntu
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Make directories
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{github.workspace}}/build
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: git clone https://github.com/KangLin/RabbitCommon.git
- name: Install apt packages
run: |
sudo apt-get update -y \
&& sudo apt-get upgrade -y \
&& sudo apt-get install -y xvfb xpra \
cmake build-essential \
debhelper fakeroot graphviz \
libglu1-mesa-dev libpulse-mainloop-glib0 \
qttools5-dev qttools5-dev-tools qtbase5-dev qtbase5-dev-tools \
qtmultimedia5-dev qtlocation5-dev libqt5svg5-dev \
qtwebengine5-dev libqtermwidget5-0-dev libqt5serialport5-dev\
libutf8proc-dev libpam0g-dev \
libxkbcommon-dev libxkbcommon-x11-dev xorg-dev libx11-xcb-dev \
libx11-dev libxfixes-dev \
libdlib-dev libopencv-dev \
libavcodec-dev libavformat-dev libavfilter-dev libavdevice-dev libavresample-dev libavutil-dev \
libsqlite3-dev
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: cache-installed-ubuntu
- name: build SeetaFace2
working-directory: ${{env.SOURCE_DIR}}
run: |
if [ ! -f ${{env.INSTALL_DIR}}/lib/cmake/SeetaFaceDetectorConfig.cmake ]; then
git clone https://github.com/KangLin/SeetaFace2.git
cd SeetaFace2
cmake -E make_directory build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}"
cmake --build . --config ${{matrix.BUILD_TYPE}}
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
fi
- name: build libfacedetection
working-directory: ${{env.SOURCE_DIR}}
run: |
if [ ! -f ${{env.INSTALL_DIR}}/lib/cmake/facedetection/facedetectionConfig.cmake ]; then
git clone https://github.com/ShiqiYu/libfacedetection.git
cd libfacedetection
cmake -E make_directory build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}"
cmake --build . --config ${{matrix.BUILD_TYPE}}
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
fi
- name: build_debpackage.sh
working-directory: ${{github.workspace}}
env:
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon
SeetaFace_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaNet_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaFaceDetector_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaFaceLandmarker_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaFaceRecognizer_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaFaceTracker_DIR: ${{env.INSTALL_DIR}}/lib/cmake
SeetaQualityAssessor_DIR: ${{env.INSTALL_DIR}}/lib/cmake
facedetection_DIR: ${{env.INSTALL_DIR}}/lib/cmake/facedetection
run: |
./build_debpackage.sh /usr/lib/`uname -m`-linux-gnu/qt5
cp ../facerecognizer_${{env.FaceRecognizer_VERSION}}_amd64.deb facerecognizer_${{env.FaceRecognizer_VERSION}}_amd64.deb
- name: Update xml file
working-directory: ${{github.workspace}}
run: |
sudo Xvfb :99 -ac &
export DISPLAY=:99.0
sudo apt install ./facerecognizer_${{env.FaceRecognizer_VERSION}}_amd64.deb
MD5=`md5sum facerecognizer_${{env.FaceRecognizer_VERSION}}_amd64.deb|awk '{print $1}'`
echo "MD5:${MD5}"
/bin/bash /opt/FaceRecognizer/bin/FaceRecognizer.sh \
-f "${{github.workspace}}/update_linux.xml" \
--md5 ${MD5} \
-m "${{env.FaceRecognizer_VERSION}}" \
-u "https://github.com/KangLin/FaceRecognizer/releases/download/v${{env.FaceRecognizer_VERSION}}/facerecognizer_${{env.FaceRecognizer_VERSION}}_amd64.deb;https://sourceforge.net/projects/FaceRecognizer/files/v${{env.FaceRecognizer_VERSION}}/facerecognizer_${{env.FaceRecognizer_VERSION}}_amd64.deb"
- name: Update artifact
if: ${{ matrix.BUILD_TYPE == 'Release' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}/facerecognizer_*.deb
${{github.workspace}}/update_linux.xml
......@@ -12,7 +12,6 @@ project(FaceRecognizerApp)
set(SOURCE_FILES
FrmDisplay.cpp
DlgLog.cpp
main.cpp
MainWindow.cpp
FrmRegisterImage.cpp
......@@ -26,12 +25,11 @@ set(SOURCE_FILES
RecognizerVideo.cpp
FrmPara.cpp
DelegateParamter.cpp
FrmBroweFile.cpp
FrmBrowseFile.cpp
)
set(HEADER_FILES
FrmDisplay.h
DlgLog.h
MainWindow.h
FrmRegisterImage.h
FrmRecognizerImage.h
......@@ -44,12 +42,11 @@ set(HEADER_FILES
RecognizerVideo.h
FrmPara.h
DelegateParamter.h
FrmBroweFile.h
FrmBrowseFile.h
)
set(SOURCE_UI_FILES
FrmDisplay.ui
DlgLog.ui
MainWindow.ui
FrmRegisterImage.ui
FrmRecognizerImage.ui
......@@ -57,19 +54,9 @@ set(SOURCE_UI_FILES
FrmRecognizerVideo.ui
ManageRecognizerVideo.ui
FrmPara.ui
FrmBroweFile.ui
FrmBrowseFile.ui
)
#翻译
GENERATED_QT_TRANSLATIONS(SOURCES ${SOURCE_FILES}
OUT_QRC TRANSLATIONS_QRC_FILES)
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
if(BUILD_TYPE STREQUAL "debug")
LIST(APPEND PRIVATE_DEFINITIONS DEBUG)
LIST(APPEND RCC_FILES
${TRANSLATIONS_QRC_FILES}
)
endif()
add_definitions(-DBUILD_VERSION="${FaceRecognizer_VERSION}")
add_definitions(-DBUILD_ARCH="${BUILD_ARCH}")
......@@ -87,13 +74,10 @@ ADD_TARGET(NAME ${PROJECT_NAME}
ISWINDOWS
VERSION ${FaceRecognizer_VERSION}
PRIVATE_DEFINITIONS FaceRecognizer_VERSION="${FaceRecognizer_VERSION}"
FaceRecognizer_REVISION="${FaceRecognizer_REVISION}"
SOURCE_FILES ${SOURCE_FILES} ${HEADER_FILES} ${SOURCE_UI_FILES} ${RCC_FILES}
PRIVATE_LIBS ${QT_LIBRARIES} FaceRecognizer)
# Install syle files
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Resource/Style/
DESTINATION ${INSTALL_DATA_PREFIX}/style
COMPONENT Runtime)
IF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Resource/image/FaceRecognizer.ico
DESTINATION .
......@@ -101,11 +85,33 @@ IF(WIN32)
ENDIF()
if(UNIX AND NOT ANDROID)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/debian/FaceRecognizer.desktop
INSTALL(FILES ${CMAKE_SOURCE_DIR}/share/FaceRecognizer.desktop
DESTINATION "share/applications"
COMPONENT Runtime)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/share/FaceRecognizer.sh
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT Runtime)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Resource/image/FaceRecognizer.png
DESTINATION "share/pixmaps"
COMPONENT Runtime)
endif()
if(Log4Qt_FOUND)
if(NOT EXISTS ${CMAKE_BINARY_DIR}/etc/FaceRecognizer_log4qt.conf)
configure_file(${CMAKE_SOURCE_DIR}/etc/FaceRecognizer_log4qt.conf
${CMAKE_BINARY_DIR}/etc/FaceRecognizer_log4qt.conf
COPYONLY)
endif()
INSTALL(FILES ${CMAKE_SOURCE_DIR}/etc/FaceRecognizer_log4qt.conf
DESTINATION etc
COMPONENT Runtime)
else()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/etc/FaceRecognizer_logqt.ini)
configure_file(${CMAKE_SOURCE_DIR}/etc/FaceRecognizer_logqt.ini
${CMAKE_BINARY_DIR}/etc/FaceRecognizer_logqt.ini
COPYONLY)
endif()
INSTALL(FILES ${CMAKE_SOURCE_DIR}/etc/FaceRecognizer_logqt.ini
DESTINATION etc
COMPONENT Runtime)
endif()
......@@ -3,8 +3,7 @@
*/
#include "DelegateParamter.h"
#include "FrmBroweFile.h"
#include "Log.h"
#include "FrmBrowseFile.h"
#include <QDebug>
#include <QEvent>
......@@ -26,7 +25,7 @@ QSize CDelegateParamter::sizeHint(const QStyleOptionViewItem &option,
case TYPE_DIRECTORY:
case TYPE_FILE:
{
CFrmBroweFile f;
CFrmBrowseFile f;
f.setStyleOption(&option);
f.setFile(index.data(Qt::EditRole).toString());
s.setWidth(qMax(f.sizeHint().width(), s.width()));
......@@ -64,7 +63,7 @@ QWidget *CDelegateParamter::createEditor(QWidget *parent,
{
case TYPE_DIRECTORY:
{
CFrmBroweFile *pW = new CFrmBroweFile(parent);
CFrmBrowseFile *pW = new CFrmBrowseFile(parent);
pW->setStyleOption(&option);
pW->setFile(index.data(Qt::EditRole).toString());
pW->setIsDirectory(true);
......@@ -75,7 +74,7 @@ QWidget *CDelegateParamter::createEditor(QWidget *parent,
}
case TYPE_FILE:
{
CFrmBroweFile *pW = new CFrmBroweFile(parent);
CFrmBrowseFile *pW = new CFrmBrowseFile(parent);
pW->setStyleOption(&option);
pW->setFile(index.data(Qt::EditRole).toString());
pW->resize(option.rect.size());
......@@ -119,7 +118,7 @@ void CDelegateParamter::setEditorData(QWidget *editor,
case TYPE_DIRECTORY:
case TYPE_FILE:
{
CFrmBroweFile *pW = dynamic_cast<CFrmBroweFile*>(editor);
CFrmBrowseFile *pW = dynamic_cast<CFrmBrowseFile*>(editor);
pW->setFile(index.data(Qt::EditRole).toString());
return;
}
......@@ -151,7 +150,7 @@ void CDelegateParamter::setModelData(QWidget *editor,
case TYPE_DIRECTORY:
case TYPE_FILE:
{
CFrmBroweFile *pW = dynamic_cast<CFrmBroweFile*>(editor);
CFrmBrowseFile *pW = dynamic_cast<CFrmBrowseFile*>(editor);
model->setData(index, pW->getFile());
return;
}
......
/**
@author: Kang Lin<kl222@126.com>
*/
#include "DlgLog.h"
#include "ui_DlgLog.h"
#include <QFile>
CDlgLog::CDlgLog(const QString &szLogFile, QWidget *parent) :
QDialog(parent),
ui(new Ui::CDlgLog)
{
ui->setupUi(this);
m_szFile = szLogFile;
if(!m_szFile.isEmpty())
{
QString szLog;
QFile f(m_szFile);
if(!f.open(QFile::ReadOnly))
return;
szLog = f.readAll();
f.close();
ui->textEdit->append(szLog);
}
}
CDlgLog::~CDlgLog()
{
delete ui;
}
void CDlgLog::on_pbOk_clicked()
{
this->accept();
}
void CDlgLog::on_pbClean_clicked()
{
ui->textEdit->clear();
QFile::remove(m_szFile);
}
/**
@author: Kang Lin<kl222@126.com>
*/
#ifndef DLGLOG_H
#define DLGLOG_H
#include <QDialog>
namespace Ui {
class CDlgLog;
}
class CDlgLog : public QDialog
{
Q_OBJECT
public:
explicit CDlgLog(const QString &szLogFile = QString(),
QWidget *parent = nullptr);
~CDlgLog();
private slots:
void on_pbOk_clicked();
void on_pbClean_clicked();
private:
Ui::CDlgLog *ui;
QString m_szFile;
};
#endif // DLGLOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CDlgLog</class>
<widget class="QDialog" name="CDlgLog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Log file</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="textEdit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbOk">
<property name="text">
<string>Ok(&amp;O)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbClean">
<property name="text">
<string>Clean(&amp;C)</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -2,37 +2,37 @@
@author: Kang Lin<kl222@126.com>
*/
#include "FrmBroweFile.h"
#include "ui_FrmBroweFile.h"
#include "FrmBrowseFile.h"
#include "ui_FrmBrowseFile.h"
#include "RabbitCommonDir.h"
#include <QPainter>
CFrmBroweFile::CFrmBroweFile(QWidget *parent) :
CFrmBrowseFile::CFrmBrowseFile(QWidget *parent) :
QWidget(parent),
ui(new Ui::CFrmBroweFile),
ui(new Ui::CFrmBrowseFile),
m_bIsDirectory(false)
{
ui->setupUi(this);
}
CFrmBroweFile::~CFrmBroweFile()
CFrmBrowseFile::~CFrmBrowseFile()
{
delete ui;
}
int CFrmBroweFile::setFile(const QString &szFile)
int CFrmBrowseFile::setFile(const QString &szFile)
{
ui->leFile->setText(szFile);
return 0;
}
QString CFrmBroweFile::getFile()
QString CFrmBrowseFile::getFile()
{
return ui->leFile->text();
}
void CFrmBroweFile::on_pbBrowse_clicked()
void CFrmBrowseFile::on_pbBrowse_clicked()
{
QString szFile;
if(m_bIsDirectory)
......@@ -47,7 +47,7 @@ void CFrmBroweFile::on_pbBrowse_clicked()
setFile(szFile);
}
int CFrmBroweFile::setStyleOption(const QStyleOptionViewItem *option)
int CFrmBrowseFile::setStyleOption(const QStyleOptionViewItem *option)
{
m_StyleOptioins = *option;
ui->leFile->setPalette(option->palette);
......@@ -56,7 +56,7 @@ int CFrmBroweFile::setStyleOption(const QStyleOptionViewItem *option)
return 0;
}
void CFrmBroweFile::paintEvent(QPaintEvent *event)
void CFrmBrowseFile::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
QPen pen;
......@@ -68,12 +68,12 @@ void CFrmBroweFile::paintEvent(QPaintEvent *event)
return;
}
bool CFrmBroweFile::getIsDirectory()
bool CFrmBrowseFile::getIsDirectory()
{
return m_bIsDirectory;
}
int CFrmBroweFile::setIsDirectory(bool d)
int CFrmBrowseFile::setIsDirectory(bool d)
{
m_bIsDirectory = d;
return 0;
......
......@@ -9,14 +9,14 @@
#include <QStyleOptionViewItem>
namespace Ui {
class CFrmBroweFile;
class CFrmBrowseFile;
}
/**
* @brief The CFrmBroweFile class
* @brief The CFrmBrowseFile class
* 提供打开文件或目录。用于 CFrmPara
*/
class CFrmBroweFile : public QWidget
class CFrmBrowseFile : public QWidget
{
Q_OBJECT
......@@ -24,8 +24,8 @@ class CFrmBroweFile : public QWidget
Q_PROPERTY(bool isDirectory READ getIsDirectory WRITE setIsDirectory)
public:
explicit CFrmBroweFile(QWidget *parent = nullptr);
virtual ~CFrmBroweFile() override;
explicit CFrmBrowseFile(QWidget *parent = nullptr);
virtual ~CFrmBrowseFile() override;
QString getFile();
int setFile(const QString &szFile);
......@@ -38,7 +38,7 @@ private slots:
void on_pbBrowse_clicked();
private:
Ui::CFrmBroweFile *ui;
Ui::CFrmBrowseFile *ui;
QStyleOptionViewItem m_StyleOptioins;
bool m_bIsDirectory;
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CFrmBroweFile</class>
<widget class="QWidget" name="CFrmBroweFile">
<class>CFrmBrowseFile</class>
<widget class="QWidget" name="CFrmBrowseFile">
<property name="geometry">
<rect>
<x>0</x>
......
......@@ -9,7 +9,11 @@
#include <QPainter>
CFrmDisplay::CFrmDisplay(QWidget *parent) :
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget(parent),
#else
QVideoWidget(parent),
#endif
ui(new Ui::CFrmDisplay),
m_bAspectRation(true)
{
......
......@@ -10,12 +10,20 @@
#include <QImage>
#include <QVideoFrame>
#include <QMetaClassInfo>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QVideoWidget>
#endif
namespace Ui {
class CFrmDisplay;
}
class CFrmDisplay : public QWidget
class CFrmDisplay
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
: public QWidget
#else
: public QVideoWidget
#endif
{
Q_OBJECT
Q_CLASSINFO("Author", "Kang Lin <kl222@126.com>")
......
......@@ -4,7 +4,6 @@
#include "FrmPara.h"
#include "ui_FrmPara.h"
#include "Log.h"
#include "FactoryFace.h"
#include "DelegateParamter.h"
#include <QDebug>
......
......@@ -17,7 +17,7 @@ class CFrmPara;
/**
* @brief The CFrmPara class
* @see CDelegateParamter
* CFrmBroweFile
* CFrmBrowseFile
*/
class CFrmPara : public QWidget
{
......@@ -26,7 +26,7 @@ class CFrmPara : public QWidget
public:
explicit CFrmPara(QWidget *parent = nullptr);
~CFrmPara();
virtual ~CFrmPara();
public Q_SLOTS:
int slotUpdateParamter(QAction *pAction = nullptr);
......
......@@ -11,6 +11,7 @@
#include <QStandardItemModel>
#include <QStandardItem>
#include <QPen>
#include <stdexcept>
CFrmRecognizerImage::CFrmRecognizerImage(QWidget *parent) :
QWidget(parent),
......
......@@ -6,12 +6,15 @@
#include "ui_FrmRecognizerVideo.h"
#include "FactoryFace.h"
#include "Performance.h"
#include "Log.h"
#include <QFont>
#include <QPainter>
#include <QDebug>
#include <QMutexLocker>
#include <stdexcept>
#include <QLoggingCategory>
Q_LOGGING_CATEGORY(logVideo, "Video")
CFrmRecognizerVideo::CFrmRecognizerVideo(QWidget *parent) :
QWidget(parent),
......@@ -28,7 +31,7 @@ CFrmRecognizerVideo::CFrmRecognizerVideo(QWidget *parent) :
CFrmRecognizerVideo::~CFrmRecognizerVideo()
{
qDebug() << "CFrmRecognizerVideo::~CFrmRecognizerVideo()";
qDebug(logVideo) << "CFrmRecognizerVideo::~CFrmRecognizerVideo()";
delete ui;
}
......@@ -63,7 +66,7 @@ void CFrmRecognizerVideo::slotDisplay(const QImage &image)
{
if(isHidden() || !m_pFace->bIsValid())
{
LOG_MODEL_ERROR("CFrmRecognizerVideo", "isHidden() || !m_pFace");
qCritical(logVideo) << "CFrmRecognizerVideo:" << "isHidden() || !m_pFace";
return;
}
......@@ -100,11 +103,11 @@ void CFrmRecognizerVideo::slotDisplay(const QImage &image)
ui->wgDisplay->slotDisplay(img);
if(bRecognize)
{
//qDebug() << "emit sigRecognize(image, faces); start";
//qDebug(logVideo) << "emit sigRecognize(image, faces); start";
QMutexLocker locker(&m_Mutex);
emit sigRecognize(image, faces);
PERFORMANCE_ADD_TIME(CFrmRecognizerVideo, "sigRecognize")
//qDebug() << "emit sigRecognize(image, faces); end";
//qDebug(logVideo) << "emit sigRecognize(image, faces); end";
}
if(faces.size() > 1)
{
......
......@@ -4,13 +4,13 @@
#include "FrmRegisterImage.h"
#include "ui_FrmRegisterImage.h"
#include "Log.h"
#include "RabbitCommonDir.h"
#include <QMessageBox>
#include <QPainter>
#include <QDebug>
#include <QPalette>
#include <stdexcept>
CFrmRegisterImage::CFrmRegisterImage(QWidget *parent) :
QWidget(parent),
......
......@@ -8,6 +8,7 @@
#include <QPainter>
#include <FactoryFace.h>
#include <stdexcept>
CFrmRegisterVideo::CFrmRegisterVideo(QWidget *parent) :
QWidget(parent),
......
......@@ -6,9 +6,11 @@
#include "ui_MainWindow.h"
#ifdef RABBITCOMMON
#include "FrmUpdater/FrmUpdater.h"
#include "DlgAbout/DlgAbout.h"
#include "FrmUpdater.h"
#include "DlgAbout.h"
#include "RabbitCommonDir.h"
#include "RabbitCommonTools.h"
#include "FrmStyle.h"
#endif
#include "FrmDisplay.h"
......@@ -17,8 +19,6 @@
#include "ManageRegisterVideo.h"
#include "ManageRecognizerVideo.h"
#include "FactoryFace.h"
#include "Log.h"
#include "DlgLog.h"
#include <QIcon>
#include <QCameraInfo>
......@@ -33,20 +33,19 @@
#include <QStandardPaths>
#include <QDockWidget>
#include <QScreen>
#include <QLoggingCategory>
Q_LOGGING_CATEGORY(log, "main")
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_pCamera(nullptr)
{
LoadStyle();
ui->setupUi(this);
CLog::Instance()->SetSaveFile(QStandardPaths::writableLocation(
QStandardPaths::TempLocation)
+ QDir::separator()
+ qApp->applicationName() + ".log");
//Init menu
ui->actionStart->setIcon(QIcon(":/image/Start"));
ui->actionStart->setIcon(QIcon::fromTheme("media-playback-start"));
ui->actionStart->setText(tr("Start"));
ui->actionStart->setToolTip(tr("Start"));
ui->actionStart->setStatusTip(tr("Start"));
......@@ -65,6 +64,13 @@ MainWindow::MainWindow(QWidget *parent) :
pSourceGroup->addAction(ui->actionFile);
pSourceGroup->addAction(ui->actionCamera);
ui->menuTools->addMenu(RabbitCommon::CTools::GetLogMenu(this));
// File
bool check = connect(&m_Player, SIGNAL(error(QMediaPlayer::Error)),
this, SLOT(slotPlayError(QMediaPlayer::Error)));
Q_ASSERT(check);
// Camera
if(!QCameraInfo::availableCameras().isEmpty())
{
......@@ -77,8 +83,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->toolBar->addWidget(cmbCameras);
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
foreach (const QCameraInfo &cameraInfo, cameras) {
// LOG_MODEL_DEBUG("MainWindows", "Camer name: %s",
// cameraInfo.deviceName().toStdString().c_str());
//qDebug(log) << "Camer name:" << cameraInfo.deviceName();
cmbCameras->addItem(cameraInfo.description());
}
......@@ -138,56 +143,10 @@ MainWindow::~MainWindow()
delete ui;
}
int MainWindow::LoadStyle()
{
QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
QString szFile = set.value("Sink",
RabbitCommon::CDir::Instance()->GetDirApplicationInstallRoot()
+ QDir::separator()
+ "data" + QDir::separator()
+ "style" + QDir::separator()
+ "black.qss").toString();
return LoadStyle(szFile);
}
int MainWindow::LoadStyle(const QString &szFile)
{
if(szFile.isEmpty())
qApp->setStyleSheet("");
else
{
QFile file(szFile);
if(file.open(QFile::ReadOnly))
{
QString stylesheet= file.readAll();
qApp->setStyleSheet(stylesheet);
file.close();
}
else
{
qDebug() << "file open file fail:" << szFile;
}
}
return 0;
}
void MainWindow::on_actionStyle_triggered()
{
QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
QString szFile = set.value("Sink",
RabbitCommon::CDir::Instance()->GetDirApplicationInstallRoot()
+ QDir::separator()
+ "data" + QDir::separator()
+ "style" + QDir::separator()
+ "black.qss").toString();
szFile = RabbitCommon::CDir::GetOpenFileName(this, tr("Open sink"),
szFile,
tr("Style files(*.qss)"));
if(szFile.isEmpty()) return;
LoadStyle(szFile);
set.setValue("Sink", szFile);
CFrmStyle* s = new CFrmStyle();
s->show();
}
void MainWindow::slotCameraChanged(int index)
......@@ -211,14 +170,14 @@ void MainWindow::slotCameraChanged(int index)
m_pCamera->load();
qInfo() << "Camera support:";
qInfo() << "Resolutions:" << m_pCamera->supportedViewfinderResolutions(m_pCamera->viewfinderSettings());
qInfo(log) << "Camera support:";
qInfo(log) << "Resolutions:" << m_pCamera->supportedViewfinderResolutions(m_pCamera->viewfinderSettings());
QList<QCamera::FrameRateRange> ranges = m_pCamera->supportedViewfinderFrameRateRanges();
for(auto &rang: ranges)
{
qInfo() << "Frame rate range:" << rang.maximumFrameRate << rang.maximumFrameRate;
qInfo(log) << "Frame rate range:" << rang.maximumFrameRate << rang.maximumFrameRate;
}
qInfo() << "Pixel formate:" << m_pCamera->supportedViewfinderPixelFormats(m_pCamera->viewfinderSettings());
qInfo(log) << "Pixel formate:" << m_pCamera->supportedViewfinderPixelFormats(m_pCamera->viewfinderSettings());
// viewfinderSettings.setResolution(640, 480);
// viewfinderSettings.setMinimumFrameRate(10.0);
......@@ -226,11 +185,11 @@ void MainWindow::slotCameraChanged(int index)
// m_pCamera->setViewfinderSettings(viewfinderSettings);
m_pCamera->unload();
qInfo() << "Current:";
qInfo() << "Resolutions:" << viewfinderSettings.resolution();
qInfo() << "Frame rate:" << viewfinderSettings.minimumFrameRate() << viewfinderSettings.maximumFrameRate();
qInfo() << "Pixel formate:" << viewfinderSettings.pixelFormat();
qInfo() << "" << viewfinderSettings.pixelAspectRatio();
qInfo(log) << "Current:";
qInfo(log) << "Resolutions:" << viewfinderSettings.resolution();
qInfo(log) << "Frame rate:" << viewfinderSettings.minimumFrameRate() << viewfinderSettings.maximumFrameRate();
qInfo(log) << "Pixel formate:" << viewfinderSettings.pixelFormat();
qInfo(log) << "" << viewfinderSettings.pixelAspectRatio();
//*/
......@@ -251,7 +210,7 @@ void MainWindow::slotCameraChanged(int index)
// focusMode = QCameraFocus::MacroFocus;
// else
// focusMode = QCameraFocus::ManualFocus;
LOG_MODEL_DEBUG("MainWindow", "focusMode:0x%x", focusMode);
qDebug(log) << "focusMode:" << focusMode;
focus->setFocusMode(focusMode);
focus->setFocusPointMode(QCameraFocus::FocusPointAuto);
......@@ -346,14 +305,17 @@ void MainWindow::on_actionFile_triggered()
return;
set.setValue("SourceFile", szFile);
QUrl url = QUrl::fromLocalFile(szFile);
m_Player.setMedia(url);
m_Player.setVideoOutput(&m_CaptureFrame);
#endif
}
void MainWindow::slotPlayError(QMediaPlayer::Error error)
{
qCritical(log) << "Play error:" << error
<< "Url:" << m_Player.media().canonicalUrl().toString();
ui->actionStart->trigger();
}
void MainWindow::on_actionStart_triggered()
{
if(ui->actionStart->isChecked())
......@@ -372,8 +334,13 @@ void MainWindow::on_actionStart_triggered()
szFile = set.value("SourceFile").toString();
QUrl url = QUrl::fromLocalFile(szFile);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_Player.setMedia(url);
m_Player.setVideoOutput(&m_CaptureFrame);
#else
m_Player.setSource(url);
#endif
m_Player.play();
}
......@@ -381,14 +348,14 @@ void MainWindow::on_actionStart_triggered()
ui->actionStart->setText(tr("Stop"));
ui->actionStart->setToolTip(tr("Stop"));
ui->actionStart->setStatusTip(tr("Stop"));
ui->actionStart->setIcon(QIcon(":/image/Stop"));
ui->actionStart->setIcon(QIcon::fromTheme("media-playback-stop"));
} else {
if(m_pCamera && ui->actionCamera->isChecked())
m_pCamera->stop();
else
m_Player.stop();
ui->actionStart->setIcon(QIcon(":/image/Start"));
ui->actionStart->setIcon(QIcon::fromTheme("media-playback-start"));
ui->actionStart->setText(tr("Start"));
ui->actionStart->setToolTip(tr("Start"));
ui->actionStart->setStatusTip(tr("Start"));
......@@ -414,13 +381,13 @@ int MainWindow::CamerOrientation(int index)
int screenAngle = 0;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
qDebug() << "orientation:" << screen->orientation()
qDebug(log) << "orientation:" << screen->orientation()
<< screen->nativeOrientation()
<< screen->orientationUpdateMask();
screenAngle = screen->angleBetween(screen->nativeOrientation(),
screen->orientation());
#endif
qDebug() << "screenAngle:" << screenAngle
qDebug(log) << "screenAngle:" << screenAngle
<< "camer orientation:" << cameraInfo.orientation();
int rotation;
if (cameraInfo.position() == QCamera::BackFace) {
......@@ -430,8 +397,8 @@ int MainWindow::CamerOrientation(int index)
rotation = (360 - cameraInfo.orientation() + screenAngle) % 360;
}
int a = cameraInfo.orientation();
LOG_MODEL_DEBUG("MainWindow", "Camer angle: %d; %d", a, rotation);
qDebug() << "orientation1:" << a << rotation;
qDebug(log) << "Camer angle:" << a << rotation;
qDebug(log) << "orientation1:" << a << rotation;
return rotation;
}
......@@ -439,9 +406,9 @@ void MainWindow::slotScreenOrientationChanged(Qt::ScreenOrientation orientation)
{
QScreen *screen = QGuiApplication::primaryScreen();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
qDebug() << "slotScreenOrientationChanged:" << orientation
<<screen->nativeOrientation()
<< screen->orientation();
qDebug(log) << "slotScreenOrientationChanged:" << orientation
<<screen->nativeOrientation()
<< screen->orientation();
#endif
}
......@@ -524,9 +491,16 @@ void MainWindow::on_actionAbout_A_triggered()
{
#ifdef RABBITCOMMON
CDlgAbout about(this);
about.m_AppIcon = QImage(":/image/FaceRecognizer");
//about.m_AppIcon = QImage(":/image/FaceRecognizer");
QIcon icon = windowIcon();
if(icon.isNull()) return;
auto sizeList = icon.availableSizes();
if(sizeList.isEmpty()) return;
QPixmap p = icon.pixmap(*sizeList.begin());
about.m_AppIcon = p.toImage();
about.m_szHomePage = "https://github.com/KangLin/FaceRecognizer";
about.m_szCopyrightStartTime = "2019";
about.m_szVersionRevision = FaceRecognizer_REVISION;
if(about.isHidden())
#if defined (Q_OS_ANDROID)
about.showMaximized();
......@@ -553,18 +527,6 @@ void MainWindow::on_actionExit_triggered()
qApp->quit();
}
void MainWindow::on_actionOpen_log_file_triggered()
{
int nRet = CLog::Instance()->OpneFile();
if(0 == nRet) return;
CDlgLog log(CLog::Instance()->GetSaveFile());
#if defined(Q_OS_ANDROID)
log.showMaximized();
#endif
log.exec();
}
void MainWindow::on_actionAiLibraries_triggered(QAction* a)
{
CFactoryFace::Instance()->SetLibType(a->data().toString(), false);
......@@ -593,7 +555,7 @@ int MainWindow::createDockPerameters()
m_Paramter = QSharedPointer<CFrmPara>(new CFrmPara(dock));
if(!m_Paramter)
{
LOG_MODEL_ERROR("MainWindow", "new CFrmPara fail");
qCritical(log) << "new CFrmPara fail";
return -1;
}
dock->setWidget(m_Paramter.data());
......
......@@ -39,18 +39,17 @@ private slots:
void on_actionDisplay_triggered();
void on_actionFile_triggered();
void on_actionExit_triggered();
void on_actionOpen_log_file_triggered();
void on_actionAiLibraries_triggered(QAction *action);
void on_actionStyle_triggered();
void slotParaDock_triggered(bool checked);
void slotScreenOrientationChanged(Qt::ScreenOrientation orientation);
void slotPlayError(QMediaPlayer::Error error);
private:
int CamerOrientation(int index);
int InitCamerOrientation();
int LoadStyle();
int LoadStyle(const QString &szFile);
int createDockPerameters();
int setModelPath(const QString &szPath);
......
......@@ -30,7 +30,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>22</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuOperate">
......@@ -81,8 +81,6 @@
<addaction name="menuRegister"/>
<addaction name="menuRecognizer"/>
<addaction name="separator"/>
<addaction name="actionOpen_log_file"/>
<addaction name="separator"/>
<addaction name="menuAI_libraries"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
......@@ -144,8 +142,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="Resource/Resource.qrc">
<normaloff>:/image/Start</normaloff>:/image/Start</iconset>
<iconset theme="media-playback-start"/>
</property>
<property name="text">
<string>Start</string>
......@@ -249,8 +246,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="Resource/Resource.qrc">
<normaloff>:/image/Video</normaloff>:/image/Video</iconset>
<iconset theme="camera-video"/>
</property>
<property name="text">
<string>Camera</string>
......@@ -381,8 +377,7 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="Resource/Resource.qrc">
<normaloff>:/image/Option</normaloff>:/image/Option</iconset>
<iconset theme="applications-system"/>
</property>
<property name="text">
<string>Options(&amp;O)</string>
......@@ -435,15 +430,6 @@
<string>Exit</string>
</property>
</action>
<action name="actionOpen_log_file">
<property name="icon">
<iconset resource="Resource/Resource.qrc">
<normaloff>:/image/Log</normaloff>:/image/Log</iconset>
</property>
<property name="text">
<string>Open log file</string>
</property>
</action>
<action name="actionKeep_display_aspect_ratio">
<property name="checkable">
<bool>true</bool>
......@@ -460,8 +446,8 @@
</action>
<action name="actionStyle">
<property name="icon">
<iconset resource="Resource/Resource.qrc">
<normaloff>:/image/Sink</normaloff>:/image/Sink</iconset>
<iconset theme="style">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Style</string>
......
......@@ -3,6 +3,7 @@
*/
#include "ManageRegisterVideo.h"
#include <stdexcept>
CManageRegisterVideo::CManageRegisterVideo(QWidget *parent) : QWidget(parent)
{
......
......@@ -4,7 +4,10 @@
#include "RecognizerThread.h"
#include "RecognizerVideo.h"
#include "Log.h"
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(log)
CRecognizerThread::CRecognizerThread(CManageRecognizerVideo *parent) : QThread()
{
......@@ -13,13 +16,12 @@ CRecognizerThread::CRecognizerThread(CManageRecognizerVideo *parent) : QThread()
CRecognizerThread::~CRecognizerThread()
{
LOG_MODEL_DEBUG("RecognizerThread", "CRecognizerThread::~CRecognizerThread");
qDebug(log) << "CRecognizerThread::~CRecognizerThread";
}
void CRecognizerThread::run()
{
LOG_MODEL_DEBUG("RecognizerThread", "CRecognizerThread::run():%d",
QThread::currentThreadId());
qDebug(log) << "CRecognizerThread::run():" << QThread::currentThreadId();
CRecognizerVideo recognizer;
bool check = connect(m_pManageRecognizerVideo, SIGNAL(sigRecognize(const QImage&, const QVector<CTracker::strFace> &)),
&recognizer, SLOT(slotRecognize(const QImage &, const QVector<CTracker::strFace> &)));
......
......@@ -3,11 +3,12 @@
*/
#include "RecognizerVideo.h"
#include "Log.h"
#include "Performance.h"
#include <QtDebug>
#include <QThread>
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(logVideo)
static int gIdQMapIntQString = qRegisterMetaType<QMap<int,QString> >();
CRecognizerVideo::CRecognizerVideo(QObject *parent) : QObject(parent)
......@@ -29,14 +30,14 @@ void CRecognizerVideo::slotRecognize(const QImage &image, const QVector<CTracker
"Mark points:" + QString::number(points.size()))
if(points.isEmpty())
{
LOG_MODEL_ERROR("CRecognizerVideo", "points is empty");
qCritical(logVideo) << "points is empty";
continue;
}
qint64 index = pFace->GetRecognizer()->Query(image, face.rect);
PERFORMANCE_ADD_TIME(CRecognizerVideo, "Query")
if(-1 == index)
{
LOG_MODEL_ERROR("CRecognizerVideo", "pid[%d] don't query", face.pid);
qCritical(logVideo) << "pid[" << face.pid << "] don't query";
continue;
}
CDataRegister data;
......
......@@ -13,7 +13,6 @@
<file alias="Exit">image/exit.png</file>
<file alias="Log">image/log.png</file>
<file alias="Delete">image/delete.png</file>
<file alias="Sink">image/skin.png</file>
<file alias="Option">image/option.png</file>
<file alias="Tools">image/Tools.png</file>
<file alias="Wait">image/wait.png</file>
......
QWidget
{
color: #00FF00;
background-color: #ff333333;
}
QWidget:disabled {
color: #B0B0B0;
/*background-color: #ffffffff;*/
}
QFrame{
color: #00FF00;
background-color: #ff333333;/*不能设置为transparent*/
}
QMainWindow::separator{
border: 1px solid #18ffffff;
border-style: outset;
width: 4px;
height: 4px;
}
QMainWindow::separator:hover{
background: #aa1f75cc;
}
QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid transparent;
background: darkgray;
padding: 0px;
}
QDockWidget::close-button:hover, QDockWidget::float-button:hover {
background: gray;
}
QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
padding: 1px -1px -1px 1px;
}
QTreeView
{
border: 1px solid #18ffffff;
}
QSplitter::handle{
border: 1px solid #18ffffff;
border-style: outset;
width: 4px;
height: 4px;
}
QSplitter::handle:hover{/*splitter->handle(1)->setAttribute(Qt::WA_Hover, true);才生效*/
border-color: #0000FF;
}
QSplitter::handle:pressed{
border-color: #aa1f75cc;
}
QAbstractScrollArea, QSciScintilla{
background-color: #ff333333;
}
/* 一定要记得,用qApp或者QApplication.instance的setStyle,
用self.setStyle会有很多地方不生效:Menu ToolTip等*/
/* =============================================== */
/* MenuBar Menu */
/* =============================================== */
QMenuBar {
background-color: #ff333333;
spacing: 1px;
border-bottom: 1px solid #18ffffff;
}
QMenuBar::item{
background: transparent;
padding: 1px 8px;
}
QMenuBar::item:selected{
background: #aa1f75cc;
border: 1px solid #aa1f75cc;
}
QMenuBar::item:pressed{
background: #aa1f75cc;
border: 1px solid #aa1f75cc;
padding-top: 4px; /*margin-bottom: -4px;*/
}
QMenu {
background-color: #ff333333;
border: 1px solid #18ffffff;
margin: 1px; /* some spacing around the menu */
padding: 1px;
}
QMenu::item{
padding: 2px 25px 2px 20px;
border: 1px solid transparent;
margin: 1px;
}
QMenu::icon {/*菜单的图标*/
width: 15px;
height: 15px;
padding:5px;
border-right: 1px inset #18ffffff;
}
QMenu::item:selected {
border-color: #18ffffff;
background: #aa1f75cc;
}
QMenu::separator {
height: 1px;
background: #18ffffff;
margin: 0 5px;
}
QMenu::indicator {/*checked 的√*/
width: 13px;
height: 13px;
padding:2px;
}
QMenu::icon:checked { /* appearance of a 'checked' icon */
background: #aa1f75cc;
border: 1px inset #aa1f75cc;
border-radius: 3px;
padding: 2px;
/*position: absolute;
top: 0px;
right: 1px;
bottom: 5px;
left: 2px;*/
}
/* =============================================== */
/* ToolBar StatusBar */
/* =============================================== */
QToolBar {
background: #ff333333;
spacing: 1px; /* spacing between items in the tool bar */
padding: 1px;
border-bottom: 1px solid #18ffffff;
}
QStatusBar{
background: transparent;
border-top:1px solid #18ffffff;
}
QStatusBar::item {
margin: 2px 0;
border-left: 1px solid #18ffffff;
}
QStatusBar QLabel{
background: transparent;
margin: 0 2px;
}
QStatusBar QPushButton{
background: transparent;
margin: 0 2px;
}
QStatusBar QPushButton:hover{
background: #aa1f75cc;
margin: 0 2px;
}
/* =============================================== */
/* Label */
/* =============================================== */
QLabel {
background: transparent;
border: 1px solid transparent;
padding: 1px;
}
/* A QLabel is a QFrame ... */
/* A QToolTip is a QLabel ... */
QToolTip {
border: 1px solid #18ffffff;
padding: 5px;
border-radius: 3px;
opacity:210;
}
/* =============================================== */
/* TextBox */
/* =============================================== */
QLineEdit {
background: #ff333333;/*不建议设为透明,否则table编辑时会字显示*/
selection-background-color: #aa1f75cc;
border: 1px solid #18ffffff;
border-radius: 2px;
border-style: inset;
padding: 0 1px;
}
QLineEdit:hover{
border-color: #aa1f75cc;
}
QLineEdit:focus{
border-color: #0000FF;
}
/*QLineEdit[readOnly="true"] { color: gray }*/
QLineEdit[echoMode="2"]{
lineedit-password-character: 9679;/*字符的ascii码35 88等 */
}
QLineEdit:read-only {
color: lightgray;
}
QLineEdit:disabled{
color: #B0B0B0;
background: #ffffffff;
}
QTextEdit{
selection-background-color:#aa1f75cc;
border: 1px solid #18ffffff;
border-style: inset;
}
QTextEdit:hover{
border-color: #aa1f75cc;
}
QTextEdit:focus{
border-color: #0000FF;
}
/* =============================================== */
/* Button */
/* =============================================== */
QPushButton {
border: 1px solid #18ffffff;
border-radius: 2px;
/*background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #999999, stop: 0.05 #888888,stop: 0.5 #888888,
stop: 0.9 #999999, stop: 1 #999999);*/
padding: 1px 4px;
min-width: 50px;
min-height: 16px;
}
QPushButton:hover{
background-color: #aa1f75cc;
border-color: #aa1f75cc;
}
QPushButton:pressed
{
border-width: 1px;
background-color: #aa1f75cc;
border-color: #18ffffff;
}
QPushButton:focus, QPushButton:default {
border-color: #0000FF; /* make the default button prominent */
}
QToolButton,QToolButton:unchecked { /* ToolBar里的按钮和带下拉菜单的按钮 */
border: 1px solid transparent;
border-radius: 3px;
background-color: transparent;
margin: 1px;
}
QToolButton:checked{
background-color: #aa1f75cc;
border-color: #aa1f75cc;
}
QToolButton:hover{
background-color: #aa1f75cc;
border-color: #aa1f75cc;
}
QToolButton:pressed,QToolButton:checked:hover{
background-color: #aa1f75cc;
border-color: #0000FF;
}
QToolButton:checked:pressed{
background-color: #aa1f75cc;
}
/* only for MenuButtonPopup */
QToolButton[popupMode="1"]{
padding-left: 1px;
padding-right: 15px; /* make way for the popup button */
border: 1px solid #18ffffff;
min-height: 15px;
/*background: qlineargradient(x1:0, y1:0 ,x2:0, y2:1
stop: 0 #999999, stop: 0.05 #888888, stop: 0.5 #888888
stop: 0.95 #999999 stop: 1#999999)*/
}
QToolButton[popupMode="1"]:hover{
background-color: #aa1f75cc;
border-color: #aa1f75cc;
}
QToolButton[popupMode="1"]:pressed{
border-width: 1px;
background-color: #aa1f75cc;
border-color: #18ffffff;
}
QToolButton::menu-button {
border: 1px solid #18ffffff;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
width: 16px;
}
/* =============================================== */
/* ComboBox */
/* =============================================== */
QComboBox{
border: 1px solid #18ffffff;
}
QComboBox:editable{
border-style: inset;
}
QComboBox:hover{
border-color: #aa1f75cc;
}
QComboBox:focus{
border-color: #0000FF;
}
QComboBox:on { /* shift the text when the popup opens */
padding-top: 2px;
padding-left: 2px;
}
QComboBox QAbstractItemView {
border: 1px solid #18ffffff;
selection-background-color: #aa1f75cc;
}
/*QComboBox QAbstractItemView::item {
height: 12px;需要设置comboBox.setView(QListView())否则会使用默认的item样式
}*/
/* =============================================== */
/* SpinBox DateTime */
/* =============================================== */
QSpinBox, QDoubleSpinBox,QDateEdit,QTimeEdit,QDateTimeEdit{
border: 1px solid #18ffffff;
border-style: inset;
}
QSpinBox:hover, QDoubleSpinBox:hover,QDateEdit:hover, QTimeEdit:hover,QDateTimeEdit:hover{
border-color: #aa1f75cc;
}
QSpinBox:focus, QDoubleSpinBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus{
border-color: #0000FF;
}
/* =============================================== */
/* Slider ProgressBar */
/* =============================================== */
QProgressBar {
border: 1px solid #18ffffff;
border-radius: 4px;
text-align: center;
}
QProgressBar::chunk {
background-color: #0000FF;
width: 4px;
margin: 1px;
}
QSlider{
border: 1px solid transparent;
}
QSlider::groove{
border: 1px solid #18ffffff;
background: #ff333333;
}
QSlider::handle {/*设置中间的那个滑动的键*/
border: 1px solid #18ffffff;
background: #aa1f75cc;
}
QSlider::groove:horizontal {
height: 3px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
left:5px; right: 5px;
}
QSlider::groove:vertical{
width: 3px;
top: 5px; bottom: 5px;
}
QSlider::handle:horizontal{
width: 6px;
margin: -7px; /* height */
}
QSlider::handle:vertical{
height: 6px;
margin: -7px; /* height */
}
QSlider::add-page{/*还没有滑上去的地方*/
border: 1px solid #18ffffff;
background:#999999;
}
QSlider::sub-page{/*已经划过的从地方*/
background: #0000FF;
}
/* =============================================== */
/* ScrollBar */
/* =============================================== */
QScrollBar{
background-color: #ff333333;
border: 1px solid #18ffffff;
border-radius: 5px;
padding: 1px;
height: 10px;
width: 10px;
}
QScrollBar:hover{
border-color:#aa1f75cc;
}
QScrollBar::handle{
border-radius: 3px;
background: #aa1f75cc;
min-width: 16px;
min-height: 16px;
}
QScrollBar::handle:hover {
background: #0000FF;
}
QScrollBar::add-line, QScrollBar::sub-line,
QScrollBar::add-page, QScrollBar::sub-page {
width: 0px;
background: transparent;
}
QScrollArea{
border: none;
}
/*QScrollArea QAbstractSlider{
border-radius: 0px;
}*/
/* =============================================== */
/* DockWidget */
/* =============================================== */
QDockWidget, QDockWidget > QWidget/*not work*/
{
border-color: #18ffffff;/*qt bug*/
background: transparent;
}
QDockWidget::title {
border-bottom: 1px solid #18ffffff;
border-style: inset;
text-align: left; /* align the text to the left */
padding: 6px;
}
/* =============================================== */
/* GroupBox */
/* =============================================== */
QGroupBox {
background-color: #ff333333;
border: 1px solid #18ffffff;
border-radius: 4px;
margin-top: 0.5em;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
left: 1em;
background-color: #ff333333;
}
/* =============================================== */
/* ToolBox */
/* =============================================== */
QToolBox{
border: 1px solid #18ffffff;
}
QToolBox::tab {
background: #999999;
border: 1px solid #18ffffff;
border-radius: 1px;
}
QToolBox::tab:hover {
background-color: #aa1f75cc;
border-color: transparent;
}
QToolBox::tab:pressed {
background-color: #aa1f75cc;
border-color: transparent;
}
QToolBox::tab:selected {
font-weight: bold;
border-color: #aa1f75cc;
}
/* =============================================== */
/* TabWidget */
/* =============================================== */
QTabWidget{
margin-top:10px;
}
QTabWidget::pane{
border: 1px solid #18ffffff;
}
QTabWidget::tab-bar {
left: 0px;
}
QTabBar::tab {
background: #ff333333;
border: 1px solid #18ffffff;
padding: 3px 5px;
}
QTabBar::tab:hover {
background: #aa1f75cc;
border-color: transparent;
}
QTabBar::tab:selected {
background: #aa1f75cc;
border-color: #aa1f75cc;
}
QTabBar::tab:pressed {
background: #aa1f75cc;
border-color: transparent;
}
QTabBar::tab:focus {
border-color: #0000FF;
}
QTabBar::tab:top{
margin-top: 3px;
border-bottom: transparent;
margin-right: 1px;
}
QTabBar::tab:bottom{
margin-bottom: 3px;
border-top: transparent;
margin-right: 1px;
}
QTabBar::tab:left{
border-right: transparent;
margin-bottom: 1px;
}
QTabBar::tab:right{
border-left: transparent;
margin-bottom: 1px;
}
/* =============================================== */
/* QHeaderView for list table */
/* =============================================== */
QHeaderView {
border: none;
margin: 0px;
padding: 0px;
}
QHeaderView::section, QTableCornerButton::section {/*设置表头属性*//*左上角*/
background-color: #999999;
padding: 0 3px;
border-right: 1px solid #18ffffff;
border-bottom: 1px solid #18ffffff;
border-radius: 0px;
}
QHeaderView::section:hover, QTableCornerButton::section:hover{
background-color: #aa1f75cc;
}
QHeaderView::section:pressed{
background-color: #aa1f75cc;
}
QHeaderView::section:checked {
background-color: #0000FF;
}
/* =============================================== */
/* QTableWidget */
/* =============================================== */
QTableWidget, QTableView
{
gridline-color: #18ffffff; /*表格中的网格线条颜色*/
background: #ff333333;
/*设置交替颜色,需要在函数属性中设置:tableWidget->setAlternatingRowColors(true)*/
alternate-background-color: #999999;
/*selection-color:#ff333333; 鼠标选中时前景色:文字颜色*/
selection-background-color:#aa1f75cc; /*鼠标选中时背景色*/
border:1px solid #18ffffff; /*边框线的宽度、颜色*/
/*border:none; 去除边界线*/
/*border-radius:5px;*/
/*padding:10px 10px;*/ /*表格与边框的间距*/
}
QTableView::item, QTabWidget::item{
background: transparent;
outline-style: none;
border: none;
}
QTableView::item:hover {
background: #aa1f75cc;
border: 1px solid #0000FF;
}
QTableView::item:selected {
background: #aa1f75cc;
color: #999999;
}
QTableView::item:selected:active {
background: #aa1f75cc;
color: #999999;
}
QTableWidget QComboBox{
margin: 2px;
border: none;
}
QWidget
{
color: #CCCCCC;
background-color: #DC333333;
}
QFrame{
color: #CCCCCC;
background-color: #DC333333;/*不能设置为transparent*/
}
QMainWindow::separator{
border: 1px solid #666666;
border-style: outset;
width: 4px;
height: 4px;
}
QMainWindow::separator:hover{
background: #66AAEE;
}
QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid transparent;
background: darkgray;
padding: 0px;
}
QDockWidget::close-button:hover, QDockWidget::float-button:hover {
background: gray;
}
QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
padding: 1px -1px -1px 1px;
}
QSplitter::handle{
border: 1px solid #666666;
border-style: outset;
width: 4px;
height: 4px;
}
QSplitter::handle:hover{/*splitter->handle(1)->setAttribute(Qt::WA_Hover, true);才生效*/
border-color: #DC88BBFF;
}
QSplitter::handle:pressed{
border-color: #DCDD9922;
}
QAbstractScrollArea, QSciScintilla{
background-color: #DC333333;
}
/* 一定要记得,用qApp或者QApplication.instance的setStyle,
用self.setStyle会有很多地方不生效:Menu ToolTip等*/
/* =============================================== */
/* MenuBar Menu */
/* =============================================== */
QMenuBar {
background-color: #DC333333;
spacing: 1px;
border-bottom: 1px solid #666666;
}
QMenuBar::item{
background: transparent;
padding: 1px 8px;
}
QMenuBar::item:selected{
background: #66AAEE;
border: 1px solid #66AAEE;
}
QMenuBar::item:pressed{
background: #DCDD9922;
border: 1px solid #DCDD9922;
padding-top: 4px; /*margin-bottom: -4px;*/
}
QMenu {
background-color: #DC333333;
border: 1px solid #666666;
margin: 1px; /* some spacing around the menu */
padding: 1px;
}
QMenu::item{
padding: 2px 25px 2px 20px;
border: 1px solid transparent;
margin: 1px;
}
QMenu::icon {/*菜单的图标*/
width: 15px;
height: 15px;
padding:5px;
border-right: 1px inset #666666;
}
QMenu::item:selected {
border-color: #666666;
background: #66AAEE;
}
QMenu::separator {
height: 1px;
background: #666666;
margin: 0 5px;
}
QMenu::indicator {/*checked 的√*/
width: 13px;
height: 13px;
padding:2px;
}
QMenu::icon:checked { /* appearance of a 'checked' icon */
background: #66AAEE;
border: 1px inset #DCDD9922;
border-radius: 3px;
padding: 2px;
/*position: absolute;
top: 0px;
right: 1px;
bottom: 5px;
left: 2px;*/
}
/* =============================================== */
/* ToolBar StatusBar */
/* =============================================== */
QToolBar {
background: #DC333333;
spacing: 1px; /* spacing between items in the tool bar */
padding: 1px;
border-bottom: 1px solid #666666;
}
QStatusBar{
background: transparent;
border-top:1px solid #666666;
}
QStatusBar::item {
margin: 2px 0;
border-left: 1px solid #666666;
}
QStatusBar QLabel{
background: transparent;
margin: 0 2px;
}
QStatusBar QPushButton{
background: transparent;
margin: 0 2px;
}
QStatusBar QPushButton:hover{
background: #66AAEE;
margin: 0 2px;
}
/* =============================================== */
/* Label */
/* =============================================== */
QLabel {
background: transparent;
border: 1px solid transparent;
padding: 1px;
}
/* A QLabel is a QFrame ... */
/* A QToolTip is a QLabel ... */
QToolTip {
border: 1px solid #666666;
padding: 5px;
border-radius: 3px;
opacity:210;
}
/* =============================================== */
/* TextBox */
/* =============================================== */
QLineEdit {
background: #DC333333;/*不建议设为透明,否则table编辑时会字显示*/
selection-background-color: #66AAEE;
border: 1px solid #666666;
border-radius: 2px;
border-style: inset;
padding: 0 1px;
}
QLineEdit:hover{
border-color: #66AAEE;
}
QLineEdit:focus{
border-color: #DC88BBFF;
}
/*QLineEdit[readOnly="true"] { color: gray }*/
QLineEdit[echoMode="2"]{
lineedit-password-character: 9679;/*字符的ascii码35 88等 */
}
QLineEdit:read-only {
color: lightgray;
}
QLineEdit:disabled{
color: lightgray;
background: lightgray;
}
QTextEdit{
selection-background-color:#66AAEE;
border: 1px solid #666666;
border-style: inset;
}
QTextEdit:hover{
border-color: #66AAEE;
}
QTextEdit:focus{
border-color: #DC88BBFF;
}
/* =============================================== */
/* Button */
/* =============================================== */
QPushButton {
border: 1px solid #666666;
border-radius: 2px;
/*background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #999999, stop: 0.05 #888888,stop: 0.5 #888888,
stop: 0.9 #999999, stop: 1 #999999);*/
padding: 1px 4px;
min-width: 50px;
min-height: 16px;
}
QPushButton:hover{
background-color: #66AAEE;
border-color: #DCDD9922;
}
QPushButton:pressed
{
border-width: 1px;
background-color: #DCDD9922;
border-color: #666666;
}
QPushButton:focus, QPushButton:default {
border-color: #DC88BBFF; /* make the default button prominent */
}
QToolButton,QToolButton:unchecked { /* ToolBar里的按钮和带下拉菜单的按钮 */
border: 1px solid transparent;
border-radius: 3px;
background-color: transparent;
margin: 1px;
}
QToolButton:checked{
background-color: #66AAEE;
border-color: #DCDD9922;
}
QToolButton:hover{
background-color: #66AAEE;
border-color: #DCDD9922;
}
QToolButton:pressed,QToolButton:checked:hover{
background-color: #DCDD9922;
border-color: #DC88BBFF;
}
QToolButton:checked:pressed{
background-color: #66AAEE;
}
/* only for MenuButtonPopup */
QToolButton[popupMode="1"]{
padding-left: 1px;
padding-right: 15px; /* make way for the popup button */
border: 1px solid #666666;
min-height: 15px;
/*background: qlineargradient(x1:0, y1:0 ,x2:0, y2:1
stop: 0 #999999, stop: 0.05 #888888, stop: 0.5 #888888
stop: 0.95 #999999 stop: 1#999999)*/
}
QToolButton[popupMode="1"]:hover{
background-color: #66AAEE;
border-color: #DCDD9922;
}
QToolButton[popupMode="1"]:pressed{
border-width: 1px;
background-color: #DCDD9922;
border-color: #666666;
}
QToolButton::menu-button {
border: 1px solid #666666;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
width: 16px;
}
/* =============================================== */
/* ComboBox */
/* =============================================== */
QComboBox{
border: 1px solid #666666;
}
QComboBox:editable{
border-style: inset;
}
QComboBox:hover{
border-color: #66AAEE;
}
QComboBox:focus{
border-color: #DC88BBFF;
}
QComboBox:on { /* shift the text when the popup opens */
padding-top: 2px;
padding-left: 2px;
}
QComboBox QAbstractItemView {
border: 1px solid #666666;
selection-background-color: #66AAEE;
}
/*QComboBox QAbstractItemView::item {
height: 12px;需要设置comboBox.setView(QListView())否则会使用默认的item样式
}*/
/* =============================================== */
/* SpinBox DateTime */
/* =============================================== */
QSpinBox, QDoubleSpinBox,QDateEdit,QTimeEdit,QDateTimeEdit{
border: 1px solid #666666;
border-style: inset;
}
QSpinBox:hover, QDoubleSpinBox:hover,QDateEdit:hover, QTimeEdit:hover,QDateTimeEdit:hover{
border-color: #66AAEE;
}
QSpinBox:focus, QDoubleSpinBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus{
border-color: #DC88BBFF;
}
/* =============================================== */
/* Slider ProgressBar */
/* =============================================== */
QProgressBar {
border: 1px solid #666666;
border-radius: 4px;
text-align: center;
}
QProgressBar::chunk {
background-color: #DC88BBFF;
width: 4px;
margin: 1px;
}
QSlider{
border: 1px solid transparent;
}
QSlider::groove{
border: 1px solid #666666;
background: #DC333333;
}
QSlider::handle {/*设置中间的那个滑动的键*/
border: 1px solid #666666;
background: #66AAEE;
}
QSlider::groove:horizontal {
height: 3px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
left:5px; right: 5px;
}
QSlider::groove:vertical{
width: 3px;
top: 5px; bottom: 5px;
}
QSlider::handle:horizontal{
width: 6px;
margin: -7px; /* height */
}
QSlider::handle:vertical{
height: 6px;
margin: -7px; /* height */
}
QSlider::add-page{/*还没有滑上去的地方*/
border: 1px solid #666666;
background:#999999;
}
QSlider::sub-page{/*已经划过的从地方*/
background: #DC88BBFF;
}
/* =============================================== */
/* ScrollBar */
/* =============================================== */
QScrollBar{
background-color: #DC333333;
border: 1px solid #666666;
border-radius: 5px;
padding: 1px;
height: 10px;
width: 10px;
}
QScrollBar:hover{
border-color:#66AAEE;
}
QScrollBar::handle{
border-radius: 3px;
background: #DCDD9922;
min-width: 16px;
min-height: 16px;
}
QScrollBar::handle:hover {
background: #DC88BBFF;
}
QScrollBar::add-line, QScrollBar::sub-line,
QScrollBar::add-page, QScrollBar::sub-page {
width: 0px;
background: transparent;
}
QScrollArea{
border: none;
}
/*QScrollArea QAbstractSlider{
border-radius: 0px;
}*/
/* =============================================== */
/* DockWidget */
/* =============================================== */
QDockWidget, QDockWidget > QWidget/*not work*/
{
border-color: #666666;/*qt bug*/
background: transparent;
}
QDockWidget::title {
border-bottom: 1px solid #666666;
border-style: inset;
text-align: left; /* align the text to the left */
padding: 6px;
}
/* =============================================== */
/* GroupBox */
/* =============================================== */
QGroupBox {
background-color: #DC333333;
border: 1px solid #666666;
border-radius: 4px;
margin-top: 0.5em;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
left: 1em;
background-color: #DC333333;
}
/* =============================================== */
/* ToolBox */
/* =============================================== */
QToolBox{
border: 1px solid #666666;
}
QToolBox::tab {
background: #999999;
border: 1px solid #666666;
border-radius: 1px;
}
QToolBox::tab:hover {
background-color: #66AAEE;
border-color: transparent;
}
QToolBox::tab:pressed {
background-color: #DCDD9922;
border-color: transparent;
}
QToolBox::tab:selected {
font-weight: bold;
border-color: #66AAEE;
}
/* =============================================== */
/* TabWidget */
/* =============================================== */
QTabWidget{
margin-top:10px;
}
QTabWidget::pane{
border: 1px solid #666666;
}
QTabWidget::tab-bar {
left: 0px;
}
QTabBar::tab {
background: #DC333333;
border: 1px solid #666666;
padding: 3px 5px;
}
QTabBar::tab:hover {
background: #66AAEE;
border-color: transparent;
}
QTabBar::tab:selected {
background: #66AAEE;
border-color: #DCDD9922;
}
QTabBar::tab:pressed {
background: #DCDD9922;
border-color: transparent;
}
QTabBar::tab:focus {
border-color: #DC88BBFF;
}
QTabBar::tab:top{
margin-top: 3px;
border-bottom: transparent;
margin-right: 1px;
}
QTabBar::tab:bottom{
margin-bottom: 3px;
border-top: transparent;
margin-right: 1px;
}
QTabBar::tab:left{
border-right: transparent;
margin-bottom: 1px;
}
QTabBar::tab:right{
border-left: transparent;
margin-bottom: 1px;
}
/* =============================================== */
/* QHeaderView for list table */
/* =============================================== */
QHeaderView {
border: none;
margin: 0px;
padding: 0px;
}
QHeaderView::section, QTableCornerButton::section {/*设置表头属性*//*左上角*/
background-color: #999999;
padding: 0 3px;
border-right: 1px solid #666666;
border-bottom: 1px solid #666666;
border-radius: 0px;
}
QHeaderView::section:hover, QTableCornerButton::section:hover{
background-color: #66AAEE;
}
QHeaderView::section:pressed{
background-color: #DCDD9922;
}
QHeaderView::section:checked {
background-color: #DC88BBFF;
}
/* =============================================== */
/* QTableWidget */
/* =============================================== */
QTableWidget, QTableView
{
gridline-color: #666666; /*表格中的网格线条颜色*/
background: #DC333333;
/*设置交替颜色,需要在函数属性中设置:tableWidget->setAlternatingRowColors(true)*/
alternate-background-color: #999999;
/*selection-color:#DC333333; 鼠标选中时前景色:文字颜色*/
selection-background-color:#66AAEE; /*鼠标选中时背景色*/
border:1px solid #666666; /*边框线的宽度、颜色*/
/*border:none; 去除边界线*/
/*border-radius:5px;*/
/*padding:10px 10px;*/ /*表格与边框的间距*/
}
QTableView::item, QTabWidget::item{
background: transparent;
outline-style: none;
border: none;
}
QTableView::item:hover {
background: #66AAEE;
border: 1px solid #DC88BBFF;
}
QTableView::item:selected {
background: #66AAEE;
color: #999999;
}
QTableView::item:selected:active {
background: #DCDD9922;
color: #999999;
}
QTableWidget QComboBox{
margin: 2px;
border: none;
}
$text = #00FF00;
$tx_disable = #B0B0B0;
$background = #ff333333;
$back_disabled = #ffffffff;
$border = #18ffffff;
$selected = #aa1f75cc; /*hover*/
$pressed = #aa1f75cc;
$focused = #0000FF; /*actived*/
$grad1a = #999999; /*gradient start*/
$grad1b = #888888; /*gradient end*/
QWidget
{
color: $text;
background-color: $background;
}
QWidget:disabled {
color: $tx_disable;
/*background-color: $back_disabled;*/
}
QFrame{
color: $text;
background-color: $background;/*不能设置为transparent*/
}
QMainWindow::separator{
border: 1px solid $border;
border-style: outset;
width: 4px;
height: 4px;
}
QMainWindow::separator:hover{
background: $selected;
}
QSplitter::handle{
border: 1px solid $border;
border-style: outset;
width: 4px;
height: 4px;
}
QSplitter::handle:hover{/*splitter->handle(1)->setAttribute(Qt::WA_Hover, true);才生效*/
border-color: $focused;
}
QSplitter::handle:pressed{
border-color: $pressed;
}
QAbstractScrollArea, QSciScintilla{
background-color: $background;
}
/* 一定要记得,用qApp或者QApplication.instance的setStyle,
用self.setStyle会有很多地方不生效:Menu ToolTip等*/
/* =============================================== */
/* MenuBar Menu */
/* =============================================== */
QMenuBar {
background-color: $background;
spacing: 1px;
border-bottom: 1px solid $border;
}
QMenuBar::item{
background: transparent;
padding: 1px 8px;
}
QMenuBar::item:selected{
background: $selected;
border: 1px solid $selected;
}
QMenuBar::item:pressed{
background: $pressed;
border: 1px solid $pressed;
padding-top: 4px; /*margin-bottom: -4px;*/
}
QMenu {
background-color: $background;
border: 1px solid $border;
margin: 1px; /* some spacing around the menu */
padding: 1px;
}
QMenu::item{
padding: 2px 25px 2px 20px;
border: 1px solid transparent;
margin: 1px;
}
QMenu::icon {/*菜单的图标*/
width: 15px;
height: 15px;
padding:5px;
border-right: 1px inset $border;
}
QMenu::item:selected {
border-color: $border;
background: $selected;
}
QMenu::separator {
height: 1px;
background: $border;
margin: 0 5px;
}
QMenu::indicator {/*checked 的√*/
width: 13px;
height: 13px;
padding:2px;
}
QMenu::icon:checked { /* appearance of a 'checked' icon */
background: $selected;
border: 1px inset $pressed;
border-radius: 3px;
padding: 2px;
/*position: absolute;
top: 0px;
right: 1px;
bottom: 5px;
left: 2px;*/
}
/* =============================================== */
/* ToolBar StatusBar */
/* =============================================== */
QToolBar {
background: $background;
spacing: 1px; /* spacing between items in the tool bar */
padding: 1px;
border-bottom: 1px solid $border;
}
QStatusBar{
background: transparent;
border-top:1px solid $border;
}
QStatusBar::item {
margin: 2px 0;
border-left: 1px solid $border;
}
QStatusBar QLabel{
background: transparent;
margin: 0 2px;
}
QStatusBar QPushButton{
background: transparent;
margin: 0 2px;
}
QStatusBar QPushButton:hover{
background: $selected;
margin: 0 2px;
}
/* =============================================== */
/* Label */
/* =============================================== */
QLabel {
background: transparent;
border: 1px solid transparent;
padding: 1px;
}
/* A QLabel is a QFrame ... */
/* A QToolTip is a QLabel ... */
QToolTip {
border: 1px solid $border;
padding: 5px;
border-radius: 3px;
opacity:210;
}
/* =============================================== */
/* TextBox */
/* =============================================== */
QLineEdit {
background: $background;/*不建议设为透明,否则table编辑时会字显示*/
selection-background-color: $selected;
border: 1px solid $border;
border-radius: 2px;
border-style: inset;
padding: 0 1px;
}
QLineEdit:hover{
border-color: $selected;
}
QLineEdit:focus{
border-color: $focused;
}
/*QLineEdit[readOnly="true"] { color: gray }*/
QLineEdit[echoMode="2"]{
lineedit-password-character: 9679;/*字符的ascii码35 88等 */
}
QLineEdit:read-only {
color: lightgray;
}
QLineEdit:disabled{
color: $tx_disable;
background: $back_disabled;
}
QTextEdit{
selection-background-color:$selected;
border: 1px solid $border;
border-style: inset;
}
QTextEdit:hover{
border-color: $selected;
}
QTextEdit:focus{
border-color: $focused;
}
/* =============================================== */
/* Button */
/* =============================================== */
QPushButton {
border: 1px solid $border;
border-radius: 2px;
/*background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 $grad1a, stop: 0.05 $grad1b,stop: 0.5 $grad1b,
stop: 0.9 $grad1a, stop: 1 $grad1a);*/
padding: 1px 4px;
min-width: 50px;
min-height: 16px;
}
QPushButton:hover{
background-color: $selected;
border-color: $pressed;
}
QPushButton:pressed
{
border-width: 1px;
background-color: $pressed;
border-color: $border;
}
QPushButton:focus, QPushButton:default {
border-color: $focused; /* make the default button prominent */
}
QToolButton,QToolButton:unchecked { /* ToolBar里的按钮和带下拉菜单的按钮 */
border: 1px solid transparent;
border-radius: 3px;
background-color: transparent;
margin: 1px;
}
QToolButton:checked{
background-color: $selected;
border-color: $pressed;
}
QToolButton:hover{
background-color: $selected;
border-color: $pressed;
}
QToolButton:pressed,QToolButton:checked:hover{
background-color: $pressed;
border-color: $focused;
}
QToolButton:checked:pressed{
background-color: $selected;
}
/* only for MenuButtonPopup */
QToolButton[popupMode="1"]{
padding-left: 1px;
padding-right: 15px; /* make way for the popup button */
border: 1px solid $border;
min-height: 15px;
/*background: qlineargradient(x1:0, y1:0 ,x2:0, y2:1
stop: 0 $grad1a, stop: 0.05 $grad1b, stop: 0.5 $grad1b
stop: 0.95 $grad1a stop: 1$grad1a)*/
}
QToolButton[popupMode="1"]:hover{
background-color: $selected;
border-color: $pressed;
}
QToolButton[popupMode="1"]:pressed{
border-width: 1px;
background-color: $pressed;
border-color: $border;
}
QToolButton::menu-button {
border: 1px solid $border;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
width: 16px;
}
/* =============================================== */
/* ComboBox */
/* =============================================== */
QComboBox{
border: 1px solid $border;
}
QComboBox:editable{
border-style: inset;
}
QComboBox:hover{
border-color: $selected;
}
QComboBox:focus{
border-color: $focused;
}
QComboBox:on { /* shift the text when the popup opens */
padding-top: 2px;
padding-left: 2px;
}
QComboBox QAbstractItemView {
border: 1px solid $border;
selection-background-color: $selected;
}
/*QComboBox QAbstractItemView::item {
height: 12px;需要设置comboBox.setView(QListView())否则会使用默认的item样式
}*/
/* =============================================== */
/* SpinBox DateTime */
/* =============================================== */
QSpinBox, QDoubleSpinBox,QDateEdit,QTimeEdit,QDateTimeEdit{
border: 1px solid $border;
border-style: inset;
}
QSpinBox:hover, QDoubleSpinBox:hover,QDateEdit:hover, QTimeEdit:hover,QDateTimeEdit:hover{
border-color: $selected;
}
QSpinBox:focus, QDoubleSpinBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus{
border-color: $focused;
}
/* =============================================== */
/* Slider ProgressBar */
/* =============================================== */
QProgressBar {
border: 1px solid $border;
border-radius: 4px;
text-align: center;
}
QProgressBar::chunk {
background-color: $focused;
width: 4px;
margin: 1px;
}
QSlider{
border: 1px solid transparent;
}
QSlider::groove{
border: 1px solid $border;
background: $background;
}
QSlider::handle {/*设置中间的那个滑动的键*/
border: 1px solid $border;
background: $selected;
}
QSlider::groove:horizontal {
height: 3px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
left:5px; right: 5px;
}
QSlider::groove:vertical{
width: 3px;
top: 5px; bottom: 5px;
}
QSlider::handle:horizontal{
width: 6px;
margin: -7px; /* height */
}
QSlider::handle:vertical{
height: 6px;
margin: -7px; /* height */
}
QSlider::add-page{/*还没有滑上去的地方*/
border: 1px solid $border;
background:$grad1a;
}
QSlider::sub-page{/*已经划过的从地方*/
background: $focused;
}
/* =============================================== */
/* ScrollBar */
/* =============================================== */
QScrollBar{
background-color: $background;
border: 1px solid $border;
border-radius: 5px;
padding: 1px;
height: 10px;
width: 10px;
}
QScrollBar:hover{
border-color:$selected;
}
QScrollBar::handle{
border-radius: 3px;
background: $pressed;
min-width: 16px;
min-height: 16px;
}
QScrollBar::handle:hover {
background: $focused;
}
QScrollBar::add-line, QScrollBar::sub-line,
QScrollBar::add-page, QScrollBar::sub-page {
width: 0px;
background: transparent;
}
QScrollArea{
border: none;
}
/*QScrollArea QAbstractSlider{
border-radius: 0px;
}*/
/* =============================================== */
/* DockWidget */
/* =============================================== */
QDockWidget, QDockWidget > QWidget/*not work*/
{
border-color: $border;/*qt bug*/
background: transparent;
}
QDockWidget::title {
border-bottom: 1px solid $border;
border-style: inset;
text-align: left; /* align the text to the left */
padding: 6px;
}
/* =============================================== */
/* GroupBox */
/* =============================================== */
QGroupBox {
background-color: $background;
border: 1px solid $border;
border-radius: 4px;
margin-top: 0.5em;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
left: 1em;
background-color: $background;
}
/* =============================================== */
/* ToolBox */
/* =============================================== */
QToolBox{
border: 1px solid $border;
}
QToolBox::tab {
background: $grad1a;
border: 1px solid $border;
border-radius: 1px;
}
QToolBox::tab:hover {
background-color: $selected;
border-color: transparent;
}
QToolBox::tab:pressed {
background-color: $pressed;
border-color: transparent;
}
QToolBox::tab:selected {
font-weight: bold;
border-color: $selected;
}
/* =============================================== */
/* TabWidget */
/* =============================================== */
QTabWidget{
margin-top:10px;
}
QTabWidget::pane{
border: 1px solid $border;
}
QTabWidget::tab-bar {
left: 0px;
}
QTabBar::tab {
background: $background;
border: 1px solid $border;
padding: 3px 5px;
}
QTabBar::tab:hover {
background: $selected;
border-color: transparent;
}
QTabBar::tab:selected {
background: $selected;
border-color: $pressed;
}
QTabBar::tab:pressed {
background: $pressed;
border-color: transparent;
}
QTabBar::tab:focus {
border-color: $focused;
}
QTabBar::tab:top{
margin-top: 3px;
border-bottom: transparent;
margin-right: 1px;
}
QTabBar::tab:bottom{
margin-bottom: 3px;
border-top: transparent;
margin-right: 1px;
}
QTabBar::tab:left{
border-right: transparent;
margin-bottom: 1px;
}
QTabBar::tab:right{
border-left: transparent;
margin-bottom: 1px;
}
/* =============================================== */
/* QHeaderView for list table */
/* =============================================== */
QHeaderView {
border: none;
margin: 0px;
padding: 0px;
}
QHeaderView::section, QTableCornerButton::section {/*设置表头属性*//*左上角*/
background-color: $grad1a;
padding: 0 3px;
border-right: 1px solid $border;
border-bottom: 1px solid $border;
border-radius: 0px;
}
QHeaderView::section:hover, QTableCornerButton::section:hover{
background-color: $selected;
}
QHeaderView::section:pressed{
background-color: $pressed;
}
QHeaderView::section:checked {
background-color: $focused;
}
/* =============================================== */
/* QTableWidget */
/* =============================================== */
QTableWidget, QTableView
{
gridline-color: $border; /*表格中的网格线条颜色*/
background: $background;
/*设置交替颜色,需要在函数属性中设置:tableWidget->setAlternatingRowColors(true)*/
alternate-background-color: $grad1a;
/*selection-color:$background; 鼠标选中时前景色:文字颜色*/
selection-background-color:$selected; /*鼠标选中时背景色*/
border:1px solid $border; /*边框线的宽度、颜色*/
/*border:none; 去除边界线*/
/*border-radius:5px;*/
/*padding:10px 10px;*/ /*表格与边框的间距*/
}
QTableView::item, QTabWidget::item{
background: transparent;
outline-style: none;
border: none;
}
QTableView::item:hover {
background: $selected;
border: 1px solid $focused;
}
QTableView::item:selected {
background: $selected;
color: $grad1a;
}
QTableView::item:selected:active {
background: $pressed;
color: $grad1a;
}
QTableWidget QComboBox{
margin: 2px;
border: none;
}
/*hover*/
/*actived*/
/*gradient start*/
/*gradient end*/
QWidget
{
color: #222;
background-color: #FFFFFF;
}
QFrame{
color: #222;
background-color: #FFFFFF;/*不能设置为transparent*/
}
QMainWindow::separator{
border: 1px solid #999999;
border-style: outset;
width: 4px;
height: 4px;
}
QMainWindow::separator:hover{
background: #8BF;
}
QSplitter::handle{
border: 1px solid #999999;
border-style: outset;
width: 4px;
height: 4px;
}
QSplitter::handle:hover{/*splitter->handle(1)->setAttribute(Qt::WA_Hover, true);才生效*/
border-color: #EA2;
}
QSplitter::handle:pressed{
border-color: #59F;
}
QSizeGrip{
background-color: none;
}
/* 一定要记得,用qApp或者QApplication.instance的setStyle,
用self.setStyle会有很多地方不生效:Menu ToolTip等*/
/* =============================================== */
/* MenuBar Menu */
/* =============================================== */
QMenuBar {
background-color: #FFFFFF;
spacing: 1px;
border-bottom: 1px solid #999999;
}
QMenuBar::item{
background: transparent;
padding: 1px 8px;
}
QMenuBar::item:selected{
background: #8BF;
border: 1px solid #8BF;
}
QMenuBar::item:pressed{
background: #59F;
border: 1px solid #59F;
padding-top: 4px; /*margin-bottom: -4px;*/
}
QMenu {
background-color: #FFFFFF;
border: 1px solid #999999;
margin: 1px; /* some spacing around the menu */
padding: 1px;
}
QMenu::item{
padding: 2px 25px 2px 15px;
border: 1px solid transparent;
margin: 1px;
}
QMenu::icon {/*菜单的图标*/
width: 15px;
height: 15px;
padding:5px;
border-right: 1px inset #999999;
}
QMenu::item:selected {
border-color: #999999;
background: #8BF;
}
QMenu::separator {
height: 1px;
background: #999999;
margin: 0 5px;
}
QMenu::indicator {/*checked 的√*/
width: 13px;
height: 13px;
padding:2px;
}
QMenu::icon:checked { /* appearance of a 'checked' icon */
background: #8BF;
border: 1px inset #59F;
border-radius: 3px;
padding: 2px;
/*position: absolute;
top: 0px;
right: 1px;
bottom: 5px;
left: 2px;*/
}
/* =============================================== */
/* ToolBar StatusBar */
/* =============================================== */
QToolBar {
background: #FFFFFF;
spacing: 1px; /* spacing between items in the tool bar */
padding: 1px;
border-bottom: 1px solid #999999;
}
QStatusBar{
background: transparent;
border-top:1px solid #999999;
}
QStatusBar::item {
margin: 2px 0;
border-left: 1px solid #999999;
}
QStatusBar QLabel{
background: transparent;
margin: 0 2px;
}
QStatusBar QPushButton{
background: transparent;
margin: 0 2px;
}
QStatusBar QPushButton:hover{
background: #8BF;
margin: 0 2px;
}
/* =============================================== */
/* Label */
/* =============================================== */
QLabel {
background: transparent;
border: 1px solid transparent;
padding: 1px;
}
/* A QLabel is a QFrame ... */
/* A QToolTip is a QLabel ... */
QToolTip {
border: 1px solid #999999;
padding: 5px;
border-radius: 3px;
opacity:210;
}
/* =============================================== */
/* TextBox */
/* =============================================== */
QLineEdit {
background: #FFFFFF;/*不建议设为透明,否则table编辑时会字显示*/
selection-background-color: #8BF;
border: 1px solid #999999;
border-radius: 2px;
border-style: inset;
padding: 0 1px;
}
QLineEdit:hover{
border-color: #8BF;
}
QLineEdit:focus{
border-color: #EA2;
}
/*QLineEdit[readOnly="true"] { color: gray }*/
QLineEdit[echoMode="2"]{
lineedit-password-character: 9679;/*字符的ascii码35 88等 */
}
QLineEdit:read-only {
color: lightgray;
}
QLineEdit:disabled{
color: lightgray;
background: lightgray;
}
QTextEdit{
selection-background-color:#8BF;
border: 1px solid #999999;
border-style: inset;
}
QTextEdit:hover{
border-color: #8BF;
}
QTextEdit:focus{
border-color: #EA2;
}
/* =============================================== */
/* Button */
/* =============================================== */
QPushButton {
border: 1px solid #999999;
border-radius: 2px;
/*background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #EEEEEF, stop: 0.05 #DADADF,stop: 0.5 #DADADF,
stop: 0.9 #EEEEEF, stop: 1 #EEEEEF);*/
padding: 1px 4px;
min-width: 50px;
min-height: 16px;
}
QPushButton:hover{
background-color: #8BF;
border-color: #59F;
}
QPushButton:pressed
{
border-width: 1px;
background-color: #59F;
border-color: #999999;
}
QPushButton:focus, QPushButton:default {
border-color: #EA2; /* make the default button prominent */
}
QToolButton,QToolButton:unchecked { /* ToolBar里的按钮和带下拉菜单的按钮 */
border: 1px solid transparent;
border-radius: 3px;
background-color: transparent;
margin: 1px;
}
QToolButton:checked{
background-color: #8BF;
border-color: #59F;
}
QToolButton:hover{
background-color: #8BF;
border-color: #59F;
}
QToolButton:pressed,QToolButton:checked:hover{
background-color: #59F;
border-color: #EA2;
}
QToolButton:checked:pressed{
background-color: #8BF;
}
/* only for MenuButtonPopup */
QToolButton[popupMode="1"]{
padding-left: 1px;
padding-right: 15px; /* make way for the popup button */
border: 1px solid #999999;
min-height: 15px;
/*background: qlineargradient(x1:0, y1:0 ,x2:0, y2:1
stop: 0 #EEEEEF, stop: 0.05 #DADADF, stop: 0.5 #DADADF
stop: 0.95 #EEEEEF stop: 1#EEEEEF)*/
}
QToolButton[popupMode="1"]:hover{
background-color: #8BF;
border-color: #59F;
}
QToolButton[popupMode="1"]:pressed{
border-width: 1px;
background-color: #59F;
border-color: #999999;
}
QToolButton::menu-button {
border: 1px solid #999999;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
width: 16px;
}
/* =============================================== */
/* ComboBox */
/* =============================================== */
QComboBox{
border: 1px solid #999999;
}
QComboBox:editable{
border-style: inset;
}
QComboBox:hover{
border-color: #8BF;
}
QComboBox:focus{
border-color: #EA2;
}
QComboBox:on { /* shift the text when the popup opens */
padding-top: 2px;
padding-left: 2px;
}
QComboBox QAbstractItemView {
border: 1px solid #999999;
selection-background-color: #8BF;
}
/*QComboBox QAbstractItemView::item {
height: 12px;需要设置comboBox.setView(QListView())否则会使用默认的item样式
}*/
/* =============================================== */
/* SpinBox DateTime */
/* =============================================== */
QSpinBox, QDoubleSpinBox,QDateEdit,QTimeEdit,QDateTimeEdit{
border: 1px solid #999999;
border-style: inset;
}
QSpinBox:hover, QDoubleSpinBox:hover,QDateEdit:hover, QTimeEdit:hover,QDateTimeEdit:hover{
border-color: #8BF;
}
QSpinBox:focus, QDoubleSpinBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus{
border-color: #EA2;
}
/* =============================================== */
/* Slider ProgressBar */
/* =============================================== */
QProgressBar {
border: 1px solid #999999;
border-radius: 4px;
text-align: center;
}
QProgressBar::chunk {
background-color: #EA2;
width: 4px;
margin: 1px;
}
QSlider{
border: 1px solid transparent;
}
QSlider::groove{
border: 1px solid #999999;
background: #FFFFFF;
}
QSlider::handle {/*设置中间的那个滑动的键*/
border: 1px solid #999999;
background: #8BF;
}
QSlider::groove:horizontal {
height: 3px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
left:5px; right: 5px;
}
QSlider::groove:vertical{
width: 3px;
top: 5px; bottom: 5px;
}
QSlider::handle:horizontal{
width: 6px;
margin: -7px; /* height */
}
QSlider::handle:vertical{
height: 6px;
margin: -7px; /* height */
}
QSlider::add-page{/*还没有滑上去的地方*/
border: 1px solid #999999;
background:#EEEEEF;
}
QSlider::sub-page{/*已经划过的从地方*/
background: #EA2;
}
/* =============================================== */
/* ScrollBar */
/* =============================================== */
QScrollBar{
background-color: #FFFFFF;
border: 1px solid #999999;
border-radius: 5px;
padding: 1px;
height: 10px;
width: 10px;
}
QScrollBar:hover{
border-color:#8BF;
}
QScrollBar::handle{
border-radius: 3px;
background: #59F;
min-width: 16px;
min-height: 16px;
}
QScrollBar::handle:hover {
background: #EA2;
}
QScrollBar::add-line, QScrollBar::sub-line,
QScrollBar::add-page, QScrollBar::sub-page {
width: 0px;
background: transparent;
}
QScrollArea{
border: none;
}
/*QScrollArea QAbstractSlider{
border-radius: 0px;
}*/
/* =============================================== */
/* DockWidget */
/* =============================================== */
QDockWidget, QDockWidget > QWidget/*not work*/
{
border-color: #999999;/*qt bug*/
background: transparent;
}
QDockWidget::title {
border-bottom: 1px solid #999999;
border-style: inset;
text-align: left; /* align the text to the left */
padding: 6px;
}
/* =============================================== */
/* GroupBox */
/* =============================================== */
QGroupBox {
background-color: #FFFFFF;
border: 1px solid #999999;
border-radius: 4px;
margin-top: 0.5em;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
left: 1em;
background-color: #FFFFFF;
}
/* =============================================== */
/* ToolBox */
/* =============================================== */
QToolBox{
border: 1px solid #999999;
}
QToolBox::tab {
background: #EEEEEF;
border: 1px solid #999999;
border-radius: 1px;
}
QToolBox::tab:hover {
background-color: #8BF;
border-color: transparent;
}
QToolBox::tab:pressed {
background-color: #59F;
border-color: transparent;
}
QToolBox::tab:selected {
font-weight: bold;
border-color: #8BF;
}
/* =============================================== */
/* TabWidget */
/* =============================================== */
QTabWidget{
margin-top:10px;
}
QTabWidget::pane{
border: 1px solid #999999;
}
QTabWidget::tab-bar {
left: 0px;
}
QTabBar::tab {
background: #FFFFFF;
border: 1px solid #999999;
padding: 3px 5px;
}
QTabBar::tab:hover {
background: #8BF;
border-color: transparent;
}
QTabBar::tab:selected {
background: #8BF;
border-color: #59F;
}
QTabBar::tab:pressed {
background: #59F;
border-color: transparent;
}
QTabBar::tab:focus {
border-color: #EA2;
}
QTabBar::tab:top{
margin-top: 3px;
border-bottom: transparent;
margin-right: 1px;
}
QTabBar::tab:bottom{
margin-bottom: 3px;
border-top: transparent;
margin-right: 1px;
}
QTabBar::tab:left{
border-right: transparent;
margin-bottom: 1px;
}
QTabBar::tab:right{
border-left: transparent;
margin-bottom: 1px;
}
/* =============================================== */
/* QHeaderView for list table */
/* =============================================== */
QHeaderView {
border: none;
margin: 0px;
padding: 0px;
}
QHeaderView::section, QTableCornerButton::section {/*设置表头属性*//*左上角*/
background-color: #EEEEEF;
padding: 0 3px;
border-right: 1px solid #999999;
border-bottom: 1px solid #999999;
border-radius: 0px;
}
QHeaderView::section:hover, QTableCornerButton::section:hover{
background-color: #8BF;
}
QHeaderView::section:pressed{
background-color: #59F;
}
QHeaderView::section:checked {
background-color: #EA2;
}
/* =============================================== */
/* QTableWidget */
/* =============================================== */
QTableWidget, QTableView
{
gridline-color: #999999; /*表格中的网格线条颜色*/
background: #FFFFFF;
/*设置交替颜色,需要在函数属性中设置:tableWidget->setAlternatingRowColors(true)*/
alternate-background-color: #EEEEEF;
/*selection-color:#FFFFFF; 鼠标选中时前景色:文字颜色*/
selection-background-color:#8BF; /*鼠标选中时背景色*/
border:1px solid #999999; /*边框线的宽度、颜色*/
/*border:none; 去除边界线*/
/*border-radius:5px;*/
/*padding:10px 10px;*/ /*表格与边框的间距*/
}
QTableView::item, QTabWidget::item{
background: transparent;
outline-style: none;
border: none;
}
QTableView::item:hover {
background: #8BF;
border: 1px solid #EA2;
}
QTableView::item:selected {
background: #8BF;
color: #EEEEEF;
}
QTableView::item:selected:active {
background: #59F;
color: #EEEEEF;
}
QTableWidget QComboBox{
margin: 2px;
border: none;
}
[Icon Theme]
Name=black
Comment=black
Inherits=breeze
Directories=svg, png, ico
[svg]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[png]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[ico]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[Icon Theme]
Name=black
Comment=black
Inherits=breeze
Directories=svg, png, ico
[svg]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[png]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[ico]
Size=200
MinSize=16
ManSize=256
Type=Scalable
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#00ff00" d="M597.333333 85.333333l256 256v512a85.333333 85.333333 0 0 1-85.333333 85.333334H256a85.333333 85.333333 0 0 1-85.333333-85.333334V170.666667a85.333333 85.333333 0 0 1 85.333333-85.333334h341.333333m170.666667 768V384h-213.333333V170.666667H256v682.666666h512m-85.333333-85.333333l-106.666667-72.533333V768H341.333333v-213.333333h234.666667v72.533333L682.666667 554.666667v213.333333z" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#00ff00" d="M853.333333 956.586667H170.666667c-66.030933 0-102.4-36.369067-102.4-102.4V256c0-60.1088 30.122667-95.6416 85.333333-101.5296V85.333333a17.066667 17.066667 0 0 1 17.066667-17.066666h682.666666a17.066667 17.066667 0 0 1 17.066667 17.066666v152.746667h68.266667a17.066667 17.066667 0 0 1 17.066666 17.066667v599.04c0 66.030933-36.369067 102.4-102.4 102.4zM170.666667 187.733333c-47.223467 0-68.266667 21.0432-68.266667 68.266667v598.186667c0 47.223467 21.0432 68.266667 68.266667 68.266666h682.666666c47.223467 0 68.266667-21.0432 68.266667-68.266666v-581.973334H512a17.066667 17.066667 0 0 1-17.066667-17.066666V187.733333H170.666667z m358.4 50.346667h307.2V102.4H187.733333v51.2h324.266667a17.066667 17.066667 0 0 1 17.066667 17.066667v67.413333zM341.333333 768V426.666667h341.333334v341.333333H341.333333z m103.253334-256v170.666667L597.333333 597.333333l-152.746666-85.333333zM682.666667 785.066667H341.333333a17.066667 17.066667 0 0 1-17.066666-17.066667V426.666667a17.066667 17.066667 0 0 1 17.066666-17.066667h341.333334a17.066667 17.066667 0 0 1 17.066666 17.066667v341.333333a17.066667 17.066667 0 0 1-17.066666 17.066667z m-324.266667-34.133334h307.2V443.733333H358.4v307.2z" /></svg>
\ No newline at end of file
[Icon Theme]
Name=black
Comment=black
Inherits=breeze
Directories=svg, png, ico
[svg]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[png]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[ico]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[Icon Theme]
Name=black
Comment=black
Inherits=breeze
Directories=svg, png, ico
[svg]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[png]
Size=200
MinSize=16
ManSize=256
Type=Scalable
[ico]
Size=200
MinSize=16
ManSize=256
Type=Scalable
......@@ -15,38 +15,37 @@
#include "FrmUpdater/FrmUpdater.h"
#endif
#include "Log.h"
Q_DECLARE_LOGGING_CATEGORY(log)
int main(int argc, char *argv[])
{
LOG_INITIALIZER;
#if (QT_VERSION > QT_VERSION_CHECK(5,6,0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
#if defined(Q_OS_ANDROID) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
QtAndroid::hideSplashScreen();
#endif
QApplication app(argc, argv);
QApplication app(argc, argv);
app.setApplicationVersion(FaceRecognizer_VERSION);
app.setApplicationName("FaceRecognizer");
#ifdef RABBITCOMMON
LOG_MODEL_INFO("main", "GetDirApplication:%s",
RabbitCommon::CDir::Instance()->GetDirApplication().toStdString().c_str());
qInfo(log) << "GetDirApplication:"
<< RabbitCommon::CDir::Instance()->GetDirApplication();
RabbitCommon::CTools::Instance()->Init();
QString szTranslator = RabbitCommon::CDir::Instance()->GetDirTranslations()
+ "/" + qApp->applicationName()
+ "App_" + QLocale::system().name() + ".qm";
qDebug() << "Translator:" << szTranslator;
qDebug(log) << "Translator:" << szTranslator;
QTranslator translator;
translator.load(szTranslator);
app.installTranslator(&translator);
#endif
app.setApplicationDisplayName(QObject::tr("Face recognizer"));
#ifdef RABBITCOMMON
CFrmUpdater *pUpdate = new CFrmUpdater();
pUpdate->SetTitle(QImage(":/image/FaceRecognizer"));
......@@ -58,7 +57,7 @@ int main(int argc, char *argv[])
if(f.open(QFile::ReadOnly))
{
QString szStyle = f.readAll();
qDebug() << "Style:" << szStyle;
qDebug(log) << "Style:" << szStyle;
qApp->setStyleSheet(szStyle);
f.close();
}
......@@ -66,16 +65,14 @@ int main(int argc, char *argv[])
app.addLibraryPath(RabbitCommon::CDir::Instance()->GetDirPlugins());
MainWindow w;
#if defined (Q_OS_ANDROID)
w.showMaximized();
#else
w.show();
#endif
int nRet = app.exec();
LOG_CLEAN;
return nRet;
}
......@@ -12,34 +12,6 @@ if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
SET(FaceRecognizer_VERSION "v0.0.4")
# Find Git Version Patch
IF(EXISTS "${CMAKE_SOURCE_DIR}/.git")
if(NOT GIT)
SET(GIT $ENV{GIT})
endif()
if(NOT GIT)
FIND_PROGRAM(GIT NAMES git git.exe git.cmd)
endif()
IF(GIT)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${GIT} describe --tags
OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_VERSION)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${GIT} rev-parse --short HEAD
OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
SET(FaceRecognizer_VERSION ${GIT_VERSION})
ENDIF()
ENDIF()
message("FaceRecognizer_VERSION:${FaceRecognizer_VERSION}")
set(VERSION ${FaceRecognizer_VERSION})
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif(NOT DEFINED CMAKE_BUILD_TYPE)
......@@ -47,7 +19,7 @@ if("Debug" STREQUAL CMAKE_BUILD_TYPE)
add_definitions(-D_DEBUG)
endif()
OPTION(ENABLE_DOWNLOAD_MODUEL "Enable automation download" OFF)
OPTION(ENABLE_DOWNLOAD_MODUEL "Enable automation download moduel files" OFF)
#需要的QT组件
if(CMAKE_VERSION VERSION_LESS "3.7.0")
......@@ -55,10 +27,13 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0")
endif()
SET(QT_COMPONENTS Core Gui Widgets Xml Network Multimedia Sql)
if(ANDROID)
SET(QT_COMPONENTS ${QT_COMPONENTS} AndroidExtras)
LIST(APPEND QT_COMPONENTS AndroidExtras)
endif()
if(NOT DEFINED QT_VERSION_MAJOR)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core)
endif()
if(QT_VERSION_MAJOR GREATER_EQUAL 6)
LIST(APPEND QT_COMPONENTS multimediawidgets)
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${QT_COMPONENTS})
message("QT_VERSION:${Qt${QT_VERSION_MAJOR}_VERSION}")
......@@ -163,17 +138,33 @@ if(NOT RabbitCommon_DIR)
set(RabbitCommon_DIR ${CMAKE_SOURCE_DIR}/../RabbitCommon)
endif()
endif()
if(DEFINED RabbitCommon_DIR AND EXISTS ${RabbitCommon_DIR}/Src)
if(RabbitCommon_DIR AND EXISTS ${RabbitCommon_DIR}/Src)
message("Use RabbitCommon source code")
add_subdirectory(${RabbitCommon_DIR}/Src ${CMAKE_BINARY_DIR}/RabbitCommon)
include(${RabbitCommon_DIR}/cmake/Translations.cmake)
else()
message("1. Please download RabbitCommon source code from https://github.com/KangLin/RabbitCommon")
message(" ag:")
message(" git clone https://github.com/KangLin/RabbitCommon.git")
message("2. Then set cmake value or environment variable RabbitCommon_DIR to download root dirctory.")
message(" ag:")
message(FATAL_ERROR " cmake -DRabbitCommon_DIR= ")
find_package(RabbitCommon)
if(NOT RabbitCommon_FOUND)
message("RabbitCommon_DIR is not found. Please use one of the following ways to set it:")
message("1. Set RabbitCommon_DIR to the install prefix of RabbitCommon.")
message("2. Set RabbitCommon_DIR to source code root of RabbitCommon.")
message("2.1 Please download the source code of RabbitCommon from https://github.com/KangLin/RabbitCommon")
message(" ag:")
message(" git clone https://github.com/KangLin/RabbitCommon.git")
message("2.2 Then set cmake variable or environment variable RabbitCommon_DIR to download root directory.")
message(" ag:")
message(" cmake -DRabbitCommon_DIR= ")
message(FATAL_ERROR "RabbitCommon_DIR isn't set.")
endif()
endif()
GET_VERSION(OUT_VERSION FaceRecognizer_VERSION
OUT_REVISION FaceRecognizer_REVISION)
if(NOT FaceRecognizer_VERSION)
SET(FaceRecognizer_VERSION "v0.0.4")
endif()
message("FaceRecognizer_VERSION:${FaceRecognizer_VERSION};FaceRecognizer_REVISION:${FaceRecognizer_REVISION}")
set(VERSION ${FaceRecognizer_VERSION})
add_subdirectory(Src)
option(BUILD_APP "Build applaction" ON)
if(BUILD_APP)
......
......@@ -7,6 +7,7 @@
+ Add ncnn face
+ FIX: divide by 0 crash. Affects all previous releases.
See RabbitCommon: 7ed300a206d8a36c30003b6c19ad181682d0ff5f
+ FFmpeg: update API avpicture_* to av_image_*
- v0.0.4
+ Add opencv face
......
......@@ -7,6 +7,7 @@
+ 增加 ncnn 实现人脸接口
+ 修复除 0 引起的崩溃。影响前面所有发行版本。此错误是 RabbitCommon 引起的。
详见:RabbitCommon: 7ed300a206d8a36c30003b6c19ad181682d0ff5f
+ FFmpeg: 兼容 API avpicture_* to av_image_*
- v0.0.4
+ 增加 opencv 实现人脸接口
......
......@@ -68,7 +68,7 @@ LangString LANG_DIRECTORY_PERMISSION ${LANG_SIMPCHINESE} "无目录访问权限"
Name "$(LANG_PRODUCT_NAME) ${PRODUCT_VERSION}"
Caption "$(LANG_PRODUCT_NAME) ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}-Setup-${PRODUCT_VERSION}.exe"
OutFile "${PRODUCT_NAME}_${PRODUCT_VERSION}_Setup.exe"
InstallDir "$LOCALAPPDATA\${PRODUCT_NAME}"
;InstallDirRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_DIR_REGKEY}" ""
......
......@@ -2,7 +2,8 @@
作者:康林(kl222@126.com)
[![Windows build status](https://ci.appveyor.com/api/projects/status/n50nxc7d8mm9bdpb/branch/master?svg=true)](https://ci.appveyor.com/project/KangLin/facerecognizer/branch/master)
[![Linux build Status](https://travis-ci.org/KangLin/FaceRecognizer.svg?branch=master)](https://travis-ci.org/KangLin/FaceRecognizer)
[![build](https://github.com/KangLin/FaceRecognizer/actions/workflows/build.yml/badge.svg)](https://github.com/KangLin/FaceRecognizer/actions/workflows/build.yml)
[![Gitter](https://badges.gitter.im/FaceRecognizer/community.svg)](https://gitter.im/FaceRecognizer/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![GitHub stars](https://img.shields.io/github/stars/KangLin/FaceRecognizer)](https://github.com/KangLin/FaceRecognizer/stars)
[![GitHub forks](https://img.shields.io/github/forks/KangLin/FaceRecognizer)](https://github.com/KangLin/FaceRecognizer/forks)
......@@ -86,7 +87,7 @@
+ [最后版本](https://github.com/KangLin/FaceRecognizer/releases/latest)
+ 当前版本:
- windows
+ [FaceRecognizer-Setup-v0.0.4.exe](https://github.com/KangLin/FaceRecognizer/releases/download/v0.0.4/FaceRecognizer-Setup-v0.0.4.exe)
+ [FaceRecognizer_v0.0.4_Setup.exe](https://github.com/KangLin/FaceRecognizer/releases/download/v0.0.4/FaceRecognizer_v0.0.4_Setup.exe)
Windows安装包,支持 Windows xp 以上系统
- android
......
......@@ -38,7 +38,6 @@ set(SOURCE_FILES
CameraQtCaptureVideoFrame.cpp
ImageTool.cpp
ConverFormat.cpp
Log.cpp
FactoryFace.cpp
Face.cpp
FaceBase.cpp
......@@ -70,23 +69,11 @@ set(INSTALLHEADER_FILES
set(HEADER_FILES
${HEADER_FILES}
${INSTALLHEADER_FILES}
Log.h
database/Database.h
database/DataRegister.h
database/TableRegister.h
)
#翻译
GENERATED_QT_TRANSLATIONS(SOURCES ${SOURCE_FILES}
OUT_QRC TRANSLATIONS_QRC_FILES)
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
if(BUILD_TYPE STREQUAL "debug")
LIST(APPEND PRIVATE_DEFINITIONS DEBUG)
LIST(APPEND RCC_FILES
${TRANSLATIONS_QRC_FILES}
)
endif()
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
if(BUILD_TYPE STREQUAL "debug")
set(LIBS_DEFINES ${LIBS_DEFINES} DEBUG)
......@@ -107,7 +94,9 @@ endif()
ADD_TARGET(NAME ${PROJECT_NAME}
VERSION ${FaceRecognizer_VERSION}
PRIVATE_DEFINITIONS FaceRecognizer_VERSION="${FaceRecognizer_VERSION}"
PRIVATE_DEFINITIONS
FaceRecognizer_VERSION="${FaceRecognizer_VERSION}"
FaceRecognizer_REVISION="${FaceRecognizer_REVISION}"
DEFINITIONS RABBITCOMMON ${LIBS_DEFINES}
SOURCE_FILES ${SOURCE_FILES} ${HEADER_FILES} ${RCC_FILES}
INSTALL_HEADER_FILES "${INSTALLHEADER_FILES}"
......
......@@ -39,10 +39,13 @@
#ifndef CAPTUREVIDEOFRAME_H
#define CAPTUREVIDEOFRAME_H
#include <QtGlobal>
#include <QAbstractVideoSurface>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QAbstractVideoSurface>
#endif
#ifdef ANDROID
#include <QVideoProbe>
#include <QVideoProbe>
#endif
#include <QCamera>
#include <QImage>
......@@ -54,7 +57,8 @@
* @brief The CCameraQtCaptureVideoFrame class
* @ingroup RABBITIM_IMPLEMENT_CAMERA_QT
*/
class FACERECOGNIZER_EXPORT CCameraQtCaptureVideoFrame : public QAbstractVideoSurface
class FACERECOGNIZER_EXPORT CCameraQtCaptureVideoFrame
: public QAbstractVideoSurface
{
Q_OBJECT
Q_CLASSINFO("Author", "Kang Lin <kl222@126.com>")
......@@ -69,15 +73,13 @@ public:
//bool isFormatSupported(const QVideoSurfaceFormat &format) const;
int SetCameraAngle(int angle);
virtual bool present(const QVideoFrame &frame);
signals:
//从摄像头捕获的原始帧
void sigCaptureFrame(const QVideoFrame &frame);
void sigCaptureFrame(const QImage &frame);
private slots:
virtual bool present(const QVideoFrame &frame);
private:
#ifdef ANDROID
QVideoProbe m_Probe;//android下,目前只能用probe捕获视频
......
#include "Face.h"
#include "Log.h"
#include <QLoggingCategory>
Q_LOGGING_CATEGORY(logFace, "Face")
CFace::CFace(QObject *parent) : QObject(parent),
m_pDetector(nullptr),
......@@ -12,7 +15,7 @@ CFace::CFace(QObject *parent) : QObject(parent),
try {
m_pDatabase = new CDatabase();
} catch (...) {
LOG_MODEL_ERROR("CFace", "new CDatabase fail");
qCritical(logFace) << "new CDatabase fail";
}
}
......@@ -31,7 +34,7 @@ int CFace::Initialize()
int CFace::Clean()
{
LOG_MODEL_DEBUG("CFace", "Clean %s", this->metaObject()->className());
qDebug(logFace) << "Clean" << this->metaObject()->className();
if(m_pDetector)
{
......@@ -81,32 +84,32 @@ bool CFace::IsValid()
{
if(!GetDector())
{
LOG_MODEL_ERROR("CFace", "CFace::GetDector is null");
qCritical(logFace) << "CFace::GetDector is null";
return false;
}
if(!GetTracker())
{
LOG_MODEL_ERROR("CFace", "CFace::GetTracker is null");
qCritical(logFace) << "CFace::GetTracker is null";
return false;
}
if(!GetLandmarker())
{
LOG_MODEL_ERROR("CFace", "CFace::GetLandmarker is null");
qCritical(logFace) << "CFace::GetLandmarker is null";
return false;
}
if(!GetRecognizer())
{
LOG_MODEL_ERROR("CFace", "CFace::GetRecognizer is null");
qCritical(logFace) << "CFace::GetRecognizer is null";
return false;
}
if(!GetFaceTools())
{
LOG_MODEL_ERROR("CFace", "CFace::GetFaceTools is null");
qCritical(logFace) << "CFace::GetFaceTools is null";
return false;
}
if(!GetDatabase())
{
LOG_MODEL_ERROR("CFace", "CFace::GetDatabase is null");
qCritical(logFace) << "CFace::GetDatabase is null";
return false;
}
return true;
......
......@@ -22,7 +22,7 @@ class FACERECOGNIZER_EXPORT CFace : public QObject
{
Q_OBJECT
Q_CLASSINFO("Author", "Kang Lin <kl222@126.com>")
Q_PROPERTY(QString name READ GetName)
Q_PROPERTY(QString descritp READ GetDescript)
Q_PROPERTY(int level READ GetLevel)
......@@ -30,7 +30,7 @@ class FACERECOGNIZER_EXPORT CFace : public QObject
public:
explicit CFace(QObject *parent = nullptr);
virtual ~CFace();
virtual int Initialize();
virtual int Clean();
virtual QString GetName();
......@@ -42,7 +42,7 @@ public:
LOWER = -1
};
virtual int GetLevel();
bool IsValid();
virtual CDetector* GetDector();
......
#include "FaceBase.h"
#include "Log.h"
#include "RabbitCommonDir.h"
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(logFace)
CFaceBase::CFaceBase(QObject *parent) : QObject(parent),
m_Device(CPU)
{
m_szModelPath = RabbitCommon::CDir::Instance()->GetDirData(false)
+ QDir::separator() + "model";
LOG_MODEL_DEBUG("CParameter", "szPath:%s", m_szModelPath.toStdString().c_str());
qDebug(logFace) << "szPath:" << m_szModelPath;
#if defined(Q_OS_ANDROID)
QDir d;
if(!d.exists(m_szModelPath))
......
#include "FaceTools.h"
#include "Log.h"
CFaceTools::CFaceTools(CFace *pFace, QObject *parent) : CFaceBase(parent),
m_pFace(pFace)
......
此差异已折叠。
此差异已折叠。
#include "Landmarker.h"
#include "Log.h"
CLandmarker::CLandmarker(CFace *pFace, QObject *parent)
: CFaceBase(parent),
......
此差异已折叠。
此差异已折叠。
......@@ -6,6 +6,7 @@
extern "C" {
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "libavutil/imgutils.h"
#undef PixelFormat
}
......@@ -21,7 +22,6 @@ public:
Q_PLUGIN_METADATA(IID CONVER_FORMAT_IID)
#endif
//设置ffmpeg日志输出
static int SetFFmpegLog();
......@@ -50,14 +50,24 @@ private:
* @param outPixelFormat:转换后帧的格式
* @return
*/
static int ConvertFormat(/*[in]*/ const AVPicture &inFrame, /** 要转换的帧 */
/*[in]*/ int nInWidth, /** 要转换的帧的宽度 */
/*[in]*/ int nInHeight, /** 要转换的帧的高度 */
/*[in]*/ AVPixelFormat inPixelFormat, /** 要转换的帧的格式 */
/*[out]*/ AVPicture &outFrame, /** 转换后的帧 */
/*[in]*/ int nOutWidth, /** 转换后的帧的宽度 */
/*[in]*/ int nOutHeight, /** 转换后的帧的高度 */
/*[in]*/ AVPixelFormat outPixelFormat);/** 转换后的帧的格式 */
static int ConvertFormat(
#if LIBAVUTIL_VERSION_MAJOR >= 55
/*[in]*/ AVFrame* inFrame, /** 要转换的帧 */
#else
/*[in]*/ const AVPicture* inFrame, /** 要转换的帧 */
#endif
/*[in]*/ int nInWidth, /** 要转换的帧的宽度 */
/*[in]*/ int nInHeight, /** 要转换的帧的高度 */
/*[in]*/ AVPixelFormat inPixelFormat, /** 要转换的帧的格式 */
#if LIBAVUTIL_VERSION_MAJOR >= 55
/*[out]*/ AVFrame* outFrame, /** 转换后的帧 */
#else
/*[out]*/ AVPicture* outFrame, /** 转换后的帧 */
#endif
/*[in]*/ int nOutWidth, /** 转换后的帧的宽度 */
/*[in]*/ int nOutHeight, /** 转换后的帧的高度 */
/*[in]*/ AVPixelFormat outPixelFormat);/** 转换后的帧的格式 */
};
#endif // CCONVERFORMATFFMPEG_H
......@@ -27,6 +27,7 @@ if(NOT ANDROID)
set(INSTALL_PATH ${INSTALL_FACE_RECOGNIZER_PLUGS_DIR}/Face)
endif()
ADD_PLUGIN_TARGET(NAME ${PROJECT_NAME}
NO_TRANSLATION
SOURCE_FILES ${SOURCES_FILES} ${HEADER_FILES}
PRIVATE_LIBS facedetection FaceRecognizer
OUTPUT_DIR ${FACE_RECOGNIZER_PLUGS_BINARY_DIR}/Face
......
......@@ -14,7 +14,7 @@ int CDetectorLibfacedetection::UpdateParameter()
int CDetectorLibfacedetection::Detect(const QImage &image, QVector<QRect> &faces)
{
if(image.isNull()) return -1;
PERFORMANCE(Libfacedetection)
QImage img = image;
if(img.format() != QImage::Format_RGB888)
......
......@@ -6,7 +6,7 @@ endif()
PROJECT(PluginConverFormatOpenCV)
find_package(OpenCV)
message("== Plug OpenCV:${OpenCV_FOUND}")
message("== Plug OpenCV:${OpenCV_FOUND};${OpenCV_LIBS}")
if(NOT OpenCV_FOUND)
return()
endif()
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。