diff --git a/.clang-format b/.clang-format index e33eb0e1..93317fa2 100644 --- a/.clang-format +++ b/.clang-format @@ -91,10 +91,6 @@ PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Left -RawStringFormats: - - Delimiter: pb - Language: TextProto - BasedOnStyle: google ReflowComments: true SortIncludes: true SortUsingDeclarations: true @@ -112,5 +108,6 @@ SpacesInSquareBrackets: true Standard: Cpp11 TabWidth: 4 UseTab: Never +UseCRLF: Always ... diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..6392c43c --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,473 @@ +name: CMake Build Matrix + +# Directories +# - $GITHUB_WORKSPACE/qskinny_source : Checkout directory for qskinny sources +# - $GITHUB_WORKSPACE/qskinny_build : Build directory for QSkinny CMake +# - $GITHUB_WORKSPACE/qskinny_install : Install directory for QSkinny package +# - $GITHUB_WORKSPACE/qskinny_build_test : Build directory for QSkinny CMake integration test + +on: + push: + branches: [cmake] + pull_request: + branches: [master] + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - { + name: "Windows Latest MSVC Qt5", + os: windows-latest, + artifact: "windows_msvc.7z", + build_type: "Release", + cc: "cl", + cxx: "cl", + environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", + archiver: "7z a", + generators: "Visual Studio 17 2022", + cmake: + { + qtversion: "5.15.2", + qtdirkey: "Qt5_DIR", + qtdirvalue: "../Qt/5.15.2/msvc2019_64/lib/cmake/Qt5", + qtprefixpath: "../Qt/5.15.2/msvc2019_64", + }, + screenshot_filename: "windows-latest-msvc-qt-5-15-2.jpg", + } + - { + name: "Windows Latest MSVC Qt6", + os: windows-latest, + artifact: "windows_msvc.7z", + build_type: "Release", + cc: "cl", + cxx: "cl", + environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", + archiver: "7z a", + generators: "Visual Studio 17 2022", + cmake: + { + qtversion: "6.5.0", + qtdirkey: "Qt6_DIR", + qtdirvalue: "../Qt/6.5.0/msvc2019_64/lib/cmake/Qt6", + qtprefixpath: "../Qt/6.5.0/msvc2019_64", + }, + screenshot_filename: "windows-latest-msvc-qt-6.5.0.jpg", + } + - { + name: "Windows 2019 MSVC Qt5", + os: windows-2019, + artifact: "windows_msvc.7z", + build_type: "Release", + cc: "cl", + cxx: "cl", + environment_script: "C:/Program Files/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", + archiver: "7z a", + generators: "Visual Studio 16 2019", + cmake: + { + qtversion: "5.15.2", + qtdirkey: "Qt5_DIR", + qtdirvalue: "../Qt/5.15.2/msvc2019_64/lib/cmake/Qt5", + qtprefixpath: "../Qt/5.15.2/msvc2019_64", + }, + screenshot_filename: "windows-2019-msvc-qt-5-15-2.jpg", + } + - { + name: "Windows 2019 MSVC Qt6", + os: windows-2019, + artifact: "windows_msvc.7z", + build_type: "Release", + cc: "cl", + cxx: "cl", + environment_script: "C:/Program Files/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", + archiver: "7z a", + generators: "Visual Studio 16 2019", + cmake: + { + qtversion: "6.5.0", + qtdirkey: "Qt6_DIR", + qtdirvalue: "../Qt/6.5.0/msvc2019_64/lib/cmake/Qt6", + qtprefixpath: "../Qt/6.5.0/msvc2019_64", + }, + screenshot_filename: "windows-2019-msvc-qt-6.5.0.jpg", + } + - { + name: "Ubuntu Latest GCC Qt5", + os: ubuntu-latest, + artifact: "ubuntu_gcc.7z", + build_type: "Release", + cc: "gcc", + cxx: "g++", + archiver: "7z a", + generators: "Ninja", + env: { DISPLAY: ":1" }, + cmake: + { + qtversion: "5.15.2", + qtdirkey: "Qt5_DIR", + qtdirvalue: "../Qt/5.15.2/gcc_64/lib/cmake/Qt5", + qtprefixpath: "../Qt/5.15.2/gcc_64", + }, + screenshot_filename: "ubuntu-latest-gcc-qt-5-15-2.jpg", + } + - { + name: "Ubuntu Latest GCC Qt6", + os: ubuntu-latest, + artifact: "ubuntu_gcc.7z", + build_type: "Release", + cc: "gcc", + cxx: "g++", + archiver: "7z a", + generators: "Ninja", + env: { DISPLAY: ":1" }, + cmake: + { + qtversion: "6.5.0", + qtdirkey: "Qt6_DIR", + qtdirvalue: "../Qt/6.5.0/gcc_64/lib/cmake/Qt6", + qtprefixpath: "../Qt/6.5.0/gcc_64", + }, + screenshot_filename: "ubuntu-latest-gcc-qt-6.5.0.jpg", + } + - { + name: "Ubuntu GCC 9 Qt5", + os: ubuntu-latest, + artifact: "ubuntu_gcc9.7z", + build_type: "Release", + cc: "gcc", + cxx: "g++", + archiver: "7z a", + generators: "Ninja", + env: { DISPLAY: ":1" }, + cmake: + { + qtversion: "5.15.2", + qtdirkey: "Qt5_DIR", + qtdirvalue: "../Qt/5.15.2/gcc_64/lib/cmake/Qt5", + qtprefixpath: "../Qt/5.15.2/gcc_64", + }, + screenshot_filename: "ubuntu-latest-gcc-9-qt-5-15-2.jpg", + } + - { + name: "Ubuntu GCC 9 Qt6", + os: ubuntu-latest, + artifact: "ubuntu_gcc9.7z", + build_type: "Release", + cc: "gcc", + cxx: "g++", + archiver: "7z a", + generators: "Ninja", + env: { DISPLAY: ":1" }, + cmake: + { + qtversion: "6.5.0", + qtdirkey: "Qt6_DIR", + qtdirvalue: "../Qt/6.5.0/gcc_64/lib/cmake/Qt6", + qtprefixpath: "../Qt/6.5.0/gcc_64", + }, + screenshot_filename: "ubuntu-latest-gcc-9-qt-6.5.0.jpg", + } + - { + name: "macOS Latest Clang Qt5", + os: macos-latest, + artifact: "macos_clang.7z", + build_type: "Release", + cc: "clang", + cxx: "clang++", + archiver: "7za a", + generators: "Ninja", + cmake: + { + qtversion: "5.15.2", + qtdirkey: "Qt5_DIR", + qtdirvalue: "../Qt/5.15.2/clang_64/lib/cmake/Qt5", + qtprefixpath: "../Qt/5.15.2/clang_64", + }, + screenshot_filename: "macos-latest-clang-qt-5-15-2.jpg", + } + - { + name: "macOS Latest Clang Qt6", + os: macos-latest, + artifact: "macos_clang.7z", + build_type: "Release", + cc: "clang", + cxx: "clang++", + archiver: "7za a", + generators: "Ninja", + cmake: + { + qtversion: "6.5.0", + qtdirkey: "Qt6_DIR", + qtdirvalue: "../Qt/6.5.0/clang_64/lib/cmake/Qt6", + qtprefixpath: "../Qt/6.5.0/clang_64", + }, + screenshot_filename: "macos-latest-clang-qt-6.5.0.jpg", + } + + steps: + - name: Git Checkout + uses: actions/checkout@v3 + with: + path: qskinny_source + + - name: Print env + run: | + echo github.event.action: ${{ github.event.action }} + echo github.event_name: ${{ github.event_name }} + + - name: Install dependencies on windows + if: startsWith(matrix.config.os, 'windows') + run: | + choco install ninja + choco install cmake --version=3.16.3 + ninja --version + cmake --version + + - name: Install dependencies on ubuntu + if: startsWith(matrix.config.name, 'Ubuntu Latest GCC') + run: | + sudo apt-get update + sudo apt-get install ninja-build cmake + ninja --version + cmake --version + gcc --version + + - name: Install dependencies on ubuntu9 + if: startsWith(matrix.config.name, 'Ubuntu GCC 9') + run: | + echo Update gcc-9 ======================================================================= + echo gcc version before + gcc --version + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install ninja-build cmake gcc-9 g++-9 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9 + echo gcc version after + gcc --version + echo Update ninja ======================================================================= + echo ninja version before + ninja --version + # wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip + wget https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip + sudo unzip ninja-linux.zip -d /usr/local/bin/ + sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force + echo ninja version after + ninja --version + echo Update cmake ======================================================================= + echo cmake version before + cmake --version + # curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2 + # wget https://github.com/Kitware/CMake/releases/latest/download/cmake-3.16.5-Linux-x86_64.sh + cmake_version=$(curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2 | cut -c 2-) + echo cmake download latest v$cmake_version version + wget https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-Linux-x86_64.sh + chmod +x cmake-$cmake_version-Linux-x86_64.sh + sudo mkdir /opt/cmake + sudo ./cmake-$cmake_version-Linux-x86_64.sh --prefix=/opt/cmake --skip-license + sudo update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 1 --force + echo cmake version after + cmake --version + + - name: Install dependencies on macos + if: startsWith(matrix.config.os, 'macos') + run: | + brew install p7zip cmake ninja + ninja --version + cmake --version + + - name: Install needed xkbcommon symlink + if: startsWith(matrix.config.name, 'Ubuntu') + run: | + sudo apt-get install libxkbcommon-dev -y + sudo apt-get install libxkbcommon-x11-0 -y + sudo apt-get install libxcb-cursor-dev -y + sudo apt-get install x11-xserver-utils -y + + - name: Install hunspell for Ubuntu + if: false && startsWith(matrix.config.name, 'Ubuntu') + run: | + sudo apt-get install -y libhunspell-dev + + - name: Install pinyin for Ubuntu + if: false && startsWith(matrix.config.name, 'Ubuntu') + run: | + sudo apt-get install -y libimepinyin-dev + + - name: Install imagemagick for Ubuntu + if: startsWith(matrix.config.name, 'Ubuntu') + run: | + sudo apt-get install -y imagemagick + + #- name: Cache Qt5 + # if: endsWith(matrix.config.name, 'Qt5') + # id: cache-qt-5-15 + # uses: actions/cache@v1 # not v2! + # with: + # path: ../Qt/5.15.2 + # key: ${{ runner.os }}-QtCache-Qt5 +# + #- name: Cache Qt6 + # if: endsWith(matrix.config.name, 'Qt6') + # id: cache-qt-6-2 + # uses: actions/cache@v1 # not v2! + # with: + # path: ../Qt/6.5.0 + # key: ${{ runner.os }}-QtCache-Qt6 + + - name: Install Qt5 + if: endsWith(matrix.config.name, 'Qt5') + uses: jurplel/install-qt-action@v3 + with: + version: "5.15.2" + target: "desktop" + install-deps: "true" + modules: "qtwebengine" + cached: ${{ steps.cache-qt-5-15.outputs.cache-hit }} + setup-python: "false" + tools: "" + set-env: "true" + tools-only: "false" + + - name: Install Qt6 + if: endsWith(matrix.config.name, 'Qt6') + uses: jurplel/install-qt-action@v3 + with: + version: "6.5.0" + target: "desktop" + install-deps: "true" + modules: "qtwebengine" + cached: ${{ steps.cache-qt-6-2.outputs.cache-hit }} + setup-python: "false" + tools: "" + set-env: "true" + tools-only: "false" + + - name: Configure ( QSkinny ) + shell: bash + run: | + mkdir qskinny_build + mkdir qskinny_install + cmake \ + -S qskinny_source \ + -B qskinny_build \ + -G "${{ matrix.config.generators }}" \ + -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ + -DCMAKE_INSTALL_PREFIX:PATH=qskinny_install \ + -DCMAKE_PREFIX_PATH:PATH="${{ matrix.config.cmake.qtprefixpath }}" \ + -D${{ matrix.config.cmake.qtdirkey }}:PATH="${{ matrix.config.cmake.qtdirvalue }}" + + - name: Build ( QSkinny ) + shell: bash + run: cmake --build qskinny_build --config ${{ matrix.config.build_type }} + + #- name: Tests + # shell: bash + # run: ctest -j14 -C Release -T test --output-on-failure + + - name: Install ( QSkinny ) Strip + shell: bash + run: cmake --install qskinny_build --prefix qskinny_install --strip --config ${{ matrix.config.build_type }} + + - name: Smoke test ( QSkinny ) on MacOS + if: startsWith(matrix.config.name, 'macOS') + env: + QT_DEBUG_PLUGINS: "1" + run: | + echo "starting iotdashboard" + DYLD_LIBRARY_PATH=./qskinny_install/lib:./qskinny_install/plugins/skins ./qskinny_build/examples/bin/iotdashboard.app/Contents/MacOS/iotdashboard -qwindowgeometry 1024x600+75+100 --screenshot ${{ matrix.config.screenshot_filename }} & + sleep 10 + + # TODO remove 'qskinny_build\skins\material3\Release' when skin install is fixed + - name: Smoke Test ( QSkinny ) on Windows + if: startsWith(matrix.config.name, 'Windows') + env: + QT_DEBUG_PLUGINS: "1" + run: | + $env:Path += ";./qskinny_install/bin;./qskinny_install/lib;./qskinny_install/plugins/skins;./qskinny_build/skins/material3/Release;./qskinny_build/skins/squiek/Release" + echo "starting iotdashboard" + Start-Process qskinny_build\examples\bin\Release\iotdashboard.exe -ArgumentList "-qwindowgeometry 1024x600+0+0 --screenshot ${{ matrix.config.screenshot_filename }}" + Start-Sleep -Seconds 10 + + - name: Smoke test ( QSkinny ) on Ubuntu + if: startsWith(matrix.config.name, 'Ubuntu') + env: + DISPLAY: ":1" + QT_DEBUG_PLUGINS: "1" + run: | + echo starting Xvfb + Xvfb :1 & + sleep 10 + echo starting iotdashboard + ./qskinny_build/examples/bin/iotdashboard --screenshot ${{ matrix.config.screenshot_filename }} & + sleep 10 + + - uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.config.screenshot_filename }} + path: ${{ matrix.config.screenshot_filename }} + + #- uses: OrbitalOwen/desktop-screenshot-action@0.1 + # with: + # file-name: ${{ matrix.config.screenshot_filename }} + + - name: Smoke Test Cleanup ( QSkinny ) on Windows + if: startsWith(matrix.config.name, 'Windows') + run: | + taskkill /IM iotdashboard.exe /T + + - name: Smoke Test Cleanup ( QSkinny ) on MacOS + if: startsWith(matrix.config.name, 'macOS') + run: | + killall iotdashboard + + - name: Smoke Test Cleanup ( QSkinny ) on Ubuntu + if: startsWith(matrix.config.name, 'Ubuntu') + run: | + killall iotdashboard + killall Xvfb + + #- name: Configure ( CMake Integration Test ) + # shell: bash + # run: | + # mkdir qskinny_build_test + # cmake \ + # -S qskinny_source/examples/iotdashboard_smoketest \ + # -B qskinny_build_test \ + # -G "${{ matrix.config.generators }}" \ + # -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ + # -DCMAKE_PREFIX_PATH:PATH="${{ matrix.config.cmake.qtprefixpath }}" \ + # -D${{ matrix.config.cmake.qtdirkey }}:PATH="${{ matrix.config.cmake.qtdirvalue }}" \ + # -DQSkinny_DIR:PATH=$GITHUB_WORKSPACE/qskinny_install/lib/cmake/QSkinny +# + #- name: Build ( CMake Integration Test ) + # shell: bash + # run: cmake --build qskinny_build_test --config ${{ matrix.config.build_type }} + + # - name: Pack + # shell: bash + # working-directory: instdir + # run: | + # ls -laR + # ${{ matrix.config.archiver }} ../${{ matrix.config.artifact }} . + + # - name: Upload + # uses: actions/upload-artifact@v1 + # with: + # path: ./${{ matrix.config.artifact }} + # name: ${{ matrix.config.artifact }} + + # - name: Upload release asset + # if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'created') + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ github.event.release.upload_url }} + # asset_path: ./${{ matrix.config.artifact }} + # asset_name: ${{ matrix.config.artifact }}.zip + # asset_content_type: application/zip diff --git a/.github/workflows/qmake.yml b/.github/workflows/qmake.yml deleted file mode 100644 index 2033c644..00000000 --- a/.github/workflows/qmake.yml +++ /dev/null @@ -1,488 +0,0 @@ -name: CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - - build-linux-qt5-15: - name: Linux Qt 5.15 build - runs-on: ubuntu-latest - env: - DISPLAY: ":1" - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-5-15 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/5.15.2 - key: ${{ runner.os }}-QtCache-Qt5 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '5.15.2' - host: 'linux' - target: 'desktop' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-5-15.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - name: Ubuntu and Qt version - run: | - cat /etc/issue - echo number of processors: $(nproc) - qmake -v - - name: qmake - run: qmake qskinny.pro - - name: make - run: make -j$(nproc) - - name: Smoke test - run: | - echo starting Xvfb - Xvfb :1 & - sleep 10 - echo starting iotdashboard - ./examples/bin/iotdashboard & - sleep 10 - echo taking screenshot - import -pause 1 -window root screenshot-linux-qt5-15.jpg - echo killing iotdashboard - killall iotdashboard - echo killing Xvfb - killall Xvfb - - name: Upload smoke test artifacts - uses: actions/upload-artifact@v2 - with: - name: screenshot-linux-qt5-15.jpg - path: screenshot-linux-qt5-15.jpg - - - build-linux-qt-lts: - name: Linux Qt 6.2 (LTS) build - runs-on: ubuntu-latest - env: - DISPLAY: ":1" - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-6-2 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/6.2.4 - key: ${{ runner.os }}-QtCache-Qt6-2 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '6.2.4' - host: 'linux' - target: 'desktop' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-6-2.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - name: Install needed xkbcommon symlink - run: sudo apt-get install libxkbcommon-dev -y - - name: Ubuntu and Qt version - run: | - cat /etc/issue - echo number of processors: $(nproc) - qmake -v - - name: qmake - run: qmake qskinny.pro - - name: make - run: make -j$(nproc) - - name: Smoke test - run: | - echo starting Xvfb - Xvfb :1 & - sleep 10 - echo starting gallery - ./examples/bin/gallery & - sleep 10 - echo taking screenshot - import -pause 1 -window root screenshot-linux-qt6-2.jpg - echo killing gallery - killall gallery - echo killing Xvfb - killall Xvfb - - name: Upload smoke test artifacts - uses: actions/upload-artifact@v2 - with: - name: screenshot-linux-qt6-2.jpg - path: screenshot-linux-qt6-2.jpg - - - build-linux-qt-current: - name: Linux Qt 6.4 (current) build - runs-on: ubuntu-latest - env: - DISPLAY: ":1" - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-6-4 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/6.4.1 - key: ${{ runner.os }}-QtCache-Qt6-4 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '6.4.1' - host: 'linux' - target: 'desktop' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-6-4.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - name: Install needed xkbcommon symlink - run: sudo apt-get install libxkbcommon-dev -y - - name: Ubuntu and Qt version - run: | - cat /etc/issue - echo number of processors: $(nproc) - qmake -v - - name: qmake - run: qmake qskinny.pro - - name: make - run: make -j$(nproc) - - name: Smoke test - run: | - echo starting Xvfb - Xvfb :1 & - sleep 10 - echo starting gallery - ./examples/bin/gallery & - sleep 10 - echo taking screenshot - import -pause 1 -window root screenshot-linux-qt6-4.jpg - echo killing gallery - killall gallery - echo killing Xvfb - killall Xvfb - - name: Upload smoke test artifacts - uses: actions/upload-artifact@v2 - with: - name: screenshot-linux-qt6-4.jpg - path: screenshot-linux-qt6-4.jpg - - - build-windows-qt5-15: - name: Windows Qt 5.15 build - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-5-15 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/5.15.2 - key: ${{ runner.os }}-QtCache-Qt5 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '5.15.2' - host: 'windows' - target: 'desktop' - arch: 'win64_msvc2019_64' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-5-15.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - uses: ilammy/msvc-dev-cmd@v1 - - - name: Windows and Qt version - run: | - systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List - qmake -v - - - name: qmake - run: qmake qskinny.pro - - - name: jom - run: | - Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip - unzip jom.zip - .\jom - - name: Smoke test - run: | - $Env:PATH += ";lib;plugins\skins" - echo "starting iotdashboard" - Start-Process .\examples\bin\iotdashboard -ArgumentList "-qwindowgeometry 1024x600+0+0" - Start-Sleep -s 10 - - uses: OrbitalOwen/desktop-screenshot-action@0.1 - with: - file-name: 'screenshot-windows-qt5-15.jpg' - - name: Cleanup smoke test - run: taskkill /IM iotdashboard.exe /T - - - build-windows-qt-lts: - name: Windows Qt 6.2 (LTS) build - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-6-2 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/6.2.4 - key: ${{ runner.os }}-QtCache-Qt6-2 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '6.2.4' - host: 'windows' - target: 'desktop' - arch: 'win64_msvc2019_64' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-6-2.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - uses: ilammy/msvc-dev-cmd@v1 - - - name: Windows and Qt version - run: | - systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List - qmake -v - - - name: qmake - run: qmake qskinny.pro - - - name: jom - run: | - Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip - unzip jom.zip - .\jom - - name: Smoke test - run: | - $Env:PATH += ";lib;plugins\skins" - echo "starting gallery" - Start-Process .\examples\bin\gallery -ArgumentList "-qwindowgeometry 1024x600+0+0" - Start-Sleep -s 10 - - uses: OrbitalOwen/desktop-screenshot-action@0.1 - with: - file-name: 'screenshot-windows-qt6-2.jpg' - - name: Cleanup smoke test - run: taskkill /IM gallery.exe /T - - - build-windows-qt-current: - name: Windows Qt 6.4 (current) build - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-6-4 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/6.4.1 - key: ${{ runner.os }}-QtCache-Qt6-4 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '6.4.1' - host: 'windows' - target: 'desktop' - arch: 'win64_msvc2019_64' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-6-4.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - uses: ilammy/msvc-dev-cmd@v1 - - - name: Windows and Qt version - run: | - systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List - qmake -v - - - name: qmake - run: qmake qskinny.pro - - - name: jom - run: | - Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip - unzip jom.zip - .\jom - - name: Smoke test - run: | - $Env:PATH += ";lib;plugins\skins" - echo "starting gallery" - Start-Process .\examples\bin\gallery -ArgumentList "-qwindowgeometry 1024x600+0+0" - Start-Sleep -s 10 - - uses: OrbitalOwen/desktop-screenshot-action@0.1 - with: - file-name: 'screenshot-windows-qt6-4.jpg' - - name: Cleanup smoke test - run: taskkill /IM gallery.exe /T - - - build-mac-qt5-15: - name: MacOS Qt 5.15 build - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-5-15 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/5.15.2 - key: ${{ runner.os }}-QtCache-Qt5 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '5.15.2' - host: 'mac' - target: 'desktop' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-5-15.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - name: MacOS and Qt version - run: | - sw_vers - echo number of processors: $(sysctl -n hw.ncpu) - qmake -v - - name: qmake - run: qmake qskinny.pro - - name: make - run: make -j$(sysctl -n hw.ncpu) - - name: Smoke test - run: | - DYLD_LIBRARY_PATH=./lib ./examples/bin/iotdashboard.app/Contents/MacOS/iotdashboard -qwindowgeometry 1024x600+75+100 & - sleep 10 - - uses: OrbitalOwen/desktop-screenshot-action@0.1 - with: - file-name: 'screenshot-macos-qt5-15.jpg' - - name: Cleanup smoke test - run: killall iotdashboard - - - build-mac-qt-lts: - name: MacOS Qt 6.2 (LTS) build - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-6-2 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/6.2.4 - key: ${{ runner.os }}-QtCache-Qt6-2 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '6.2.4' - host: 'mac' - target: 'desktop' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-6-2.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - name: MacOS and Qt version - run: | - sw_vers - echo number of processors: $(sysctl -n hw.ncpu) - qmake -v - - name: qmake - run: qmake qskinny.pro - - name: make - run: make -j$(sysctl -n hw.ncpu) - - name: Smoke test - run: | - DYLD_LIBRARY_PATH=./lib ./examples/bin/gallery.app/Contents/MacOS/gallery -qwindowgeometry 1024x600+75+100 & - sleep 10 - - uses: OrbitalOwen/desktop-screenshot-action@0.1 - with: - file-name: 'screenshot-macos-qt6-2.jpg' - - name: Cleanup smoke test - run: killall gallery - - build-mac-qt-current: - name: MacOS Qt 6.4 (current) build - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Cache Qt - id: cache-qt-6-4 - uses: actions/cache@v1 # not v2! - with: - path: ../Qt/6.4.1 - key: ${{ runner.os }}-QtCache-Qt6-4 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '6.4.1' - host: 'mac' - target: 'desktop' - install-deps: 'true' - modules: 'qtwebengine' - cached: ${{ steps.cache-qt-6-4.outputs.cache-hit }} - setup-python: 'true' - tools: '' - set-env: 'true' - tools-only: 'false' - - - name: MacOS and Qt version - run: | - sw_vers - echo number of processors: $(sysctl -n hw.ncpu) - qmake -v - - name: qmake - run: qmake qskinny.pro - - name: make - run: make -j$(sysctl -n hw.ncpu) - - name: Smoke test - run: | - DYLD_LIBRARY_PATH=./lib ./examples/bin/gallery.app/Contents/MacOS/gallery -qwindowgeometry 1024x600+75+100 & - sleep 10 - - uses: OrbitalOwen/desktop-screenshot-action@0.1 - with: - file-name: 'screenshot-macos-qt6-4.jpg' - - name: Cleanup smoke test - run: killall gallery diff --git a/.gitignore b/.gitignore index 6d51d27d..32698b35 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ qskinny.pro.user *.log html tags +.vscode diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..820b15c1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,118 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +cmake_minimum_required(VERSION 3.16.3) + +macro(qsk_setup_options) + + option(BUILD_PEDANTIC "Enable pedantic compile flags ( only GNU/CLANG )" OFF) + option(BUILD_QSKDLL "Build libs ( not plugins ) as shared library" ON) + option(BUILD_QML_EXPORT "Exporting QSkinny to QML" ON) + + option(BUILD_TOOLS "Build qskinny tools" ON) + option(BUILD_INPUTCONTEXT "Build virtual keyboard support" ON) + option(BUILD_EXAMPLES "Build qskinny examples" ON) + option(BUILD_PLAYGROUND "Build qskinny playground" ON) + + # we actually want to use cmake_dependent_option - minimum cmake version ?? + + option( BUILD_SVG2QVG_STANDALONE "Build svg2qvg without qskinny library dependency" ON ) + if( NOT BUILD_TOOLS ) + set( BUILD_SVG2QVG_STANDALONE OFF ) + endif() + + if( NOT BUILD_INPUTCONTEXT ) + set( ENABLE_PINYIN OFF ) + set( ENABLE_HUNSPELL OFF ) + endif() + + option(ENABLE_ENSURE_SKINS "Examples add skins manually, when not finding plugins" ON) + +endmacro() + +macro(qsk_setup_build) + + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTORCC ON) + set(CMAKE_AUTOUIC OFF) + set(CMAKE_GLOBAL_AUTOGEN_TARGET OFF) + set(AUTOGEN_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/autogen") + + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + + qsk_initialize_build_flags() + + if ( BUILD_PEDANTIC ) + message( STATUS "Setting pedantic compiler flags" ) + qsk_enable_pedantic_flags() + endif() + + # Loading individual settings from a file that is + # propagated by the environmant variable QSK_LOCAL_CMAKE_RULES + # This is a leftover from the previous qmake build environment. + # Let's if we can do this using cmake standard mechanisms TODO ... + + qsk_load_optional_build_flags() + + # Finalizing after processing QSK_LOCAL_CMAKE_RULES + qsk_finalize_build_flags() + +endmacro() + +macro(qsk_setup_install) + # we have to provide and install a QSkinnyConfig.cmake + # TODO ... +endmacro() + +############################################################################ +# QSkinny +############################################################################ + +project(QSkinny + LANGUAGES C CXX + HOMEPAGE_URL "https://github.com/uwerat/qskinny" + VERSION 0.8.0) + +qsk_setup_options() + +include(GNUInstallDirs) + +# loading helper macros +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +include("QskConfigMacros") +include("QskFindMacros") +include("QskBuildFunctions") + +qsk_setup_Qt() +qsk_setup_build() +qsk_setup_install() + +add_subdirectory(src) +add_subdirectory(skins) + +if(BUILD_QML_EXPORT) + add_subdirectory(qmlexport) +endif() + +if(BUILD_INPUTCONTEXT) + add_subdirectory(inputcontext) +endif() + +if(BUILD_EXAMPLES OR BUILD_PLAYGROUND) + add_subdirectory(support) +endif() + +if(BUILD_TOOLS) + add_subdirectory(tools) +endif() + +if(BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + +if(BUILD_PLAYGROUND) + add_subdirectory(playground) +endif() diff --git a/README.md b/README.md index 89e64fb8..8b6dae4d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ![](https://github.com/uwerat/qskinny/workflows/CI/badge.svg) +[![CMake Build Matrix](https://github.com/vrcomputing/qskinny/actions/workflows/cmake.yml/badge.svg)](https://github.com/vrcomputing/qskinny/actions/workflows/cmake.yml) + The (Q)Skinny library is a framework built on top of the Qt scene graph and very few core classes from Qt/Quick. It offers a set of lightweight controls, that can be used from C++ and/or QML. @@ -37,6 +39,10 @@ On debian bullseye these packages need to be installed: `build-essential qt-qmake qtbase5-dev qtbase5-private-dev qtdeclarative5-dev qtdeclarative5-private-dev libqt5svg5-dev`. +> Optional: When enabling the `hunspell` feature the following package needs to be installed: `libhunspell-dev` + +> Optional: When enabling the `pinyin` feature the following package needs to be installed: `libimepinyin-dev` + If you want to know more about QSkinny - or even like to give it a specific direction - please contact support@qskinny.org. diff --git a/cmake/ECMEnableSanitizers.cmake b/cmake/ECMEnableSanitizers.cmake new file mode 100644 index 00000000..dcdb8621 --- /dev/null +++ b/cmake/ECMEnableSanitizers.cmake @@ -0,0 +1,172 @@ +# SPDX-FileCopyrightText: 2014 Mathieu Tarral +# +# SPDX-License-Identifier: BSD-3-Clause + +#[=======================================================================[.rst: +ECMEnableSanitizers +------------------- + +Enable compiler sanitizer flags. + +The following sanitizers are supported: + +- Address Sanitizer +- Memory Sanitizer +- Thread Sanitizer +- Leak Sanitizer +- Undefined Behaviour Sanitizer + +All of them are implemented in Clang, depending on your version, and +there is an work in progress in GCC, where some of them are currently +implemented. + +This module will check your current compiler version to see if it +supports the sanitizers that you want to enable + +Usage +===== + +Simply add:: + + include(ECMEnableSanitizers) + +to your ``CMakeLists.txt``. Note that this module is included in +KDECompilerSettings, so projects using that module do not need to also +include this one. + +The sanitizers are not enabled by default. Instead, you must set +``ECM_ENABLE_SANITIZERS`` (either in your ``CMakeLists.txt`` or on the +command line) to a semicolon-separated list of sanitizers you wish to enable. +The options are: + +- address +- memory +- thread +- leak +- undefined +- fuzzer-no-link +- fuzzer + +The sanitizers "address", "memory" and "thread" are mutually exclusive. You +cannot enable two of them in the same build. + +"leak" requires the "address" sanitizer. + +.. note:: + + To reduce the overhead induced by the instrumentation of the sanitizers, it + is advised to enable compiler optimizations (``-O1`` or higher). + +Example +======= + +This is an example of usage:: + + mkdir build + cd build + cmake -DECM_ENABLE_SANITIZERS='address;leak;undefined' .. + +.. note:: + + Most of the sanitizers will require Clang. To enable it, use:: + + -DCMAKE_CXX_COMPILER=clang++ + +Since 1.3.0. +#]=======================================================================] + +# MACRO check_compiler_version +#----------------------------- +macro (check_compiler_version gcc_required_version clang_required_version msvc_required_version) + if ( + ( + CMAKE_CXX_COMPILER_ID MATCHES "GNU" + AND + CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_required_version} + ) + OR + ( + CMAKE_CXX_COMPILER_ID MATCHES "Clang" + AND + CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${clang_required_version} + ) + OR + ( + CMAKE_CXX_COMPILER_ID MATCHES "MSVC" + AND + CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${msvc_required_version} + ) + ) + # error ! + message(FATAL_ERROR "You ask to enable the sanitizer ${CUR_SANITIZER}, + but your compiler ${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION} + does not support it ! + You should use at least GCC ${gcc_required_version}, Clang ${clang_required_version} + or MSVC ${msvc_required_version} + (99.99 means not implemented yet)") + endif () +endmacro () + +# MACRO check_compiler_support +#------------------------------ +macro (enable_sanitizer_flags sanitize_option) + if (${sanitize_option} MATCHES "address") + check_compiler_version("4.8" "3.1" "19.28") + if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set(XSAN_COMPILE_FLAGS "-fsanitize=address") + else() + set(XSAN_COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls") + set(XSAN_LINKER_FLAGS "asan") + endif() + elseif (${sanitize_option} MATCHES "thread") + check_compiler_version("4.8" "3.1" "99.99") + set(XSAN_COMPILE_FLAGS "-fsanitize=thread") + set(XSAN_LINKER_FLAGS "tsan") + elseif (${sanitize_option} MATCHES "memory") + check_compiler_version("99.99" "3.1" "99.99") + set(XSAN_COMPILE_FLAGS "-fsanitize=memory") + elseif (${sanitize_option} MATCHES "leak") + check_compiler_version("4.9" "3.4" "99.99") + set(XSAN_COMPILE_FLAGS "-fsanitize=leak") + set(XSAN_LINKER_FLAGS "lsan") + elseif (${sanitize_option} MATCHES "undefined") + check_compiler_version("4.9" "3.1" "99.99") + set(XSAN_COMPILE_FLAGS "-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-omit-frame-pointer -fno-optimize-sibling-calls") + elseif (${sanitize_option} MATCHES "fuzzer-no-link") + check_compiler_version("99.99" "6.0" "99.99") + set(XSAN_COMPILE_FLAGS "-fsanitize=fuzzer-no-link") + set(XSAN_LINKER_FLAGS "-fsanitize=fuzzer-no-link") + elseif (${sanitize_option} MATCHES "fuzzer") + check_compiler_version("99.99" "6.0" "99.99") + set(XSAN_COMPILE_FLAGS "-fsanitize=fuzzer") + else () + message(FATAL_ERROR "Compiler sanitizer option \"${sanitize_option}\" not supported.") + endif () +endmacro () + +if (ECM_ENABLE_SANITIZERS) + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + # for each element of the ECM_ENABLE_SANITIZERS list + foreach ( CUR_SANITIZER ${ECM_ENABLE_SANITIZERS} ) + # lowercase filter + string(TOLOWER ${CUR_SANITIZER} CUR_SANITIZER) + # check option and enable appropriate flags + enable_sanitizer_flags ( ${CUR_SANITIZER} ) + # TODO: GCC will not link pthread library if enabled ASan + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XSAN_COMPILE_FLAGS}" ) + endif() + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XSAN_COMPILE_FLAGS}" ) + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + link_libraries(${XSAN_LINKER_FLAGS}) + endif() + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") + endif () + endforeach() + else() + message(STATUS "Tried to enable sanitizers (-DECM_ENABLE_SANITIZERS=${ECM_ENABLE_SANITIZERS}), \ +but compiler (${CMAKE_CXX_COMPILER_ID}) does not have sanitizer support") + endif() +endif() diff --git a/cmake/QskBuildFunctions.cmake b/cmake/QskBuildFunctions.cmake new file mode 100644 index 00000000..34734bf1 --- /dev/null +++ b/cmake/QskBuildFunctions.cmake @@ -0,0 +1,101 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +function(qsk_add_executable target) + + if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) + qt6_add_executable(${ARGV}) + else() + add_executable(${ARGV}) + endif() + + set_target_properties(${target} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) + +endfunction() + +function(qsk_add_library target) + + if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) + qt6_add_library(${ARGV}) + else() + add_library(${ARGV}) + endif() + + set_target_properties(${target} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) + +endfunction() + +function(qsk_add_plugin target TYPE CLASS_NAME) + + cmake_parse_arguments(PARSE_ARGV 3 arg "MANUAL_FINALIZATION" "" "") + + # qt6_add_plugin calls add_library as MODULE - even when SHARED + # is requested. In general this ould be the correct type for plugins - + # however we also want to link the plugin when ENABLE_ENSURE_SKINS + # is enabled. + # Probably the correct solution would be to put the implemetation of + # the skins into a regular lib and the plugins would contain + # the factories only. TODO ... + # So for the moment better don't do: + # qt6_add_plugin(${target} SHARED ${CLASS_NAME} ) + + if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) + qt6_add_library(${target} SHARED ) + else() + add_library(${target} SHARED ) + endif() + + set_target_properties(${target} PROPERTIES + QT_PLUGIN_CLASS_NAME ${CLASS_NAME} ) + + target_compile_definitions(${target} PRIVATE QT_PLUGIN ) + + target_sources( ${target} PRIVATE ${arg_UNPARSED_ARGUMENTS} ) + target_link_libraries(${target} PRIVATE qskinny) + + set_target_properties(${target} PROPERTIES FOLDER ${TYPE}) + + # the plugin has to go to .../plugins/${TYPE}/ + # otherwise it won't be found at runtime ... + + set_target_properties( ${target} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/${TYPE}) + + install(TARGETS ${target} DESTINATION "plugins/${TYPE}" ) + set_target_properties(${target} PROPERTIES + INSTALL_RPATH "\${ORIGIN}/../../lib" ) + +endfunction() + +function(qsk_add_example target) + + cmake_parse_arguments(PARSE_ARGV 1 arg "MANUAL_FINALIZATION" "" "") + + qsk_add_executable(${target} WIN32 MACOSX_BUNDLE ${arg_UNPARSED_ARGUMENTS} ) + + set_target_properties(${target} PROPERTIES FOLDER examples) + + set_target_properties(${target} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../bin ) + + target_link_libraries(${target} PRIVATE qskinny ) + + # not all examples need this one. TODO ... + target_link_libraries(${target} PRIVATE qsktestsupport) + + if( BUILD_QML_EXPORT ) + # Only needed, when having QML files. Autodetections is possible + # by looking into all '*.qrc' files ( rcc --list *.qrc ) for *.qml + # entries TODO ... + + target_link_libraries(${target} PRIVATE qskqmlexport) + endif() + + # for examples with subdirectories + target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_LIST_DIR}) + +endfunction() diff --git a/cmake/QskConfigMacros.cmake b/cmake/QskConfigMacros.cmake new file mode 100644 index 00000000..14d28255 --- /dev/null +++ b/cmake/QskConfigMacros.cmake @@ -0,0 +1,165 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +macro(qsk_load_optional_build_flags) + + if( DEFINED ENV{QSK_LOCAL_CMAKE_RULES} ) + + # When not working with the Qt/Creator it is often more convenient + # to include the specific options of your local build, than passing + # them all on the command line + + set(LOCAL_RULES $ENV{QSK_LOCAL_CMAKE_RULES}) + + if(NOT "${LOCAL_RULES}" STREQUAL "") + + if(EXISTS ${LOCAL_RULES}) + message(STATUS "Loading build options from: ${LOCAL_RULES}") + include(${LOCAL_RULES}) + else() + message(Warning "Loading build options from: ${LOCAL_RULES}" - Failed) + endif() + + endif() + + endif() + +endmacro() + +macro(qsk_enable_pedantic_flags) + + if(QT_VERSION_MAJOR VERSION_EQUAL 5) + add_compile_definitions(QT_STRICT_ITERATORS) + endif() + + # note: setting CMAKE_CXX_COMPILER without CMAKE_CXX_COMPILER_ID + # will fail here + + if ( ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) + OR ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) ) + + add_compile_options( -pedantic) + add_compile_options( -pedantic-errors) + + add_compile_options( -Wformat -Werror=format-security) + add_compile_options( -Wsuggest-override) + + add_compile_options( -Wextra-semi ) + add_compile_options( -Winline ) + + add_compile_options( -Wmissing-declarations ) + add_compile_options( -Wredundant-decls ) + + add_compile_options( -Wnon-virtual-dtor ) + add_compile_options( -Woverloaded-virtual ) + add_compile_options( -Wfloat-equal ) + + if ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) + + add_compile_options( -Wsuggest-attribute=pure) + add_compile_options( -Wsuggest-attribute=const) + add_compile_options( -Wsuggest-attribute=noreturn) + add_compile_options( -Wsuggest-attribute=malloc) + add_compile_options( -Wsuggest-final-types) + add_compile_options( -Wsuggest-final-methods) + + add_compile_options( -Wduplicated-branches ) + add_compile_options( -Wduplicated-cond ) + add_compile_options( -Wshadow=local) + + # we have a lot of useless casts, when qreal is a double, + # that are needed when qreal is a float. + + # add_compile_options( -Wuseless-cast ) + + add_compile_options( -Wlogical-op) + add_compile_options( -Wclass-memaccess ) + + elseif ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) + + add_compile_options( -Weverything) + add_compile_options( -Wno-c++98-compat) + add_compile_options( -Wno-c++98-compat-pedantic ) + add_compile_options( -Wno-global-constructors ) + + # We have a lot of dummy destructors with the intention to + # - a breakpoint for the debugger + # - being able to add some debug statements without recompiling + # - preparation for binary compatible changes + # Needs to be reconsidered: TODO ... + add_compile_options( -Wno-deprecated-copy-with-user-provided-dtor ) + + add_compile_options( -Wno-signed-enum-bitfield ) + add_compile_options( -Wno-padded ) + + # since Qt 6.3 Q_GLOBAL_STATIC seems to use what is not supported for < c++20 + add_compile_options( -Wno-gnu-zero-variadic-macro-arguments ) + endif() + endif() + +endmacro() + +macro(qsk_initialize_build_flags) + + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + + set(CMAKE_C_VISIBILITY_PRESET hidden) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + + add_compile_definitions(QT_NO_KEYWORDS) + # add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x000000) + + if ( NOT MSVC ) + add_compile_options( -Wall -Wextra ) + else() + add_compile_options(/W4 /WX) + endif() + +endmacro() + +macro(qsk_finalize_build_flags) + + message( STATUS "Build Type: ${CMAKE_BUILD_TYPE}" ) + + if (CMAKE_BUILD_TYPE MATCHES Debug) + add_compile_definitions(ITEM_STATISTICS=1) + endif() + + if( (CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU") ) + + if (CMAKE_BUILD_TYPE MATCHES Debug) + add_compile_options(-O0) + else() + add_compile_options(-O3) + endif() + + add_compile_options(-ffast-math) + + endif() + + + if ( NOT "${ECM_ENABLE_SANITIZERS}" STREQUAL "") + + # see: https://api.kde.org/ecm/module/ECMEnableSanitizers.html + # + # a semicolon-separated list of sanitizers: + # - address + # - memory + # - thread + # - leak + # - undefined + # - fuzzer + # + # where “address”, “memory” and “thread” are mutually exclusive + # f.e: set(ECM_ENABLE_SANITIZERS address;leak;undefined) + + include(ECMEnableSanitizers) + + endif() + +endmacro() diff --git a/cmake/QskFindMacros.cmake b/cmake/QskFindMacros.cmake new file mode 100644 index 00000000..a5b0ba36 --- /dev/null +++ b/cmake/QskFindMacros.cmake @@ -0,0 +1,119 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +macro(qsk_setup_Qt) + + # Often users have several Qt installations on their system and + # need to be able to explicitly the one to be used. Let's see if + # standard cmake features are good enough or if we need to introduce + # something sort of additional option. TODO ... + + find_package(QT "5.15" NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick) + + if ( QT_FOUND ) + + # Would like to have a status message about where the Qt installation + # has been found without having the mess of CMAKE_FIND_DEBUG_MODE + # With Qt6 there seems to be: _qt_cmake_dir + + message(STATUS "Found Qt ${QT_VERSION} ${_qt_cmake_dir}") + else() + message(FATAL_ERROR "Couldn't find any Qt package !") + endif() + + # Using find_package is probably no good idea as all other Qt modules should + # be located below ${_qt_cmake_dir}. Otherwise we might end up with modules + # from different packages. TODO ... + + if( BUILD_TOOLS ) + # needed for building the svg2qvg tool + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Svg) + endif() + + if( BUILD_EXAMPLES OR BUILD_PLAYGROUND ) + # On embedded systems you often find optimized Qt installations without + # Qt/Widgets support. QSkinny itself does not need Qt/Widgets - however + # playground/grids demonstrates the differences between the various + # grid layouts. So no big deal when it is missing. + + find_package(Qt${QT_VERSION_MAJOR} QUIET OPTIONAL_COMPONENTS QuickWidgets) + if (NOT Qt${QT_VERSION_MAJOR}QuickWidgets_FOUND) + message(STATUS "No Qt/Quick Widgets support: skipping some unimportant examples") + endif() + endif() + + if(BUILD_PLAYGROUND) + # When building Qt most of the time is spent on the WebEngine modules + # while only few applications need it. So it is a common situation to + # have Qt installations without. + # playground/webview shows how to use the Qt/Quick frontend from + # C++, but QSkinny itself does not need the WebEngine at all. + + if (QT_VERSION_MAJOR VERSION_LESS 6) + find_package(Qt${QT_VERSION_MAJOR} QUIET OPTIONAL_COMPONENTS WebEngine) + set( Qt5WebEngineQuick_FOUND ${Qt5WebEngine_FOUND} ) + else() + find_package(Qt${QT_VERSION_MAJOR} QUIET + OPTIONAL_COMPONENTS WebEngineCore WebEngineQuick) + endif() + + if( NOT Qt${QT_VERSION_MAJOR}WebEngineQuick_FOUND) + message(STATUS "No Qt/Quick WebEngine support: skipping some unimportant examples") + endif() + endif() +endmacro() + +macro(qsk_setup_Hunspell) + + find_package(PkgConfig) + + pkg_check_modules(hunspell hunspell IMPORTED_TARGET) + set(package_name "PkgConfig::hunspell") + + if (NOT TARGET "${package_name}") + set(Hunspell_FOUND 0) + return() + endif() + + add_library(Hunspell::Hunspell INTERFACE IMPORTED) + target_link_libraries(Hunspell::Hunspell INTERFACE ${package_name}) + unset(package_name) + + set(Hunspell_FOUND TRUE) + +endmacro() + +macro(qsk_setup_Pinyin) + + # does this code work ???? + + find_package(PkgConfig) + pkg_check_modules(PKG_PINYIN QUIET pinyin) + + find_path(PINYIN_INCLUDE_DIRS + NAMES pinyinime.h + PATH_SUFFIXES pinyin LibIME LibIME/libime/pinyin + HINTS ${PKG_PINYIN_INCLUDE_DIRS}) + + find_library(PINYIN_LIBRARIES + NAMES ${PKG_PINYIN_LIBRARIES} IMEPinyin imepinyin ime libime libimepinyin + HINTS ${PKG_PINYIN_LIBRARY_DIRS}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(PINYIN + REQUIRED_VARS PINYIN_LIBRARIES PINYIN_INCLUDE_DIRS + VERSION_VAR PKG_PINYIN_VERSION) + + mark_as_advanced(PINYIN_INCLUDE_DIRS PINYIN_LIBRARIES) + + add_library(pinyin SHARED IMPORTED GLOBAL) + set_target_properties(pinyin PROPERTIES IMPORTED_LOCATION ${PINYIN_LIBRARIES}) + + target_include_directories(pinyin INTERFACE ${PINYIN_INCLUDE_DIRS}) + + find_package(LibIMEPinyin REQUIRED) + find_package(Fcitx5Utils REQUIRED) + +endmacro() diff --git a/cmake/QskTools.cmake b/cmake/QskTools.cmake new file mode 100644 index 00000000..f5705909 --- /dev/null +++ b/cmake/QskTools.cmake @@ -0,0 +1,18 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +## @param SVG_FILENAME absolute filename to the svg +## @param QVG_FILENAME absolute filename to the qvg +function(qsk_svg2qvg SVG_FILENAME QVG_FILENAME) + get_filename_component(QVG_FILENAME ${QVG_FILENAME} ABSOLUTE) + get_filename_component(SVG_FILENAME ${SVG_FILENAME} ABSOLUTE) + add_custom_command( + COMMAND svg2qvg ${SVG_FILENAME} ${QVG_FILENAME} + OUTPUT ${QVG_FILENAME} + DEPENDS ${SVG_FILENAME} + WORKING_DIRECTORY $ + COMMENT "Compiling ${SVG_FILENAME} to ${QVG_FILENAME}") +endfunction() + diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 00000000..5b0a8d80 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,23 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +add_subdirectory(desktop) +add_subdirectory(gallery) +add_subdirectory(layouts) +add_subdirectory(listbox) +add_subdirectory(messagebox) +add_subdirectory(mycontrols) +add_subdirectory(qvgviewer) +add_subdirectory(thumbnails) +add_subdirectory(tabview) +add_subdirectory(iotdashboard) + +if( BUILD_QML_EXPORT ) + add_subdirectory(boxes) + add_subdirectory(buttons) + add_subdirectory(frames) + add_subdirectory(glabels) + add_subdirectory(messageboxQml) +endif() diff --git a/examples/boxes/CMakeLists.txt b/examples/boxes/CMakeLists.txt new file mode 100644 index 00000000..f77c5bcf --- /dev/null +++ b/examples/boxes/CMakeLists.txt @@ -0,0 +1,6 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(boxes Box.h Box.cpp main.cpp) diff --git a/examples/boxes/boxes.pro b/examples/boxes/boxes.pro deleted file mode 100644 index c35431b7..00000000 --- a/examples/boxes/boxes.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - Box.h - -SOURCES += \ - Box.cpp \ - main.cpp diff --git a/examples/buttons/CMakeLists.txt b/examples/buttons/CMakeLists.txt new file mode 100644 index 00000000..88c9d477 --- /dev/null +++ b/examples/buttons/CMakeLists.txt @@ -0,0 +1,9 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES main.cpp) +qt_add_resources(SOURCES buttons.qrc) + +qsk_add_example(buttons ${SOURCES}) diff --git a/examples/buttons/buttons.pro b/examples/buttons/buttons.pro deleted file mode 100644 index c8fe49fb..00000000 --- a/examples/buttons/buttons.pro +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG += qskexample qskqmlexport - -RESOURCES += \ - buttons.qrc - -SOURCES += \ - main.cpp diff --git a/examples/desktop/CMakeLists.txt b/examples/desktop/CMakeLists.txt new file mode 100644 index 00000000..54b495c5 --- /dev/null +++ b/examples/desktop/CMakeLists.txt @@ -0,0 +1,6 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(desktop main.cpp) diff --git a/examples/desktop/desktop.pro b/examples/desktop/desktop.pro deleted file mode 100644 index 0a7f08c9..00000000 --- a/examples/desktop/desktop.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += qskexample - -SOURCES += \ - main.cpp diff --git a/examples/examples.pro b/examples/examples.pro deleted file mode 100644 index 935bc124..00000000 --- a/examples/examples.pro +++ /dev/null @@ -1,22 +0,0 @@ -TEMPLATE = subdirs - -# c++ -SUBDIRS += \ - desktop \ - gallery \ - layouts \ - listbox \ - messagebox \ - mycontrols \ - qvgviewer \ - thumbnails \ - tabview \ - iotdashboard - -# qml -SUBDIRS += \ - boxes \ - buttons \ - frames \ - glabels \ - messageboxQml diff --git a/examples/frames/CMakeLists.txt b/examples/frames/CMakeLists.txt new file mode 100644 index 00000000..bdfaaee8 --- /dev/null +++ b/examples/frames/CMakeLists.txt @@ -0,0 +1,10 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES Frame.h Frame.cpp main.cpp) +qt_add_resources(SOURCES frames.qrc) + +qsk_add_example(frames ${SOURCES}) + diff --git a/examples/frames/frames.pro b/examples/frames/frames.pro deleted file mode 100644 index 7286be02..00000000 --- a/examples/frames/frames.pro +++ /dev/null @@ -1,11 +0,0 @@ -CONFIG += qskexample qskqmlexport - -RESOURCES += \ - frames.qrc - -HEADERS += \ - Frame.h - -SOURCES += \ - Frame.cpp \ - main.cpp diff --git a/examples/gallery/CMakeLists.txt b/examples/gallery/CMakeLists.txt new file mode 100644 index 00000000..dd837b0f --- /dev/null +++ b/examples/gallery/CMakeLists.txt @@ -0,0 +1,19 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES + label/LabelPage.h label/LabelPage.cpp + inputs/InputPage.h inputs/InputPage.cpp + progressbar/ProgressBarPage.h progressbar/ProgressBarPage.cpp + button/ButtonPage.h button/ButtonPage.cpp + selector/SelectorPage.h selector/SelectorPage.cpp + dialog/DialogPage.h dialog/DialogPage.cpp + Page.h Page.cpp + main.cpp +) +qt_add_resources(SOURCES icons.qrc) + +qsk_add_example(gallery ${SOURCES}) + diff --git a/examples/gallery/gallery.pro b/examples/gallery/gallery.pro deleted file mode 100644 index 435dbf4c..00000000 --- a/examples/gallery/gallery.pro +++ /dev/null @@ -1,23 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - label/LabelPage.h \ - inputs/InputPage.h \ - progressbar/ProgressBarPage.h \ - button/ButtonPage.h \ - selector/SelectorPage.h \ - dialog/DialogPage.h \ - Page.h - -SOURCES += \ - label/LabelPage.cpp \ - inputs/InputPage.cpp \ - progressbar/ProgressBarPage.cpp \ - button/ButtonPage.cpp \ - selector/SelectorPage.cpp \ - dialog/DialogPage.cpp \ - Page.cpp \ - main.cpp - -RESOURCES += \ - icons.qrc diff --git a/examples/glabels/CMakeLists.txt b/examples/glabels/CMakeLists.txt new file mode 100644 index 00000000..f4462ee8 --- /dev/null +++ b/examples/glabels/CMakeLists.txt @@ -0,0 +1,9 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES main.cpp) +qt_add_resources(SOURCES glabels.qrc) + +qsk_add_example(glabels ${SOURCES}) diff --git a/examples/glabels/glabels.pro b/examples/glabels/glabels.pro deleted file mode 100644 index b453e68d..00000000 --- a/examples/glabels/glabels.pro +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG += qskexample qskqmlexport - -RESOURCES += \ - glabels.qrc - -SOURCES += \ - main.cpp diff --git a/examples/iotdashboard/CMakeLists.txt b/examples/iotdashboard/CMakeLists.txt new file mode 100644 index 00000000..81f4ef27 --- /dev/null +++ b/examples/iotdashboard/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES + Box.h Box.cpp + BoxWithButtons.h BoxWithButtons.cpp + CircularProgressBar.h CircularProgressBar.cpp + CircularProgressBarSkinlet.h CircularProgressBarSkinlet.cpp + Diagram.h Diagram.cpp + DiagramSkinlet.h DiagramSkinlet.cpp + EnergyMeter.h EnergyMeter.cpp + GraphicProvider.h GraphicProvider.cpp + GridBox.h GridBox.cpp + LightDisplaySkinlet.h LightDisplaySkinlet.cpp + LightDisplay.h LightDisplay.cpp + DashboardPage.h DashboardPage.cpp + DevicesPage.h DevicesPage.cpp + MainItem.h MainItem.cpp + MainWindow.h MainWindow.cpp + MembersPage.h MembersPage.cpp + MenuBar.h MenuBar.cpp + MyDevices.h MyDevices.cpp + RoomsPage.h RoomsPage.cpp + RoundedIcon.h RoundedIcon.cpp + Skin.h Skin.cpp + StatisticsPage.h StatisticsPage.cpp + TopBar.h TopBar.cpp + RoundButton.h RoundButton.cpp + UsageBox.h UsageBox.cpp + UsageDiagram.h UsageDiagram.cpp + StoragePage.h StoragePage.cpp + StorageMeter.h StorageMeter.cpp + StorageBar.h StorageBar.cpp + StorageBarSkinlet.h StorageBarSkinlet.cpp + nodes/DiagramDataNode.h nodes/DiagramDataNode.cpp + nodes/DiagramSegmentsNode.h nodes/DiagramSegmentsNode.cpp + nodes/RadialTickmarksNode.cpp nodes/RadialTickmarksNode.h + main.cpp +) +qt_add_resources(SOURCES images.qrc fonts.qrc) + +qsk_add_example(iotdashboard ${SOURCES}) diff --git a/examples/iotdashboard/iotdashboard.pro b/examples/iotdashboard/iotdashboard.pro deleted file mode 100644 index 5c7dc598..00000000 --- a/examples/iotdashboard/iotdashboard.pro +++ /dev/null @@ -1,80 +0,0 @@ -CONFIG += qskexample - -SOURCES += \ - Box.cpp \ - BoxWithButtons.cpp \ - CircularProgressBar.cpp \ - CircularProgressBarSkinlet.cpp \ - DashboardPage.cpp \ - DevicesPage.cpp \ - Diagram.cpp \ - DiagramSkinlet.cpp \ - EnergyMeter.cpp \ - GraphicProvider.cpp \ - GridBox.cpp \ - LightDisplaySkinlet.cpp \ - LightDisplay.cpp \ - MainItem.cpp \ - MainWindow.cpp \ - MenuBar.cpp \ - MembersPage.cpp \ - MyDevices.cpp \ - RoomsPage.cpp \ - RoundedIcon.cpp \ - Skin.cpp \ - StatisticsPage.cpp \ - TopBar.cpp \ - RoundButton.cpp \ - UsageBox.cpp \ - UsageDiagram.cpp \ - StoragePage.cpp \ - StorageMeter.cpp \ - StorageBar.cpp \ - StorageBarSkinlet.cpp \ - main.cpp \ - -SOURCES += \ - nodes/DiagramDataNode.cpp \ - nodes/DiagramSegmentsNode.cpp \ - nodes/RadialTickmarksNode.cpp - -HEADERS += \ - Box.h \ - BoxWithButtons.h \ - CircularProgressBar.h \ - CircularProgressBarSkinlet.h \ - Diagram.h \ - DiagramSkinlet.h \ - EnergyMeter.h \ - GraphicProvider.h \ - GridBox.h \ - LightDisplaySkinlet.h \ - LightDisplay.h \ - DashboardPage.h \ - DevicesPage.h \ - MainItem.h \ - MainWindow.h \ - MembersPage.h \ - MenuBar.h \ - MyDevices.h \ - RoomsPage.h \ - RoundedIcon.h \ - Skin.h \ - StatisticsPage.h \ - TopBar.h \ - RoundButton.h \ - UsageBox.h \ - UsageDiagram.h \ - StoragePage.h \ - StorageMeter.h \ - StorageBar.h \ - StorageBarSkinlet.h \ - -HEADERS += \ - nodes/DiagramDataNode.h \ - nodes/DiagramSegmentsNode.h \ - nodes/RadialTickmarksNode.h - -RESOURCES += \ - images.qrc \ - fonts.qrc diff --git a/examples/iotdashboard/main.cpp b/examples/iotdashboard/main.cpp index 78b71d87..dbd4f5ee 100644 --- a/examples/iotdashboard/main.cpp +++ b/examples/iotdashboard/main.cpp @@ -7,7 +7,9 @@ #include "GraphicProvider.h" #include "Skin.h" +#ifdef USE_SHORTCUTS #include +#endif #include #include @@ -17,6 +19,7 @@ #include #include +#include namespace { @@ -75,13 +78,26 @@ int main( int argc, char* argv[] ) qskSetup->setSkin( "DaytimeSkin" ); +#ifdef USE_SHORTCUTS // With CTRL-B you can rotate a couple of visual debug modes SkinnyShortcut::enable( SkinnyShortcut::RotateSkin | SkinnyShortcut::DebugBackground | SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit ); +#endif MainWindow window; window.show(); + for( int i = 1; i < argc; i++ ) + { + if( argv[i] == QStringLiteral("--screenshot") && i + 1 < argc ) + { + QTimer::singleShot( 500, &window, [&app, &window, filename = QString(argv[i + 1])]() + { auto image = window.grabWindow(); image.save(filename); } ); + + break; + } + } + return app.exec(); } diff --git a/examples/layouts/CMakeLists.txt b/examples/layouts/CMakeLists.txt new file mode 100644 index 00000000..bfbbe041 --- /dev/null +++ b/examples/layouts/CMakeLists.txt @@ -0,0 +1,18 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES + TestRectangle.h TestRectangle.cpp + ButtonBox.h ButtonBox.cpp + FlowLayoutPage.h FlowLayoutPage.cpp + GridLayoutPage.h GridLayoutPage.cpp + LinearLayoutPage.h LinearLayoutPage.cpp + DynamicConstraintsPage.h DynamicConstraintsPage.cpp + StackLayoutPage.h StackLayoutPage.cpp + main.cpp +) +qt_add_resources(SOURCES layouts.qrc) + +qsk_add_example(layouts ${SOURCES}) diff --git a/examples/layouts/layouts.pro b/examples/layouts/layouts.pro deleted file mode 100644 index 5ce8b85c..00000000 --- a/examples/layouts/layouts.pro +++ /dev/null @@ -1,23 +0,0 @@ -CONFIG += qskexample qskqmlexport - -RESOURCES += \ - layouts.qrc - -HEADERS += \ - TestRectangle.h \ - ButtonBox.h \ - FlowLayoutPage.h \ - GridLayoutPage.h \ - LinearLayoutPage.h \ - DynamicConstraintsPage.h \ - StackLayoutPage.h - -SOURCES += \ - TestRectangle.cpp \ - ButtonBox.cpp \ - FlowLayoutPage.cpp \ - GridLayoutPage.cpp \ - LinearLayoutPage.cpp \ - DynamicConstraintsPage.cpp \ - StackLayoutPage.cpp \ - main.cpp diff --git a/examples/listbox/CMakeLists.txt b/examples/listbox/CMakeLists.txt new file mode 100644 index 00000000..e6a002e6 --- /dev/null +++ b/examples/listbox/CMakeLists.txt @@ -0,0 +1,6 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(listbox main.cpp) diff --git a/examples/listbox/listbox.pro b/examples/listbox/listbox.pro deleted file mode 100644 index 0a7f08c9..00000000 --- a/examples/listbox/listbox.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += qskexample - -SOURCES += \ - main.cpp diff --git a/examples/messagebox/CMakeLists.txt b/examples/messagebox/CMakeLists.txt new file mode 100644 index 00000000..3ff79c51 --- /dev/null +++ b/examples/messagebox/CMakeLists.txt @@ -0,0 +1,6 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(messagebox main.cpp) diff --git a/examples/messagebox/messagebox.pro b/examples/messagebox/messagebox.pro deleted file mode 100644 index 0a7f08c9..00000000 --- a/examples/messagebox/messagebox.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += qskexample - -SOURCES += \ - main.cpp diff --git a/examples/messageboxQml/CMakeLists.txt b/examples/messageboxQml/CMakeLists.txt new file mode 100644 index 00000000..ce4c7c30 --- /dev/null +++ b/examples/messageboxQml/CMakeLists.txt @@ -0,0 +1,9 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES main.cpp) +qt_add_resources(SOURCES messagebox.qrc) + +qsk_add_example(messageboxQml ${SOURCES}) diff --git a/examples/messageboxQml/messageboxQml.pro b/examples/messageboxQml/messageboxQml.pro deleted file mode 100644 index bdcd2d9b..00000000 --- a/examples/messageboxQml/messageboxQml.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += qskexample -CONFIG += qskqmlexport - -RESOURCES += \ - messagebox.qrc - -SOURCES += \ - main.cpp diff --git a/examples/mycontrols/CMakeLists.txt b/examples/mycontrols/CMakeLists.txt new file mode 100644 index 00000000..b0b94e37 --- /dev/null +++ b/examples/mycontrols/CMakeLists.txt @@ -0,0 +1,11 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(mycontrols + MySkin.h MySkin.cpp + MyToggleButton.h MyToggleButton.cpp + MyToggleButtonSkinlet.h MyToggleButtonSkinlet.cpp + main.cpp +) diff --git a/examples/mycontrols/mycontrols.pro b/examples/mycontrols/mycontrols.pro deleted file mode 100644 index ac6892b5..00000000 --- a/examples/mycontrols/mycontrols.pro +++ /dev/null @@ -1,12 +0,0 @@ -CONFIG += qskexample - -SOURCES += \ - MySkin.cpp \ - MyToggleButton.cpp \ - MyToggleButtonSkinlet.cpp \ - main.cpp - -HEADERS += \ - MyToggleButton.h \ - MyToggleButtonSkinlet.h \ - MySkin.h diff --git a/examples/qvgviewer/CMakeLists.txt b/examples/qvgviewer/CMakeLists.txt new file mode 100644 index 00000000..95d92215 --- /dev/null +++ b/examples/qvgviewer/CMakeLists.txt @@ -0,0 +1,9 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES MainWindow.h MainWindow.cpp main.cpp) +qt_add_resources(SOURCES qvgviewer.qrc) + +qsk_add_example(qvgviewer ${SOURCES}) diff --git a/examples/qvgviewer/qvgviewer.pro b/examples/qvgviewer/qvgviewer.pro deleted file mode 100644 index d2c05ec5..00000000 --- a/examples/qvgviewer/qvgviewer.pro +++ /dev/null @@ -1,34 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - MainWindow.h - -SOURCES += \ - MainWindow.cpp \ - main.cpp - -# CONFIG += autoqvg - -autoqvg { - - CONFIG += qskqvg - - QVGRESOURCES += \ - qvgviewer.qrc - - SVGSOURCES = \ - svg/01.01.10.svg \ - svg/01.03.04q.svg \ - svg/01.08.05q.svg \ - svg/01.25.18.svg - -} else { - - # When cross compiling we need to have the svg2qvg tool being - # compiled for the build environment - not for the one of the target. - # So we better have precompiled qvg files in the repository to - # make the build process much easier - - RESOURCES += \ - qvgviewer.qrc -} diff --git a/examples/tabview/CMakeLists.txt b/examples/tabview/CMakeLists.txt new file mode 100644 index 00000000..d8b79eee --- /dev/null +++ b/examples/tabview/CMakeLists.txt @@ -0,0 +1,11 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(tabview + CustomSlider.h CustomSlider.cpp + CustomSliderSkinlet.h CustomSliderSkinlet.cpp + OtherSlider.h OtherSlider.cpp + main.cpp +) diff --git a/examples/tabview/tabview.pro b/examples/tabview/tabview.pro deleted file mode 100644 index dbef219c..00000000 --- a/examples/tabview/tabview.pro +++ /dev/null @@ -1,12 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - CustomSlider.h \ - CustomSliderSkinlet.h \ - OtherSlider.h \ - -SOURCES += \ - CustomSlider.cpp \ - CustomSliderSkinlet.cpp \ - OtherSlider.cpp \ - main.cpp diff --git a/examples/thumbnails/CMakeLists.txt b/examples/thumbnails/CMakeLists.txt new file mode 100644 index 00000000..33145919 --- /dev/null +++ b/examples/thumbnails/CMakeLists.txt @@ -0,0 +1,6 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(thumbnails main.cpp) diff --git a/examples/thumbnails/thumbnails.pro b/examples/thumbnails/thumbnails.pro deleted file mode 100644 index 0a7f08c9..00000000 --- a/examples/thumbnails/thumbnails.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += qskexample - -SOURCES += \ - main.cpp diff --git a/features/default_post.prf b/features/default_post.prf deleted file mode 100644 index ae6a2573..00000000 --- a/features/default_post.prf +++ /dev/null @@ -1,36 +0,0 @@ -load(default_post) - -equals(TEMPLATE, lib) { - - plugin { - - !isEmpty( QSK_PLUGIN_SUBDIR ) { - - DESTDIR = $${QSK_PLUGIN_DIR}/$${QSK_PLUGIN_SUBDIR} - } - - darwin { - # Add install name to all libraries, including plugins - LIBS += -Wl,-install_name,@rpath/lib$${TARGET}.dylib - } - } - else { - - DESTDIR = $${QSK_LIB_DIR} - } - - unix { - - VERSION = $${QSK_VERSION} - } - - contains(QSK_CONFIG, QskDll) { - - CONFIG += dll - DEFINES += QSK_DLL - } - else { - CONFIG += staticlib - } -} - diff --git a/features/default_pre.prf b/features/default_pre.prf deleted file mode 100644 index d9f64801..00000000 --- a/features/default_pre.prf +++ /dev/null @@ -1,20 +0,0 @@ -load(default_pre) - -QSK_ROOT = $$clean_path( $$PWD/.. ) - -equals( QSK_ROOT, $$_PRO_FILE_PWD_ ) { - - QSK_SUB_DIR = "." - QSK_OUT_ROOT = $$OUT_PWD -} -else { - - QSK_SUB_DIR = $$relative_path( $$_PRO_FILE_PWD_, $$QSK_ROOT ) - QSK_OUT_ROOT = $$replace( OUT_PWD, /$$QSK_SUB_DIR, "" ) -} - -QSK_PLUGIN_DIR = $${QSK_OUT_ROOT}/plugins -QSK_LIB_DIR = $${QSK_OUT_ROOT}/lib - -include( qskconfig.pri ) -include( qskfunctions.pri ) diff --git a/features/qskconfig.pri b/features/qskconfig.pri deleted file mode 100644 index 1b3f20fb..00000000 --- a/features/qskconfig.pri +++ /dev/null @@ -1,188 +0,0 @@ -############################################################################ -# QSkinny - Copyright (C) 2016 Uwe Rathmann -# This file may be used under the terms of the QSkinny License, Version 1.0 -############################################################################ - -QSK_VER_MAJ = 0 -QSK_VER_MIN = 0 -QSK_VER_PAT = 0 -QSK_VERSION = $${QSK_VER_MAJ}.$${QSK_VER_MIN}.$${QSK_VER_PAT} - -# trying the PREFIX environment variable first - -QSK_INSTALL_PREFIX = $$(PREFIX) - -isEmpty( QSK_INSTALL_PREFIX ) { - - QSK_INSTALL_PREFIX = $$[QT_INSTALL_PREFIX] - - unix { - QSK_INSTALL_PREFIX = /usr/local/qskinny-$${QSK_VERSION} - } - - win32 { - QSK_INSTALL_PREFIX = C:/Qskinny-$${QSK_VERSION} - } -} - -QSK_INSTALL_DOCS = $${QSK_INSTALL_PREFIX}/doc -QSK_INSTALL_HEADERS = $${QSK_INSTALL_PREFIX}/include -QSK_INSTALL_LIBS = $${QSK_INSTALL_PREFIX}/lib -QSK_INSTALL_BINS = $${QSK_INSTALL_PREFIX}/bin -QSK_INSTALL_PLUGINS = $${QSK_INSTALL_PREFIX}/plugins -QSK_INSTALL_EXAMPLES = $${QSK_INSTALL_PREFIX}/examples - -CONFIG += no_private_qt_headers_warning - -CONFIG += warn_on -CONFIG += no_keywords -CONFIG += silent -#CONFIG -= depend_includepath - -CONFIG += strict_c++ -CONFIG += c++17 -CONFIG += pedantic -CONFIG += hide_symbols - -# CONFIG += debug -# CONFIG += sanitize - -use_no_rpath { - CONFIG -= use_local_rpath use_install_rpath -} else { - cross_compile { - CONFIG *= use_install_rpath - QMAKE_RPATHLINKDIR *= $${QSK_PLUGIN_DIR}/skins - } else { - !use_install_rpath: CONFIG *= use_local_rpath - } -} - -MOC_DIR = moc -OBJECTS_DIR = obj -RCC_DIR = rcc - -QSK_CONFIG += QskDll - -linux { - - pedantic { - - DEFINES += QT_STRICT_ITERATORS - - # Qt headers do not stand pedantic checks, so it's better - # to exclude them by declaring them as system includes - - CONFIG += qtassysteminclude - } - - qtassysteminclude { - - # As most distros set QT_INSTALL_HEADERS to /usr/include we - # would run into gcc compiler errors and better drop it - # from the list below. Should be no problem as we don't - # add the Qt module to our includes and therefore don't - # need this path. - - QMAKE_CXXFLAGS += \ - -isystem $$[QT_INSTALL_HEADERS]/QtCore \ - -isystem $$[QT_INSTALL_HEADERS]/QtCore/$$[QT_VERSION]/QtCore \ - -isystem $$[QT_INSTALL_HEADERS]/QtGui \ - -isystem $$[QT_INSTALL_HEADERS]/QtGui/$$[QT_VERSION]/QtGui \ - -isystem $$[QT_INSTALL_HEADERS]/QtQuick \ - -isystem $$[QT_INSTALL_HEADERS]/QtQuick/$$[QT_VERSION]/QtQuick \ - -isystem $$[QT_INSTALL_HEADERS]/QtQml \ - -isystem $$[QT_INSTALL_HEADERS]/QtQml/$$[QT_VERSION]/QtQml \ - } -} - -linux-g++ | linux-g++-64 { - - # --- optional optimzations - - QMAKE_CXXFLAGS_DEBUG *= -O0 - #QMAKE_CXXFLAGS_DEBUG *= -Og - - QMAKE_CXXFLAGS_RELEASE *= -O3 - QMAKE_CXXFLAGS_RELEASE *= -ffast-math - - # QMAKE_CXXFLAGS_RELEASE *= -Ofast - # QMAKE_CXXFLAGS_RELEASE *= -Os -} - -pedantic { - - linux-g++ | linux-g++-64 { - - QMAKE_CXXFLAGS *= -pedantic-errors - QMAKE_CXXFLAGS *= -Wextra - QMAKE_CXXFLAGS *= -Werror=format-security - #QMAKE_CXXFLAGS *= -Wlogical-op - - # QMAKE_CXXFLAGS *= -Wconversion - # QMAKE_CXXFLAGS *= -Wfloat-equal - # QMAKE_CXXFLAGS *= -Wshadow - - QMAKE_CXXFLAGS *= -Wsuggest-override - # QMAKE_CXXFLAGS *= -Wsuggest-final-types - # QMAKE_CXXFLAGS *= -Wsuggest-final-methods - - # QMAKE_CXXFLAGS *= -fanalyzer - } - - linux-clang { - - #QMAKE_CXXFLAGS *= -pedantic-errors - - #QMAKE_CXXFLAGS *= -Weverything - #QMAKE_CXXFLAGS *= -Wno-c++98-compat-pedantic - #QMAKE_CXXFLAGS *= -Wno-global-constructors - #QMAKE_CXXFLAGS *= -Wno-exit-time-destructors - #QMAKE_CXXFLAGS *= -Wno-padded - #QMAKE_CXXFLAGS *= -Wno-float-equal - #QMAKE_CXXFLAGS *= -Wno-undefined-reinterpret-cast - #QMAKE_CXXFLAGS *= -Wno-deprecated - #QMAKE_CXXFLAGS *= -Wno-switch-enum - #QMAKE_CXXFLAGS *= -Wno-keyword-macro - #QMAKE_CXXFLAGS *= -Wno-old-style-cast - #QMAKE_CXXFLAGS *= -Wno-used-but-marked-unused - #QMAKE_CXXFLAGS *= -Wno-weak-vtables - #QMAKE_CXXFLAGS *= -Wno-shadow - #QMAKE_CXXFLAGS *= -Wno-double-promotion - #QMAKE_CXXFLAGS *= -Wno-conversion - #QMAKE_CXXFLAGS *= -Wno-documentation-unknown-command - #QMAKE_CXXFLAGS *= -Wno-unused-macros - } -} - -sanitize { - - CONFIG += sanitizer - CONFIG += sanitize_address - # CONFIG *= sanitize_undefined - - linux-g++ | linux-g++-64 { - #QMAKE_CXXFLAGS *= -fsanitize-address-use-after-scope - #QMAKE_LFLAGS *= -fsanitize-address-use-after-scope - } -} - -debug { - DEFINES += ITEM_STATISTICS=1 -} - -# DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x000000 - -LOCAL_PRI=$$(QSK_LOCAL_PRI) - -if ( !isEmpty( LOCAL_PRI ) ) { - - if ( exists( $${LOCAL_PRI} ) ) { - - # When not working with the Qt/Creator it is often more convenient - # to include the specific options of your local build, than passing - # them all on the command line - - include( $${LOCAL_PRI} ) - } -} diff --git a/features/qskexample.prf b/features/qskexample.prf deleted file mode 100644 index 09e4f4e0..00000000 --- a/features/qskexample.prf +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -CONFIG += qskinny qsktestsupport - -DEFINES += QSK_DLL -DESTDIR = $$clean_path( $${OUT_PWD}/../bin ) - -target.path = $${QSK_INSTALL_EXAMPLES}/bin -INSTALLS = target diff --git a/features/qskfunctions.pri b/features/qskfunctions.pri deleted file mode 100644 index 4dcde4e8..00000000 --- a/features/qskfunctions.pri +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################ -# QSkinny - Copyright (C) 2016 Uwe Rathmann -# This file may be used under the terms of the QSkinny License, Version 1.0 -############################################################################ - -defineReplace(qskLibraryTarget) { - - return( $$qtLibraryTarget($$1) ) -} - -defineReplace(qskPluginTarget) { - - return( $$qtLibraryTarget($$1) ) -} - -defineTest(qskAddLibrary) { - - LIBS *= -L$$1 - LIBS += -l$$2$$qtPlatformTargetSuffix() - - export(LIBS) - - return(true) -} diff --git a/features/qskinny.prf b/features/qskinny.prf deleted file mode 100644 index f306d67e..00000000 --- a/features/qskinny.prf +++ /dev/null @@ -1,18 +0,0 @@ -QT *= quick - -QSK_DIRS = \ - $${QSK_ROOT}/src/common \ - $${QSK_ROOT}/src/controls \ - $${QSK_ROOT}/src/dialogs \ - $${QSK_ROOT}/src/graphic \ - $${QSK_ROOT}/src/inputpanel \ - $${QSK_ROOT}/src/layouts \ - $${QSK_ROOT}/src/nodes - -INCLUDEPATH *= $${QSK_DIRS} -DEPENDPATH *= $${QSK_DIRS} - -use_install_rpath: QMAKE_RPATHDIR *= $${QSK_INSTALL_LIBS} -use_local_rpath: QMAKE_RPATHDIR *= $${QSK_LIB_DIR} - -qskAddLibrary( $${QSK_LIB_DIR}, qskinny ) diff --git a/features/qskqmlexport.prf b/features/qskqmlexport.prf deleted file mode 100644 index c1fcf19b..00000000 --- a/features/qskqmlexport.prf +++ /dev/null @@ -1,9 +0,0 @@ -QSK_QML_EXPORT_DIRS = $${QSK_ROOT}/qmlexport - -INCLUDEPATH *= $${QSK_QML_EXPORT_DIRS} -DEPENDPATH *= $${QSK_QML_EXPORT_DIRS} - -use_install_rpath: QMAKE_RPATHDIR *= $${QSK_INSTALL_LIBS} -use_local_rpath: QMAKE_RPATHDIR *= $${QSK_LIB_DIR} - -qskAddLibrary( $${QSK_LIB_DIR}, qskqmlexport) diff --git a/features/qskqvg.prf b/features/qskqvg.prf deleted file mode 100644 index 39f25b4e..00000000 --- a/features/qskqvg.prf +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################## -# rules to create qvg from svg files -############################################################################## - -SVG2QVG=$$shell_path($${QSK_OUT_ROOT}/tools/bin/svg2qvg) -QVG_DIR=qvg - -svg2qvg.name = SVG compiler -svg2qvg.input = SVGSOURCES -svg2qvg.output = $${QVG_DIR}/${QMAKE_FILE_BASE}.qvg -svg2qvg.variable_out = -svg2qvg.commands += ($$sprintf($${QMAKE_MKDIR_CMD}, $${QVG_DIR})) && $${SVG2QVG} ${QMAKE_FILE_IN} $${svg2qvg.output} - -QMAKE_EXTRA_COMPILERS += svg2qvg - -############################################################################## -# When using qvg files, that have to be generated from svg files, as resource, -############################################################################## - -qvgrcc.name = RCC compiler -qvgrcc.input = QVGRESOURCES -qvgrcc.output = $${RCC_DIR}/qrc_${QMAKE_FILE_BASE}.cpp -qvgrcc.variable_out = SOURCES -qvgrcc.CONFIG += add_inputs_as_makefile_deps - -# Paths inside a qrc file are always relative to the path of the -# qrc file itself. So in case of shadow builds we need to copy the -# qrc file into the shadow directory as the included qvg files -# are generated there. - -QRC_SHADOW_CLONE = $$shell_path( $${OUT_PWD}/${QMAKE_FILE_BASE}_shadow.qrc ) -qtPrepareTool(QMAKE_RCC, rcc, _DEP) - -equals( OUT_PWD, $${_PRO_FILE_PWD_} ) { - - qvgrcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} - -} else { - - qvgrcc.depend_command = \ - $${QMAKE_COPY} ${QMAKE_FILE_IN} $${QRC_SHADOW_CLONE} && \ - $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS $${QRC_SHADOW_CLONE} && \ - $${QMAKE_DEL_FILE} $${QRC_SHADOW_CLONE} -} - -equals( OUT_PWD, $${_PRO_FILE_PWD_} ) { - - qvgrcc.commands = $$QMAKE_RCC $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} - -} else { - - qvgrcc.commands = \ - $${QMAKE_COPY} ${QMAKE_FILE_IN} $${QRC_SHADOW_CLONE} && \ - $$QMAKE_RCC $$QMAKE_RESOURCE_FLAGS $${QRC_SHADOW_CLONE} -o ${QMAKE_FILE_OUT} && \ - $${QMAKE_DEL_FILE} $${QRC_SHADOW_CLONE} -} - -QMAKE_EXTRA_COMPILERS += qvgrcc - diff --git a/features/qsktestsupport.prf b/features/qsktestsupport.prf deleted file mode 100644 index 9b2a239b..00000000 --- a/features/qsktestsupport.prf +++ /dev/null @@ -1,9 +0,0 @@ -QSK_TEST_SUPPORT_DIRS = $${QSK_ROOT}/support - -INCLUDEPATH *= $${QSK_TEST_SUPPORT_DIRS} -DEPENDPATH *= $${QSK_TEST_SUPPORT_DIRS} - -use_install_rpath: QMAKE_RPATHDIR *= $${QSK_INSTALL_EXAMPLES}/lib -use_local_rpath: QMAKE_RPATHDIR *= $${QSK_LIB_DIR} - -qskAddLibrary( $${QSK_LIB_DIR}, qsktestsupport) diff --git a/inputcontext/CMakeLists.txt b/inputcontext/CMakeLists.txt new file mode 100644 index 00000000..4650719d --- /dev/null +++ b/inputcontext/CMakeLists.txt @@ -0,0 +1,49 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +if(NOT LINUX AND ENABLE_HUNSPELL) + message(WARNING "Feature 'hunspell' only available for UNIX!") + unset(ENABLE_HUNSPELL CACHE) +endif() + +if(NOT LINUX AND ENABLE_PINYIN) + message(WARNING "Feature 'pinyin' only available for UNIX!") + unset(ENABLE_PINYIN CACHE) +endif() + +set(SOURCES QskInputContextGlobal.h QskInputContextPlugin.cpp) + +if(ENABLE_PINYIN) + qsk_setup_Pinyin() + + list(APPEND SOURCES + ${CMAKE_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.h + ${CMAKE_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.cpp + ) +endif() + +if(ENABLE_HUNSPELL) + qsk_setup_Hunspell() + + list(APPEND SOURCES + ${CMAKE_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.h + ${CMAKE_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.cpp + ) +endif() + +set(target qskinputcontext) + +qsk_add_plugin(${target} platforminputcontexts QskInputContextPlugin ${SOURCES}) + +if(ENABLE_PINYIN) + target_link_libraries(${target} PRIVATE pinyin Fcitx5::Utils) +endif() + +if(ENABLE_HUNSPELL) + target_link_libraries(${target} PRIVATE hunspell) +endif() + +set_target_properties(${target} PROPERTIES DEFINE_SYMBOL QSK_INPUTCONTEXT_MAKEDLL ) +target_link_libraries(${target} PRIVATE qskinny Qt::GuiPrivate) diff --git a/inputcontext/inputcontext.pro b/inputcontext/inputcontext.pro deleted file mode 100644 index 9d4e7af0..00000000 --- a/inputcontext/inputcontext.pro +++ /dev/null @@ -1,52 +0,0 @@ -TEMPLATE = lib -TARGET = $$qskPluginTarget(qskinputcontext) - -QT += gui-private - -CONFIG += plugin -CONFIG += qskinny - -QSK_PLUGIN_SUBDIR = platforminputcontexts -contains(QSK_CONFIG, QskDll): DEFINES += QSK_INPUTCONTEXT_MAKEDLL - -HEADERS += \ - QskInputContextGlobal.h - -SOURCES += \ - QskInputContextPlugin.cpp - -OTHER_FILES += metadata.json - -pinyin { - - unix { - - CONFIG += link_pkgconfig - PKGCONFIG += pinyin - - HEADERS += \ - QskPinyinTextPredictor.h - - SOURCES += \ - QskPinyinTextPredictor.cpp - } -} - -hunspell { - - unix { - - CONFIG += link_pkgconfig - PKGCONFIG += hunspell - - HEADERS += \ - QskHunspellTextPredictor.h - - SOURCES += \ - QskHunspellTextPredictor.cpp - } - -} - -target.path = $${QSK_INSTALL_PLUGINS}/$${QSK_PLUGIN_SUBDIR} -INSTALLS = target diff --git a/playground/CMakeLists.txt b/playground/CMakeLists.txt new file mode 100644 index 00000000..4dab3e0a --- /dev/null +++ b/playground/CMakeLists.txt @@ -0,0 +1,31 @@ +add_subdirectory(anchors) +add_subdirectory(dials) +add_subdirectory(dialogbuttons) +add_subdirectory(gradients) +add_subdirectory(invoker) +add_subdirectory(shadows) +add_subdirectory(shapes) + +if (BUILD_INPUTCONTEXT) + add_subdirectory(inputpanel) +endif() + +if (BUILD_QML_EXPORT) + add_subdirectory(images) +endif() + +if (QT_VERSION_MAJOR VERSION_LESS 6) + if(TARGET Qt::WebEngine) + add_subdirectory(webview) + endif() +else() + if(TARGET Qt::WebEngineCore) + if(TARGET Qt::WebEngineQuick) + add_subdirectory(webview) + endif() + endif() +endif() + +if(TARGET Qt::QuickWidgets) + add_subdirectory(grids) +endif() diff --git a/playground/anchors/CMakeLists.txt b/playground/anchors/CMakeLists.txt new file mode 100644 index 00000000..734f0e38 --- /dev/null +++ b/playground/anchors/CMakeLists.txt @@ -0,0 +1,15 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES + kiwi/Strength.h kiwi/Term.h kiwi/Variable.h + kiwi/Constraint.h kiwi/Constraint.cpp + kiwi/Expression.h kiwi/Expression.cpp + kiwi/Solver.h kiwi/Solver.cpp + AnchorBox.h AnchorBox.cpp + main.cpp +) + +qsk_add_example(anchors ${SOURCES}) diff --git a/playground/anchors/anchors.pro b/playground/anchors/anchors.pro deleted file mode 100644 index d56d699f..00000000 --- a/playground/anchors/anchors.pro +++ /dev/null @@ -1,21 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - kiwi/Constraint.h \ - kiwi/Expression.h \ - kiwi/Solver.h \ - kiwi/Strength.h \ - kiwi/Term.h \ - kiwi/Variable.h - -SOURCES += \ - kiwi/Expression.cpp \ - kiwi/Constraint.cpp \ - kiwi/Solver.cpp - -HEADERS += \ - AnchorBox.h - -SOURCES += \ - AnchorBox.cpp \ - main.cpp diff --git a/playground/dialogbuttons/CMakeLists.txt b/playground/dialogbuttons/CMakeLists.txt new file mode 100644 index 00000000..0414e3a7 --- /dev/null +++ b/playground/dialogbuttons/CMakeLists.txt @@ -0,0 +1,6 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(dialogbuttons Window.h Window.cpp main.cpp) diff --git a/playground/dialogbuttons/dialogbuttons.pro b/playground/dialogbuttons/dialogbuttons.pro deleted file mode 100644 index 94614da0..00000000 --- a/playground/dialogbuttons/dialogbuttons.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - Window.h - -SOURCES += \ - Window.cpp \ - main.cpp diff --git a/playground/dials/CMakeLists.txt b/playground/dials/CMakeLists.txt new file mode 100644 index 00000000..8181e76e --- /dev/null +++ b/playground/dials/CMakeLists.txt @@ -0,0 +1,15 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES + SkinFactory.h SkinFactory.cpp + Dial.h Dial.cpp + DialSkinlet.h DialSkinlet.cpp + Dashboard.h Dashboard.cpp + main.cpp +) +qt_add_resources(SOURCES images.qrc) + +qsk_add_example(dials ${SOURCES}) diff --git a/playground/dials/dials.pro b/playground/dials/dials.pro deleted file mode 100644 index 8b462919..00000000 --- a/playground/dials/dials.pro +++ /dev/null @@ -1,17 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - SkinFactory.h \ - Dial.h \ - DialSkinlet.h \ - Dashboard.h - -SOURCES += \ - SkinFactory.cpp \ - Dial.cpp \ - DialSkinlet.cpp \ - Dashboard.cpp \ - main.cpp \ - -RESOURCES += \ - images.qrc diff --git a/playground/gradients/CMakeLists.txt b/playground/gradients/CMakeLists.txt new file mode 100644 index 00000000..2585b70e --- /dev/null +++ b/playground/gradients/CMakeLists.txt @@ -0,0 +1,17 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES GradientView.h GradientView.cpp main.cpp) + +if(TARGET quickshapes_private) + list(APPEND SOURCES GradientQuickShape.h GradientQuickShape.cpp) +endif() + +qsk_add_example(gradients ${SOURCES}) + +if(TARGET quickshapes_private) + target_compile_definitions(gradients PRIVATE SHAPE_GRADIENT) + target_link_libraries(gradients PRIVATE quickshapes_private) +endif() diff --git a/playground/gradients/gradients.pro b/playground/gradients/gradients.pro deleted file mode 100644 index 4bd9e8f8..00000000 --- a/playground/gradients/gradients.pro +++ /dev/null @@ -1,18 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - GradientView.h - -SOURCES += \ - GradientView.cpp \ - main.cpp - -qtHaveModule(quickshapes_private) { - - QT += quickshapes_private - - HEADERS += GradientQuickShape.h - SOURCES += GradientQuickShape.cpp - - DEFINES += SHAPE_GRADIENT -} diff --git a/playground/grids/CMakeLists.txt b/playground/grids/CMakeLists.txt new file mode 100644 index 00000000..1c9473f3 --- /dev/null +++ b/playground/grids/CMakeLists.txt @@ -0,0 +1,18 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES + GridAccessor.h GridAccessor.cpp + GridSkinny.h GridSkinny.cpp + GridWidgets.h GridWidgets.cpp + GridGraphics.h GridGraphics.cpp + GridQuick.h GridQuick.cpp + TestBox.h TestBox.cpp + main.cpp +) + +qsk_add_example(grids ${SOURCES}) +target_link_libraries(grids PRIVATE Qt::QuickWidgets) + diff --git a/playground/grids/grids.pro b/playground/grids/grids.pro deleted file mode 100644 index 3c85b881..00000000 --- a/playground/grids/grids.pro +++ /dev/null @@ -1,27 +0,0 @@ -CONFIG += qskexample -QT += widgets quickwidgets - -HEADERS += \ - GridAccessor.h \ - GridSkinny.h \ - GridWidgets.h \ - GridGraphics.h \ - GridQuick.h \ - TestBox.h - -SOURCES += \ - GridAccessor.cpp \ - GridSkinny.cpp \ - GridWidgets.cpp \ - GridGraphics.cpp \ - GridQuick.cpp \ - TestBox.cpp \ - main.cpp - -linux { - - pedantic { - QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtQuickWidgets - QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtWidgets - } -} diff --git a/playground/images/CMakeLists.txt b/playground/images/CMakeLists.txt new file mode 100644 index 00000000..d331f3d7 --- /dev/null +++ b/playground/images/CMakeLists.txt @@ -0,0 +1,9 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES Image.h Image.cpp main.cpp) +qt_add_resources(SOURCES images.qrc) + +qsk_add_example(images ${SOURCES}) diff --git a/playground/images/images.pro b/playground/images/images.pro deleted file mode 100644 index a6903224..00000000 --- a/playground/images/images.pro +++ /dev/null @@ -1,13 +0,0 @@ -CONFIG += qskexample qskqmlexport - -QT += quick_private - -RESOURCES += \ - images.qrc - -HEADERS += \ - Image.h - -SOURCES += \ - Image.cpp \ - main.cpp diff --git a/playground/inputpanel/CMakeLists.txt b/playground/inputpanel/CMakeLists.txt new file mode 100644 index 00000000..c7e5d143 --- /dev/null +++ b/playground/inputpanel/CMakeLists.txt @@ -0,0 +1,6 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(inputpanel main.cpp) diff --git a/playground/inputpanel/inputpanel.pro b/playground/inputpanel/inputpanel.pro deleted file mode 100644 index 0a7f08c9..00000000 --- a/playground/inputpanel/inputpanel.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += qskexample - -SOURCES += \ - main.cpp diff --git a/playground/invoker/CMakeLists.txt b/playground/invoker/CMakeLists.txt new file mode 100644 index 00000000..e1377546 --- /dev/null +++ b/playground/invoker/CMakeLists.txt @@ -0,0 +1,8 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(invoker Callback.h Callback.cpp Invoker.h Invoker.cpp main.cpp) +set_target_properties(invoker PROPERTIES AUTOMOC_MOC_OPTIONS --no-warnings) + diff --git a/playground/invoker/invoker.pro b/playground/invoker/invoker.pro deleted file mode 100644 index 80f517d6..00000000 --- a/playground/invoker/invoker.pro +++ /dev/null @@ -1,12 +0,0 @@ -CONFIG += qskexample - -QMAKE_MOC_OPTIONS += -nw # disable warning about missing READ - -HEADERS += \ - Callback.h \ - Invoker.h - -SOURCES += \ - Callback.cpp \ - Invoker.cpp \ - main.cpp diff --git a/playground/playground.pro b/playground/playground.pro deleted file mode 100644 index c464205e..00000000 --- a/playground/playground.pro +++ /dev/null @@ -1,24 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - anchors \ - dials \ - dialogbuttons \ - gradients \ - invoker \ - inputpanel \ - images \ - shadows \ - shapes - -qtHaveModule(webengine) { - - SUBDIRS += \ - webview -} - -qtHaveModule(quickwidgets) { - - SUBDIRS += \ - grids -} diff --git a/playground/shadows/CMakeLists.txt b/playground/shadows/CMakeLists.txt new file mode 100644 index 00000000..3f375cbe --- /dev/null +++ b/playground/shadows/CMakeLists.txt @@ -0,0 +1,6 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(shadows ShadowedBox.h ShadowedBox.cpp main.cpp) diff --git a/playground/shadows/shadows.pro b/playground/shadows/shadows.pro deleted file mode 100644 index 2d7ca870..00000000 --- a/playground/shadows/shadows.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += qskexample - -HEADERS += \ - ShadowedBox.h \ - -SOURCES += \ - ShadowedBox.cpp \ - main.cpp diff --git a/playground/shapes/CMakeLists.txt b/playground/shapes/CMakeLists.txt new file mode 100644 index 00000000..95b42221 --- /dev/null +++ b/playground/shapes/CMakeLists.txt @@ -0,0 +1,22 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES + ShapeItem.h ShapeItem.cpp + GeometricShape.h GeometricShape.cpp + Stroke.h Stroke.cpp + Window.h Window.cpp + main.cpp +) + +if( BUILD_QML_EXPORT ) + qt_add_resources(SOURCES shapes.qrc) +endif() + +qsk_add_example(shapes ${SOURCES}) + +if( NOT BUILD_QML_EXPORT ) + target_compile_definitions(shapes PRIVATE NO_QML) +endif() diff --git a/playground/shapes/main.cpp b/playground/shapes/main.cpp index 5d755e5d..bfd57c6a 100644 --- a/playground/shapes/main.cpp +++ b/playground/shapes/main.cpp @@ -7,12 +7,14 @@ #include "GeometricShape.h" #include "Stroke.h" -#include #include #include #include +#ifndef NO_QML + +#include #include template< typename T > @@ -44,6 +46,8 @@ static bool doQml( int argc, char* argv[] ) return false; } +#endif + int main( int argc, char* argv[] ) { #ifdef ITEM_STATISTICS @@ -53,6 +57,7 @@ int main( int argc, char* argv[] ) QGuiApplication app( argc, argv ); SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts ); +#ifndef NO_QML if ( doQml( argc, argv ) ) { qDebug() << "Running QML"; @@ -66,7 +71,7 @@ int main( int argc, char* argv[] ) return app.exec(); } - else +#endif { qDebug() << "Running C++"; diff --git a/playground/shapes/shapes.pro b/playground/shapes/shapes.pro deleted file mode 100644 index 4ceeb610..00000000 --- a/playground/shapes/shapes.pro +++ /dev/null @@ -1,17 +0,0 @@ -CONFIG += qskexample qskqmlexport - -RESOURCES += \ - shapes.qrc - -HEADERS += \ - Stroke.h \ - ShapeItem.h \ - GeometricShape.h \ - Window.h - -SOURCES += \ - Stroke.cpp \ - ShapeItem.cpp \ - GeometricShape.cpp \ - Window.cpp \ - main.cpp diff --git a/playground/webview/CMakeLists.txt b/playground/webview/CMakeLists.txt new file mode 100644 index 00000000..68dda9ec --- /dev/null +++ b/playground/webview/CMakeLists.txt @@ -0,0 +1,13 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +qsk_add_example(webview main.cpp) + +if (QT_VERSION_MAJOR VERSION_GREATER 5) + target_link_libraries(webview PRIVATE Qt::WebEngineQuick Qt::WebEngineQuickPrivate) +else() + target_link_libraries(webview PRIVATE Qt::WebEngine Qt::WebEnginePrivate) +endif() + diff --git a/playground/webview/main.cpp b/playground/webview/main.cpp index 454e3639..2e1437fa 100644 --- a/playground/webview/main.cpp +++ b/playground/webview/main.cpp @@ -37,7 +37,10 @@ int main( int argc, char* argv[] ) QskObjectCounter counter( true ); #endif +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) + // namespace QtWebEngine doesn't exist in Qt6: https://doc.qt.io/qt-5/qtwebengine.html QtWebEngine::initialize(); +#endif QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app( argc, argv ); diff --git a/playground/webview/webview.pro b/playground/webview/webview.pro deleted file mode 100644 index 97b6fe8f..00000000 --- a/playground/webview/webview.pro +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG += qskexample -QT += webengine webengine-private webenginecore-private core-private - -SOURCES += \ - main.cpp diff --git a/qmlexport/CMakeLists.txt b/qmlexport/CMakeLists.txt new file mode 100644 index 00000000..ef1744dc --- /dev/null +++ b/qmlexport/CMakeLists.txt @@ -0,0 +1,23 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +set(HEADERS QskQmlGlobal.h QskShortcutQml.h QskLayoutQml.h QskMainQml.h QskQml.h) +set(SOURCES QskShortcutQml.cpp QskLayoutQml.cpp QskMainQml.cpp QskQml.cpp) + +set(target qskqmlexport) +qsk_add_library(${target} SHARED ${SOURCES} ${HEADERS}) + +target_link_libraries(${target} PRIVATE qskinny) +target_include_directories(${target} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) +set_target_properties(${target} PROPERTIES PUBLIC_HEADER QskQml.h) + +if(BUILD_QSKDLL) + set_target_properties(${target} PROPERTIES DEFINE_SYMBOL QSK_QML_MAKEDLL) + set_target_properties(${target} PROPERTIES INSTALL_RPATH "\${ORIGIN}" ) + set_target_properties(${target} PROPERTIES + VERSION ${CMAKE_PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) +endif() + +install(TARGETS ${target} ) diff --git a/qmlexport/qmlexport.pro b/qmlexport/qmlexport.pro deleted file mode 100644 index 12c44dd9..00000000 --- a/qmlexport/qmlexport.pro +++ /dev/null @@ -1,26 +0,0 @@ -TEMPLATE = lib -TARGET = $$qskLibraryTarget(qskqmlexport) - -QT += quick-private -CONFIG += qskinny - -contains(QSK_CONFIG, QskDll): DEFINES += QSK_QML_MAKEDLL - -HEADERS += \ - QskQml.hpp - -HEADERS += \ - QskQmlGlobal.h \ - QskShortcutQml.h \ - QskLayoutQml.h \ - QskMainQml.h \ - QskQml.h - -SOURCES += \ - QskShortcutQml.cpp \ - QskLayoutQml.cpp \ - QskMainQml.cpp \ - QskQml.cpp - -target.path = $${QSK_INSTALL_LIBS} -INSTALLS = target diff --git a/qskinny.pro b/qskinny.pro deleted file mode 100644 index 7a41eef1..00000000 --- a/qskinny.pro +++ /dev/null @@ -1,27 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = \ - src \ - skins \ - inputcontext \ - qmlexport \ - tools \ - support \ - examples \ - playground - -OTHER_FILES = \ - doc/Doxyfile \ - doc/*.dox \ - doc/*.metadox \ - doc/classes/*.dox \ - doc/classes/*.metadox \ - TODO - -qmlexport.depends = src -inputcontext.depends = src -skins.depends = src -tools.depends = src -support.depends = src skins -examples.depends = tools support skins qmlexport -playground.depends = tools support skins qmlexport diff --git a/skins/CMakeLists.txt b/skins/CMakeLists.txt new file mode 100644 index 00000000..37ca7925 --- /dev/null +++ b/skins/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(squiek) +add_subdirectory(material3) \ No newline at end of file diff --git a/skins/material3/CMakeLists.txt b/skins/material3/CMakeLists.txt new file mode 100644 index 00000000..43c02b7b --- /dev/null +++ b/skins/material3/CMakeLists.txt @@ -0,0 +1,13 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +set(SOURCES + QskMaterial3Global.h QskMaterial3Skin.h QskMaterial3Skin.cpp + QskMaterial3SkinFactory.h QskMaterial3SkinFactory.cpp +) +qt_add_resources(SOURCES icons.qrc) + +qsk_add_plugin(material3skin skins QskMaterial3SkinFactory ${SOURCES}) +set_target_properties(material3skin PROPERTIES DEFINE_SYMBOL QSK_MATERIAL3_MAKEDLL ) diff --git a/skins/material3/QskMaterial3SkinFactory.h b/skins/material3/QskMaterial3SkinFactory.h index 9727a329..f7edf8a4 100644 --- a/skins/material3/QskMaterial3SkinFactory.h +++ b/skins/material3/QskMaterial3SkinFactory.h @@ -12,9 +12,10 @@ class QSK_MATERIAL3_EXPORT QskMaterial3SkinFactory : public QskSkinFactory { Q_OBJECT - +#if defined( QSK_MATERIAL3_MAKEDLL ) Q_PLUGIN_METADATA( IID QskSkinFactoryIID FILE "metadata.json" ) Q_INTERFACES( QskSkinFactory ) +#endif public: QskMaterial3SkinFactory( QObject* parent = nullptr ); diff --git a/skins/material3/material3.pro b/skins/material3/material3.pro deleted file mode 100644 index fafc9a08..00000000 --- a/skins/material3/material3.pro +++ /dev/null @@ -1,25 +0,0 @@ -CONFIG += plugin -CONFIG += qskinny - -TEMPLATE = lib -QSK_PLUGIN_SUBDIR = skins - -TARGET = $$qskPluginTarget(material3skin) -DEFINES += QSK_MATERIAL3_MAKEDLL - -HEADERS += \ - QskMaterial3Global.h \ - QskMaterial3Skin.h \ - QskMaterial3SkinFactory.h - -SOURCES += \ - QskMaterial3Skin.cpp \ - QskMaterial3SkinFactory.cpp - -RESOURCES += \ - icons.qrc \ - -OTHER_FILES += metadata.json - -target.path = $${QSK_INSTALL_PLUGINS}/$${QSK_PLUGIN_SUBDIR} -INSTALLS = target diff --git a/skins/skins.pro b/skins/skins.pro deleted file mode 100644 index 2a2c6621..00000000 --- a/skins/skins.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - squiek \ - material3 diff --git a/skins/squiek/CMakeLists.txt b/skins/squiek/CMakeLists.txt new file mode 100644 index 00000000..28469bff --- /dev/null +++ b/skins/squiek/CMakeLists.txt @@ -0,0 +1,10 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +qsk_add_plugin(squiekskin skins QskSquiekSkinFactory + QskSquiekGlobal.h QskSquiekSkin.h QskSquiekSkin.cpp + QskSquiekSkinFactory.h QskSquiekSkinFactory.cpp +) +set_target_properties(squiekskin PROPERTIES DEFINE_SYMBOL QSK_SQUIEK_MAKEDLL) diff --git a/skins/squiek/QskSquiekSkinFactory.h b/skins/squiek/QskSquiekSkinFactory.h index 280135bb..73f3f936 100644 --- a/skins/squiek/QskSquiekSkinFactory.h +++ b/skins/squiek/QskSquiekSkinFactory.h @@ -13,8 +13,10 @@ class QSK_SQUIEK_EXPORT QskSquiekSkinFactory : public QskSkinFactory { Q_OBJECT +#if defined( QSK_SQUIEK_MAKEDLL ) Q_PLUGIN_METADATA( IID QskSkinFactoryIID FILE "metadata.json" ) Q_INTERFACES( QskSkinFactory ) +#endif public: QskSquiekSkinFactory( QObject* parent = nullptr ); diff --git a/skins/squiek/squiek.pro b/skins/squiek/squiek.pro deleted file mode 100644 index 95e05fd4..00000000 --- a/skins/squiek/squiek.pro +++ /dev/null @@ -1,22 +0,0 @@ -CONFIG += plugin -CONFIG += qskinny - -TEMPLATE = lib -QSK_PLUGIN_SUBDIR = skins - -TARGET = $$qskPluginTarget(squiekskin) -DEFINES += QSK_SQUIEK_MAKEDLL - -HEADERS += \ - QskSquiekGlobal.h \ - QskSquiekSkin.h \ - QskSquiekSkinFactory.h - -SOURCES += \ - QskSquiekSkin.cpp \ - QskSquiekSkinFactory.cpp - -OTHER_FILES += metadata.json - -target.path = $${QSK_INSTALL_PLUGINS}/$${QSK_PLUGIN_SUBDIR} -INSTALLS = target diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..21bbab9d --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,481 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +list(APPEND HEADERS + common/QskArcMetrics.h + common/QskAspect.h + common/QskBoxBorderColors.h + common/QskBoxBorderMetrics.h + common/QskBoxShapeMetrics.h + common/QskBoxHints.h + common/QskFunctions.h + common/QskGlobal.h + common/QskGradient.h + common/QskGradientDirection.h + common/QskGradientStop.h + common/QskHctColor.h + common/QskIntervalF.h + common/QskLabelData.h + common/QskMargins.h + common/QskMetaFunction.h + common/QskMetaFunction.hpp + common/QskMetaInvokable.h + common/QskNamespace.h + common/QskObjectCounter.h + common/QskPlacementPolicy.h + common/QskPlatform.h + common/QskRgbValue.h + common/QskScaleEngine.h + common/QskScaleTickmarks.h + common/QskShadowMetrics.h + common/QskSizePolicy.h + common/QskStateCombination.h + common/QskTextColors.h + common/QskTextOptions.h +) + +list(APPEND SOURCES + common/QskArcMetrics.cpp + common/QskAspect.cpp + common/QskBoxBorderColors.cpp + common/QskBoxBorderMetrics.cpp + common/QskBoxShapeMetrics.cpp + common/QskBoxHints.cpp + common/QskFunctions.cpp + common/QskGradient.cpp + common/QskGradientDirection.cpp + common/QskGradientStop.cpp + common/QskHctColor.cpp + common/QskIntervalF.cpp + common/QskLabelData.cpp + common/QskMargins.cpp + common/QskMetaFunction.cpp + common/QskMetaInvokable.cpp + common/QskObjectCounter.cpp + common/QskPlatform.cpp + common/QskPlacementPolicy.cpp + common/QskRgbValue.cpp + common/QskScaleEngine.cpp + common/QskScaleTickmarks.cpp + common/QskShadowMetrics.cpp + common/QskSizePolicy.cpp + common/QskTextColors.cpp + common/QskTextOptions.cpp +) + +list(APPEND HEADERS + graphic/QskColorFilter.h + graphic/QskGraphic.h + graphic/QskGraphicImageProvider.h + graphic/QskGraphicIO.h + graphic/QskGraphicPaintEngine.h + graphic/QskGraphicProvider.h + graphic/QskGraphicProviderMap.h + graphic/QskGraphicTextureFactory.h + graphic/QskIcon.h + graphic/QskPainterCommand.h + graphic/QskStandardSymbol.h +) + +list(APPEND SOURCES + graphic/QskColorFilter.cpp + graphic/QskGraphic.cpp + graphic/QskGraphicImageProvider.cpp + graphic/QskGraphicIO.cpp + graphic/QskGraphicPaintEngine.cpp + graphic/QskGraphicProvider.cpp + graphic/QskGraphicProviderMap.cpp + graphic/QskGraphicTextureFactory.cpp + graphic/QskIcon.cpp + graphic/QskPainterCommand.cpp + graphic/QskStandardSymbol.cpp +) + +list(APPEND HEADERS + nodes/QskArcNode.h + nodes/QskArcRenderer.h + nodes/QskBoxNode.h + nodes/QskBoxClipNode.h + nodes/QskBoxFillNode.h + nodes/QskBoxRectangleNode.h + nodes/QskBoxRenderer.h + nodes/QskBoxMetrics.h + nodes/QskBoxBasicStroker.h + nodes/QskBoxGradientStroker.h + nodes/QskBoxColorMap.h + nodes/QskBoxShadowNode.h + nodes/QskColorRamp.h + nodes/QskGraphicNode.h + nodes/QskPaintedNode.h + nodes/QskPlainTextRenderer.h + nodes/QskRichTextRenderer.h + nodes/QskScaleRenderer.h + nodes/QskSGNode.h + nodes/QskStrokeNode.h + nodes/QskShapeNode.h + nodes/QskGradientMaterial.h + nodes/QskTextNode.h + nodes/QskTextRenderer.h + nodes/QskTextureRenderer.h + nodes/QskTickmarksNode.h + nodes/QskVertex.h +) + +list(APPEND SOURCES + nodes/QskArcNode.cpp + nodes/QskArcRenderer.cpp + nodes/QskBoxNode.cpp + nodes/QskBoxClipNode.cpp + nodes/QskBoxFillNode.cpp + nodes/QskBoxRectangleNode.cpp + nodes/QskBoxRenderer.cpp + nodes/QskBoxMetrics.cpp + nodes/QskBoxBasicStroker.cpp + nodes/QskBoxGradientStroker.cpp + nodes/QskBoxShadowNode.cpp + nodes/QskColorRamp.cpp + nodes/QskGraphicNode.cpp + nodes/QskPaintedNode.cpp + nodes/QskPlainTextRenderer.cpp + nodes/QskRectangleNode.cpp + nodes/QskRichTextRenderer.cpp + nodes/QskScaleRenderer.cpp + nodes/QskSGNode.cpp + nodes/QskStrokeNode.cpp + nodes/QskShapeNode.cpp + nodes/QskGradientMaterial.cpp + nodes/QskTextNode.cpp + nodes/QskTextRenderer.cpp + nodes/QskTextureRenderer.cpp + nodes/QskTickmarksNode.cpp + nodes/QskVertex.cpp +) + +qt_add_resources(SOURCES nodes/shaders.qrc) + +list(APPEND HEADERS + controls/QskAbstractButton.h + controls/QskAnimationHint.h + controls/QskAnimator.h + controls/QskMainView.h + controls/QskBoundedControl.h + controls/QskBoundedInput.h + controls/QskBoundedRangeInput.h + controls/QskBoundedValueInput.h + controls/QskBox.h + controls/QskBoxSkinlet.h + controls/QskCheckBox.h + controls/QskCheckBoxSkinlet.h + controls/QskComboBox.h + controls/QskComboBoxSkinlet.h + controls/QskControl.h + controls/QskEvent.h + controls/QskFlickAnimator.h + controls/QskFocusIndicator.h + controls/QskFocusIndicatorSkinlet.h + controls/QskGesture.h + controls/QskGestureRecognizer.h + controls/QskGraphicLabel.h + controls/QskGraphicLabelSkinlet.h + controls/QskHintAnimator.h + controls/QskInputGrabber.h + controls/QskListView.h + controls/QskListViewSkinlet.h + controls/QskMenu.h + controls/QskMenuSkinlet.h + controls/QskObjectTree.h + controls/QskPageIndicator.h + controls/QskPageIndicatorSkinlet.h + controls/QskPanGestureRecognizer.h + controls/QskPopup.h + controls/QskPopupSkinlet.h + controls/QskPushButton.h + controls/QskPushButtonSkinlet.h + controls/QskProgressBar.h + controls/QskProgressBarSkinlet.h + controls/QskQuick.h + controls/QskQuickItem.h + controls/QskRadioBox.h + controls/QskRadioBoxSkinlet.h + controls/QskScrollArea.h + controls/QskScrollBox.h + controls/QskScrollView.h + controls/QskScrollViewSkinlet.h + controls/QskSegmentedBar.h + controls/QskSegmentedBarSkinlet.h + controls/QskSeparator.h + controls/QskSeparatorSkinlet.h + controls/QskSetup.h + controls/QskShortcutMap.h + controls/QskSimpleListBox.h + controls/QskSkin.h + controls/QskSkinFactory.h + controls/QskSkinHintTable.h + controls/QskSkinHintTableEditor.h + controls/QskSkinManager.h + controls/QskSkinStateChanger.h + controls/QskSkinTransition.h + controls/QskSkinlet.h + controls/QskSkinnable.h + controls/QskSlider.h + controls/QskSliderSkinlet.h + controls/QskStatusIndicator.h + controls/QskStatusIndicatorSkinlet.h + controls/QskSpinBox.h + controls/QskSpinBoxSkinlet.h + controls/QskSubWindowArea.h + controls/QskSubWindowAreaSkinlet.h + controls/QskSubWindow.h + controls/QskSubWindowSkinlet.h + controls/QskSwitchButton.h + controls/QskSwitchButtonSkinlet.h + controls/QskTabBar.h + controls/QskTabButton.h + controls/QskTabButtonSkinlet.h + controls/QskTabView.h + controls/QskTabViewSkinlet.h + controls/QskTextInput.h + controls/QskTextInputSkinlet.h + controls/QskTextLabel.h + controls/QskTextLabelSkinlet.h + controls/QskVariantAnimator.h + controls/QskWindow.h +) + +list(APPEND PRIVATE_HEADERS + controls/QskDirtyItemFilter.h + controls/QskControlPrivate.h + controls/QskQuickItemPrivate.h +) + +list(APPEND SOURCES + controls/QskAbstractButton.cpp + controls/QskAnimator.cpp + controls/QskAnimationHint.cpp + controls/QskMainView.cpp + controls/QskBoundedControl.cpp + controls/QskBoundedInput.cpp + controls/QskBoundedRangeInput.cpp + controls/QskBoundedValueInput.cpp + controls/QskBox.cpp + controls/QskBoxSkinlet.cpp + controls/QskCheckBox.cpp + controls/QskCheckBoxSkinlet.cpp + controls/QskComboBox.cpp + controls/QskComboBoxSkinlet.cpp + controls/QskControl.cpp + controls/QskControlPrivate.cpp + controls/QskDirtyItemFilter.cpp + controls/QskEvent.cpp + controls/QskFlickAnimator.cpp + controls/QskFocusIndicator.cpp + controls/QskFocusIndicatorSkinlet.cpp + controls/QskGesture.cpp + controls/QskGestureRecognizer.cpp + controls/QskGraphicLabel.cpp + controls/QskGraphicLabelSkinlet.cpp + controls/QskHintAnimator.cpp + controls/QskInputGrabber.cpp + controls/QskListView.cpp + controls/QskListViewSkinlet.cpp + controls/QskMenuSkinlet.cpp + controls/QskMenu.cpp + controls/QskObjectTree.cpp + controls/QskPageIndicator.cpp + controls/QskPageIndicatorSkinlet.cpp + controls/QskPanGestureRecognizer.cpp + controls/QskPopup.cpp + controls/QskPopupSkinlet.cpp + controls/QskPushButton.cpp + controls/QskPushButtonSkinlet.cpp + controls/QskProgressBar.cpp + controls/QskProgressBarSkinlet.cpp + controls/QskQuick.cpp + controls/QskQuickItem.cpp + controls/QskQuickItemPrivate.cpp + controls/QskScrollArea.cpp + controls/QskScrollBox.cpp + controls/QskScrollView.cpp + controls/QskScrollViewSkinlet.cpp + controls/QskRadioBox.cpp + controls/QskRadioBoxSkinlet.cpp + controls/QskSegmentedBar.cpp + controls/QskSegmentedBarSkinlet.cpp + controls/QskSeparator.cpp + controls/QskSeparatorSkinlet.cpp + controls/QskSetup.cpp + controls/QskShortcutMap.cpp + controls/QskSimpleListBox.cpp + controls/QskSkin.cpp + controls/QskSkinHintTable.cpp + controls/QskSkinHintTableEditor.cpp + controls/QskSkinFactory.cpp + controls/QskSkinManager.cpp + controls/QskSkinTransition.cpp + controls/QskSkinlet.cpp + controls/QskSkinnable.cpp + controls/QskSlider.cpp + controls/QskSliderSkinlet.cpp + controls/QskSpinBox.cpp + controls/QskSpinBoxSkinlet.cpp + controls/QskStatusIndicator.cpp + controls/QskStatusIndicatorSkinlet.cpp + controls/QskSubWindowArea.cpp + controls/QskSubWindowAreaSkinlet.cpp + controls/QskSubWindow.cpp + controls/QskSubWindowSkinlet.cpp + controls/QskSwitchButton.cpp + controls/QskSwitchButtonSkinlet.cpp + controls/QskTabBar.cpp + controls/QskTabButton.cpp + controls/QskTabButtonSkinlet.cpp + controls/QskTabView.cpp + controls/QskTabViewSkinlet.cpp + controls/QskTextInput.cpp + controls/QskTextInputSkinlet.cpp + controls/QskTextLabel.cpp + controls/QskTextLabelSkinlet.cpp + controls/QskVariantAnimator.cpp + controls/QskWindow.cpp +) + +list(APPEND HEADERS + layouts/QskGridBox.h + layouts/QskGridLayoutEngine.h + layouts/QskIndexedLayoutBox.h + layouts/QskLayoutChain.h + layouts/QskLayoutEngine2D.h + layouts/QskLayoutElement.h + layouts/QskLayoutMetrics.h + layouts/QskLinearBox.h + layouts/QskLinearLayoutEngine.h + layouts/QskStackBoxAnimator.h + layouts/QskStackBox.h +) + +list(APPEND PRIVATE_HEADERS + layouts/QskSubcontrolLayoutEngine.h +) + +list(APPEND SOURCES + layouts/QskGridBox.cpp + layouts/QskGridLayoutEngine.cpp + layouts/QskIndexedLayoutBox.cpp + layouts/QskLayoutChain.cpp + layouts/QskLayoutEngine2D.cpp + layouts/QskLayoutElement.cpp + layouts/QskLayoutMetrics.cpp + layouts/QskLinearBox.cpp + layouts/QskLinearLayoutEngine.cpp + layouts/QskStackBoxAnimator.cpp + layouts/QskStackBox.cpp + layouts/QskSubcontrolLayoutEngine.cpp +) + +list(APPEND HEADERS + dialogs/QskDialog.h + dialogs/QskDialogButton.h + dialogs/QskDialogButtonBox.h + dialogs/QskDialogSubWindow.h + dialogs/QskDialogWindow.h + dialogs/QskMessageSubWindow.h + dialogs/QskMessageWindow.h + dialogs/QskSelectionSubWindow.h + dialogs/QskSelectionWindow.h +) + +list(APPEND SOURCES + dialogs/QskDialogButton.cpp + dialogs/QskDialogButtonBox.cpp + dialogs/QskDialog.cpp + dialogs/QskDialogSubWindow.cpp + dialogs/QskDialogWindow.cpp + dialogs/QskMessageSubWindow.cpp + dialogs/QskMessageWindow.cpp + dialogs/QskSelectionSubWindow.cpp + dialogs/QskSelectionWindow.cpp +) + +list(APPEND HEADERS + inputpanel/QskTextPredictor.h + inputpanel/QskInputContext.h + inputpanel/QskInputPanel.h + inputpanel/QskInputPanelBox.h + inputpanel/QskInputPredictionBar.h + inputpanel/QskVirtualKeyboard.h +) + +list(APPEND SOURCES + inputpanel/QskTextPredictor.cpp + inputpanel/QskInputContext.cpp + inputpanel/QskInputPanel.cpp + inputpanel/QskInputPanelBox.cpp + inputpanel/QskInputPredictionBar.cpp + inputpanel/QskVirtualKeyboard.cpp +) + +if(ENABLE_PINYIN) + list(APPEND HEADERS inputpanel/QskPinyinTextPredictor.h) + list(APPEND SOURCES inputpanel/QskPinyinTextPredictor.cpp) +endif() + +if(ENABLE_HUNSPELL) + list(APPEND HEADERS inputpanel/QskHunspellTextPredictor.h) + list(APPEND SOURCES inputpanel/QskHunspellTextPredictor.cpp) +endif() + +set(target qskinny) + +if(BUILD_QSKDLL) + qsk_add_library(${target} SHARED ${SOURCES} ${HEADERS} ${PRIVATE_HEADERS}) +else() + qsk_add_library(${target} STATIC ${SOURCES} ${HEADERS} ${PRIVATE_HEADERS}) +endif() + +if(BUILD_QSKDLL) + target_compile_definitions(${target} PUBLIC QSK_DLL ) + set_target_properties(${target} PROPERTIES DEFINE_SYMBOL QSK_MAKEDLL) +endif() + +target_include_directories(${target} PUBLIC + $ + $ + $ + $ + $ + $ + $) + +target_link_libraries(${target} + PUBLIC Qt::Core Qt::CorePrivate Qt::Quick Qt::QuickPrivate) + +if (QT_VERSION_MAJOR VERSION_GREATER 5) + target_link_libraries(${target} PUBLIC Qt::OpenGL Qt::OpenGLPrivate) +endif() + +if(ENABLE_HUNSPELL) + target_link_libraries(${target} PRIVATE hunspell) +endif() + +if(ENABLE_PINYIN) + target_compile_definitions(${target} PRIVATE PINYIN) + target_link_libraries(${target} PRIVATE pinyin Fcitx5::Utils) + + target_include_directories(${target} + PUBLIC $) +endif() + +set_target_properties(${target} PROPERTIES FOLDER libs) + +# TODO hack for standalone qvg2svg +set_target_properties(${target} + PROPERTIES AUTOGEN_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/qskinny_autogen) + +list(TRANSFORM HEADERS PREPEND "${CMAKE_CURRENT_LIST_DIR}/") +set_target_properties(${target} PROPERTIES PUBLIC_HEADER "${HEADERS}") +set_target_properties(${target} PROPERTIES + VERSION ${CMAKE_PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) + +install(TARGETS ${target} ) diff --git a/src/src.pro b/src/src.pro deleted file mode 100644 index 6cd9ba77..00000000 --- a/src/src.pro +++ /dev/null @@ -1,454 +0,0 @@ -TEMPLATE = lib -TARGET = $$qskLibraryTarget(qskinny) - -QT += quick quick-private - -greaterThan( QT_MAJOR_VERSION, 5 ) { - QT += opengl-private -} - -contains(QSK_CONFIG, QskDll): DEFINES += QSK_MAKEDLL - -QSK_SUBDIRS = common graphic nodes controls layouts dialogs inputpanel -INCLUDEPATH *= $${QSK_SUBDIRS} -DEPENDPATH *= $${QSK_SUBDIRS} - -# CONFIG += pinyin -# CONFIG += hunspell - -HEADERS += \ - common/QskArcMetrics.h \ - common/QskAspect.h \ - common/QskBoxBorderColors.h \ - common/QskBoxBorderMetrics.h \ - common/QskBoxShapeMetrics.h \ - common/QskBoxHints.h \ - common/QskFunctions.h \ - common/QskGlobal.h \ - common/QskGradient.h \ - common/QskGradientDirection.h \ - common/QskGradientStop.h \ - common/QskHctColor.h \ - common/QskIntervalF.h \ - common/QskLabelData.h \ - common/QskMargins.h \ - common/QskMetaFunction.h \ - common/QskMetaFunction.hpp \ - common/QskMetaInvokable.h \ - common/QskNamespace.h \ - common/QskObjectCounter.h \ - common/QskPlacementPolicy.h \ - common/QskPlatform.h \ - common/QskRgbValue.h \ - common/QskScaleEngine.h \ - common/QskScaleTickmarks.h \ - common/QskShadowMetrics.h \ - common/QskSizePolicy.h \ - common/QskStateCombination.h \ - common/QskTextColors.h \ - common/QskTextOptions.h - -SOURCES += \ - common/QskArcMetrics.cpp \ - common/QskAspect.cpp \ - common/QskBoxBorderColors.cpp \ - common/QskBoxBorderMetrics.cpp \ - common/QskBoxShapeMetrics.cpp \ - common/QskBoxHints.cpp \ - common/QskFunctions.cpp \ - common/QskGradient.cpp \ - common/QskGradientDirection.cpp \ - common/QskGradientStop.cpp \ - common/QskHctColor.cpp \ - common/QskIntervalF.cpp \ - common/QskLabelData.cpp \ - common/QskMargins.cpp \ - common/QskMetaFunction.cpp \ - common/QskMetaInvokable.cpp \ - common/QskObjectCounter.cpp \ - common/QskPlatform.cpp \ - common/QskPlacementPolicy.cpp \ - common/QskRgbValue.cpp \ - common/QskScaleEngine.cpp \ - common/QskScaleTickmarks.cpp \ - common/QskShadowMetrics.cpp \ - common/QskSizePolicy.cpp \ - common/QskTextColors.cpp \ - common/QskTextOptions.cpp - -HEADERS += \ - graphic/QskColorFilter.h \ - graphic/QskGraphic.h \ - graphic/QskGraphicImageProvider.h \ - graphic/QskGraphicIO.h \ - graphic/QskGraphicPaintEngine.h \ - graphic/QskGraphicProvider.h \ - graphic/QskGraphicProviderMap.h \ - graphic/QskGraphicTextureFactory.h \ - graphic/QskIcon.h \ - graphic/QskPainterCommand.h \ - graphic/QskStandardSymbol.h - -SOURCES += \ - graphic/QskColorFilter.cpp \ - graphic/QskGraphic.cpp \ - graphic/QskGraphicImageProvider.cpp \ - graphic/QskGraphicIO.cpp \ - graphic/QskGraphicPaintEngine.cpp \ - graphic/QskGraphicProvider.cpp \ - graphic/QskGraphicProviderMap.cpp \ - graphic/QskGraphicTextureFactory.cpp \ - graphic/QskIcon.cpp \ - graphic/QskPainterCommand.cpp \ - graphic/QskStandardSymbol.cpp - -HEADERS += \ - nodes/QskArcNode.h \ - nodes/QskArcRenderer.h \ - nodes/QskBoxNode.h \ - nodes/QskBoxClipNode.h \ - nodes/QskBoxFillNode.h \ - nodes/QskBoxRectangleNode.h \ - nodes/QskBoxRenderer.h \ - nodes/QskBoxMetrics.h \ - nodes/QskBoxBasicStroker.h \ - nodes/QskBoxGradientStroker.h \ - nodes/QskBoxColorMap.h \ - nodes/QskBoxShadowNode.h \ - nodes/QskColorRamp.h \ - nodes/QskGraphicNode.h \ - nodes/QskPaintedNode.h \ - nodes/QskPlainTextRenderer.h \ - nodes/QskRectangleNode.h \ - nodes/QskRichTextRenderer.h \ - nodes/QskScaleRenderer.h \ - nodes/QskSGNode.h \ - nodes/QskStrokeNode.h \ - nodes/QskShapeNode.h \ - nodes/QskGradientMaterial.h \ - nodes/QskTextNode.h \ - nodes/QskTextRenderer.h \ - nodes/QskTextureRenderer.h \ - nodes/QskTickmarksNode.h \ - nodes/QskVertex.h - -SOURCES += \ - nodes/QskArcNode.cpp \ - nodes/QskArcRenderer.cpp \ - nodes/QskBoxNode.cpp \ - nodes/QskBoxClipNode.cpp \ - nodes/QskBoxFillNode.cpp \ - nodes/QskBoxRectangleNode.cpp \ - nodes/QskBoxRenderer.cpp \ - nodes/QskBoxMetrics.cpp \ - nodes/QskBoxBasicStroker.cpp \ - nodes/QskBoxGradientStroker.cpp \ - nodes/QskBoxShadowNode.cpp \ - nodes/QskColorRamp.cpp \ - nodes/QskGraphicNode.cpp \ - nodes/QskPaintedNode.cpp \ - nodes/QskPlainTextRenderer.cpp \ - nodes/QskRectangleNode.cpp \ - nodes/QskRichTextRenderer.cpp \ - nodes/QskScaleRenderer.cpp \ - nodes/QskSGNode.cpp \ - nodes/QskStrokeNode.cpp \ - nodes/QskShapeNode.cpp \ - nodes/QskGradientMaterial.cpp \ - nodes/QskTextNode.cpp \ - nodes/QskTextRenderer.cpp \ - nodes/QskTextureRenderer.cpp \ - nodes/QskTickmarksNode.cpp \ - nodes/QskVertex.cpp - -RESOURCES += \ - nodes/shaders.qrc - -HEADERS += \ - controls/QskAbstractButton.h \ - controls/QskAnimationHint.h \ - controls/QskAnimator.h \ - controls/QskBoundedControl.h \ - controls/QskBoundedInput.h \ - controls/QskBoundedRangeInput.h \ - controls/QskBoundedValueInput.h \ - controls/QskBox.h \ - controls/QskBoxSkinlet.h \ - controls/QskCheckBox.h \ - controls/QskCheckBoxSkinlet.h \ - controls/QskComboBox.h \ - controls/QskComboBoxSkinlet.h \ - controls/QskControl.h \ - controls/QskControlPrivate.h \ - controls/QskDirtyItemFilter.h \ - controls/QskEvent.h \ - controls/QskFlickAnimator.h \ - controls/QskFocusIndicator.h \ - controls/QskFocusIndicatorSkinlet.h \ - controls/QskGesture.h \ - controls/QskGestureRecognizer.h \ - controls/QskGraphicLabel.h \ - controls/QskGraphicLabelSkinlet.h \ - controls/QskHintAnimator.h \ - controls/QskInputGrabber.h \ - controls/QskListView.h \ - controls/QskListViewSkinlet.h \ - controls/QskMainView.h \ - controls/QskMenu.h \ - controls/QskMenuSkinlet.h \ - controls/QskObjectTree.h \ - controls/QskPageIndicator.h \ - controls/QskPageIndicatorSkinlet.h \ - controls/QskPanGestureRecognizer.h \ - controls/QskPopup.h \ - controls/QskPopupSkinlet.h \ - controls/QskPushButton.h \ - controls/QskPushButtonSkinlet.h \ - controls/QskProgressBar.h \ - controls/QskProgressBarSkinlet.h \ - controls/QskQuick.h \ - controls/QskQuickItem.h \ - controls/QskQuickItemPrivate.h \ - controls/QskRadioBox.h \ - controls/QskRadioBoxSkinlet.h \ - controls/QskScrollArea.h \ - controls/QskScrollBox.h \ - controls/QskScrollView.h \ - controls/QskScrollViewSkinlet.h \ - controls/QskSegmentedBar.h \ - controls/QskSegmentedBarSkinlet.h \ - controls/QskSeparator.h \ - controls/QskSeparatorSkinlet.h \ - controls/QskSetup.h \ - controls/QskShortcutMap.h \ - controls/QskSimpleListBox.h \ - controls/QskSkin.h \ - controls/QskSkinFactory.h \ - controls/QskSkinHintTable.h \ - controls/QskSkinHintTableEditor.h \ - controls/QskSkinManager.h \ - controls/QskSkinStateChanger.h \ - controls/QskSkinTransition.h \ - controls/QskSkinlet.h \ - controls/QskSkinnable.h \ - controls/QskSlider.h \ - controls/QskSliderSkinlet.h \ - controls/QskStatusIndicator.h \ - controls/QskStatusIndicatorSkinlet.h \ - controls/QskSpinBox.h \ - controls/QskSpinBoxSkinlet.h \ - controls/QskSubWindowArea.h \ - controls/QskSubWindowAreaSkinlet.h \ - controls/QskSubWindow.h \ - controls/QskSubWindowSkinlet.h \ - controls/QskSwitchButton.h \ - controls/QskSwitchButtonSkinlet.h \ - controls/QskTabBar.h \ - controls/QskTabButton.h \ - controls/QskTabButtonSkinlet.h \ - controls/QskTabView.h \ - controls/QskTabViewSkinlet.h \ - controls/QskTextInput.h \ - controls/QskTextInputSkinlet.h \ - controls/QskTextLabel.h \ - controls/QskTextLabelSkinlet.h \ - controls/QskVariantAnimator.h \ - controls/QskWindow.h - -SOURCES += \ - controls/QskAbstractButton.cpp \ - controls/QskAnimator.cpp \ - controls/QskAnimationHint.cpp \ - controls/QskBoundedControl.cpp \ - controls/QskBoundedInput.cpp \ - controls/QskBoundedRangeInput.cpp \ - controls/QskBoundedValueInput.cpp \ - controls/QskBox.cpp \ - controls/QskBoxSkinlet.cpp \ - controls/QskCheckBox.cpp \ - controls/QskCheckBoxSkinlet.cpp \ - controls/QskComboBox.cpp \ - controls/QskComboBoxSkinlet.cpp \ - controls/QskControl.cpp \ - controls/QskControlPrivate.cpp \ - controls/QskDirtyItemFilter.cpp \ - controls/QskEvent.cpp \ - controls/QskFlickAnimator.cpp \ - controls/QskFocusIndicator.cpp \ - controls/QskFocusIndicatorSkinlet.cpp \ - controls/QskGesture.cpp \ - controls/QskGestureRecognizer.cpp \ - controls/QskGraphicLabel.cpp \ - controls/QskGraphicLabelSkinlet.cpp \ - controls/QskHintAnimator.cpp \ - controls/QskInputGrabber.cpp \ - controls/QskListView.cpp \ - controls/QskListViewSkinlet.cpp \ - controls/QskMainView.cpp \ - controls/QskMenuSkinlet.cpp \ - controls/QskMenu.cpp \ - controls/QskObjectTree.cpp \ - controls/QskPageIndicator.cpp \ - controls/QskPageIndicatorSkinlet.cpp \ - controls/QskPanGestureRecognizer.cpp \ - controls/QskPopup.cpp \ - controls/QskPopupSkinlet.cpp \ - controls/QskPushButton.cpp \ - controls/QskPushButtonSkinlet.cpp \ - controls/QskProgressBar.cpp \ - controls/QskProgressBarSkinlet.cpp \ - controls/QskQuick.cpp \ - controls/QskQuickItem.cpp \ - controls/QskQuickItemPrivate.cpp \ - controls/QskScrollArea.cpp \ - controls/QskScrollBox.cpp \ - controls/QskScrollView.cpp \ - controls/QskRadioBox.cpp \ - controls/QskRadioBoxSkinlet.cpp \ - controls/QskScrollViewSkinlet.cpp \ - controls/QskSegmentedBar.cpp \ - controls/QskSegmentedBarSkinlet.cpp \ - controls/QskSeparator.cpp \ - controls/QskSeparatorSkinlet.cpp \ - controls/QskSetup.cpp \ - controls/QskShortcutMap.cpp \ - controls/QskSimpleListBox.cpp \ - controls/QskSkin.cpp \ - controls/QskSkinHintTable.cpp \ - controls/QskSkinHintTableEditor.cpp \ - controls/QskSkinFactory.cpp \ - controls/QskSkinManager.cpp \ - controls/QskSkinTransition.cpp \ - controls/QskSkinlet.cpp \ - controls/QskSkinnable.cpp \ - controls/QskSlider.cpp \ - controls/QskSliderSkinlet.cpp \ - controls/QskSpinBox.cpp \ - controls/QskSpinBoxSkinlet.cpp \ - controls/QskStatusIndicator.cpp \ - controls/QskStatusIndicatorSkinlet.cpp \ - controls/QskSubWindowArea.cpp \ - controls/QskSubWindowAreaSkinlet.cpp \ - controls/QskSubWindow.cpp \ - controls/QskSubWindowSkinlet.cpp \ - controls/QskSwitchButton.cpp \ - controls/QskSwitchButtonSkinlet.cpp \ - controls/QskTabBar.cpp \ - controls/QskTabButton.cpp \ - controls/QskTabButtonSkinlet.cpp \ - controls/QskTabView.cpp \ - controls/QskTabViewSkinlet.cpp \ - controls/QskTextInput.cpp \ - controls/QskTextInputSkinlet.cpp \ - controls/QskTextLabel.cpp \ - controls/QskTextLabelSkinlet.cpp \ - controls/QskVariantAnimator.cpp \ - controls/QskWindow.cpp - -HEADERS += \ - layouts/QskGridBox.h \ - layouts/QskGridLayoutEngine.h \ - layouts/QskIndexedLayoutBox.h \ - layouts/QskLayoutChain.h \ - layouts/QskLayoutEngine2D.h \ - layouts/QskLayoutElement.h \ - layouts/QskLayoutMetrics.h \ - layouts/QskLinearBox.h \ - layouts/QskLinearLayoutEngine.h \ - layouts/QskStackBoxAnimator.h \ - layouts/QskStackBox.h \ - layouts/QskSubcontrolLayoutEngine.h - -SOURCES += \ - layouts/QskGridBox.cpp \ - layouts/QskGridLayoutEngine.cpp \ - layouts/QskIndexedLayoutBox.cpp \ - layouts/QskLayoutChain.cpp \ - layouts/QskLayoutEngine2D.cpp \ - layouts/QskLayoutElement.cpp \ - layouts/QskLayoutMetrics.cpp \ - layouts/QskLinearBox.cpp \ - layouts/QskLinearLayoutEngine.cpp \ - layouts/QskStackBoxAnimator.cpp \ - layouts/QskStackBox.cpp \ - layouts/QskSubcontrolLayoutEngine.cpp - -HEADERS += \ - dialogs/QskDialog.h \ - dialogs/QskDialogButton.h \ - dialogs/QskDialogButtonBox.h \ - dialogs/QskDialogSubWindow.h \ - dialogs/QskDialogWindow.h \ - dialogs/QskMessageSubWindow.h \ - dialogs/QskMessageWindow.h \ - dialogs/QskSelectionSubWindow.h \ - dialogs/QskSelectionWindow.h - -SOURCES += \ - dialogs/QskDialogButton.cpp \ - dialogs/QskDialogButtonBox.cpp \ - dialogs/QskDialog.cpp \ - dialogs/QskDialogSubWindow.cpp \ - dialogs/QskDialogWindow.cpp \ - dialogs/QskMessageSubWindow.cpp \ - dialogs/QskMessageWindow.cpp \ - dialogs/QskSelectionSubWindow.cpp \ - dialogs/QskSelectionWindow.cpp - -HEADERS += \ - inputpanel/QskTextPredictor.h \ - inputpanel/QskInputContext.h \ - inputpanel/QskInputPanel.h \ - inputpanel/QskInputPanelBox.h \ - inputpanel/QskInputPredictionBar.h \ - inputpanel/QskVirtualKeyboard.h - -SOURCES += \ - inputpanel/QskTextPredictor.cpp \ - inputpanel/QskInputContext.cpp \ - inputpanel/QskInputPanel.cpp \ - inputpanel/QskInputPanelBox.cpp \ - inputpanel/QskInputPredictionBar.cpp \ - inputpanel/QskVirtualKeyboard.cpp - - -pinyin { - - unix { - - DEFINES += PINYIN - - CONFIG += link_pkgconfig - PKGCONFIG += pinyin - - HEADERS += \ - inputpanel/QskPinyinTextPredictor.h - - SOURCES += \ - inputpanel/QskPinyinTextPredictor.cpp - } -} - -hunspell { - - unix { - - DEFINES += HUNSPELL - - CONFIG += link_pkgconfig - PKGCONFIG += hunspell - - HEADERS += \ - inputpanel/QskHunspellTextPredictor.h - - SOURCES += \ - inputpanel/QskHunspellTextPredictor.cpp - } -} - -target.path = $${QSK_INSTALL_LIBS} -INSTALLS = target - -header_files.files = $$HEADERS -header_files.path = $${QSK_INSTALL_HEADERS} -INSTALLS += header_files diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt new file mode 100644 index 00000000..9325aaaa --- /dev/null +++ b/support/CMakeLists.txt @@ -0,0 +1,59 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the 3-clause BSD License +############################################################################ + +set(SOURCES + SkinnyGlobal.h + SkinnyNamespace.h SkinnyNamespace.cpp + SkinnyShapeFactory.h SkinnyShapeFactory.cpp + SkinnyShapeProvider.h SkinnyShapeProvider.cpp + SkinnyShortcut.h SkinnyShortcut.cpp +) + +set(target qsktestsupport) + +if (BUILD_QSKDLL) + qsk_add_library(${target} SHARED ${SOURCES}) +else() + qsk_add_library(${target} STATIC ${SOURCES}) +endif() + +target_link_libraries(${target} PUBLIC qskinny) + +if (BUILD_QSKDLL) + set_target_properties( ${target} PROPERTIES DEFINE_SYMBOL SKINNY_MAKEDLL ) +endif() + +target_compile_definitions(${target} + PRIVATE PLUGIN_PATH=${CMAKE_BINARY_DIR}/plugins) + +target_include_directories(${target} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) + +if(ENABLE_ENSURE_SKINS) + target_include_directories(${target} PRIVATE ${CMAKE_SOURCE_DIR}/skins) + target_compile_definitions(${target} PRIVATE ENSURE_SKINS) + target_link_libraries(${target} PRIVATE squiekskin material3skin) +endif() + +set(HIDE_SYSTEM_FONTS ON) + +if(HIDE_SYSTEM_FONTS) + message( STATUS "Hiding system fonts from the examples" ) + + # The fonts being used in the examples are included and we do not + # need the fonts from the system. To avoid, that setting up the font + # cache slows doesn the stratup performance we hide the system fonts + # be using a dummy font config environment. + # ( this hack is pretty old ( Qt 5.4 ) - maybe it is not needed anymore TODO ) + + set(QSK_FONTDIR ${CMAKE_CURRENT_LIST_DIR}/fonts) + set(QSK_FONTCACHEDIR ${CMAKE_CURRENT_BINARY_DIR}/fontconfig) + set(QSK_FONTCONF_FILE ${QSK_FONTCACHEDIR}/fonts.conf) + + configure_file(fonts.conf.cmake.in ${QSK_FONTCONF_FILE} + @ONLY NEWLINE_STYLE LF) + + target_compile_definitions(${target} + PRIVATE FONTCONFIG_FILE=${QSK_FONTCONF_FILE}) +endif() diff --git a/support/fonts.conf.in b/support/fonts.conf.cmake.in similarity index 53% rename from support/fonts.conf.in rename to support/fonts.conf.cmake.in index ac65f704..501a1fa0 100644 --- a/support/fonts.conf.in +++ b/support/fonts.conf.cmake.in @@ -1,9 +1,6 @@ - - - FONTDIR - FONTCACHEDIR/cache - + @QSK_FONTDIR@ + @QSK_FONTCACHEDIR@/cache diff --git a/support/support.pro b/support/support.pro deleted file mode 100644 index 80773cf8..00000000 --- a/support/support.pro +++ /dev/null @@ -1,57 +0,0 @@ -TEMPLATE = lib -TARGET = $$qskLibraryTarget(qsktestsupport) - -target.path = $${QSK_INSTALL_EXAMPLES}/lib -INSTALLS = target - -CONFIG += ensure_skins -CONFIG += fontconfig -CONFIG += qskinny - -contains(QSK_CONFIG, QskDll): DEFINES += SKINNY_MAKEDLL - -HEADERS += \ - SkinnyGlobal.h \ - SkinnyNamespace.h \ - SkinnyShapeFactory.h \ - SkinnyShapeProvider.h \ - SkinnyShortcut.h - -SOURCES += \ - SkinnyNamespace.cpp \ - SkinnyShapeFactory.cpp \ - SkinnyShapeProvider.cpp \ - SkinnyShortcut.cpp - -DEFINES += PLUGIN_PATH=$${QSK_PLUGIN_DIR} - -ensure_skins { - - # Enabling fall back code, that inserts some skin factories manually - # when not finding skin factories as plugins - - INCLUDEPATH *= $${QSK_ROOT}/skins - DEPENDPATH *= $${QSK_ROOT}/skins - - DEFINES += ENSURE_SKINS - - use_install_rpath: QMAKE_RPATHDIR *= $${QSK_INSTALL_PLUGINS}/skins - use_local_rpath: QMAKE_RPATHDIR *= $${QSK_PLUGIN_DIR}/skins - - qskAddLibrary($${QSK_PLUGIN_DIR}/skins, squiekskin) - qskAddLibrary($${QSK_PLUGIN_DIR}/skins, material3skin) -} - -fontconfig { - - QSK_FONTDIR=$${PWD}/fonts - QSK_FONTCACHEDIR=$${OUT_PWD}/fontconfig - QSK_FONTCONF_FILE=$${QSK_FONTCACHEDIR}/fonts.conf - - QSK_FONTCONF_DATA = "$$cat( $${PWD}/fonts.conf.in, false )" - QSK_FONTCONF_DATA = $$replace(QSK_FONTCONF_DATA, FONTCACHEDIR, $${QSK_FONTCACHEDIR} ) - QSK_FONTCONF_DATA = $$replace(QSK_FONTCONF_DATA, FONTDIR, $${QSK_FONTDIR} ) - write_file( $${QSK_FONTCONF_FILE}, QSK_FONTCONF_DATA ) - - DEFINES += FONTCONFIG_FILE=$$clean_path( $$QSK_FONTCONF_FILE ) -} diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 00000000..74da26cc --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,3 @@ +if(TARGET Qt::Svg) + add_subdirectory(svg2qvg) +endif() \ No newline at end of file diff --git a/tools/svg2qvg/CMakeLists.txt b/tools/svg2qvg/CMakeLists.txt new file mode 100644 index 00000000..07cae97b --- /dev/null +++ b/tools/svg2qvg/CMakeLists.txt @@ -0,0 +1,44 @@ +############################################################################ +# QSkinny - Copyright (C) 2016 Uwe Rathmann +# This file may be used under the terms of the QSkinny License, Version 1.0 +############################################################################ + +set(target svg2qvg) +qsk_add_executable(${target} main.cpp) + +if(BUILD_SVG2QVG_STANDALONE) + + # NOTE: when building standalone some moc files are transitively required. + # These files are being created by the qskinny build, hence we add an explicit dependency. + # E.g. main.cpp -> #include -> #include "moc_QskGraphic.cpp" + add_dependencies(${target} qskinny) + + # TODO hack for standalone qvg2svg + get_target_property(qskinny_AUTOGEN_DIR qskinny AUTOGEN_BUILD_DIR) + if (${qskinny_AUTOGEN_DIR} STREQUAL "") + message(FATAL_ERROR "Directory '${qskinny_AUTOGEN_DIR}' doesn't exist") + endif() + + # TODO fix multi configuration generators + if(CMAKE_GENERATOR MATCHES "Visual Studio.*") + add_definitions("/I${qskinny_AUTOGEN_DIR}/include_\$(Configuration)") + else() + target_include_directories(${target} PRIVATE ${qskinny_AUTOGEN_DIR}/include) + endif() + + target_include_directories(${target} + PRIVATE + ${CMAKE_SOURCE_DIR}/src/common + ${CMAKE_SOURCE_DIR}/src/graphic) + + target_compile_definitions(${target} PRIVATE QSK_STANDALONE) + target_link_libraries(${target} PRIVATE Qt::Gui Qt::GuiPrivate) +else() + target_link_libraries(${target} PRIVATE qskinny) +endif() + +target_link_libraries(${target} PRIVATE Qt::Svg) + +set_target_properties(${target} PROPERTIES FOLDER tools) + +install(TARGETS ${target}) diff --git a/tools/svg2qvg/svg2qvg.pro b/tools/svg2qvg/svg2qvg.pro deleted file mode 100644 index 19a433f1..00000000 --- a/tools/svg2qvg/svg2qvg.pro +++ /dev/null @@ -1,38 +0,0 @@ -TEMPLATE = app -TARGET = svg2qvg - -QT += svg - -CONFIG += standalone -CONFIG -= app_bundle -CONFIG -= sanitize - -DESTDIR = $${QSK_OUT_ROOT}/tools/bin - -standalone { - - # We only need a very small subset of QSkinny and by including the - # necessary cpp files svg2qvg becomes independent from the library - - QSK_DIRS = \ - $${QSK_ROOT}/src/common \ - $${QSK_ROOT}/src/graphic - - INCLUDEPATH *= $${QSK_DIRS} $${QSK_OUT_ROOT}/src/$${MOC_DIR} - DEPENDPATH += $${QSK_DIRS} - - DEFINES += QSK_STANDALONE - QSK_CONFIG -= QskDll - - QT += gui-private -} -else { - - CONFIG += qskinny -} - -SOURCES += \ - main.cpp - -target.path = $${QSK_INSTALL_BINS} -INSTALLS = target diff --git a/tools/tools.pro b/tools/tools.pro deleted file mode 100644 index 244b20c9..00000000 --- a/tools/tools.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = subdirs - -qtHaveModule(svg) { - - SUBDIRS += \ - svg2qvg -}