diff --git a/.appveyor.yml b/.appveyor.yml index 35ef837..9771255 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,36 +1,28 @@ -version: '2.3.2.{build}' +version: '{build}' branches: only: - master -image: Visual Studio 2015 -clone_depth: 1 +image: Visual Studio 2017 + environment: global: # Appveyor doesn't have Qt 12 yet - LatestLTSQtVersion: 5.9 - LatestQtVersion: 5.11 + LatestQtVersion: 5.13 matrix: - # Latest version of Qt, dll, 64bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC - targetPlatform: amd64 - use_mingw: "false" - use_static: "false" - use_cmake: "false" # 32 bit builds # MSVC 2015 builds # Dynamic Library builds # LTS version of Qt, dll, 32bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: x86 use_mingw: "false" use_static: "false" use_cmake: "false" # LTS version of Qt, dll, 32bit, MSVC 2015, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: x86 use_mingw: "false" use_static: "false" @@ -38,15 +30,15 @@ environment: # end Dynamic Library builds # Static Library builds # LTS version of Qt, static, 32bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: x86 use_mingw: "false" use_static: "true" use_cmake: "false" # LTS version of Qt, static, 32bit, MSVC 2015, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: x86 use_mingw: "false" use_static: "true" @@ -56,15 +48,15 @@ environment: # MinGW builds # Dynamic Library builds # LTS version of Qt, dll, 32bit, MinGW, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - COMPILER: C:\Qt\Tools\mingw530_32 + - QT5: C:\Qt\%LatestQtVersion%\mingw73_32 + COMPILER: C:\Qt\Tools\mingw730_32 targetPlatform: x86 use_mingw: "true" use_static: "false" use_cmake: "false" # LTS version of Qt, dll, 32bit, MinGW, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - COMPILER: C:\Qt\Tools\mingw530_32 + - QT5: C:\Qt\%LatestQtVersion%\mingw73_32 + COMPILER: C:\Qt\Tools\mingw730_32 targetPlatform: x86 use_mingw: "true" use_static: "false" @@ -72,15 +64,15 @@ environment: # end Dynamic Library builds # Static Library builds # LTS version of Qt, static, 32bit, MinGW, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - COMPILER: C:\Qt\Tools\mingw530_32 + - QT5: C:\Qt\%LatestQtVersion%\mingw73_32 + COMPILER: C:\Qt\Tools\mingw730_32 targetPlatform: x86 use_mingw: "true" use_static: "true" use_cmake: "false" # LTS version of Qt, static, 32bit, MinGW, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - COMPILER: C:\Qt\Tools\mingw530_32 + - QT5: C:\Qt\%LatestQtVersion%\mingw73_32 + COMPILER: C:\Qt\Tools\mingw730_32 targetPlatform: x86 use_mingw: "true" use_static: "true" @@ -92,15 +84,15 @@ environment: # MSVC 2015 builds # Dynamic Library builds # LTS version of Qt, dll, 64bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: amd64 use_mingw: "false" use_static: "false" use_cmake: "false" # LTS version of Qt, dll, 64bit, MSVC 2015, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: amd64 use_mingw: "false" use_static: "false" @@ -108,15 +100,15 @@ environment: # end Dynamic Library builds # Static Library builds # LTS version of Qt, static, 64bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: amd64 use_mingw: "false" use_static: "true" use_cmake: "false" # LTS version of Qt, static, 64bit, MSVC 2015, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: amd64 use_mingw: "false" use_static: "true" @@ -129,10 +121,9 @@ matrix: fast_finish: true before_build: -- set PATH=%COMPILER%\bin;%QT5%\bin;%PATH% - set originalWD=%CD% - call "%QT5%\bin\qtenv2.bat" -- cd %originalWD% +- cd /D %originalWD% - if %use_mingw%==false call "%COMPILER%\vcvarsall.bat" %targetPlatform% - if %use_static%==true (set USESTATIC=ON) else (set USESTATIC=OFF) - if %use_mingw%==true (set CMAKEGENERATOR="MinGW Makefiles") else (set CMAKEGENERATOR="NMake Makefiles") @@ -140,8 +131,8 @@ before_build: - if %use_mingw%==true set PATH=%PATH:C:\Program Files\Git\usr\bin;=% build_script: -- if %use_cmake%==true mkdir .\build -- if %use_cmake%==true cd .\build +- if %use_cmake%==true mkdir build +- if %use_cmake%==true cd build - if %use_cmake%==true cmake --version - if %use_cmake%==true cmake -G %CMAKEGENERATOR% -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DBUILD_STATIC=%USESTATIC% -DCMAKE_INSTALL_PREFIX="./installed" ../ - if %use_cmake%==true cmake --build . diff --git a/.cproject b/.cproject deleted file mode 100644 index cdd20b3..0000000 --- a/.cproject +++ /dev/null @@ -1,395 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mingw32-make - -j - all - false - false - false - - - make - clean - false - true - false - - - mingw32-make - -j6 - debug - false - false - false - - - qmake - -recursive ../ads.pro - true - false - false - - - mingw32-make - -j4 - release - false - false - false - - - mingw32-make - -j - all - false - false - false - - - make - - clean - false - true - false - - - mingw32-make - -j6 - debug - false - false - false - - - qmake - -recursive ../../src/src.pro - true - false - false - - - mingw32-make - -j4 - release - false - false - false - - - mingw32-make - -j - all - false - false - false - - - make - clean - false - true - false - - - mingw32-make - -j6 - debug - false - false - false - - - qmake - -recursive ../../example/example.pro - true - false - false - - - mingw32-make - -j4 - release - false - false - false - - - mingw32-make - -j - all - false - false - false - - - make - - clean - false - true - false - - - mingw32-make - -j6 - debug - false - false - false - - - qmake - -recursive ../../demo/demo.pro - true - false - false - - - mingw32-make - -j4 - release - false - false - false - - - mingw32-make - -j - all - false - false - false - - - make - - clean - false - true - false - - - mingw32-make - -j6 - debug - false - false - false - - - qmake - -recursive ../../../examples/sidebar/sidebar.pro - - true - false - false - - - mingw32-make - -j4 - release - false - false - false - - - mingw32-make - -j - all - false - false - false - - - make - clean - false - true - false - - - mingw32-make - -j6 - debug - false - false - false - - - qmake - -recursive ../../AdvancedDockingSystemDemo/AdvancedDockingSystemDemo.pro - true - false - false - - - mingw32-make - -j4 - release - false - false - false - - - mingw32-make - -j - all - false - false - false - - - make - clean - false - true - false - - - mingw32-make - -j6 - debug - false - false - false - - - qmake - -recursive ../../AdvancedDockingSystemDemo_v2/AdvancedDockingSystemDemo_v2.pro - true - false - false - - - mingw32-make - -j4 - release - false - false - false - - - mingw32-make - -j - all - false - false - false - - - make - clean - false - true - false - - - mingw32-make - -j6 - debug - false - false - false - - - qmake - -recursive ../../AdvancedDockingSystem/src.pro - true - false - false - - - mingw32-make - -j4 - release - false - false - false - - - - diff --git a/.gitignore b/.gitignore index 7b001e3..f9e79be 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,368 @@ Makefile *.pyd __pycache__ PyQtAds/rc.py +/.cproject + + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*[.json, .xml, .info] + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd +/ build +/Settings.ini diff --git a/.travis.yml b/.travis.yml index 6b4afaa..d45b526 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,6 @@ language: cpp # gcc is clang on mac compiler: gcc -git: - depth: 1 - matrix: fast_finish: true include: @@ -21,74 +18,152 @@ matrix: packages: - qt55base - qt55tools - - gcc-6 - - g++-6 - - libc6-i386 + - gcc-9 + - g++-9 script: - PATH="/opt/qt55/bin:$PATH" - - CXX="g++-6" - - CC="gcc-6" + - CXX="g++-9" + - CC="gcc-9" - qt55-env.sh - qmake - make - make install - name: Ubuntu qmake dll os: linux - dist: xenial + dist: bionic group: stable + services: + - xvfb + compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test - - sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial' + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' update: true packages: - - qt512base - - qt512tools - - gcc-6 - - g++-6 + - qt514base + - qt514tools + - gcc-9 + - g++-9 - libc6-i386 - libgl-dev - libgl1-mesa-dev - mesa-common-dev script: - - PATH="/opt/qt512/bin:$PATH" - - CXX="g++-6" - - CC="gcc-6" - - qt512-env.sh + - PATH="/opt/qt514/bin:$PATH" + - CXX="g++-9" + - CC="gcc-9" + - qt514-env.sh - qmake - make - make install - name: Ubuntu qmake static os: linux - dist: xenial + dist: bionic group: stable + services: + - xvfb + compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test - - sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial' + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' update: true packages: - - qt512base - - qt512tools - - gcc-6 - - g++-6 + - qt514base + - qt514tools + - gcc-9 + - g++-9 - libc6-i386 - libgl-dev - libgl1-mesa-dev - mesa-common-dev script: - - PATH="/opt/qt512/bin:$PATH" - - CXX="g++-6" - - CC="gcc-6" - - qt512-env.sh + - PATH="/opt/qt514/bin:$PATH" + - CXX="g++-9" + - CC="gcc-9" + - qt514-env.sh - qmake "CONFIG+=adsBuildStatic" - make - make install + - name: Ubuntu CMake dll + os: linux + dist: bionic + group: stable + services: + - xvfb + compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' + update: true + packages: + - qt514base + - qt514tools + - gcc-9 + - g++-9 + - libc6-i386 + - libgl-dev + - libgl1-mesa-dev + - mesa-common-dev + script: + - PATH="/opt/qt514/bin:$PATH" + - CXX="g++-9" + - CC="gcc-9" + - qt514-env.sh + - mkdir ./build + - cd ./build + - cmake --version + - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_STATIC=OFF -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_STATIC=OFF -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - name: Ubuntu CMake Static + os: linux + dist: bionic + group: stable + services: + - xvfb + compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' + update: true + packages: + - qt514base + - qt514tools + - gcc-9 + - g++-9 + - libc6-i386 + - libgl-dev + - libgl1-mesa-dev + - mesa-common-dev + script: + - PATH="/opt/qt514/bin:$PATH" + - CXX="g++-9" + - CC="gcc-9" + - qt514-env.sh + - mkdir ./build + - cd ./build + - cmake --version + - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_STATIC=ON -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_STATIC=ON -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install - name: macOS CMake dll os: osx - osx_image: xcode10.1 + osx_image: xcode11.3 + compiler: clang addons: homebrew: packages: @@ -107,7 +182,8 @@ matrix: - cmake --build . --target install - name: macOS CMake static os: osx - osx_image: xcode10.1 + osx_image: xcode11.3 + compiler: clang addons: homebrew: packages: @@ -126,7 +202,8 @@ matrix: - cmake --build . --target install - name: macOS qmake dll os: osx - osx_image: xcode10.1 + osx_image: xcode11.3 + compiler: clang addons: homebrew: packages: @@ -139,7 +216,8 @@ matrix: - make install - name: macOS qmake static os: osx - osx_image: xcode10.1 + osx_image: xcode11.3 + compiler: clang addons: homebrew: packages: diff --git a/CMakeLists.txt b/CMakeLists.txt index a246a97..94fdb8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,131 +1,22 @@ -cmake_minimum_required(VERSION 3.3) -set(ads_VERSION "2.3.2") -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -project(QtAdvancedDockingSystem VERSION ${ads_VERSION}) +cmake_minimum_required(VERSION 3.5) +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) +include(GetGitRevisionDescription) +git_describe(GitTagVersion --tags) +string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GitTagVersion}") +string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GitTagVersion}") +string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}") +set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") +project(QtADS LANGUAGES CXX VERSION ${VERSION_SHORT}) option(BUILD_STATIC "Build the static library" OFF) option(BUILD_EXAMPLES "Build the examples" ON) -set(REQUIRED_QT_VERSION 5.5.0) -find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) -message(STATUS "Found Qt ${Qt5Core_VERSION}") -set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) -set(ads_INCLUDE ${ads_INCLUDE} "${CMAKE_CURRENT_SOURCE_DIR}/src") -set(ads_LIBS ${ads_LIBS} ${Qt5Core_LIBRARIES}) -set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS}) -set(ads_LIBS ${ads_LIBS} ${Qt5Gui_LIBRARIES}) -set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) -set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) -set(ads_LIBS ${ads_LIBS} ${Qt5Widgets_LIBRARIES}) -set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) -set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) -if(BUILD_STATIC) - set(CMAKE_STATIC_LIBRARY_SUFFIX "_static${CMAKE_STATIC_LIBRARY_SUFFIX}") -endif() -set(ads_SRCS - src/ads_globals.cpp - src/DockAreaTabBar.cpp - src/DockAreaTitleBar.cpp - src/DockAreaWidget.cpp - src/DockContainerWidget.cpp - src/DockManager.cpp - src/DockOverlay.cpp - src/DockSplitter.cpp - src/DockWidget.cpp - src/DockWidgetTab.cpp - src/DockingStateReader.cpp - src/ElidingLabel.cpp - src/FloatingDockContainer.cpp - src/FloatingDragPreview.cpp - src/IconProvider.cpp - src/DockComponentsFactory.cpp - src/ads.qrc - src/linux/FloatingWidgetTitleBar.cpp -) -set(ads_INSTALL_INCLUDE - src/ads_globals.h - src/DockAreaTabBar.h - src/DockAreaTitleBar.h - src/DockAreaTitleBar_p.h - src/DockAreaWidget.h - src/DockContainerWidget.h - src/DockManager.h - src/DockOverlay.h - src/DockSplitter.h - src/DockWidget.h - src/DockWidgetTab.h - src/DockingStateReader.h - src/ElidingLabel.h - src/FloatingDockContainer.h - src/FloatingDragPreview.h - src/IconProvider.h - src/DockComponentsFactory.h - src/linux/FloatingWidgetTitleBar.h -) if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") set(ads_PlatformDir "x86") else() set(ads_PlatformDir "x64") endif() -if(BUILD_STATIC) - add_library(qtadvanceddocking STATIC ${ads_SRCS}) - target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC) -else() - add_library(qtadvanceddocking SHARED ${ads_SRCS}) - set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_SHARED_EXPORT) -endif() -install(FILES ${ads_INSTALL_INCLUDE} - DESTINATION include - COMPONENT headers -) -install(FILES - "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" - "${CMAKE_CURRENT_SOURCE_DIR}/gnu-lgpl-v2.1.md" - DESTINATION license - COMPONENT license -) -install(TARGETS qtadvanceddocking - EXPORT adsTargets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - INCLUDES DESTINATION include -) - -include(CMakePackageConfigHelpers) -write_basic_package_version_file("adsConfigVersion.cmake" - VERSION ${ads_VERSION} - COMPATIBILITY SameMajorVersion -) -install(EXPORT adsTargets - FILE adsTargets.cmake - NAMESPACE ads:: - DESTINATION lib/cmake/ads -) -install(FILES "adsConfig.cmake" "${CMAKE_BINARY_DIR}/adsConfigVersion.cmake" - DESTINATION lib/cmake/ads -) - -target_include_directories(qtadvanceddocking PUBLIC - "$" - $ - ) -target_link_libraries(qtadvanceddocking PUBLIC ${ads_LIBS}) -target_compile_definitions(qtadvanceddocking PRIVATE ${ads_COMPILE_DEFINE}) -set_target_properties(qtadvanceddocking PROPERTIES - VERSION ${ads_VERSION} - EXPORT_NAME "QtAdvancedDockingSystem" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" -) +add_subdirectory(src) if(BUILD_EXAMPLES) - add_subdirectory(examples/simple) - add_subdirectory(examples/sidebar) + add_subdirectory(examples) add_subdirectory(demo) endif() diff --git a/cmake/modules/GetGitRevisionDescription.cmake b/cmake/modules/GetGitRevisionDescription.cmake new file mode 100644 index 0000000..a9ad77b --- /dev/null +++ b/cmake/modules/GetGitRevisionDescription.cmake @@ -0,0 +1,172 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision( [ ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe( [ ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_get_exact_tag( [ ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# git_local_changes() +# +# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. +# Uses the return code of "git diff-index --quiet HEAD --". +# Does not regard untracked files. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(get_git_head_revision _refspecvar _hashvar) + set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + # check if this is a submodule + if(NOT IS_DIRECTORY ${GIT_DIR}) + file(READ ${GIT_DIR} submodule) + string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) + endif() + if(NOT IS_DIRECTORY "${GIT_DIR}") + file(READ ${GIT_DIR} worktree) + string(REGEX REPLACE "gitdir: (.*)worktrees(.*)\n$" "\\1" GIT_DIR ${worktree}) + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) +endfunction() + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() + + #message(STATUS "Arguments to execute_process: ${ARGN}") + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + describe + ${hash} + ${ARGN} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_local_changes _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + diff-index --quiet HEAD -- + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(res EQUAL 0) + set(${_var} "CLEAN" PARENT_SCOPE) + else() + set(${_var} "DIRTY" PARENT_SCOPE) + endif() +endfunction() diff --git a/cmake/modules/GetGitRevisionDescription.cmake.in b/cmake/modules/GetGitRevisionDescription.cmake.in new file mode 100644 index 0000000..6d8b708 --- /dev/null +++ b/cmake/modules/GetGitRevisionDescription.cmake.in @@ -0,0 +1,41 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + else() + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index aa88d62..d2bc9e0 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,29 +1,9 @@ -cmake_minimum_required(VERSION 3.3) -set (CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) -project(ads_demo VERSION "1.0") -set(REQUIRED_QT_VERSION 5.5.0) -find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) -set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Core_LIBRARIES}) -set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) -set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} ) -set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Gui_LIBRARIES}) -set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) -set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) -set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Widgets_LIBRARIES}) -set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) -set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) +cmake_minimum_required(VERSION 3.5) +project(ads_demo VERSION ${VERSION_SHORT}) + +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) if(WIN32) - find_package(Qt5AxContainer ${REQUIRED_QT_VERSION} REQUIRED) - set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5AxContainer_LIBRARIES}) - set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5AxContainer_INCLUDE_DIRS}) - set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5AxContainer_COMPILE_DEFINITIONS}) + find_package(Qt5 5.5 COMPONENTS AxContainer REQUIRED) endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) set(ads_demo_SRCS @@ -35,22 +15,26 @@ set(ads_demo_SRCS demo.qrc ) add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS}) -if(BUILD_STATIC) - set(ads_demo_DEFINE ${ads_demo_DEFINE} ADS_STATIC) +target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src") +target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) +if(WIN32) + target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt5::AxContainer) endif() -add_dependencies(AdvancedDockingSystemDemo qtadvanceddocking) -target_include_directories(AdvancedDockingSystemDemo PUBLIC - $ - $ - ) -target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_demo_INCLUDE}) -target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking ${ads_demo_LIBS}) -target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ${ads_demo_DEFINE}) +target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking) set_target_properties(AdvancedDockingSystemDemo PROPERTIES - VERSION "1.0" - SOVERSION 1 + AUTOMOC ON + AUTORCC ON + AUTOUIC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} EXPORT_NAME "Qt Advanced Docking System Demo" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" ) +#if(BUILD_STATIC) +# target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ADS_STATIC) +#endif() + diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..d1a4516 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.5) +project(QtADSExamples LANGUAGES CXX VERSION ${VERSION_SHORT}) +add_subdirectory(simple) +add_subdirectory(sidebar) +add_subdirectory(deleteonclose) \ No newline at end of file diff --git a/examples/deleteonclose/CMakeLists.txt b/examples/deleteonclose/CMakeLists.txt new file mode 100644 index 0000000..0aa8630 --- /dev/null +++ b/examples/deleteonclose/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.5) +project(ads_example_deleteonclose VERSION ${VERSION_SHORT}) +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +add_executable(DeleteOnCloseTest WIN32 + main.cpp +) +target_include_directories(DeleteOnCloseTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src") +target_link_libraries(DeleteOnCloseTest PRIVATE qtadvanceddocking) +target_link_libraries(DeleteOnCloseTest PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) +set_target_properties(DeleteOnCloseTest PROPERTIES + AUTOMOC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} + EXPORT_NAME "Qt Advanced Docking System Delete on Close Example" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" +) diff --git a/examples/sidebar/CMakeLists.txt b/examples/sidebar/CMakeLists.txt index a050e88..6940583 100644 --- a/examples/sidebar/CMakeLists.txt +++ b/examples/sidebar/CMakeLists.txt @@ -1,45 +1,24 @@ -cmake_minimum_required(VERSION 3.3) -set (CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -project(ads_example VERSION "1.0") -set(REQUIRED_QT_VERSION 5.5.0) -find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Core_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} ) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Gui_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Widgets_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) +cmake_minimum_required(VERSION 3.5) +project(ads_example_sidebar VERSION ${VERSION_SHORT}) +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(ads_example_SRCS +add_executable(SidebarExample WIN32 main.cpp MainWindow.cpp MainWindow.ui ) -add_executable(SidebarExample WIN32 ${ads_example_SRCS}) -if(BUILD_STATIC) - set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) -endif() -add_dependencies(SidebarExample qtadvanceddocking) -target_include_directories(SidebarExample PUBLIC - $ - $ - ) -target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src" ${ads_example_INCLUDE}) -target_link_libraries(SidebarExample PRIVATE qtadvanceddocking ${ads_example_LIBS}) -target_compile_definitions(SidebarExample PRIVATE ${ads_example_DEFINE}) +target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src") +target_link_libraries(SidebarExample PRIVATE qtadvanceddocking) +target_link_libraries(SidebarExample PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) set_target_properties(SidebarExample PROPERTIES - VERSION "1.0" - SOVERSION 1 - EXPORT_NAME "Qt Advanced Docking System Example" + AUTOMOC ON + AUTORCC ON + AUTOUIC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} + EXPORT_NAME "Qt Advanced Docking System Sidebar Example" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" diff --git a/examples/simple/CMakeLists.txt b/examples/simple/CMakeLists.txt index 35e9866..8c66a5a 100644 --- a/examples/simple/CMakeLists.txt +++ b/examples/simple/CMakeLists.txt @@ -1,45 +1,24 @@ -cmake_minimum_required(VERSION 3.3) -set (CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -project(ads_example VERSION "1.0") -set(REQUIRED_QT_VERSION 5.5.0) -find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Core_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} ) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Gui_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Widgets_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) +cmake_minimum_required(VERSION 3.5) +project(ads_example_simple VERSION ${VERSION_SHORT}) +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(ads_example_SRCS +add_executable(SimpleExample WIN32 main.cpp MainWindow.cpp MainWindow.ui ) -add_executable(SimpleExample WIN32 ${ads_example_SRCS}) -if(BUILD_STATIC) - set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) -endif() -add_dependencies(SimpleExample qtadvanceddocking) -target_include_directories(SimpleExample PUBLIC - $ - $ - ) -target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src" ${ads_example_INCLUDE}) -target_link_libraries(SimpleExample PRIVATE qtadvanceddocking ${ads_example_LIBS}) -target_compile_definitions(SimpleExample PRIVATE ${ads_example_DEFINE}) +target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src") +target_link_libraries(SimpleExample PRIVATE qtadvanceddocking) +target_link_libraries(SimpleExample PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) set_target_properties(SimpleExample PROPERTIES - VERSION "1.0" - SOVERSION 1 - EXPORT_NAME "Qt Advanced Docking System Example" + AUTOMOC ON + AUTORCC ON + AUTOUIC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} + EXPORT_NAME "Qt Advanced Docking System Simple Example" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..7893cce --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,106 @@ +cmake_minimum_required(VERSION 3.5) +project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT}) +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +if(BUILD_STATIC) + set(CMAKE_STATIC_LIBRARY_SUFFIX "_static${CMAKE_STATIC_LIBRARY_SUFFIX}") +endif() +set(ads_SRCS + ads_globals.cpp + DockAreaTabBar.cpp + DockAreaTitleBar.cpp + DockAreaWidget.cpp + DockContainerWidget.cpp + DockManager.cpp + DockOverlay.cpp + DockSplitter.cpp + DockWidget.cpp + DockWidgetTab.cpp + DockingStateReader.cpp + ElidingLabel.cpp + FloatingDockContainer.cpp + FloatingDragPreview.cpp + IconProvider.cpp + DockComponentsFactory.cpp + ads.qrc +) +set(ads_INSTALL_INCLUDE + ads_globals.h + DockAreaTabBar.h + DockAreaTitleBar.h + DockAreaTitleBar_p.h + DockAreaWidget.h + DockContainerWidget.h + DockManager.h + DockOverlay.h + DockSplitter.h + DockWidget.h + DockWidgetTab.h + DockingStateReader.h + ElidingLabel.h + FloatingDockContainer.h + FloatingDragPreview.h + IconProvider.h + DockComponentsFactory.h +) +if (UNIX) + set(ads_SRCS linux/FloatingWidgetTitleBar.cpp ${ads_SRCS}) + set(ads_INSTALL_INCLUDE linux/FloatingWidgetTitleBar.h ${ads_INSTALL_INCLUDE}) +endif() +if(BUILD_STATIC) + add_library(qtadvanceddocking STATIC ${ads_SRCS}) + target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC) +else() + add_library(qtadvanceddocking SHARED ${ads_SRCS}) + target_compile_definitions(qtadvanceddocking PRIVATE ADS_SHARED_EXPORT) +endif() +target_link_libraries(qtadvanceddocking PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) +set_target_properties(qtadvanceddocking PROPERTIES + AUTOMOC ON + AUTORCC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} + EXPORT_NAME "qtadvanceddocking" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" +) +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "qtadvanceddockingConfigVersion.cmake" + VERSION ${VERSION_SHORT} + COMPATIBILITY SameMajorVersion +) +install(FILES ${ads_INSTALL_INCLUDE} + DESTINATION include + COMPONENT headers +) +install(FILES + "${CMAKE_SOURCE_DIR}/LICENSE" + "${CMAKE_SOURCE_DIR}/gnu-lgpl-v2.1.md" + DESTINATION license + COMPONENT license +) +install(TARGETS qtadvanceddocking + EXPORT adsTargets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + INCLUDES DESTINATION include +) + +install(EXPORT adsTargets + FILE adsTargets.cmake + NAMESPACE ads:: + DESTINATION lib/cmake/qtadvanceddocking +) +install(FILES qtadvanceddockingConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/qtadvanceddockingConfigVersion.cmake" + DESTINATION lib/cmake/qtadvanceddocking +) + +target_include_directories(qtadvanceddocking PUBLIC + $ +) + diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index 4e68727..d135d04 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -27,7 +27,7 @@ //============================================================================ // INCLUDES //============================================================================ -#include +#include "FloatingDragPreview.h" #include "DockAreaTabBar.h" #include diff --git a/src/DockComponentsFactory.cpp b/src/DockComponentsFactory.cpp index 85a5475..1f8be65 100644 --- a/src/DockComponentsFactory.cpp +++ b/src/DockComponentsFactory.cpp @@ -8,7 +8,7 @@ //============================================================================ // INCLUDES //============================================================================ -#include +#include "DockComponentsFactory.h" #include diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 69c13d7..0c5c2a2 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -293,6 +293,7 @@ QWidget* CDockWidget::takeWidget() w = d->ScrollArea->takeWidget(); delete d->ScrollArea; d->ScrollArea = nullptr; + d->Widget = nullptr; } else if (d->Widget) { diff --git a/src/DockWidgetTab.cpp b/src/DockWidgetTab.cpp index 378cc59..21fb63d 100644 --- a/src/DockWidgetTab.cpp +++ b/src/DockWidgetTab.cpp @@ -28,7 +28,7 @@ //============================================================================ // INCLUDES //============================================================================ -#include +#include "FloatingDragPreview.h" #include "ElidingLabel.h" #include "DockWidgetTab.h" diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 3c458a2..3ab5c17 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -48,6 +48,9 @@ #ifdef Q_OS_WIN #include +#ifdef _MSC_VER +#pragma comment(lib, "User32.lib") +#endif #endif #ifdef Q_OS_LINUX #include "linux/FloatingWidgetTitleBar.h" @@ -57,7 +60,7 @@ namespace ads { #ifdef Q_OS_WIN -#if 0 +#if 0 // set to 1 if you need this function for debugging /** * Just for debuging to convert windows message identifiers to strings */ @@ -715,7 +718,6 @@ bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *mess if (d->isState(DraggingMousePressed)) { ADS_PRINT("CFloatingDockContainer::nativeEvent WM_ENTERSIZEMOVE" << e->type()); - qApp->installEventFilter(this); d->setState(DraggingFloatingWidget); d->updateDropOverlays(QCursor::pos()); } @@ -724,8 +726,15 @@ bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *mess case WM_EXITSIZEMOVE: if (d->isState(DraggingFloatingWidget)) { - ADS_PRINT("CFloatingDockContainer::nativeEvent WM_EXITSIZEMOVE" << e->type());; - d->titleMouseReleaseEvent(); + ADS_PRINT("CFloatingDockContainer::nativeEvent WM_EXITSIZEMOVE" << e->type()); + if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) + { + d->handleEscapeKey(); + } + else + { + d->titleMouseReleaseEvent(); + } } break; } @@ -798,43 +807,6 @@ void CFloatingDockContainer::showEvent(QShowEvent *event) } -//============================================================================ -bool CFloatingDockContainer::eventFilter(QObject *watched, QEvent *e) -{ - Q_UNUSED(watched); - // I have not found a way to detect non client area key press events to - // handle escape key presses. On Windows, if the escape key is pressed while - // dragging around a widget, the widget position is reset to its start position - // which in turn generates a QEvent::NonClientAreaMouseButtonRelease event - // if the mouse is outside of the widget after the move to its initial position - // or a QEvent::MouseButtonRelease event, if the mouse is inside of teh widget - // after the position has been reset. - // So we can install an event filter on the application to get these events - // here to properly cancel dragging and hide the overlays. - // If we are in DraggingFloatingWidget state, it means the widget - // has been dragged already but if the position is the same like - // the start position, then this is an indication that the escape - // key has been pressed. - if (e->type() == QEvent::MouseButtonRelease || e->type() == QEvent::NonClientAreaMouseButtonRelease) - { - ADS_PRINT("CFloatingDockContainer::eventFilter QEvent::MouseButtonRelease or" - "QEvent::NonClientAreaMouseButtonRelease" << "d->DragggingState " << d->DraggingState); - qApp->removeEventFilter(this); - if (d->DragStartPos == pos()) - { - d->handleEscapeKey(); - return true; - } - return false; - } - -#if (ADS_DEBUG_LEVEL > 0) - qDebug() << QTime::currentTime() << "CFloatingDockContainer::eventFilter " << e->type(); -#endif - return false; -} - - //============================================================================ void CFloatingDockContainer::startFloating(const QPoint &DragStartMousePos, const QSize &Size, eDragState DragState, QWidget *MouseEventHandler) diff --git a/src/FloatingDockContainer.h b/src/FloatingDockContainer.h index 5800a33..2028147 100644 --- a/src/FloatingDockContainer.h +++ b/src/FloatingDockContainer.h @@ -179,7 +179,6 @@ protected: // reimplements QWidget virtual void closeEvent(QCloseEvent *event) override; virtual void hideEvent(QHideEvent *event) override; virtual void showEvent(QShowEvent *event) override; - virtual bool eventFilter(QObject *watched, QEvent *event) override; #ifdef Q_OS_WIN /** diff --git a/src/qtadvanceddockingConfig.cmake b/src/qtadvanceddockingConfig.cmake new file mode 100644 index 0000000..65173fa --- /dev/null +++ b/src/qtadvanceddockingConfig.cmake @@ -0,0 +1,2 @@ +include(CMakeFindDependencyMacro) +include("${CMAKE_CURRENT_LIST_DIR}/adsTargets.cmake") \ No newline at end of file diff --git a/src/src.pro b/src/src.pro index f117495..b54cbeb 100644 --- a/src/src.pro +++ b/src/src.pro @@ -73,7 +73,7 @@ SOURCES += linux/FloatingWidgetTitleBar.cpp } isEmpty(PREFIX){ - PREFIX=..\installed + PREFIX=../installed warning("Install Prefix not set") } headers.path=$$PREFIX/include