commit a2f82a86b6c70856b38a97370a4e2f6050aec564 Author: dela Date: Wed Jun 10 11:17:51 2026 +0800 chore: baseline usable version diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..86318a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,55 @@ +# 构建目录 (最重要的!) +/build/ +/build*/ +*.user + +# C++ 编译产物 +*.exe +*.dll +*.o +*.obj +*.ilk +*.pdb +*.suo + +# 库文件 +*.lib +*.a +*.so + +# MOC 和 UI 生成的文件 +moc_*.cpp +ui_*.h +qrc_*.cpp + +# 本地 IDE 设置 +.DS_Store +.vs/ +.vscode/ + +# clangd 缓存 +.cache/ +compile_commands.json + +# 预编译第三方库 (请参阅 README 中的构建说明) +libs/libmpv/ + +# Release 构建产物 +*.zip + +# AI 辅助工具 +.antigravityignore +.antigravityrules +.gemini/ +.agents/ +_agents/ +# ���Ӳݸ� +linuxdo_post.md + +# ������ +dist/ +release/ +build/ +.idea +cmake-build-debug/ +packaging/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1f1047b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libs/qwindowkit"] + path = libs/qwindowkit + url = https://github.com/stdware/qwindowkit.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7349978 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,114 @@ +cmake_minimum_required(VERSION 3.19) + +project(qEmby VERSION 0.0.5 LANGUAGES CXX) + +if(APPLE) + set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0) +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(GNUInstallDirs) +include(QEmbyPlatformDeps) + +set(QEMBY_RUNTIME_LIB_SUBDIR "qemby" CACHE STRING + "Subdirectory under the install libdir for bundled private runtime libraries") + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") + + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +if(MSVC) + add_compile_options(/MP) +endif() + +# ========================================== +# 允许通过缓存变量或环境变量提供 Qt 安装路径 +# Windows 未显式指定时仍会尝试兼容现有本地默认路径 +# ========================================== +set(QEMBY_QT_ROOT "" CACHE PATH + "Optional Qt installation root or CMake prefix path") +qemby_append_default_qt_prefixes() + +# 寻找 Qt6 (不再允许降级) +find_package(Qt6 REQUIRED COMPONENTS Widgets Core Network Concurrent OpenGLWidgets LinguistTools WebSockets Svg) +if(UNIX AND NOT APPLE) + find_package(Qt6 QUIET COMPONENTS DBus) +endif() + +# ========================================== +# 【关键修复】: 为第三方子模块 (qwindowkit/qmsetup) 注入所需的 Qt 版本环境变量 +# ========================================== +set(QT_VERSION_MAJOR ${Qt6_VERSION_MAJOR}) +set(QT_VERSION_MINOR ${Qt6_VERSION_MINOR}) +set(QT_VERSION ${Qt6_VERSION}) + +# ========================================== +# 引入 QCoro (C++20 Coroutines for Qt) +# ========================================== +include(FetchContent) + +function(qemby_ensure_noop_install_script build_dir) + if(NOT build_dir) + return() + endif() + + file(MAKE_DIRECTORY "${build_dir}") + file(WRITE "${build_dir}/cmake_install.cmake" + "# qEmby placeholder install script for third-party dependency\n") +endfunction() + +set(_qemby_saved_skip_install_rules ${CMAKE_SKIP_INSTALL_RULES}) +set(CMAKE_SKIP_INSTALL_RULES ON) +FetchContent_Declare( + QCoro + GIT_REPOSITORY https://github.com/danvratil/qcoro.git + GIT_TAG v0.10.0 +) + +# 强制 QCoro 使用 Qt6 进行编译,并关闭不必要的测试与示例构建以加快编译速度 +set(QCORO_QT_MAJOR_VERSION 6 CACHE STRING "Use Qt6 for QCoro" FORCE) +set(QCORO_BUILD_EXAMPLES OFF CACHE BOOL "Disable QCoro examples" FORCE) +set(QCORO_WITH_QML OFF CACHE BOOL "Disable QCoro QML module" FORCE) +set(QCORO_WITH_QTQUICK OFF CACHE BOOL "Disable QCoro QtQuick module" FORCE) +set(BUILD_TESTING OFF CACHE BOOL "Disable QCoro tests" FORCE) + +FetchContent_MakeAvailable(QCoro) +FetchContent_GetProperties(QCoro) +qemby_ensure_noop_install_script("${qcoro_BINARY_DIR}") + +# ========================================== +# 引入 spdlog (高性能线程安全日志库, MIT License) +# ========================================== +FetchContent_Declare( + spdlog + GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_TAG v1.15.3 +) +set(SPDLOG_BUILD_EXAMPLE OFF CACHE BOOL "Disable spdlog examples" FORCE) +set(SPDLOG_BUILD_TESTS OFF CACHE BOOL "Disable spdlog tests" FORCE) +set(SPDLOG_INSTALL OFF CACHE BOOL "Disable spdlog install rules" FORCE) +FetchContent_MakeAvailable(spdlog) +FetchContent_GetProperties(spdlog) +qemby_ensure_noop_install_script("${spdlog_BINARY_DIR}") +set(CMAKE_SKIP_INSTALL_RULES ${_qemby_saved_skip_install_rules}) +unset(_qemby_saved_skip_install_rules) +# ========================================== + +set(QWINDOWKIT_INSTALL OFF CACHE BOOL + "Disable QWindowKit development install rules inside qEmby" FORCE) + +add_subdirectory(libs/qwindowkit) +add_subdirectory(libs/qwindowkit/examples/shared) +add_subdirectory(src/qEmbyCore) +add_subdirectory(src/qEmbyApp) + +include(QEmbyPackaging) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0d47326 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025-2026 AlanHJ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..101d5fb --- /dev/null +++ b/README.md @@ -0,0 +1,376 @@ +

+ qEmby Logo +

+ +

qEmby

+ +

+ A modern desktop client for Emby & Jellyfin media servers
+ Emby & Jellyfin 媒体服务器的现代桌面客户端 +

+ +

+ License: MIT + Release + Qt 6 + C++20 + Platform: Windows | Linux | macOS +

+ +

+ 中文 | English +

+ +--- + + + +## 📸 应用截图 + +

+ 首页 + 影片详情 +

+

+ 设置 + 管理仪表盘 +

+ +## 📥 下载 + +最新版本:**v0.0.5** + +| 安装包 | 说明 | +|---|---| +| [qEmby-v0.0.5-Win-x64-Setup.exe](https://github.com/AlanHJ/qEmby/releases/download/v0.0.5/qEmby-v0.0.5-Win-x64-Setup.exe) | Windows 10/11 x64 安装包 | +| [qEmby-v0.0.5-Win-x64.zip](https://github.com/AlanHJ/qEmby/releases/download/v0.0.5/qEmby-v0.0.5-Win-x64.zip) | Windows 10/11 x64 绿色便携版 | +| [qemby-0.0.5-macos-arm64.dmg](https://github.com/AlanHJ/qEmby/releases/download/v0.0.5/qemby-0.0.5-macos-arm64.dmg) | macOS 26+ (Apple 芯片) | + +旧版 Windows、Linux 和 macOS 构建可以在 [Releases](https://github.com/AlanHJ/qEmby/releases) 页面下载。 + +## 🚀 v0.0.5 更新内容 + +- 优化了剧集详情页展示,支持版本切换。 +- 支持播放状态展示和切换。 +- 增加了详情页的缓存,加快下一次载入速度。 +- 优化了播放界面 OSD,支持上一集和下一集,支持连续播放。 +- 优化了媒体库等上下滑动的流畅度,优化了加载图片的逻辑。 +- 新增播放完成画廊,默认关闭,可以在设置中打开。 + +## ✨ 功能特性 + +- 🎬 浏览和管理你的 Emby / Jellyfin 媒体库 +- ▶️ 内置 **libmpv** 驱动的视频播放器 +- 💬 弹幕播放,支持搜索、匹配、缓存和原生覆盖层渲染 +- 🧩 支持元数据编辑、媒体识别、图片更新和播放列表管理 +- 📥 下载管理器 +- 🌗 深色 / 浅色主题切换 +- 🌐 国际化支持(中文 / 英文 / 法语) +- 🔍 支持搜索历史的媒体搜索 +- 📺 当前支持电视剧、电影媒体类型 +- 📦 提供 Windows 安装包 / 绿色版,以及 Linux AppImage / deb 包 +- ⚡ 基于 C++20 协程的异步操作(QCoro) +- 🪟 原生风格的自定义窗口边框(QWindowKit) + +## 💻 平台支持 + +| 平台 | 状态 | +|---|---| +| Windows 10/11 x64 | ✅ 已适配 | +| Linux x64 (AppImage / deb) | ✅ 已适配 | +| macOS 26+ (Apple Silicon) | ✅ 已适配 | + +## 📋 开发路线图 + +- [x] Emby / Jellyfin 媒体库浏览 +- [x] 内置视频播放器(libmpv) +- [x] 深色 / 浅色主题 +- [x] 国际化支持(中文 / 英文) +- [x] 媒体搜索与搜索历史 +- [x] 电视剧、电影支持 +- [x] 服务器管理仪表盘 +- [x] 支持添加到播放列表和从播放列表中移除 +- [x] 支持识别来更新元数据 +- [x] 支持修改元数据和图片 +- [x] 弹幕系统(搜索、匹配、设置、渲染) +- [x] 下载管理器 +- [ ] AI 字幕生成 +- [x] Linux 平台适配 +- [x] macOS 平台适配 + +> 本项目为个人兴趣开发,欢迎贡献和反馈! + +## 🛠️ 技术栈 + +| 组件 | 技术 | +|---|---| +| 框架 | Qt 6.x (Widgets) | +| 语言 | C++20 | +| 视频播放 | libmpv | +| 异步 | QCoro (Qt C++20 协程) | +| 日志 | spdlog | +| 窗口框架 | QWindowKit | +| 构建系统 | CMake | + +## 📦 环境要求 + +- **Qt 6.x**(包含 Widgets、Core、Network、Concurrent、OpenGLWidgets、LinguistTools、WebSockets 模块) +- **CMake** ≥ 3.16 +- 支持 **C++20** 的编译器(推荐 MSVC 2022) +- **libmpv** 开发文件(见下方说明) +- **Git**(用于克隆子模块) + +## 🚀 构建指南 + +### 1. 克隆仓库 + +```bash +git clone --recursive https://github.com/AlanHJ/qEmby.git +cd qEmby +``` + +### 2. 获取 libmpv + +下载 libmpv 开发包,并放置到 `libs/libmpv/` 目录下,结构如下: + +``` +libs/libmpv/ +├── bin/ +│ └── libmpv-2.dll +├── include/ +│ └── mpv/ +│ ├── client.h +│ └── render.h (等) +└── lib/ + └── libmpv.dll.a +``` + +libmpv 获取方式: +- [shinchiro/mpv-winbuild-cmake](https://github.com/shinchiro/mpv-winbuild-cmake/releases)(Windows 预编译版本) +- [mpv-player/mpv](https://github.com/mpv-player/mpv)(从源码编译) + +### 3. 配置和构建 + +```bash +cmake -B build -DCMAKE_PREFIX_PATH="/path/to/Qt6/lib/cmake" +cmake --build build --config Release +``` + +> **提示:** 在 Windows 上使用 MSVC 时,也可以直接在 Qt Creator 或 Visual Studio 中打开 CMake 项目。 + +## 📁 项目结构 + +``` +qEmby/ +├── CMakeLists.txt # 根 CMake 配置 +├── libs/ +│ ├── libmpv/ # libmpv SDK(未纳入版本控制,见构建指南) +│ └── qwindowkit/ # QWindowKit(git 子模块) +└── src/ + ├── qEmbyCore/ # 核心库(API、模型、服务) + │ ├── api/ # Emby/Jellyfin API 客户端 + │ ├── config/ # 配置管理 + │ ├── models/ # 数据模型 + │ └── services/ # 业务逻辑服务 + └── qEmbyApp/ # 桌面应用 + ├── components/ # 可复用 UI 组件 + ├── managers/ # 应用管理器 + ├── resources/ # 图标、主题、翻译 + ├── utils/ # 工具类 + └── views/ # 应用视图 +``` + +## 💬 交流社区 + +加入 Telegram 交流群:[https://t.me/+qXQ-zU56z9gxOWNl](https://t.me/+qXQ-zU56z9gxOWNl) + +> **注意:** 本项目是为爱发电项目,测试覆盖不全,敬请谅解。如有问题请通过 [GitHub Issues](https://github.com/AlanHJ/qEmby/issues) 反馈。 + +## 📄 许可证 + +本项目基于 [MIT 许可证](LICENSE) 开源。 + +## 🙏 致谢 + +- [Qt](https://www.qt.io/) — 应用框架 (LGPL v3) +- [mpv](https://mpv.io/) — 媒体播放引擎 (LGPL v2.1+) +- [QWindowKit](https://github.com/stdware/qwindowkit) — 自定义窗口框架 (Apache-2.0) +- [QCoro](https://github.com/danvratil/qcoro) — Qt C++20 协程库 (MIT) +- [spdlog](https://github.com/gabime/spdlog) — 高性能日志库 (MIT) + +--- + + + +## 📸 Screenshots + +

+ Home + Detail +

+

+ Settings + Admin Dashboard +

+ +## 📥 Download + +Latest release: **v0.0.5** + +| Package | Description | +|---|---| +| [qEmby-v0.0.5-Win-x64-Setup.exe](https://github.com/AlanHJ/qEmby/releases/download/v0.0.5/qEmby-v0.0.5-Win-x64-Setup.exe) | Windows 10/11 x64 installer | +| [qEmby-v0.0.5-Win-x64.zip](https://github.com/AlanHJ/qEmby/releases/download/v0.0.5/qEmby-v0.0.5-Win-x64.zip) | Windows 10/11 x64 portable package | +| [qemby-0.0.5-macos-arm64.dmg](https://github.com/AlanHJ/qEmby/releases/download/v0.0.5/qemby-0.0.5-macos-arm64.dmg) | macOS 26+ (Apple Silicon) | + +Older Windows, Linux and macOS builds are available on the [Releases](https://github.com/AlanHJ/qEmby/releases) page. + +## 🚀 What's New in v0.0.5 + +- Optimized episode detail page display with version switching support. +- Added playback status display and switching. +- Added detail page caching for faster subsequent loading. +- Enhanced player OSD with previous/next episode and continuous playback. +- Improved scrolling smoothness in media library views and optimized image loading logic. +- Added post-playback gallery (disabled by default, configurable in settings). + +## ✨ Features + +- 🎬 Browse and manage your Emby / Jellyfin media library +- ▶️ Built-in video player powered by **libmpv** +- 💬 Danmaku playback with search, matching, cache and native overlay rendering +- 🧩 Metadata editing, media identification, image updates and playlist tools +- 📥 Download manager +- 🌗 Dark and Light theme support +- 🌐 Internationalization support (Chinese / English) +- 🔍 Media search with history +- 📺 TV series and movies media types +- 📦 Windows installer / portable packages and Linux AppImage / deb packages +- ⚡ Asynchronous operations with C++20 coroutines (QCoro) +- 🪟 Custom window frame with native look (QWindowKit) + +## 💻 Platform Support + +| Platform | Status | +|---|---| +| Windows 10/11 x64 | ✅ Supported | +| Linux x64 (AppImage / deb) | ✅ Supported | +| macOS 26+ (Apple Silicon) | ✅ Supported | + +## 📋 Roadmap + +- [x] Emby / Jellyfin media library browsing +- [x] Built-in video player (libmpv) +- [x] Dark / Light theme +- [x] Internationalization (Chinese / English) +- [x] Media search with history +- [x] TV series & movies support +- [x] Server administration dashboard +- [x] Playlist support (add/remove items) +- [x] Media identification & metadata refresh +- [x] Metadata and image editing +- [x] Danmaku (bullet comments) system +- [x] Download manager +- [ ] AI-powered subtitle generation +- [x] Linux platform support +- [x] macOS platform support + +> This is a personal hobby project, developed out of interest. Contributions and feedback are welcome! + +## 🛠️ Tech Stack + +| Component | Technology | +|---|---| +| Framework | Qt 6.x (Widgets) | +| Language | C++20 | +| Video Player | libmpv | +| Async | QCoro (C++20 Coroutines for Qt) | +| Logging | spdlog | +| Window Kit | QWindowKit | +| Build System | CMake | + +## 📦 Prerequisites + +- **Qt 6.x** (with Widgets, Core, Network, Concurrent, OpenGLWidgets, LinguistTools, WebSockets) +- **CMake** ≥ 3.16 +- **C++20** compatible compiler (MSVC 2022 recommended) +- **libmpv** development files (see below) +- **Git** (for cloning submodules) + +## 🚀 Build + +### 1. Clone the repository + +```bash +git clone --recursive https://github.com/AlanHJ/qEmby.git +cd qEmby +``` + +### 2. Get libmpv + +Download the libmpv development package and place it in `libs/libmpv/` with the following structure: + +``` +libs/libmpv/ +├── bin/ +│ └── libmpv-2.dll +├── include/ +│ └── mpv/ +│ ├── client.h +│ └── render.h (etc.) +└── lib/ + └── libmpv.dll.a +``` + +You can get libmpv from: +- [shinchiro/mpv-winbuild-cmake](https://github.com/shinchiro/mpv-winbuild-cmake/releases) (Windows builds) +- [mpv-player/mpv](https://github.com/mpv-player/mpv) (build from source) + +### 3. Configure and build + +```bash +cmake -B build -DCMAKE_PREFIX_PATH="/path/to/Qt6/lib/cmake" +cmake --build build --config Release +``` + +> **Tip:** On Windows with MSVC, you can also open the project in Qt Creator or Visual Studio with CMake support. + +## 📁 Project Structure + +``` +qEmby/ +├── CMakeLists.txt # Root CMake configuration +├── libs/ +│ ├── libmpv/ # libmpv SDK (not tracked, see Build section) +│ └── qwindowkit/ # QWindowKit (git submodule) +└── src/ + ├── qEmbyCore/ # Core library (API, models, services) + │ ├── api/ # Emby/Jellyfin API client + │ ├── config/ # Configuration management + │ ├── models/ # Data models + │ └── services/ # Business logic services + └── qEmbyApp/ # Desktop application + ├── components/ # Reusable UI components + ├── managers/ # Application managers + ├── resources/ # Icons, themes, translations + ├── utils/ # Utility classes + └── views/ # Application views +``` + +## 💬 Community + +Join our Telegram group: [https://t.me/+qXQ-zU56z9gxOWNl](https://t.me/+qXQ-zU56z9gxOWNl) + +> **Note:** This is a passion project with limited testing. Your understanding is appreciated. Please report any issues via [GitHub Issues](https://github.com/AlanHJ/qEmby/issues). + +## 📄 License + +This project is licensed under the [MIT License](LICENSE). + +## 🙏 Acknowledgements + +- [Qt](https://www.qt.io/) — Application framework (LGPL v3) +- [mpv](https://mpv.io/) — Media player engine (LGPL v2.1+) +- [QWindowKit](https://github.com/stdware/qwindowkit) — Custom window frame (Apache-2.0) +- [QCoro](https://github.com/danvratil/qcoro) — C++20 Coroutines for Qt (MIT) +- [spdlog](https://github.com/gabime/spdlog) — Fast logging library (MIT) diff --git a/cmake/QEmbyPackaging.cmake b/cmake/QEmbyPackaging.cmake new file mode 100644 index 0000000..cc3b325 --- /dev/null +++ b/cmake/QEmbyPackaging.cmake @@ -0,0 +1,77 @@ +include_guard(GLOBAL) + +include(GNUInstallDirs) + +if(UNIX AND NOT APPLE) + set(_qemby_runtime_install_dir "${CMAKE_INSTALL_BINDIR}") + if(QEMBY_RUNTIME_LIB_SUBDIR) + set(_qemby_runtime_install_dir + "${CMAKE_INSTALL_LIBDIR}/${QEMBY_RUNTIME_LIB_SUBDIR}") + endif() + + foreach(_qemby_runtime_target IN ITEMS qEmbyApp qEmbyCore QWKCore QWKWidgets) + if(TARGET "${_qemby_runtime_target}") + set_target_properties("${_qemby_runtime_target}" PROPERTIES + INSTALL_RPATH "$ORIGIN" + ) + endif() + endforeach() + + set(_qemby_qwk_install_targets) + foreach(_qemby_qwk_target IN ITEMS QWKCore QWKWidgets) + if(TARGET "${_qemby_qwk_target}") + list(APPEND _qemby_qwk_install_targets "${_qemby_qwk_target}") + endif() + endforeach() + + if(_qemby_qwk_install_targets) + install(TARGETS ${_qemby_qwk_install_targets} + LIBRARY DESTINATION "${_qemby_runtime_install_dir}" + RUNTIME DESTINATION "${_qemby_runtime_install_dir}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) + endif() + + if(QEMBY_RUNTIME_LIB_SUBDIR) + set(_qemby_launcher_exec + "${CMAKE_INSTALL_LIBDIR}/${QEMBY_RUNTIME_LIB_SUBDIR}/qEmbyApp") + else() + set(_qemby_launcher_exec "${CMAKE_INSTALL_BINDIR}/qEmbyApp") + endif() + + set(_qemby_launcher "${CMAKE_CURRENT_BINARY_DIR}/qemby") + file(WRITE "${_qemby_launcher}" + "#!/bin/sh\n" + "prefix_dir=$(CDPATH= cd -- \"$(dirname -- \"$0\")/..\" && pwd)\n" + "exec \"$prefix_dir/${_qemby_launcher_exec}\" \"$@\"\n" + ) + install(PROGRAMS "${_qemby_launcher}" + DESTINATION "${CMAKE_INSTALL_BINDIR}" + ) + + set(_qemby_desktop_file "${CMAKE_CURRENT_BINARY_DIR}/qemby.desktop") + file(WRITE "${_qemby_desktop_file}" + "[Desktop Entry]\n" + "Type=Application\n" + "Name=qEmby\n" + "Comment=Desktop client for Emby and Jellyfin media servers\n" + "Exec=qemby\n" + "Icon=qemby\n" + "Terminal=false\n" + "Categories=AudioVideo;Video;Player;\n" + ) + install(FILES "${_qemby_desktop_file}" + DESTINATION "${CMAKE_INSTALL_DATADIR}/applications" + ) + + install(FILES "${CMAKE_SOURCE_DIR}/src/qEmbyApp/resources/svg/qemby_logo.svg" + DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps" + RENAME qemby.svg + ) +endif() + +set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") +set(CPACK_PACKAGE_VENDOR "qEmby") + +include(CPack) diff --git a/cmake/QEmbyPlatformDeps.cmake b/cmake/QEmbyPlatformDeps.cmake new file mode 100644 index 0000000..86d92fe --- /dev/null +++ b/cmake/QEmbyPlatformDeps.cmake @@ -0,0 +1,68 @@ +include_guard(GLOBAL) + +function(qemby_append_default_qt_prefixes) + set(_qemby_qt_prefixes) + + if(QEMBY_QT_ROOT) + list(APPEND _qemby_qt_prefixes + "${QEMBY_QT_ROOT}" + "${QEMBY_QT_ROOT}/lib/cmake" + ) + endif() + + if(DEFINED ENV{QTDIR} AND NOT "$ENV{QTDIR}" STREQUAL "") + list(APPEND _qemby_qt_prefixes + "$ENV{QTDIR}" + "$ENV{QTDIR}/lib/cmake" + ) + endif() + + if(WIN32) + list(APPEND _qemby_qt_prefixes + "E:/Qt6/6.9.2/msvc2022_64" + "E:/Qt6/6.9.2/msvc2022_64/lib/cmake" + ) + endif() + + foreach(_qemby_qt_prefix IN LISTS _qemby_qt_prefixes) + if(EXISTS "${_qemby_qt_prefix}") + list(APPEND CMAKE_PREFIX_PATH "${_qemby_qt_prefix}") + endif() + endforeach() + + if(CMAKE_PREFIX_PATH) + list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH) + endif() + + set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}" PARENT_SCOPE) +endfunction() + +function(qemby_link_libmpv target) + if(NOT TARGET "${target}") + message(FATAL_ERROR "qemby_link_libmpv: target '${target}' does not exist") + endif() + + if(WIN32) + set(_qemby_mpv_root "${CMAKE_SOURCE_DIR}/libs/libmpv") + set(_qemby_mpv_include_dir "${_qemby_mpv_root}/include") + + find_library(MPV_LIBRARY + NAMES mpv libmpv mpv-2 libmpv-2 + PATHS "${_qemby_mpv_root}/lib" + NO_DEFAULT_PATH + ) + + if(NOT MPV_LIBRARY OR NOT EXISTS "${_qemby_mpv_include_dir}/mpv/client.h") + message(FATAL_ERROR + "Could not find bundled libmpv. Place the libmpv SDK under libs/libmpv.") + endif() + + target_include_directories("${target}" PRIVATE "${_qemby_mpv_include_dir}") + target_link_libraries("${target}" PRIVATE "${MPV_LIBRARY}") + return() + endif() + + find_package(PkgConfig REQUIRED) + pkg_check_modules(MPV REQUIRED IMPORTED_TARGET mpv) + target_link_libraries("${target}" PRIVATE PkgConfig::MPV) +endfunction() diff --git a/docs/日志.md b/docs/日志.md new file mode 100644 index 0000000..1644307 --- /dev/null +++ b/docs/日志.md @@ -0,0 +1,191 @@ + PID: 175765 (qEmbyApp) + UID: 1000 (carry) + GID: 1000 (carry) + Signal: 11 (SEGV) + Timestamp: Tue 2026-06-02 23:11:06 CST (4s ago) +Command Line: /usr/lib/qemby/qEmbyApp +Executable: /usr/lib/qemby/qEmbyApp +Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-qemby@8ff009190f4e4b38bc41611225ac1527.service +Unit: user@1000.service +User Unit: app-qemby@8ff009190f4e4b38bc41611225ac1527.service +Slice: user-1000.slice +Owner UID: 1000 (carry) +Boot ID: 0f5ae2ec38e1407888fd6408682d668f +Machine ID: 6e2f5cc0492944268af4a0786b730302 +Hostname: carryarch +Storage: /var/lib/systemd/coredump/core.qEmbyApp.1000.0f5ae2ec38e1407888fd6408682d668f.175765.1780413066000000.zst (present) +Size on Disk: 8.4M +Message: Process 175765 (qEmbyApp) of user 1000 dumped core. + + Stack trace of thread 175765: + #0 0x00007efc0ffebe57 n/a (libcrypto.so.3 + 0x3ebe57) + #1 0x00007efc141f081b n/a (libQt6Core.so.6 + 0x1f081b) + #2 0x00007efc1556ce17 _ZN14QStackedWidget14currentChangedEi (libQt6Widgets.so.6 + 0x36ce17) + #3 0x00007efc141f081b n/a (libQt6Core.so.6 + 0x1f081b) + #4 0x00007efc15343551 _ZN14QStackedLayout15setCurrentIndexEi (libQt6Widgets.so.6 + 0x143551) + #5 0x0000555fe097dcef _ZN9QtPrivate15QCallableObjectIZZN10MainWindow14navigateToHomeEvENKUlvE_clEvEUlvE_NS_4ListIJEEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb (qEmbyApp + 0x266cef) + #6 0x00007efc141f081b n/a (libQt6Core.so.6 + 0x1f081b) + #7 0x00007efc143358c7 _ZN25QAbstractAnimationPrivate8setStateEN18QAbstractAnimation5StateE (libQt6Core.so.6 + 0x3358c7) + #8 0x00007efc14335e2b n/a (libQt6Core.so.6 + 0x335e2b) + #9 0x00007efc1432c9d1 _ZN13QUnifiedTimer21updateAnimationTimersEv (libQt6Core.so.6 + 0x32c9d1) + #10 0x00007efc14334ff5 n/a (libQt6Core.so.6 + 0x334ff5) + #11 0x00007efc141e7cf9 _ZN7QObject5eventEP6QEvent (libQt6Core.so.6 + 0x1e7cf9) + #12 0x00007efc1530411f _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent (libQt6Widgets.so.6 + 0x10411f) + #13 0x00007efc14183658 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent (libQt6Core.so.6 + 0x183658) + #14 0x00007efc1436b2f5 _ZN14QTimerInfoList14activateTimersEv (libQt6Core.so.6 + 0x36b2f5) + #15 0x00007efc1449fc19 n/a (libQt6Core.so.6 + 0x49fc19) + #16 0x00007efc0faadbfd n/a (libglib-2.0.so.0 + 0x61bfd) + #17 0x00007efc0faafe57 n/a (libglib-2.0.so.0 + 0x63e57) + #18 0x00007efc0faaffe5 g_main_context_iteration (libglib-2.0.so.0 + 0x63fe5) + #19 0x00007efc1449d0b2 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt6Core.so.6 + 0x49d0b2) + #20 0x00007efc14191983 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt6Core.so.6 + 0x191983) + #21 0x00007efc14186eaa _ZN16QCoreApplication4execEv (libQt6Core.so.6 + 0x186eaa) + #22 0x0000555fe07fa5d5 main (qEmbyApp + 0xe35d5) + #23 0x00007efc13827741 n/a (libc.so.6 + 0x27741) + #24 0x00007efc13827879 __libc_start_main (libc.so.6 + 0x27879) + #25 0x0000555fe07faaf5 _start (qEmbyApp + 0xe3af5) + + Stack trace of thread 175777: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175774: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175773: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175772: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175790: + #0 0x00007efc1413f3c8 _ZNK9QIODevice12bytesToWriteEv (libQt6Core.so.6 + 0x13f3c8) + #1 0x00007efc15ac8063 _ZN22QAbstractSocketPrivate13writeToSocketEv (libQt6Network.so.6 + 0xc0063) + #2 0x00007efc141e7d46 _ZN7QObject5eventEP6QEvent (libQt6Core.so.6 + 0x1e7d46) + #3 0x00007efc1530411f _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent (libQt6Widgets.so.6 + 0x10411f) + #4 0x00007efc14183658 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent (libQt6Core.so.6 + 0x183658) + #5 0x00007efc14183a61 _ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData (libQt6Core.so.6 + 0x183a61) + #6 0x00007efc1449fc98 n/a (libQt6Core.so.6 + 0x49fc98) + #7 0x00007efc0faadbfd n/a (libglib-2.0.so.0 + 0x61bfd) + #8 0x00007efc0faafe57 n/a (libglib-2.0.so.0 + 0x63e57) + #9 0x00007efc0faaffe5 g_main_context_iteration (libglib-2.0.so.0 + 0x63fe5) + #10 0x00007efc1449d0b2 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt6Core.so.6 + 0x49d0b2) + #11 0x00007efc14191983 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt6Core.so.6 + 0x191983) + #12 0x00007efc142b9342 _ZN7QThread4execEv (libQt6Core.so.6 + 0x2b9342) + #13 0x00007efc14378595 n/a (libQt6Core.so.6 + 0x378595) + #14 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #15 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175775: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175769: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894b04 n/a (libc.so.6 + 0x94b04) + #3 0x00007efc1390f9ce __poll (libc.so.6 + 0x10f9ce) + #4 0x00007efc01c5220b n/a (libxcb.so.1 + 0xd20b) + #5 0x00007efc01c53f3d xcb_wait_for_event (libxcb.so.1 + 0xef3d) + #6 0x00007efbfd2383d9 n/a (libQt6XcbQpa.so.6 + 0x563d9) + #7 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #8 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #9 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175788: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175768: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894b04 n/a (libc.so.6 + 0x94b04) + #3 0x00007efc1390fff6 ppoll (libc.so.6 + 0x10fff6) + #4 0x00007efc0faafedf n/a (libglib-2.0.so.0 + 0x63edf) + #5 0x00007efc0faaffe5 g_main_context_iteration (libglib-2.0.so.0 + 0x63fe5) + #6 0x00007efc1449d0b2 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt6Core.so.6 + 0x49d0b2) + #7 0x00007efc14191983 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt6Core.so.6 + 0x191983) + #8 0x00007efc142b9342 _ZN7QThread4execEv (libQt6Core.so.6 + 0x2b9342) + #9 0x00007efc15fb37d1 n/a (libQt6DBus.so.6 + 0x397d1) + #10 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #11 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #12 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175771: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175776: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + + Stack trace of thread 175789: + #0 0x00007efc138a0a52 n/a (libc.so.6 + 0xa0a52) + #1 0x00007efc13894abc n/a (libc.so.6 + 0x94abc) + #2 0x00007efc13894e07 n/a (libc.so.6 + 0x94e07) + #3 0x00007efc13897882 pthread_cond_timedwait (libc.so.6 + 0x97882) + #4 0x00007efc143713a9 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x3713a9) + #5 0x00007efc142b6e86 n/a (libQt6Core.so.6 + 0x2b6e86) + #6 0x00007efc143784fb n/a (libQt6Core.so.6 + 0x3784fb) + #7 0x00007efc138981b9 n/a (libc.so.6 + 0x981b9) + #8 0x00007efc1391d21c n/a (libc.so.6 + 0x11d21c) + ELF object binary architecture: AMD x86-64 diff --git a/libs/qwindowkit/.clang-format b/libs/qwindowkit/.clang-format new file mode 100644 index 0000000..e2f1720 --- /dev/null +++ b/libs/qwindowkit/.clang-format @@ -0,0 +1,130 @@ +# References: +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# https://code.qt.io/cgit/qt/qt5.git/tree/_clang-format + +BasedOnStyle: LLVM + +Standard: c++17 + +# 指针和引用的对齐方式。 +# 可能的值有: +# PAS_Left (在配置中: Left) 指针左对齐。 +# PAS_Right (在配置中: Right) 指针右对齐。 +# PAS_Middle (在配置中: Middle) 指针中间对齐。 +PointerAlignment: Right + +# public/protected/private 等访问修饰符偏移量 +AccessModifierOffset: -4 + +# 缩进长度 +IndentWidth: 4 + +# 连续空行的最大数 +MaxEmptyLinesToKeep: 999 + +# 在OC中的@property后面添加一个空格。例如:使用“@property (readonly)”而不是“@property(readonly)” +ObjCSpaceAfterProperty: true + +# OC块中所拍的字符数 +ObjCBlockIndentWidth: 4 + +# 取决于值, 语句“int f() { return 0; }”可以被放到一个单行。 +# 可能的值有: +# SFS_None (在配置中: None) 从不合并方法或函数到单独的一行。 +# SFS_Empty (在配置中: Empty) 仅合并空的函数。 +# SFS_Inline (在配置中: Inline) 仅合并类中定义的方法或函数. 意味着 “empty”. +# SFS_All (在配置中: All) 合并所有的方法适应单行. +AllowShortFunctionsOnASingleLine: None + +# 如果为真(true), 语句“if (a) return;” 能被放到单行。 +AllowShortIfStatementsOnASingleLine: false + +# 如果为真(true), 对齐注释。 +AlignTrailingComments: true + +# 如果为真,对齐连续的宏定义 +AlignConsecutiveMacros: true + +# 如果为真(true),将会在“[”之后和“]”之前插入空格。 +SpacesInSquareBrackets: false + +# 如果为真(true), 将会在“(”之后和“)”之前插入空格。 +SpacesInParentheses : false + +# 如果为真(true), 校准连续的声明。 +# 这将会校准连续多行的声明的名字。这将会导致像下面这样的格式: +# int aaaa = 12; +# float b = 23; +# std::string ccc = 23; +AlignConsecutiveDeclarations: false + +# 如果为真(true),连续调整多行 +# 这将会调整连续行中的分配操作符。这将会导致像下面这样的格式: +# int aaaa = 12; +# int b = 23; +# int ccc = 23; +AlignConsecutiveAssignments: false + +# 如果为假(false),移除分配操作符(=)前空格。 +SpaceBeforeAssignmentOperators: true + +# 如果为真(true), 将会在字面量容器中插入空格(例如 OC和Javascript的数组和字典字面量)。 +SpacesInContainerLiterals: false + +# 缩进case标签 +IndentCaseLabels: true + +# 如果表达式中包含函数调用,并且函数调用因为表达式太长被放到了下一行,是否缩进 +IndentWrappedFunctionNames: true + +# 如果为真(true), 保持块的起始空行。 +# true: false: +# if (foo) { vs. if (foo) { +# bar(); +# bar(); } +# } +KeepEmptyLinesAtTheStartOfBlocks: true + +# 允许所有参数都被放在下一行 +AllowAllParametersOfDeclarationOnNextLine: false + +# 使用C风格强制类型转换后,是否在中间添加一个空格 +SpaceAfterCStyleCast: true + +# 在模板定义后换行 +AlwaysBreakTemplateDeclarations: Yes + +# Tab长度 +TabWidth: 4 + +# 是否使用Tab +UseTab: Never + +# 在括号后对齐参数 +# someLongFunction(argument1, +# argument2); +AlignAfterOpenBracket: Align + +# 名字空间内部缩进 +NamespaceIndentation: All + +# 一行最长列数 +ColumnLimit: 100 + +# 按层次缩进宏定义 +IndentPPDirectives: AfterHash + +# 预处理语句缩进为 2 +PPIndentWidth: 2 + +# 数组元素对齐 +AlignArrayOfStructures: Left + +# 不对头文件排序 +SortIncludes: Never + +FixNamespaceComments: false + +StatementMacros: ['__qas_attr__', '__qas_exclude__', '__qas_include__'] + +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ] \ No newline at end of file diff --git a/libs/qwindowkit/.gitignore b/libs/qwindowkit/.gitignore new file mode 100644 index 0000000..6f277c6 --- /dev/null +++ b/libs/qwindowkit/.gitignore @@ -0,0 +1,98 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.log +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +# *.res +# *.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +__pycache__ +*.pyc + +# Binaries +# -------- +*.dll +*.exe + +.DS_Store +*/.DS_Store + +build-* +build/ +cmake-build* +*.user +*.lnk +_workingDir* +.vscode +.idea +.cache +cache +.vs +out/ +CMakeSettings.json +# /vcpkg +/data +/*.natvis + +*.sublime-* +setup-vcpkg.json +setup-vcpkg-temp* \ No newline at end of file diff --git a/libs/qwindowkit/.gitmodules b/libs/qwindowkit/.gitmodules new file mode 100644 index 0000000..1d7f9e5 --- /dev/null +++ b/libs/qwindowkit/.gitmodules @@ -0,0 +1,4 @@ +[submodule "qmsetup"] + path = qmsetup + url = ../../stdware/qmsetup.git + branch = main \ No newline at end of file diff --git a/libs/qwindowkit/CMakeLists.txt b/libs/qwindowkit/CMakeLists.txt new file mode 100644 index 0000000..776b5dc --- /dev/null +++ b/libs/qwindowkit/CMakeLists.txt @@ -0,0 +1,144 @@ +cmake_minimum_required(VERSION 3.19) + +project(QWindowKit + VERSION 1.5.1.0 + LANGUAGES CXX + HOMEPAGE_URL "https://github.com/stdware/qwindowkit" + DESCRIPTION "Cross-platform window customization framework" +) + +# ---------------------------------- +# Build Options +# ---------------------------------- +option(QWINDOWKIT_BUILD_STATIC "Build static libraries" OFF) +option(QWINDOWKIT_BUILD_WIDGETS "Build widgets module" ON) +option(QWINDOWKIT_BUILD_QUICK "Build quick module" OFF) +option(QWINDOWKIT_BUILD_EXAMPLES "Build examples" OFF) +option(QWINDOWKIT_BUILD_DOCUMENTATIONS "Build documentations" OFF) +option(QWINDOWKIT_INSTALL "Install library" ON) + +option(QWINDOWKIT_FORCE_QT_WINDOW_CONTEXT "Force use Qt Window Context" OFF) +option(QWINDOWKIT_ENABLE_WINDOWS_SYSTEM_BORDERS "Enable system borders on Windows" ON) +option(QWINDOWKIT_ENABLE_STYLE_AGENT "Enable building style agent" ON) + +#[[ + +Detailed Introcuction to Configure Options: + +`QWINDOWKIT_BUILD_DOCUMENTATIONS` + - If you have installed `Doxygen`, you can ENABLE this option so that the documentations + will also be built and installed. + - If not, you can read the comments in `qdoc` style in `cpp` files to get detailed usages + of the public APIs. + +`QWINDOWKIT_ENABLE_WINDOWS_SYSTEM_BORDERS` + - If you don't want the system borders on Windows 10/11, you can DISABLE this option. + - If so, the Windows 10 top border issue will disappear. However, part of the client edge + area will be occupied as the resizing margins. + +`QWINDOWKIT_FORCE_QT_WINDOW_CONTEXT` + - If you want to use pure Qt emulated frameless implementation, you can ENABLE this option. + - If so, all system native features will be lost. + - The Qt Window Context is supported on all platforms. + +`QWINDOWKIT_ENABLE_STYLE_AGENT` + - Select whether to exclude the style component by DISABLING this option according to your + requirements and your Qt version. + +#]] + +# ---------------------------------- +# CMake Settings +# ---------------------------------- +if(MSVC) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /manifest:no") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /manifest:no") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /manifest:no") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") + + if(NOT DEFINED CMAKE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX "d") + endif() +elseif(MINGW) + if(NOT DEFINED CMAKE_STATIC_LIBRARY_PREFIX) + set(CMAKE_STATIC_LIBRARY_PREFIX "") + endif() + + if(NOT DEFINED CMAKE_SHARED_LIBRARY_PREFIX) + set(CMAKE_SHARED_LIBRARY_PREFIX "") + endif() + + if(NOT DEFINED CMAKE_IMPORT_LIBRARY_PREFIX) + set(CMAKE_IMPORT_LIBRARY_PREFIX "") + endif() +endif() + +if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Release") +endif() + +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_CROSSCOMPILING) + set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../lib") + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) +endif() + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) +set(CMAKE_C_VISIBILITY_PRESET "hidden") +set(CMAKE_CXX_VISIBILITY_PRESET "hidden") + +if(QWINDOWKIT_INSTALL) + include(GNUInstallDirs) + include(CMakePackageConfigHelpers) +endif() + +# ---------------------------------- +# Project Variables +# ---------------------------------- +set(QWINDOWKIT_VERSION ${PROJECT_VERSION}) +set(QWINDOWKIT_INSTALL_NAME ${PROJECT_NAME}) + +string(TIMESTAMP _QWINDOWKIT_CURRENT_YEAR "%Y") +set(QWINDOWKIT_COPYRIGHT "Copyright 2023-${_QWINDOWKIT_CURRENT_YEAR} Stdware Collections") +set(QWINDOWKIT_DESCRIPTION ${PROJECT_DESCRIPTION}) + +# ---------------------------------- +# Find basic dependencies +# ---------------------------------- +find_package(qmsetup QUIET) + +if(NOT TARGET qmsetup::library) + # Modify this variable according to your project structure + set(_source_dir ${CMAKE_CURRENT_SOURCE_DIR}/qmsetup) + + # Import install function + include("${_source_dir}/cmake/modules/private/InstallPackage.cmake") + + # Install package in place + set(_package_path) + qm_install_package(qmsetup + SOURCE_DIR ${_source_dir} + BUILD_TYPE Release + RESULT_PATH _package_path + ) + + # Find package again + find_package(qmsetup REQUIRED PATHS ${_package_path}) + + # Update import path + set(qmsetup_DIR ${_package_path} CACHE PATH "" FORCE) +endif() + +qm_import(Filesystem) +qm_init_directories() + +set(QT_NO_PRIVATE_MODULE_WARNING ON) + +# ---------------------------------- +# Add source modules +# ---------------------------------- +add_subdirectory(src) + +if(QWINDOWKIT_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() \ No newline at end of file diff --git a/libs/qwindowkit/LICENSE b/libs/qwindowkit/LICENSE new file mode 100644 index 0000000..d6629a9 --- /dev/null +++ b/libs/qwindowkit/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (C) 2023-2025 Stdware Collections (https://www.github.com/stdware) + Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/libs/qwindowkit/README.md b/libs/qwindowkit/README.md new file mode 100644 index 0000000..a639a0c --- /dev/null +++ b/libs/qwindowkit/README.md @@ -0,0 +1,316 @@ +# QWindowKit + +Cross-platform window customization framework for Qt Widgets and Qt Quick. + +This project inherited the major implementations from [wangwenx190 FramelessHelper](https://github.com/wangwenx190/framelesshelper), with a complete refactoring and upgrading of the architecture. + +Feature requests are welcome. + +## Stay In Touch :triangular_flag_on_post: + +You can share your findings, thoughts and ideas on improving / implementing QWindowKit functionalities on more platforms and apps! + +- Chat with us on [Discord](https://discord.gg/grrM4Tmesy) +- 中文用户可加入 QQ 群 876419693 + +## Supported Platforms + +- Microsoft Windows +- Apple macOS (11+) +- GNU/Linux + +## Features + +- Full support of Windows 11 Snap Layout +- Better workaround to handle Windows 10 top border issue +- Support Mac system buttons geometry customization +- Simpler APIs, more detailed documentations and comments + +## Gallery + +### Windows 11 (With Snap Layout) + +![image](./docs/images/win11.png) + +### Windows 10 (And 7, Vista) + +![image](./docs/images/win10.png) + +### macOS & Linux + +| macOS | Linux (Ubuntu 20.04) | +|:-------------------------------:|:---------------------------------:| +| ![image](./docs/images/mac.png) | ![image](./docs/images/linux.png) | + +## Requirements + +| Component | Requirement | Details | +|:---------:|:-----------:|:-------------------------:| +| Qt | \>=5.12 | Core, Gui, Widgets, Quick | +| Compiler | \>=C++17 | MSVC 2019, GCC, Clang | +| CMake | \>=3.19 | >=3.20 is recommended | + +Please read [Vulnerabilities](#Vulnerabilities) carefully to acquire detailed requirements. + +### Tested Compilers + +- Windows + - MSVC: 2019, 2022 + - MinGW (GCC): 13.2.0 +- macOS + - Clang 14.0.3 +- Ubuntu + - GCC: 9.4.0 + +## Dependencies + +- Qt 5.12 or higher +- [qmsetup](https://github.com/stdware/qmsetup) + +## Integrate + +### Build & Install + +```sh +git clone --recursive https://github.com/stdware/qwindowkit +cd qwindowkit + +cmake -B build -S . \ + -DCMAKE_PREFIX_PATH= \ + -Dqmsetup_DIR= \ # Optional + -DQWINDOWKIT_BUILD_QUICK=TRUE \ # Optional + -DCMAKE_INSTALL_PREFIX=/path/install \ + -G "Ninja Multi-Config" + +cmake --build build --target install --config Debug +cmake --build build --target install --config Release +``` +Read the root `CMakeLists.txt` for more build options. + +You can also include this directory as a subproject if you choose CMake as your build system. + +For other build systems, you need to install with CMake first and include the corresponding configuration files in your project. + +### Import + +#### CMake Project + +```sh +cmake -B build -DQWindowKit_DIR=/path/install/lib/cmake/QWindowKit +``` + +```cmake +find_package(QWindowKit COMPONENTS Core Widgets Quick REQUIRED) +target_link_libraries(widgets_app PUBLIC QWindowKit::Widgets) +target_link_libraries(quick_app PUBLIC QWindowKit::Quick) +``` + +#### QMake Project + +```cmake +# WidgetsApp.pro +include("/path/install/share/QWindowKit/qmake/QWKWidgets.pri") + +# QuickApp.pro +include("/path/install/share/QWindowKit/qmake/QWKQuick.pri") +``` + +#### Visual Studio Project + +See [Visual Studio Guide](./docs/visual-studio-guide.md) for detailed usages. + +## Quick Start + +### Qt Widgets Application + +#### Initialization + +The following initialization should be done before any widget constructs. + +```cpp +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings) + + // ... +} +``` + +#### Setup Window Agent + +First, setup `WidgetWindowAgent` for your top `QWidget` instance. (Each window needs its own agent.) + +```c++ +#include + +MyWidget::MyWidget(QWidget *parent) { + // ... + auto agent = new QWK::WidgetWindowAgent(this); + agent->setup(this); + // ... +} +``` + +If you don't want to derive a new widget class or change the constructor, you can initialize the agent after the window +constructs. + +```c++ +auto w = new MyWidget(); +auto agent = new QWK::WidgetWindowAgent(w); +agent->setup(w); +``` + +You should call `QWK::WidgetWindowAgent::setup()` as early as possible, especially when you need to set the size constrains. QWindowKit will change some Qt internal data which will affect how Qt calculates the window size, and thus you need to let QWindowKit initialize at the very beginning. + +#### Construct Title bar + +Then, construct your title bar widget, without which the window lacks the basic interaction feature, and it's better to +put it into the window's layout. + +You can use the [`WindowBar`](examples/shared/widgetframe/windowbar.h) provided by `WidgetFrame` in the examples as the +container of your title bar components. + +Let `WidgetWindowAgent` know which widget the title bar is. + +```c++ +agent->setTitleBar(myTitleBar); +``` + +Next, set system button hints to let `WidgetWindowAgent` know the role of the child widgets, which is important for the +Snap Layout to work. + +```c++ +agent->setSystemButton(QWK::WindowAgentBase::WindowIcon, myTitleBar->iconButton()); +agent->setSystemButton(QWK::WindowAgentBase::Minimize, myTitleBar->minButton()); +agent->setSystemButton(QWK::WindowAgentBase::Maximize, myTitleBar->maxButton()); +agent->setSystemButton(QWK::WindowAgentBase::Close, myTitleBar->closeButton()); +``` + +Doing this does not mean that these buttons' click events are automatically associated with window actions, you still need to manually connect the signals and slots to emulate the native window behaviors. + +On macOS, this step can be skipped because it is better to use the buttons provided by the system. + +Last but not least, set hit-test visible hint to let `WidgetWindowAgent` know which widgets are willing to receive mouse events. + +```c++ +agent->setHitTestVisible(myTitleBar->menuBar(), true); +``` + +The rest region within the title bar will be regarded as the draggable area for the user to move the window, and thus any QWidgets inside it will not receive any user interaction events such as mouse events/focus events/etc anymore, but you can still send/post such events to these widgets manually, either through Qt API or system API. + +- If you want to disable window maximization, you can remove the `Qt::WindowMaximizeButtonHint` flag from the window. + + + +### Qt Quick Application + +#### Initialization + +Make sure you have registered `QWindowKit` into QtQuick: + +```cpp +#include + +int main(int argc, char *argv[]) +{ + // ... + QQmlApplicationEngine engine; + // ... + QWK::registerTypes(&engine); + // ... +} +``` + +#### Setup Window Components + +Then you can use `QWindowKit` data types and classes by importing its URI: + +```qml +import QtQuick 2.15 +import QtQuick.Window 2.15 +import QWindowKit 1.0 + +Window { + id: window + visible: false // We hide it first, so we can move the window to our desired position silently. + Component.onCompleted: { + windowAgent.setup(window) + window.visible = true + } + WindowAgent { + id: windowAgent + // ... + } +} +``` + +You can omit the version number or use "auto" instead of "1.0" for the module URI if you are using Qt6. + +As we just mentioned above, if you are going to set the size constrains, please do it after `windowAgent.setup()` is called. + +### Learn More + +See [examples](examples) for more demo use cases. The examples have no High DPI support. + +- QWindowKit Internals [TODO] +- [FramelessHelper Related](docs/framelesshelper-related.md) + + +### Vulnerabilities + +#### Qt Version +- To achieve better frameless functionality, QWindowKit depends heavily on Qt's internal implementation. However, there are many differences in different versions of Qt, and earlier versions of Qt5 and Qt6 have many bugs which make it extremely difficult for QWindowKit to workaround without changing the Qt source code. +- And also due to limited manpower, although QWindowKit can be successfully compiled on Qt 5.12 or later, it can hardly work perfectly on all Qt versions. +- Therefore, the following Qt version ranges are recommended, if there are any exceptions with QWindowKit in your application, make sure the Qt version you use is in the ranges before raising the issue. + - Qt 5: 5.15.2 or higher (you may be able to build QWK on top of older Qt versions, however, QWK may not behave well and we won't accept bug reports from these unsupported versions) + - Qt 6: 6.6.2 or higher (the newer, the better) + +#### Hot Switch +- Once you have made the window frameless, it will not be able to switch back to the system frame again unless you destroy your window and recreate it with different settings. + +- Do not use `QWidget::setWindowFlags` to change the window flags after `windowAgent.setup()` is called. As a result, `QWK::WidgetWindowAgent` can not be setup on `QDockWidget`. + +#### Native Child Widget +- If you are about to add a widget with `Qt::WA_NativeWindow` property enabled as a descendent of the frameless window, you should enable `Qt::WA_DontCreateNativeAncestors` of it in advance. + +#### Size Constrains +- If you want to disable window resizing, you can set a fixed size, which is officially supported by QWindowKit. If you use other special means to achieve this (eg. hook Win32 messages), QWK doesn't guarantee everything can still be fully functional. +- If you set a maximized width or height, the window should not be maximized because you cannot get the correct window size through Qt APIs. You may workaround this by using system APIs such as `GetWindowRect` or `GetClientRect`. The root cause lies deep in Qt QPA implementations and currently we don't know how to fix it without modifying Qt itself. + +#### Windows 10 +- Due to the inherent defects in the Windows 10 window system, the top border will disappear when the system title bar is removed. We have filtered Qt's event and perfectly reshown the system top border, thanks to the implementation of Windows Terminal for our reference. However, this workaround only works with QtWidgets and QtQuick (**only when rendering through OpenGL/D3D11/D3D12, not Vulkan**) applications. +- For QtQuick applications, when rendering through Vulkan, the top border will become a solid black line, that's a known issue and currently we are not able to fix it. Please use QWK's borderless version if you can't change your graphics backend. +- For QtQuick applications, when rendering through D3D11/D3D12, you may see a strange white line on window top, it may disappear if you resize the window. Currently it's a bug and we are working hard to find a suitable solution for it, for now you can set the environment variable `QT_QPA_DISABLE_REDIRECTION_SURFACE` to a non-zero value in your `main` function before any `QCoreApplication` instance is created to workaround this issue. This environment variable is first introduced in Qt 6.7.0 (qtbase/838fc606c170fac112f7bb5971c2507b7b56d08a). You must **NOT** enable this feature for OpenGL/Vulkan because their rendering will be totally broken. + +## TODO + +- Fix mouse cursor mapping issues +- More documentations +- When do we support Linux native features? + +## Special Thanks + +- [Maplespe](https://github.com/Maplespe) +- [zhiyiYo](https://github.com/zhiyiYo) + +## License + +QWindowKit is licensed under the [Apache 2.0 License](./LICENSE). + + diff --git a/libs/qwindowkit/docs/framelesshelper-related.md b/libs/qwindowkit/docs/framelesshelper-related.md new file mode 100644 index 0000000..67bb7b7 --- /dev/null +++ b/libs/qwindowkit/docs/framelesshelper-related.md @@ -0,0 +1,89 @@ +# FramelessHelper 2.x + +Cross-platform window customization framework for Qt Widgets and Qt Quick. Supports Windows, Linux and macOS. + +## Join with Us :triangular_flag_on_post: + +You can join our [Discord channel](https://discord.gg/grrM4Tmesy) to communicate with us. You can share your findings, thoughts and ideas on improving / implementing FramelessHelper functionalities on more platforms and apps! + +## More + +### Title Bar Design Guidance + +- Microsoft: +- KDE: +- GNOME: +- Apple: + +## Platform Notes + +### Windows + +- If DWM composition is disabled in some very rare cases (only possible on Windows 7), the top-left corner and top-right corner will appear in round shape. The round corners can be restored to square if you re-enable DWM composition. +- There's an OpenGL driver bug which will cause some frameless windows have a strange black bar right on top of your homemade title bar, and it also makes the controls in your windows shifted to the bottom-right corner for some pixels. It's a bug of your graphics card driver, specifically, your OpenGL driver, not FramelessHelper. There are some solutions provided by our users but some of them may not work in all conditions, you can pick one from them: + + Solution | Principle + -------- | --------- + Upgrade the graphics driver | Try to use a newer driver which may ship with the fix + Change the system theme to "Basic" (in contrary to "Windows Aero") | Let Windows use pure software rendering + If there are multiple graphics cards, use another one instead | Try to use a different driver which may don't have such bug at all + Upgrade the system to at least Windows 11 | Windows 11 redesigned the windowing system so the bug can no longer be triggered + Remove the `WS_THICKFRAME` and `WS_OVERLAPPED` styles from the window, and maybe also add the `WS_POPUP` style at the same time, and don't do anything inside the `WM_NCCALCSIZE` block (just return `false` directly or remove/comment out the whole block) | Try to mirror Qt's `FramelessWindowHint`'s behavior + Use `Qt::FramelessWindowHint` instead of doing the `WM_NCCALCSIZE` trick | Qt's rendering code path is totally different between these two solutions + Force Qt to use the ANGLE backend instead of the Desktop OpenGL | ANGLE will translate OpenGL directives into D3D ones + Force Qt to use pure software rendering instead of rendering through OpenGL | Qt is not using OpenGL at all + Force Qt to use the Mesa 3D libraries instead of normal OpenGL | Try to use a different OpenGL implementation + Use Direct3D/Vulkan/Metal instead of OpenGL | Just don't use the buggy OpenGL + + If you are lucky enough, one of them may fix the issue for you. If not, you may try to use multiple solutions together. **But I can't guarantee the issue can 100% be fixed.** +- Due to there are many sub-versions of Windows 10, it's highly recommended to use the latest version of Windows 10, at least **no older than Windows 10 1809**. If you try to use this framework on some very old Windows 10 versions such as 1507 or 1607, there may be some compatibility issues. Using this framework on Windows 7 is also supported but not recommended. To get the most stable behavior and the best appearance, you should use it on the latest version of Windows 10 or Windows 11. +- To make the snap layout work as expected, there are some additional rules for your homemade system buttons to follow: + - **Add a manifest file to your application. In the manifest file, you need to claim your application supports Windows 11 explicitly. This step is VERY VERY IMPORTANT. Without this step, the snap layout feature can't be enabled.** + - Call `setSystemButton()` for each button (it can be any *QWidget* or *QQuickItem*) to let FramelessHelper know which is the minimize/maximize/close button. + +### Linux + +- FramelessHelper will force your application to use the _XCB_ platform plugin when running on Wayland. +- The resize area is inside of the window. + +### macOS + +- Some users reported that the window is not resizable on some old macOS versions. + +## Special Thanks + +*Ordered by first contribution time (it may not be very accurate, sorry)* + +- [Yuhang Zhao](https://github.com/wangwenx190): Help me create this project. This project is mainly based on his code. +- [Julien](https://github.com/JulienMaille): Help me test this library on many various environments and help me fix the bugs we found. Contributed many code to improve this library. The MainWindow example is mostly based on his code. +- [Altair Wei](https://github.com/altairwei): Help me fix quite some small bugs and give me many important suggestions, the 2.x version is also inspired by his idea during our discussions. +- [Kenji Mouri](https://github.com/MouriNaruto): Give me a lot of help on Win32 native developing. +- [Dylan Liu](https://github.com/mentalfl0w): Help me improve the build process on macOS. +- [SineStriker](https://github.com/SineStriker): Spent over a whole week helping me improve the Snap Layout implementation, fixing potential bugs and also give me a lot of professional and useful suggestions. Without his great effort, the new implementation may never come. +- And also thanks to other contributors not listed here! Without their valuable help, this library wouldn't have such good quality and user experience! + +## License + +```text +MIT License + +Copyright (C) 2021-2023 by wangwenx190 (Yuhang Zhao) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` \ No newline at end of file diff --git a/libs/qwindowkit/docs/images/linux.png b/libs/qwindowkit/docs/images/linux.png new file mode 100644 index 0000000..9ccd8b6 Binary files /dev/null and b/libs/qwindowkit/docs/images/linux.png differ diff --git a/libs/qwindowkit/docs/images/mac.png b/libs/qwindowkit/docs/images/mac.png new file mode 100644 index 0000000..f4aecca Binary files /dev/null and b/libs/qwindowkit/docs/images/mac.png differ diff --git a/libs/qwindowkit/docs/images/vs-guide-1.png b/libs/qwindowkit/docs/images/vs-guide-1.png new file mode 100644 index 0000000..c43226d Binary files /dev/null and b/libs/qwindowkit/docs/images/vs-guide-1.png differ diff --git a/libs/qwindowkit/docs/images/vs-guide-2.png b/libs/qwindowkit/docs/images/vs-guide-2.png new file mode 100644 index 0000000..23dfbb6 Binary files /dev/null and b/libs/qwindowkit/docs/images/vs-guide-2.png differ diff --git a/libs/qwindowkit/docs/images/vs-guide-3.png b/libs/qwindowkit/docs/images/vs-guide-3.png new file mode 100644 index 0000000..a082662 Binary files /dev/null and b/libs/qwindowkit/docs/images/vs-guide-3.png differ diff --git a/libs/qwindowkit/docs/images/win10.png b/libs/qwindowkit/docs/images/win10.png new file mode 100644 index 0000000..7975626 Binary files /dev/null and b/libs/qwindowkit/docs/images/win10.png differ diff --git a/libs/qwindowkit/docs/images/win11.png b/libs/qwindowkit/docs/images/win11.png new file mode 100644 index 0000000..af54f3d Binary files /dev/null and b/libs/qwindowkit/docs/images/win11.png differ diff --git a/libs/qwindowkit/docs/visual-studio-guide.md b/libs/qwindowkit/docs/visual-studio-guide.md new file mode 100644 index 0000000..8bc490e --- /dev/null +++ b/libs/qwindowkit/docs/visual-studio-guide.md @@ -0,0 +1,15 @@ +# Visual Studio Guide + +![Visual Studio Guide - Step 1](./images/vs-guide-1.png) + +First, click the "View" menu, find "Other Windows", click "Property Manager". + +![Visual Studio Guide - Step 2](./images/vs-guide-2.png) + +Then, right click the project name item and pop up a context menu, click "Add +Existing Property Sheet...". + +![Visual Studio Guide - Step 3](./images/vs-guide-3.png) + +Finally, find the "QWindowKit.props" in the "[Build output folder of +QWindowKit]\share\QWindowKit" folder, click "Open" button. \ No newline at end of file diff --git a/libs/qwindowkit/examples/CMakeLists.txt b/libs/qwindowkit/examples/CMakeLists.txt new file mode 100644 index 0000000..5d27181 --- /dev/null +++ b/libs/qwindowkit/examples/CMakeLists.txt @@ -0,0 +1,23 @@ +set(QWK_EXAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +macro(qwk_add_example _target) + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTOUIC ON) + set(CMAKE_AUTORCC ON) + + add_executable(${_target}) + qm_configure_target(${_target} ${ARGN}) + qm_add_win_rc(${_target} ICON ${QWK_EXAMPLES_DIR}/shared/resources/app/example.ico) + qm_add_win_manifest(${_target}) + qm_add_mac_bundle(${_target} ICON ${QWK_EXAMPLES_DIR}/shared/resources/app/example.icns) +endmacro() + +add_subdirectory(shared) + +if(QWINDOWKIT_BUILD_WIDGETS) + add_subdirectory(mainwindow) +endif() + +if(QWINDOWKIT_BUILD_QUICK) + add_subdirectory(qml) +endif() \ No newline at end of file diff --git a/libs/qwindowkit/examples/mainwindow/CMakeLists.txt b/libs/qwindowkit/examples/mainwindow/CMakeLists.txt new file mode 100644 index 0000000..644e733 --- /dev/null +++ b/libs/qwindowkit/examples/mainwindow/CMakeLists.txt @@ -0,0 +1,10 @@ +project(QWKExample_MainWindow) + +file(GLOB _src *.h *.cpp) + +qwk_add_example(${PROJECT_NAME} + FEATURES cxx_std_17 + SOURCES ${_src} mainwindow.qrc ../shared/resources/shared.qrc + QT_LINKS Core Gui Widgets # MultimediaWidgets + LINKS QWKWidgets WidgetFrame +) \ No newline at end of file diff --git a/libs/qwindowkit/examples/mainwindow/dark-style.qss b/libs/qwindowkit/examples/mainwindow/dark-style.qss new file mode 100644 index 0000000..33ac251 --- /dev/null +++ b/libs/qwindowkit/examples/mainwindow/dark-style.qss @@ -0,0 +1,170 @@ +/* Window bar */ + +QWK--WindowBar[bar-active=true] { + /*background-color: #3C3C3C;*/ + background-color: transparent; +} + +QWK--WindowBar[bar-active=false] { + /*background-color: #505050;*/ + background-color: transparent; +} + + +/* Title label */ + +QWK--WindowBar>QLabel#win-title-label { + padding: 0; + border: none; + color: #ECECEC; + background-color: transparent; + min-height: 28px; +} + + +/* System buttons */ + +QWK--WindowBar>QAbstractButton[system-button=true] { + qproperty-iconSize: 12px 12px; + min-width: 50px; + border: none; + padding: 0; + background-color: transparent; +} + +QWK--WindowBar>QAbstractButton#pin-button { + qproperty-iconNormal: url(":/window-bar/pin.svg"); + qproperty-iconChecked: url(":/window-bar/pin-fill.svg"); + qproperty-iconSize: 15px 15px; +} + +QWK--WindowBar>QAbstractButton#pin-button:hover, +QWK--WindowBar>QAbstractButton#pin-button:pressed { + background-color: rgba(255, 255, 255, 15%); +} + +QWK--WindowBar>QAbstractButton#min-button { + qproperty-iconNormal: url(":/window-bar/minimize.svg"); +} + +QWK--WindowBar>QAbstractButton#min-button:hover, +QWK--WindowBar>QAbstractButton#min-button:pressed { + background-color: rgba(255, 255, 255, 15%); +} + +QWK--WindowBar>QAbstractButton#max-button { + qproperty-iconNormal: url(":/window-bar/maximize.svg"); + qproperty-iconChecked: url(":/window-bar/restore.svg"); +} + +QWK--WindowBar>QAbstractButton#max-button:hover, +QWK--WindowBar>QAbstractButton#max-button:pressed { + background-color: rgba(255, 255, 255, 15%); +} + +QWK--WindowBar>QAbstractButton#close-button { + qproperty-iconNormal: url(":/window-bar/close.svg"); +} + +QWK--WindowBar>QAbstractButton#close-button:hover, +QWK--WindowBar>QAbstractButton#close-button:pressed { + background-color: #e81123; +} + + +/* Icon button */ + +QWK--WindowBar>QAbstractButton#icon-button { + qproperty-iconNormal: url(":/app/example.png"); + qproperty-iconSize: 18px 18px; + min-width: 40px; + border: none; + padding: 0; + background-color: transparent; +} + + +/* Menu Bar */ + +QMenuBar { + background-color: transparent; + border: none; +} + +QMenuBar>QToolButton#qt_menubar_ext_button { + qproperty-icon: url(":/window-bar/more-line.svg"); +} + +QMenuBar>QToolButton#qt_menubar_ext_button:hover, +QMenuBar>QToolButton#qt_menubar_ext_button:pressed { + background-color: rgba(255, 255, 255, 10%); +} + +QMenuBar::item { + color: #CCCCCC; + border: none; + padding: 8px 12px; +} + +QMenuBar::item:selected { + background-color: rgba(255, 255, 255, 10%); +} + + +/* Menu */ + +QMenu { + padding: 4px; + background: #303030; + border: 1px solid transparent; +} + +QMenu::indicator { + left: 6px; + width: 20px; + height: 20px; +} + +QMenu::icon { + left: 6px; +} + +QMenu::item { + background: transparent; + color: #CCCCCC; + padding: 6px 24px; +} + +QMenu::item:selected { + color: white; + background-color: #0060C0; +} + +QMenu::item:disabled { + color: #666666; + background-color: transparent; +} + +QMenu::separator { + height: 2px; + background-color: #5B5B5B; + margin: 6px 0; +} + + +/* Window */ + +MainWindow { + background-color: #1E1E1E; +} + +MainWindow[custom-style=true] { + background-color: transparent; +} + +QWidget#clock-widget { + font-size: 75px; + color: #FEFEFE; + font-weight: bold; + background-color: transparent; +} \ No newline at end of file diff --git a/libs/qwindowkit/examples/mainwindow/light-style.qss b/libs/qwindowkit/examples/mainwindow/light-style.qss new file mode 100644 index 0000000..1f7b4c9 --- /dev/null +++ b/libs/qwindowkit/examples/mainwindow/light-style.qss @@ -0,0 +1,168 @@ +/* Window bar */ + +QWK--WindowBar[bar-active=true] { + background-color: #195ABE; + /* background-color: transparent; */ +} + +QWK--WindowBar[bar-active=false] { + background-color: #195ABE; + /* background-color: transparent; */ +} + + +/* Title label */ + +QWK--WindowBar>QLabel#win-title-label { + padding: 0; + border: none; + color: #ECECEC; + background-color: transparent; + min-height: 28px; +} + + +/* System buttons */ + +QWK--WindowBar>QAbstractButton[system-button=true] { + qproperty-iconSize: 12px 12px; + min-width: 50px; + border: none; + padding: 0; + background-color: transparent; +} + +QWK--WindowBar>QAbstractButton#pin-button { + qproperty-iconNormal: url(":/window-bar/pin.svg"); + qproperty-iconChecked: url(":/window-bar/pin-fill.svg"); + qproperty-iconSize: 15px 15px; +} + +QWK--WindowBar>QAbstractButton#pin-button:hover, +QWK--WindowBar>QAbstractButton#pin-button:pressed { + background-color: rgba(0, 0, 0, 15%); +} + +QWK--WindowBar>QAbstractButton#min-button { + qproperty-iconNormal: url(":/window-bar/minimize.svg"); +} + +QWK--WindowBar>QAbstractButton#min-button:hover, +QWK--WindowBar>QAbstractButton#min-button:pressed { + background-color: rgba(0, 0, 0, 15%); +} + +QWK--WindowBar>QAbstractButton#max-button { + qproperty-iconNormal: url(":/window-bar/maximize.svg"); + qproperty-iconChecked: url(":/window-bar/restore.svg"); +} + +QWK--WindowBar>QAbstractButton#max-button:hover, +QWK--WindowBar>QAbstractButton#max-button:pressed { + background-color: rgba(0, 0, 0, 15%); +} + +QWK--WindowBar>QAbstractButton#close-button { + qproperty-iconNormal: url(":/window-bar/close.svg"); +} + +QWK--WindowBar>QAbstractButton#close-button:hover, +QWK--WindowBar>QAbstractButton#close-button:pressed { + background-color: #e81123; +} + + +/* Icon button */ + +QWK--WindowBar>QAbstractButton#icon-button { + qproperty-iconNormal: url(":/app/example.png"); + qproperty-iconSize: 18px 18px; + min-width: 40px; + border: none; + padding: 0; + background-color: transparent; +} + + +/* Menu Bar */ + +QMenuBar { + background-color: transparent; + border: none; +} + +QMenuBar>QToolButton#qt_menubar_ext_button { + qproperty-icon: url(":/window-bar/more-line.svg"); +} + +QMenuBar>QToolButton#qt_menubar_ext_button:hover, +QMenuBar>QToolButton#qt_menubar_ext_button:pressed { + background-color: rgba(255, 255, 255, 10%); +} + +QMenuBar::item { + color: #EEEEEE; + border: none; + padding: 8px 12px; +} + +QMenuBar::item:selected { + background-color: rgba(255, 255, 255, 10%); +} + + +/* Menu */ + +QMenu { + padding: 4px; + background: white; + border: 1px solid #E0E0E0; +} + +QMenu::indicator { + left: 6px; + width: 20px; + height: 20px; +} + +QMenu::icon { + left: 6px; +} + +QMenu::item { + background: transparent; + color: #333333; + padding: 6px 24px; +} + +QMenu::item:selected { + background-color: rgba(0, 0, 0, 10%); +} + +QMenu::item:disabled { + color: #CCCCCC; +} + +QMenu::separator { + height: 2px; + background-color: #CCCCCC; + margin: 6px 0; +} + + +/* Window */ + +MainWindow { + background-color: #F3F3F3; +} + +MainWindow[custom-style=true] { + background-color: transparent; +} + +QWidget#clock-widget { + font-size: 75px; + color: #333333; + font-weight: bold; + background-color: transparent; +} \ No newline at end of file diff --git a/libs/qwindowkit/examples/mainwindow/main.cpp b/libs/qwindowkit/examples/mainwindow/main.cpp new file mode 100644 index 0000000..7052bbb --- /dev/null +++ b/libs/qwindowkit/examples/mainwindow/main.cpp @@ -0,0 +1,34 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "mainwindow.h" + +int main(int argc, char *argv[]) { + qputenv("QT_WIN_DEBUG_CONSOLE", "attach"); + qputenv("QSG_INFO", "1"); + //qputenv("QT_WIDGETS_HIGHDPI_DOWNSCALE", "1"); + //qputenv("QT_WIDGETS_RHI", "1"); + //qputenv("QSG_RHI_BACKEND", "d3d12"); + //qputenv("QSG_RHI_HDR", "scrgb"); + //qputenv("QT_QPA_DISABLE_REDIRECTION_SURFACE", "1"); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QGuiApplication::setHighDpiScaleFactorRoundingPolicy( + Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); +#endif +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); +#endif + + QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); + QApplication a(argc, argv); + + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/libs/qwindowkit/examples/mainwindow/mainwindow.cpp b/libs/qwindowkit/examples/mainwindow/mainwindow.cpp new file mode 100644 index 0000000..2bf6058 --- /dev/null +++ b/libs/qwindowkit/examples/mainwindow/mainwindow.cpp @@ -0,0 +1,385 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#include "mainwindow.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +# include +#else +# include +#endif + +// #include + +#include + +#include +#include + +class ClockWidget : public QLabel { +public: + explicit ClockWidget(QWidget *parent = nullptr) : QLabel(parent) { + startTimer(100); + setAlignment(Qt::AlignCenter); + } + + ~ClockWidget() override = default; + +protected: + void timerEvent(QTimerEvent *event) override { + QLabel::timerEvent(event); + setText(QTime::currentTime().toString(QStringLiteral("hh:mm:ss"))); + } +}; + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { + setAttribute(Qt::WA_DontCreateNativeAncestors); + + installWindowAgent(); + +#if 1 + auto clockWidget = new ClockWidget(); + clockWidget->setObjectName(QStringLiteral("clock-widget")); + clockWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setCentralWidget(clockWidget); +#else + auto webView = new QWebEngineView(); + webView->load(QUrl("https://www.baidu.com")); + setCentralWidget(webView); +#endif + + loadStyleSheet(Dark); + + setWindowTitle(tr("Example MainWindow")); + resize(800, 600); + + // setFixedHeight(600); + // windowAgent->centralize(); +} + +static inline void emulateLeaveEvent(QWidget *widget) { + Q_ASSERT(widget); + if (!widget) { + return; + } + QTimer::singleShot(0, widget, [widget]() { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + const QScreen *screen = widget->screen(); +#else + const QScreen *screen = widget->windowHandle()->screen(); +#endif + const QPoint globalPos = QCursor::pos(screen); + if (!QRect(widget->mapToGlobal(QPoint{0, 0}), widget->size()).contains(globalPos)) { + QCoreApplication::postEvent(widget, new QEvent(QEvent::Leave)); + if (widget->testAttribute(Qt::WA_Hover)) { + const QPoint localPos = widget->mapFromGlobal(globalPos); + const QPoint scenePos = widget->window()->mapFromGlobal(globalPos); + static constexpr const auto oldPos = QPoint{}; + const Qt::KeyboardModifiers modifiers = QGuiApplication::keyboardModifiers(); +#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)) + const auto event = + new QHoverEvent(QEvent::HoverLeave, scenePos, globalPos, oldPos, modifiers); + Q_UNUSED(localPos); +#elif (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)) + const auto event = new QHoverEvent(QEvent::HoverLeave, localPos, globalPos, oldPos, modifiers); + Q_UNUSED(scenePos); +#else + const auto event = new QHoverEvent(QEvent::HoverLeave, localPos, oldPos, modifiers); + Q_UNUSED(scenePos); +#endif + QCoreApplication::postEvent(widget, event); + } + } + }); +} + +MainWindow::~MainWindow() = default; + +bool MainWindow::event(QEvent *event) { + switch (event->type()) { + case QEvent::WindowActivate: { + auto menu = menuWidget(); + if (menu) { + menu->setProperty("bar-active", true); + style()->polish(menu); + } + break; + } + + case QEvent::WindowDeactivate: { + auto menu = menuWidget(); + if (menu) { + menu->setProperty("bar-active", false); + style()->polish(menu); + } + break; + } + + default: + break; + } + return QMainWindow::event(event); +} + +void MainWindow::installWindowAgent() { + // 1. Setup window agent + windowAgent = new QWK::WidgetWindowAgent(this); + windowAgent->setup(this); + + // 2. Construct your title bar + auto menuBar = [this]() { + auto menuBar = new QMenuBar(this); + + // Virtual menu + auto file = new QMenu(tr("File(&F)"), menuBar); + file->addAction(new QAction(tr("New(&N)"), menuBar)); + file->addAction(new QAction(tr("Open(&O)"), menuBar)); + file->addSeparator(); + + auto edit = new QMenu(tr("Edit(&E)"), menuBar); + edit->addAction(new QAction(tr("Undo(&U)"), menuBar)); + edit->addAction(new QAction(tr("Redo(&R)"), menuBar)); + + // Theme action + auto darkAction = new QAction(tr("Enable dark theme"), menuBar); + darkAction->setCheckable(true); + connect(darkAction, &QAction::triggered, this, [this](bool checked) { + loadStyleSheet(checked ? Dark : Light); // + }); + connect(this, &MainWindow::themeChanged, darkAction, [this, darkAction]() { + darkAction->setChecked(currentTheme == Dark); // + }); + +#ifdef Q_OS_WIN + auto noneAction = new QAction(tr("None"), menuBar); + noneAction->setData(QStringLiteral("none")); + noneAction->setCheckable(true); + noneAction->setChecked(true); + + auto dwmBlurAction = new QAction(tr("Enable DWM blur"), menuBar); + dwmBlurAction->setData(QStringLiteral("dwm-blur")); + dwmBlurAction->setCheckable(true); + + auto acrylicAction = new QAction(tr("Enable acrylic material"), menuBar); + acrylicAction->setData(QStringLiteral("acrylic-material")); + acrylicAction->setCheckable(true); + + auto micaAction = new QAction(tr("Enable mica"), menuBar); + micaAction->setData(QStringLiteral("mica")); + micaAction->setCheckable(true); + + auto micaAltAction = new QAction(tr("Enable mica alt"), menuBar); + micaAltAction->setData(QStringLiteral("mica-alt")); + micaAltAction->setCheckable(true); + + auto winStyleGroup = new QActionGroup(menuBar); + winStyleGroup->addAction(noneAction); + winStyleGroup->addAction(dwmBlurAction); + winStyleGroup->addAction(acrylicAction); + winStyleGroup->addAction(micaAction); + winStyleGroup->addAction(micaAltAction); + connect(winStyleGroup, &QActionGroup::triggered, this, + [this, winStyleGroup](QAction *action) { + // Unset all custom style attributes first, otherwise the style will not display + // correctly + for (const QAction *_act : winStyleGroup->actions()) { + const QString data = _act->data().toString(); + if (data.isEmpty() || data == QStringLiteral("none")) { + continue; + } + windowAgent->setWindowAttribute(data, false); + } + const QString data = action->data().toString(); + if (data == QStringLiteral("none")) { + setProperty("custom-style", false); + } else if (!data.isEmpty()) { + windowAgent->setWindowAttribute(data, true); + setProperty("custom-style", true); + } + style()->polish(this); + }); + +#elif defined(Q_OS_MAC) + // Set whether to use system buttons (close/minimize/zoom) + // - true: Hide system buttons (use custom UI controls) + // - false: Show native system buttons (default behavior) + windowAgent->setWindowAttribute(QStringLiteral("no-system-buttons"), false); + + auto darkBlurAction = new QAction(tr("Dark blur"), menuBar); + darkBlurAction->setCheckable(true); + connect(darkBlurAction, &QAction::toggled, this, [this](bool checked) { + if (!windowAgent->setWindowAttribute(QStringLiteral("blur-effect"), "dark")) { + return; + } + if (checked) { + setProperty("custom-style", true); + style()->polish(this); + } + }); + + auto lightBlurAction = new QAction(tr("Light blur"), menuBar); + lightBlurAction->setCheckable(true); + connect(lightBlurAction, &QAction::toggled, this, [this](bool checked) { + if (!windowAgent->setWindowAttribute(QStringLiteral("blur-effect"), "light")) { + return; + } + if (checked) { + setProperty("custom-style", true); + style()->polish(this); + } + }); + + auto noBlurAction = new QAction(tr("No blur"), menuBar); + noBlurAction->setCheckable(true); + connect(noBlurAction, &QAction::toggled, this, [this](bool checked) { + if (!windowAgent->setWindowAttribute(QStringLiteral("blur-effect"), "none")) { + return; + } + if (checked) { + setProperty("custom-style", false); + style()->polish(this); + } + }); + + auto macStyleGroup = new QActionGroup(menuBar); + macStyleGroup->addAction(darkBlurAction); + macStyleGroup->addAction(lightBlurAction); + macStyleGroup->addAction(noBlurAction); +#endif + + // Real menu + auto settings = new QMenu(tr("Settings(&S)"), menuBar); + settings->addAction(darkAction); + +#ifdef Q_OS_WIN + settings->addSeparator(); + settings->addAction(noneAction); + settings->addAction(dwmBlurAction); + settings->addAction(acrylicAction); + settings->addAction(micaAction); + settings->addAction(micaAltAction); +#elif defined(Q_OS_MAC) + settings->addAction(darkBlurAction); + settings->addAction(lightBlurAction); + settings->addAction(noBlurAction); +#endif + + menuBar->addMenu(file); + menuBar->addMenu(edit); + menuBar->addMenu(settings); + return menuBar; + }(); + menuBar->setObjectName(QStringLiteral("win-menu-bar")); + + auto titleLabel = new QLabel(); + titleLabel->setAlignment(Qt::AlignCenter); + titleLabel->setObjectName(QStringLiteral("win-title-label")); + +#ifndef Q_OS_MAC + auto iconButton = new QWK::WindowButton(); + iconButton->setObjectName(QStringLiteral("icon-button")); + iconButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + auto pinButton = new QWK::WindowButton(); + pinButton->setCheckable(true); + pinButton->setObjectName(QStringLiteral("pin-button")); + pinButton->setProperty("system-button", true); + pinButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + auto minButton = new QWK::WindowButton(); + minButton->setObjectName(QStringLiteral("min-button")); + minButton->setProperty("system-button", true); + minButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + auto maxButton = new QWK::WindowButton(); + maxButton->setCheckable(true); + maxButton->setObjectName(QStringLiteral("max-button")); + maxButton->setProperty("system-button", true); + maxButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + auto closeButton = new QWK::WindowButton(); + closeButton->setObjectName(QStringLiteral("close-button")); + closeButton->setProperty("system-button", true); + closeButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); +#endif + + auto windowBar = new QWK::WindowBar(); +#ifndef Q_OS_MAC + windowBar->setIconButton(iconButton); + windowBar->setPinButton(pinButton); + windowBar->setMinButton(minButton); + windowBar->setMaxButton(maxButton); + windowBar->setCloseButton(closeButton); +#endif + windowBar->setMenuBar(menuBar); + windowBar->setTitleLabel(titleLabel); + windowBar->setHostWidget(this); + + windowAgent->setTitleBar(windowBar); +#ifndef Q_OS_MAC + windowAgent->setHitTestVisible(pinButton, true); + windowAgent->setSystemButton(QWK::WindowAgentBase::WindowIcon, iconButton); + windowAgent->setSystemButton(QWK::WindowAgentBase::Minimize, minButton); + windowAgent->setSystemButton(QWK::WindowAgentBase::Maximize, maxButton); + windowAgent->setSystemButton(QWK::WindowAgentBase::Close, closeButton); +#endif + windowAgent->setHitTestVisible(menuBar, true); + +#if defined(Q_OS_MAC) && 0 + windowAgent->setSystemButtonAreaCallback([](const QSize &size) { + static constexpr const int width = 75; + return QRect(QPoint(size.width() - width, 0), QSize(width, size.height())); // + }); +#endif + + setMenuWidget(windowBar); + + +#ifndef Q_OS_MAC + connect(windowBar, &QWK::WindowBar::pinRequested, this, [this, pinButton](bool pin) { + if (isHidden() || isMinimized() || isMaximized() || isFullScreen()) { + return; + } + setWindowFlag(Qt::WindowStaysOnTopHint, pin); + show(); + pinButton->setChecked(pin); + }); + connect(windowBar, &QWK::WindowBar::minimizeRequested, this, &QWidget::showMinimized); + connect(windowBar, &QWK::WindowBar::maximizeRequested, this, [this, maxButton](bool max) { + if (max) { + showMaximized(); + } else { + showNormal(); + } + + // It's a Qt issue that if a QAbstractButton::clicked triggers a window's maximization, + // the button remains to be hovered until the mouse move. As a result, we need to + // manually send leave events to the button. + emulateLeaveEvent(maxButton); + }); + connect(windowBar, &QWK::WindowBar::closeRequested, this, &QWidget::close); +#endif +} + +void MainWindow::loadStyleSheet(Theme theme) { + if (!styleSheet().isEmpty() && theme == currentTheme) + return; + currentTheme = theme; + + if (QFile qss(theme == Dark ? QStringLiteral(":/dark-style.qss") + : QStringLiteral(":/light-style.qss")); + qss.open(QIODevice::ReadOnly | QIODevice::Text)) { + setStyleSheet(QString::fromUtf8(qss.readAll())); + Q_EMIT themeChanged(); + } +} diff --git a/libs/qwindowkit/examples/mainwindow/mainwindow.h b/libs/qwindowkit/examples/mainwindow/mainwindow.h new file mode 100644 index 0000000..53514a1 --- /dev/null +++ b/libs/qwindowkit/examples/mainwindow/mainwindow.h @@ -0,0 +1,42 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace QWK { + class WidgetWindowAgent; + class StyleAgent; +} + +class MainWindow : public QMainWindow { + Q_OBJECT +public: + explicit MainWindow(QWidget *parent = nullptr); + ~MainWindow() override; + + enum Theme { + Dark, + Light, + }; + Q_ENUM(Theme) + +Q_SIGNALS: + void themeChanged(); + +protected: + bool event(QEvent *event) override; + +private: + void installWindowAgent(); + void loadStyleSheet(Theme theme); + + Theme currentTheme{}; + + QWK::WidgetWindowAgent *windowAgent; +}; + +#endif // MAINWINDOW_H diff --git a/libs/qwindowkit/examples/mainwindow/mainwindow.qrc b/libs/qwindowkit/examples/mainwindow/mainwindow.qrc new file mode 100644 index 0000000..af208ee --- /dev/null +++ b/libs/qwindowkit/examples/mainwindow/mainwindow.qrc @@ -0,0 +1,6 @@ + + + dark-style.qss + light-style.qss + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/qml/CMakeLists.txt b/libs/qwindowkit/examples/qml/CMakeLists.txt new file mode 100644 index 0000000..e99d23c --- /dev/null +++ b/libs/qwindowkit/examples/qml/CMakeLists.txt @@ -0,0 +1,10 @@ +project(QWKExample_QML) + +file(GLOB _src *.h *.cpp *.qrc) + +qwk_add_example(${PROJECT_NAME} + FEATURES cxx_std_17 + SOURCES ${_src} ../shared/resources/shared.qrc + QT_LINKS Core Gui Qml Quick + LINKS QWKQuick +) \ No newline at end of file diff --git a/libs/qwindowkit/examples/qml/FramelessWindow.qml b/libs/qwindowkit/examples/qml/FramelessWindow.qml new file mode 100644 index 0000000..592c90a --- /dev/null +++ b/libs/qwindowkit/examples/qml/FramelessWindow.qml @@ -0,0 +1,260 @@ +import QtQuick 2.15 +import QtQuick.Window 2.15 +import QtQuick.Controls 2.15 +import Qt.labs.platform 1.1 +import QWindowKit 1.0 + +Window { + property bool showWhenReady: true + property alias titleBar: titleBar + + id: window + width: 800 + height: 600 + color: darkStyle.windowBackgroundColor + title: qsTr("QWindowKit QtQuick Demo") + Component.onCompleted: { + windowAgent.setup(window) + windowAgent.setWindowAttribute("dark-mode", true) + if (window.showWhenReady) { + window.visible = true + } + } + + QtObject { + id: lightStyle + } + + QtObject { + id: darkStyle + readonly property color windowBackgroundColor: "#1E1E1E" + } + + Timer { + interval: 100 + running: true + repeat: true + onTriggered: timeLabel.text = Qt.formatTime(new Date(), "hh:mm:ss") + } + + WindowAgent { + id: windowAgent + } + + TapHandler { + acceptedButtons: Qt.RightButton + onTapped: contextMenu.open() + } + + Rectangle { + id: titleBar + anchors { + top: parent.top + left: parent.left + right: parent.right + } + height: 32 + //color: window.active ? "#3C3C3C" : "#505050" + color: "transparent" + Component.onCompleted: windowAgent.setTitleBar(titleBar) + + Image { + id: iconButton + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: 10 + } + width: 18 + height: 18 + mipmap: true + source: "qrc:///app/example.png" + fillMode: Image.PreserveAspectFit + Component.onCompleted: windowAgent.setSystemButton(WindowAgent.WindowIcon, iconButton) + } + + Text { + anchors { + verticalCenter: parent.verticalCenter + left: iconButton.right + leftMargin: 10 + } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: window.title + font.pixelSize: 14 + color: "#ECECEC" + } + + Row { + anchors { + top: parent.top + right: parent.right + } + height: parent.height + + QWKButton { + id: minButton + height: parent.height + source: "qrc:///window-bar/minimize.svg" + onClicked: window.showMinimized() + Component.onCompleted: windowAgent.setSystemButton(WindowAgent.Minimize, minButton) + } + + QWKButton { + id: maxButton + height: parent.height + source: window.visibility === Window.Maximized ? "qrc:///window-bar/restore.svg" : "qrc:///window-bar/maximize.svg" + onClicked: { + if (window.visibility === Window.Maximized) { + window.showNormal() + } else { + window.showMaximized() + } + } + Component.onCompleted: windowAgent.setSystemButton(WindowAgent.Maximize, maxButton) + } + + QWKButton { + id: closeButton + height: parent.height + source: "qrc:///window-bar/close.svg" + background: Rectangle { + color: { + if (!closeButton.enabled) { + return "gray"; + } + if (closeButton.pressed) { + return "#e81123"; + } + if (closeButton.hovered) { + return "#e81123"; + } + return "transparent"; + } + } + onClicked: window.close() + Component.onCompleted: windowAgent.setSystemButton(WindowAgent.Close, closeButton) + } + } + } + + Label { + id: timeLabel + anchors.centerIn: parent + font { + pointSize: 75 + bold: true + } + color: "#FEFEFE" + Component.onCompleted: { + if ($curveRenderingAvailable) { + console.log("Curve rendering for text is available.") + timeLabel.renderType = Text.CurveRendering + } + } + } + + Menu { + id: contextMenu + + Menu { + id: themeMenu + title: qsTr("Theme") + + MenuItemGroup { + id: themeMenuGroup + items: themeMenu.items + } + + MenuItem { + text: qsTr("Light") + checkable: true + onTriggered: windowAgent.setWindowAttribute("dark-mode", false) + } + + MenuItem { + text: qsTr("Dark") + checkable: true + checked: true + onTriggered: windowAgent.setWindowAttribute("dark-mode", true) + } + } + + Menu { + id: specialEffectMenu + title: qsTr("Special effect") + + MenuItemGroup { + id: specialEffectMenuGroup + items: specialEffectMenu.items + } + + MenuItem { + enabled: Qt.platform.os === "windows" + text: qsTr("None") + checkable: true + checked: true + onTriggered: { + window.color = darkStyle.windowBackgroundColor + windowAgent.setWindowAttribute("dwm-blur", false) + windowAgent.setWindowAttribute("acrylic-material", false) + windowAgent.setWindowAttribute("mica", false) + windowAgent.setWindowAttribute("mica-alt", false) + } + } + + MenuItem { + enabled: Qt.platform.os === "windows" + text: qsTr("DWM blur") + checkable: true + onTriggered: { + window.color = "transparent" + windowAgent.setWindowAttribute("acrylic-material", false) + windowAgent.setWindowAttribute("mica", false) + windowAgent.setWindowAttribute("mica-alt", false) + windowAgent.setWindowAttribute("dwm-blur", true) + } + } + + MenuItem { + enabled: Qt.platform.os === "windows" + text: qsTr("Acrylic material") + checkable: true + onTriggered: { + window.color = "transparent" + windowAgent.setWindowAttribute("dwm-blur", false) + windowAgent.setWindowAttribute("mica", false) + windowAgent.setWindowAttribute("mica-alt", false) + windowAgent.setWindowAttribute("acrylic-material", true) + } + } + + MenuItem { + enabled: Qt.platform.os === "windows" + text: qsTr("Mica") + checkable: true + onTriggered: { + window.color = "transparent" + windowAgent.setWindowAttribute("dwm-blur", false) + windowAgent.setWindowAttribute("acrylic-material", false) + windowAgent.setWindowAttribute("mica-alt", false) + windowAgent.setWindowAttribute("mica", true) + } + } + + MenuItem { + enabled: Qt.platform.os === "windows" + text: qsTr("Mica Alt") + checkable: true + onTriggered: { + window.color = "transparent" + windowAgent.setWindowAttribute("dwm-blur", false) + windowAgent.setWindowAttribute("acrylic-material", false) + windowAgent.setWindowAttribute("mica", false) + windowAgent.setWindowAttribute("mica-alt", true) + } + } + } + } +} diff --git a/libs/qwindowkit/examples/qml/QWKButton.qml b/libs/qwindowkit/examples/qml/QWKButton.qml new file mode 100644 index 0000000..e781d69 --- /dev/null +++ b/libs/qwindowkit/examples/qml/QWKButton.qml @@ -0,0 +1,40 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +Button { + id: root + width: height * 1.5 + leftPadding: 0 + topPadding: 0 + rightPadding: 0 + bottomPadding: 0 + leftInset: 0 + topInset: 0 + rightInset: 0 + bottomInset: 0 + property alias source: image.source + contentItem: Item { + Image { + id: image + anchors.centerIn: parent + mipmap: true + width: 12 + height: 12 + fillMode: Image.PreserveAspectFit + } + } + background: Rectangle { + color: { + if (!root.enabled) { + return "gray"; + } + if (root.pressed) { + return Qt.rgba(0, 0, 0, 0.15); + } + if (root.hovered) { + return Qt.rgba(0, 0, 0, 0.15); + } + return "transparent"; + } + } +} \ No newline at end of file diff --git a/libs/qwindowkit/examples/qml/main.cpp b/libs/qwindowkit/examples/qml/main.cpp new file mode 100644 index 0000000..c81e550 --- /dev/null +++ b/libs/qwindowkit/examples/qml/main.cpp @@ -0,0 +1,54 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#include +#include +#include +#include + +#include + +#ifdef Q_OS_WIN +// Indicates to hybrid graphics systems to prefer the discrete part by default. +extern "C" { + Q_DECL_EXPORT unsigned long NvOptimusEnablement = 0x00000001; + Q_DECL_EXPORT int AmdPowerXpressRequestHighPerformance = 1; +} +#endif + +int main(int argc, char *argv[]) { + qputenv("QT_WIN_DEBUG_CONSOLE", "attach"); // or "new": create a separate console window + qputenv("QSG_INFO", "1"); + qputenv("QSG_NO_VSYNC", "1"); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + qputenv("QT_QUICK_CONTROLS_STYLE", "Basic"); +#else + qputenv("QT_QUICK_CONTROLS_STYLE", "Default"); +#endif + +#ifdef Q_OS_WINDOWS + qputenv("QSG_RHI_BACKEND", "d3d11"); // options: d3d11, d3d12, opengl, vulkan + qputenv("QT_QPA_DISABLE_REDIRECTION_SURFACE", "1"); +#endif + //qputenv("QSG_RHI_HDR", "scrgb"); // other options: hdr10, p3 + +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QGuiApplication::setHighDpiScaleFactorRoundingPolicy( + Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); +#endif + QGuiApplication application(argc, argv); + // Make sure alpha channel is requested, our special effects on Windows depends on it. + QQuickWindow::setDefaultAlphaBuffer(true); + QQmlApplicationEngine engine; +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + const bool curveRenderingAvailable = true; +#else + const bool curveRenderingAvailable = false; +#endif + engine.rootContext()->setContextProperty(QStringLiteral("$curveRenderingAvailable"), QVariant(curveRenderingAvailable)); + QWK::registerTypes(&engine); + engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); + return application.exec(); +} \ No newline at end of file diff --git a/libs/qwindowkit/examples/qml/main.qml b/libs/qwindowkit/examples/qml/main.qml new file mode 100644 index 0000000..41871fc --- /dev/null +++ b/libs/qwindowkit/examples/qml/main.qml @@ -0,0 +1,42 @@ +import QtQuick 2.15 +import QtQuick.Window 2.15 +import QtQuick.Controls 2.15 + +FramelessWindow { + property FramelessWindow childWindow: FramelessWindow { + showWhenReady: false + } + + Drawer { + id: drawer + width: 0.66 * parent.width + height: parent.height + edge: Qt.RightEdge + onAboutToShow: titleBar.enabled = false + onAboutToHide: titleBar.enabled = true + + Label { + text: "Content goes here!" + anchors.centerIn: parent + } + } + + Row { + anchors { + horizontalCenter: parent.horizontalCenter + bottom: parent.bottom + bottomMargin: 20 + } + spacing: 10 + + Button { + text: qsTr("Open Child Window") + onClicked: childWindow.visible = true + } + + Button { + text: qsTr("Open Drawer") + onClicked: drawer.visible = true + } + } +} diff --git a/libs/qwindowkit/examples/qml/qml.qrc b/libs/qwindowkit/examples/qml/qml.qrc new file mode 100644 index 0000000..7eaf353 --- /dev/null +++ b/libs/qwindowkit/examples/qml/qml.qrc @@ -0,0 +1,7 @@ + + + main.qml + QWKButton.qml + FramelessWindow.qml + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/CMakeLists.txt b/libs/qwindowkit/examples/shared/CMakeLists.txt new file mode 100644 index 0000000..187da26 --- /dev/null +++ b/libs/qwindowkit/examples/shared/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(widgetframe) \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/resources/app/example.icns b/libs/qwindowkit/examples/shared/resources/app/example.icns new file mode 100644 index 0000000..bc4bb61 Binary files /dev/null and b/libs/qwindowkit/examples/shared/resources/app/example.icns differ diff --git a/libs/qwindowkit/examples/shared/resources/app/example.ico b/libs/qwindowkit/examples/shared/resources/app/example.ico new file mode 100644 index 0000000..316795d Binary files /dev/null and b/libs/qwindowkit/examples/shared/resources/app/example.ico differ diff --git a/libs/qwindowkit/examples/shared/resources/app/example.png b/libs/qwindowkit/examples/shared/resources/app/example.png new file mode 100644 index 0000000..61bf23c Binary files /dev/null and b/libs/qwindowkit/examples/shared/resources/app/example.png differ diff --git a/libs/qwindowkit/examples/shared/resources/shared.qrc b/libs/qwindowkit/examples/shared/resources/shared.qrc new file mode 100644 index 0000000..46efc75 --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/shared.qrc @@ -0,0 +1,13 @@ + + + window-bar/close.svg + window-bar/fullscreen.svg + window-bar/maximize.svg + window-bar/minimize.svg + window-bar/restore.svg + window-bar/more-line.svg + window-bar/pin.svg + window-bar/pin-fill.svg + app/example.png + + diff --git a/libs/qwindowkit/examples/shared/resources/window-bar/close.svg b/libs/qwindowkit/examples/shared/resources/window-bar/close.svg new file mode 100644 index 0000000..103d04e --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/window-bar/close.svg @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/resources/window-bar/fullscreen.svg b/libs/qwindowkit/examples/shared/resources/window-bar/fullscreen.svg new file mode 100644 index 0000000..fff0898 --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/window-bar/fullscreen.svg @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/resources/window-bar/maximize.svg b/libs/qwindowkit/examples/shared/resources/window-bar/maximize.svg new file mode 100644 index 0000000..a50c909 --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/window-bar/maximize.svg @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/resources/window-bar/minimize.svg b/libs/qwindowkit/examples/shared/resources/window-bar/minimize.svg new file mode 100644 index 0000000..e4e4bfd --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/window-bar/minimize.svg @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/resources/window-bar/more-line.svg b/libs/qwindowkit/examples/shared/resources/window-bar/more-line.svg new file mode 100644 index 0000000..246247f --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/window-bar/more-line.svg @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/resources/window-bar/pin-fill.svg b/libs/qwindowkit/examples/shared/resources/window-bar/pin-fill.svg new file mode 100644 index 0000000..6be8c4d --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/window-bar/pin-fill.svg @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/resources/window-bar/pin.svg b/libs/qwindowkit/examples/shared/resources/window-bar/pin.svg new file mode 100644 index 0000000..3c5d0bf --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/window-bar/pin.svg @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/resources/window-bar/restore.svg b/libs/qwindowkit/examples/shared/resources/window-bar/restore.svg new file mode 100644 index 0000000..bb6e245 --- /dev/null +++ b/libs/qwindowkit/examples/shared/resources/window-bar/restore.svg @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/widgetframe/CMakeLists.txt b/libs/qwindowkit/examples/shared/widgetframe/CMakeLists.txt new file mode 100644 index 0000000..e4e2a9b --- /dev/null +++ b/libs/qwindowkit/examples/shared/widgetframe/CMakeLists.txt @@ -0,0 +1,17 @@ +project(WidgetFrame) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +file(GLOB _src *.h *.cpp) + +add_library(${PROJECT_NAME} STATIC) + +qm_configure_target(${PROJECT_NAME} + FEATURES cxx_std_17 + SOURCES ${_src} + QT_LINKS Core Gui Widgets +) + +target_include_directories(${PROJECT_NAME} PUBLIC . ..) \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/widgetframe/windowbar.cpp b/libs/qwindowkit/examples/shared/widgetframe/windowbar.cpp new file mode 100644 index 0000000..cac35db --- /dev/null +++ b/libs/qwindowkit/examples/shared/widgetframe/windowbar.cpp @@ -0,0 +1,408 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#include "windowbar.h" +#include "windowbar_p.h" + +#include +#include +#include + +namespace QWK { + + WindowBarPrivate::WindowBarPrivate() { + w = nullptr; + autoTitle = true; + autoIcon = false; + } + + WindowBarPrivate::~WindowBarPrivate() = default; + + void WindowBarPrivate::init() { + Q_Q(WindowBar); + layout = new QHBoxLayout(); + if (QLocale::system().textDirection() == Qt::RightToLeft) { + layout->setDirection(QBoxLayout::RightToLeft); + } + + layout->setContentsMargins(QMargins()); + layout->setSpacing(0); + for (int i = IconButton; i <= CloseButton; ++i) { + insertDefaultSpace(i); + } + q->setLayout(layout); + } + + void WindowBarPrivate::setWidgetAt(int index, QWidget *widget) { + auto item = layout->takeAt(index); + auto orgWidget = item->widget(); + if (orgWidget) { + orgWidget->deleteLater(); + } + delete item; + if (!widget) { + insertDefaultSpace(index); + } else { + layout->insertWidget(index, widget); + } + } + + QWidget *WindowBarPrivate::takeWidgetAt(int index) { + auto item = layout->itemAt(index); + auto orgWidget = item->widget(); + if (orgWidget) { + item = layout->takeAt(index); + delete item; + insertDefaultSpace(index); + } + return orgWidget; + } + + WindowBar::WindowBar(QWidget *parent) : WindowBar(*new WindowBarPrivate(), parent) { + } + + WindowBar::~WindowBar() = default; + + QMenuBar *WindowBar::menuBar() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::MenuWidget)); + } + + QLabel *WindowBar::titleLabel() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::TitleLabel)); + } + + QAbstractButton *WindowBar::iconButton() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::IconButton)); + } + + QAbstractButton *WindowBar::backButton() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::BackButton)); + } + + QAbstractButton *WindowBar::homeButton() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::HomeButton)); + } + + QAbstractButton *WindowBar::favButton() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::FavButton)); + } + + QWidget *WindowBar::centerWidget() const { + Q_D(const WindowBar); + return d->widgetAt(WindowBarPrivate::CenterWidget); + } + + QAbstractButton *WindowBar::pinButton() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::PinButton)); + } + + QAbstractButton *WindowBar::minButton() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::MinimizeButton)); + } + + QAbstractButton *WindowBar::maxButton() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::MaximizeButton)); + } + + QAbstractButton *WindowBar::closeButton() const { + Q_D(const WindowBar); + return static_cast(d->widgetAt(WindowBarPrivate::CloseButton)); + } + + void WindowBar::setMenuBar(QMenuBar *menuBar) { + Q_D(WindowBar); + auto org = takeMenuBar(); + if (org) + org->deleteLater(); + if (!menuBar) + return; + d->setWidgetAt(WindowBarPrivate::MenuWidget, menuBar); + menuBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); + } + + void WindowBar::setTitleLabel(QLabel *label) { + Q_D(WindowBar); + auto org = takeTitleLabel(); + if (org) + org->deleteLater(); + if (!label) + return; + d->setWidgetAt(WindowBarPrivate::TitleLabel, label); + if (d->autoTitle && d->w) + label->setText(d->w->windowTitle()); + label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); + } + + void WindowBar::setIconButton(QAbstractButton *btn) { + Q_D(WindowBar); + auto org = takeIconButton(); + if (org) + org->deleteLater(); + if (!btn) + return; + d->setWidgetAt(WindowBarPrivate::IconButton, btn); + if (d->autoIcon && d->w) + btn->setIcon(d->w->windowIcon()); + btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + } + + void WindowBar::setBackButton(QAbstractButton *btn) { + Q_D(WindowBar); + auto org = takeBackButton(); + if (org) + org->deleteLater(); + if (!btn) + return; + d->setWidgetAt(WindowBarPrivate::BackButton, btn); + btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + } + + void WindowBar::setHomeButton(QAbstractButton *btn) { + Q_D(WindowBar); + auto org = takeHomeButton(); + if (org) + org->deleteLater(); + if (!btn) + return; + d->setWidgetAt(WindowBarPrivate::HomeButton, btn); + btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + } + + void WindowBar::setFavButton(QAbstractButton *btn) { + Q_D(WindowBar); + auto org = takeFavButton(); + if (org) + org->deleteLater(); + if (!btn) + return; + d->setWidgetAt(WindowBarPrivate::FavButton, btn); + btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + } + + void WindowBar::setCenterWidget(QWidget *widget) { + Q_D(WindowBar); + auto org = takeCenterWidget(); + if (org) + org->deleteLater(); + if (!widget) + return; + d->setWidgetAt(WindowBarPrivate::CenterWidget, widget); + widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + } + + void WindowBar::setPinButton(QAbstractButton *btn) { + Q_D(WindowBar); + auto org = takePinButton(); + if (org) + org->deleteLater(); + if (!btn) + return; + d->setWidgetAt(WindowBarPrivate::PinButton, btn); + connect(btn, &QAbstractButton::clicked, this, &WindowBar::pinRequested); + } + + void WindowBar::setMinButton(QAbstractButton *btn) { + Q_D(WindowBar); + auto org = takeMinButton(); + if (org) + org->deleteLater(); + if (!btn) + return; + d->setWidgetAt(WindowBarPrivate::MinimizeButton, btn); + connect(btn, &QAbstractButton::clicked, this, &WindowBar::minimizeRequested); + } + + void WindowBar::setMaxButton(QAbstractButton *btn) { + Q_D(WindowBar); + auto org = takeMaxButton(); + if (org) + org->deleteLater(); + if (!btn) + return; + d->setWidgetAt(WindowBarPrivate::MaximizeButton, btn); + connect(btn, &QAbstractButton::clicked, this, &WindowBar::maximizeRequested); + } + + void WindowBar::setCloseButton(QAbstractButton *btn) { + Q_D(WindowBar); + auto org = takeCloseButton(); + if (org) + org->deleteLater(); + if (!btn) + return; + d->setWidgetAt(WindowBarPrivate::CloseButton, btn); + connect(btn, &QAbstractButton::clicked, this, &WindowBar::closeRequested); + } + + QMenuBar *WindowBar::takeMenuBar() { + Q_D(WindowBar); + return static_cast(d->takeWidgetAt(WindowBarPrivate::MenuWidget)); + } + + QLabel *WindowBar::takeTitleLabel() { + Q_D(WindowBar); + return static_cast(d->takeWidgetAt(WindowBarPrivate::TitleLabel)); + } + + QAbstractButton *WindowBar::takeIconButton() { + Q_D(WindowBar); + return static_cast(d->takeWidgetAt(WindowBarPrivate::IconButton)); + } + + QAbstractButton *WindowBar::takeBackButton() { + Q_D(WindowBar); + return static_cast(d->takeWidgetAt(WindowBarPrivate::BackButton)); + } + + QAbstractButton *WindowBar::takeHomeButton() { + Q_D(WindowBar); + return static_cast(d->takeWidgetAt(WindowBarPrivate::HomeButton)); + } + + QAbstractButton *WindowBar::takeFavButton() { + Q_D(WindowBar); + return static_cast(d->takeWidgetAt(WindowBarPrivate::FavButton)); + } + + QWidget *WindowBar::takeCenterWidget() { + Q_D(WindowBar); + return d->takeWidgetAt(WindowBarPrivate::CenterWidget); + } + + QAbstractButton *WindowBar::takePinButton() { + Q_D(WindowBar); + auto btn = static_cast(d->takeWidgetAt(WindowBarPrivate::PinButton)); + if (!btn) { + return nullptr; + } + disconnect(btn, &QAbstractButton::clicked, this, &WindowBar::pinRequested); + return btn; + } + + QAbstractButton *WindowBar::takeMinButton() { + Q_D(WindowBar); + auto btn = static_cast(d->takeWidgetAt(WindowBarPrivate::MinimizeButton)); + if (!btn) { + return nullptr; + } + disconnect(btn, &QAbstractButton::clicked, this, &WindowBar::minimizeRequested); + return btn; + } + + QAbstractButton *WindowBar::takeMaxButton() { + Q_D(WindowBar); + auto btn = static_cast(d->takeWidgetAt(WindowBarPrivate::MaximizeButton)); + if (!btn) { + return nullptr; + } + disconnect(btn, &QAbstractButton::clicked, this, &WindowBar::maximizeRequested); + return btn; + } + + QAbstractButton *WindowBar::takeCloseButton() { + Q_D(WindowBar); + auto btn = static_cast(d->takeWidgetAt(WindowBarPrivate::CloseButton)); + if (!btn) { + return nullptr; + } + disconnect(btn, &QAbstractButton::clicked, this, &WindowBar::closeRequested); + return btn; + } + + QWidget *WindowBar::hostWidget() const { + Q_D(const WindowBar); + return d->w; + } + + void WindowBar::setHostWidget(QWidget *w) { + Q_D(WindowBar); + + QWidget *org = d->w; + if (org) { + org->removeEventFilter(this); + } + d_ptr->w = w; + if (w) { + w->installEventFilter(this); + } + } + + bool WindowBar::titleFollowWindow() const { + Q_D(const WindowBar); + return d->autoTitle; + } + + void WindowBar::setTitleFollowWindow(bool value) { + Q_D(WindowBar); + d->autoTitle = value; + } + + bool WindowBar::iconFollowWindow() const { + Q_D(const WindowBar); + return d->autoIcon; + } + + void WindowBar::setIconFollowWindow(bool value) { + Q_D(WindowBar); + d->autoIcon = value; + } + + bool WindowBar::eventFilter(QObject *obj, QEvent *event) { + Q_D(WindowBar); + auto w = d->w; + if (obj == w) { + QAbstractButton *iconBtn = iconButton(); + QLabel *label = titleLabel(); + QAbstractButton *maxBtn = maxButton(); + switch (event->type()) { + case QEvent::WindowIconChange: { + if (d_ptr->autoIcon && iconBtn) { + iconBtn->setIcon(w->windowIcon()); + iconChanged(w->windowIcon()); + } + break; + } + case QEvent::WindowTitleChange: { + if (d_ptr->autoTitle && label) { + label->setText(w->windowTitle()); + titleChanged(w->windowTitle()); + } + break; + } + case QEvent::WindowStateChange: { + if (maxBtn) { + maxBtn->setChecked(w->isMaximized()); + } + break; + } + default: + break; + } + } + return QWidget::eventFilter(obj, event); + } + + void WindowBar::titleChanged(const QString &text) { + Q_UNUSED(text) + } + + void WindowBar::iconChanged(const QIcon &icon){Q_UNUSED(icon)} + + WindowBar::WindowBar(WindowBarPrivate &d, QWidget *parent) + : QFrame(parent), d_ptr(&d) { + d.q_ptr = this; + + d.init(); + } + +} diff --git a/libs/qwindowkit/examples/shared/widgetframe/windowbar.h b/libs/qwindowkit/examples/shared/widgetframe/windowbar.h new file mode 100644 index 0000000..94b6471 --- /dev/null +++ b/libs/qwindowkit/examples/shared/widgetframe/windowbar.h @@ -0,0 +1,91 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#ifndef WINDOWBAR_H +#define WINDOWBAR_H + +#include +#include +#include +#include +#include + +namespace QWK { + + class WindowBarPrivate; + + class WindowBar : public QFrame { + Q_OBJECT + Q_DECLARE_PRIVATE(WindowBar) + public: + explicit WindowBar(QWidget *parent = nullptr); + ~WindowBar(); + + public: + QMenuBar *menuBar() const; + QLabel *titleLabel() const; + QAbstractButton *iconButton() const; + QAbstractButton *backButton() const; + QAbstractButton *homeButton() const; + QAbstractButton *favButton() const; + QWidget *centerWidget() const; + QAbstractButton *pinButton() const; + QAbstractButton *minButton() const; + QAbstractButton *maxButton() const; + QAbstractButton *closeButton() const; + + void setMenuBar(QMenuBar *menuBar); + void setTitleLabel(QLabel *label); + void setIconButton(QAbstractButton *btn); + void setBackButton(QAbstractButton *btn); + void setHomeButton(QAbstractButton *btn); + void setFavButton(QAbstractButton *btn); + void setCenterWidget(QWidget *widget); + void setPinButton(QAbstractButton *btn); + void setMinButton(QAbstractButton *btn); + void setMaxButton(QAbstractButton *btn); + void setCloseButton(QAbstractButton *btn); + + QMenuBar *takeMenuBar(); + QLabel *takeTitleLabel(); + QAbstractButton *takeIconButton(); + QAbstractButton *takeBackButton(); + QAbstractButton *takeHomeButton(); + QAbstractButton *takeFavButton(); + QWidget *takeCenterWidget(); + QAbstractButton *takePinButton(); + QAbstractButton *takeMinButton(); + QAbstractButton *takeMaxButton(); + QAbstractButton *takeCloseButton(); + + QWidget *hostWidget() const; + void setHostWidget(QWidget *w); + + bool titleFollowWindow() const; + void setTitleFollowWindow(bool value); + + bool iconFollowWindow() const; + void setIconFollowWindow(bool value); + + Q_SIGNALS: + void pinRequested(bool pin = false); + void minimizeRequested(); + void maximizeRequested(bool max = false); + void closeRequested(); + + protected: + bool eventFilter(QObject *obj, QEvent *event) override; + + virtual void titleChanged(const QString &text); + virtual void iconChanged(const QIcon &icon); + + protected: + WindowBar(WindowBarPrivate &d, QWidget *parent = nullptr); + + QScopedPointer d_ptr; + }; + +} + +#endif // WINDOWBAR_H diff --git a/libs/qwindowkit/examples/shared/widgetframe/windowbar_p.h b/libs/qwindowkit/examples/shared/widgetframe/windowbar_p.h new file mode 100644 index 0000000..bb78a93 --- /dev/null +++ b/libs/qwindowkit/examples/shared/widgetframe/windowbar_p.h @@ -0,0 +1,62 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#ifndef WINDOWBARPRIVATE_H +#define WINDOWBARPRIVATE_H + +#include + +#include "windowbar.h" + +namespace QWK { + + class WindowBarPrivate { + Q_DECLARE_PUBLIC(WindowBar) + public: + WindowBarPrivate(); + virtual ~WindowBarPrivate(); + + void init(); + + WindowBar *q_ptr; + + QWidget *w; + bool autoTitle; + bool autoIcon; + + enum WindowBarItem { + IconButton, + MenuWidget, + TitleLabel, + BackButton, + HomeButton, + FavButton, + CenterWidget, + PinButton, + MinimizeButton, + MaximizeButton, + CloseButton, + }; + + QHBoxLayout *layout; + + inline QWidget *widgetAt(int index) const { + return layout->itemAt(index)->widget(); + } + + void setWidgetAt(int index, QWidget *widget); + + QWidget *takeWidgetAt(int index); + + inline void insertDefaultSpace(int index) { + layout->insertSpacerItem(index, new QSpacerItem(0, 0)); + } + + private: + Q_DISABLE_COPY(WindowBarPrivate) + }; + +} + +#endif // WINDOWBARPRIVATE_H diff --git a/libs/qwindowkit/examples/shared/widgetframe/windowbutton.cpp b/libs/qwindowkit/examples/shared/widgetframe/windowbutton.cpp new file mode 100644 index 0000000..f0b2c70 --- /dev/null +++ b/libs/qwindowkit/examples/shared/widgetframe/windowbutton.cpp @@ -0,0 +1,94 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#include "windowbutton.h" +#include "windowbutton_p.h" + +#include +#include + +namespace QWK { + + WindowButtonPrivate::WindowButtonPrivate() = default; + + WindowButtonPrivate::~WindowButtonPrivate() = default; + + void WindowButtonPrivate::init() { + } + + void WindowButtonPrivate::reloadIcon() { + Q_Q(WindowButton); + + if (!q->isEnabled() && !iconDisabled.isNull()) { + q->setIcon(iconDisabled); + return; + } + + if (q->isChecked() && !iconChecked.isNull()) { + q->setIcon(iconChecked); + return; + } + + if (!iconNormal.isNull()) { + q->setIcon(iconNormal); + } + } + + WindowButton::WindowButton(QWidget *parent) : WindowButton(*new WindowButtonPrivate(), parent) { + } + + WindowButton::~WindowButton() = default; + + QIcon WindowButton::iconNormal() const { + Q_D(const WindowButton); + return d->iconNormal; + } + + void WindowButton::setIconNormal(const QIcon &icon) { + Q_D(WindowButton); + d->iconNormal = icon; + d->reloadIcon(); + } + + QIcon WindowButton::iconChecked() const { + Q_D(const WindowButton); + return d->iconChecked; + } + + void WindowButton::setIconChecked(const QIcon &icon) { + Q_D(WindowButton); + d->iconChecked = icon; + d->reloadIcon(); + } + + QIcon WindowButton::iconDisabled() const { + Q_D(const WindowButton); + return d->iconDisabled; + } + + void WindowButton::setIconDisabled(const QIcon &icon) { + Q_D(WindowButton); + d->iconDisabled = icon; + d->reloadIcon(); + } + + void WindowButton::checkStateSet() { + Q_D(WindowButton); + d->reloadIcon(); + } + + void WindowButton::mouseDoubleClickEvent(QMouseEvent *event) { + if (event->button() == Qt::LeftButton) { + Q_EMIT doubleClicked(); + } + } + + WindowButton::WindowButton(WindowButtonPrivate &d, QWidget *parent) + : QPushButton(parent), d_ptr(&d) { + d.q_ptr = this; + + d.init(); + } + +} diff --git a/libs/qwindowkit/examples/shared/widgetframe/windowbutton.h b/libs/qwindowkit/examples/shared/widgetframe/windowbutton.h new file mode 100644 index 0000000..402b50f --- /dev/null +++ b/libs/qwindowkit/examples/shared/widgetframe/windowbutton.h @@ -0,0 +1,50 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#ifndef WINDOWBUTTON_H +#define WINDOWBUTTON_H + +#include + +namespace QWK { + + class WindowButtonPrivate; + + class WindowButton : public QPushButton { + Q_OBJECT + Q_DECLARE_PRIVATE(WindowButton) + Q_PROPERTY(QIcon iconNormal READ iconNormal WRITE setIconNormal FINAL) + Q_PROPERTY(QIcon iconChecked READ iconChecked WRITE setIconChecked FINAL) + Q_PROPERTY(QIcon iconDisabled READ iconDisabled WRITE setIconDisabled FINAL) + public: + explicit WindowButton(QWidget *parent = nullptr); + ~WindowButton(); + + public: + QIcon iconNormal() const; + void setIconNormal(const QIcon &icon); + + QIcon iconChecked() const; + void setIconChecked(const QIcon &icon); + + QIcon iconDisabled() const; + void setIconDisabled(const QIcon &icon); + + Q_SIGNALS: + void doubleClicked(); + + protected: + void checkStateSet() override; + + void mouseDoubleClickEvent(QMouseEvent *event) override; + + protected: + WindowButton(WindowButtonPrivate &d, QWidget *parent = nullptr); + + QScopedPointer d_ptr; + }; + +} + +#endif // WINDOWBUTTON_H \ No newline at end of file diff --git a/libs/qwindowkit/examples/shared/widgetframe/windowbutton_p.h b/libs/qwindowkit/examples/shared/widgetframe/windowbutton_p.h new file mode 100644 index 0000000..34aaaaf --- /dev/null +++ b/libs/qwindowkit/examples/shared/widgetframe/windowbutton_p.h @@ -0,0 +1,31 @@ +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) +// SPDX-License-Identifier: Apache-2.0 + +#ifndef WINDOWBUTTONPRIVATE_H +#define WINDOWBUTTONPRIVATE_H + +#include "windowbutton.h" + +namespace QWK { + + class WindowButtonPrivate { + Q_DECLARE_PUBLIC(WindowButton) + public: + WindowButtonPrivate(); + virtual ~WindowButtonPrivate(); + + void init(); + + WindowButton *q_ptr; + + QIcon iconNormal; + QIcon iconChecked; + QIcon iconDisabled; + + void reloadIcon(); + }; + +} + +#endif // WINDOWBUTTONPRIVATE_H \ No newline at end of file diff --git a/libs/qwindowkit/qmsetup/.clang-format b/libs/qwindowkit/qmsetup/.clang-format new file mode 100644 index 0000000..e2f1720 --- /dev/null +++ b/libs/qwindowkit/qmsetup/.clang-format @@ -0,0 +1,130 @@ +# References: +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# https://code.qt.io/cgit/qt/qt5.git/tree/_clang-format + +BasedOnStyle: LLVM + +Standard: c++17 + +# 指针和引用的对齐方式。 +# 可能的值有: +# PAS_Left (在配置中: Left) 指针左对齐。 +# PAS_Right (在配置中: Right) 指针右对齐。 +# PAS_Middle (在配置中: Middle) 指针中间对齐。 +PointerAlignment: Right + +# public/protected/private 等访问修饰符偏移量 +AccessModifierOffset: -4 + +# 缩进长度 +IndentWidth: 4 + +# 连续空行的最大数 +MaxEmptyLinesToKeep: 999 + +# 在OC中的@property后面添加一个空格。例如:使用“@property (readonly)”而不是“@property(readonly)” +ObjCSpaceAfterProperty: true + +# OC块中所拍的字符数 +ObjCBlockIndentWidth: 4 + +# 取决于值, 语句“int f() { return 0; }”可以被放到一个单行。 +# 可能的值有: +# SFS_None (在配置中: None) 从不合并方法或函数到单独的一行。 +# SFS_Empty (在配置中: Empty) 仅合并空的函数。 +# SFS_Inline (在配置中: Inline) 仅合并类中定义的方法或函数. 意味着 “empty”. +# SFS_All (在配置中: All) 合并所有的方法适应单行. +AllowShortFunctionsOnASingleLine: None + +# 如果为真(true), 语句“if (a) return;” 能被放到单行。 +AllowShortIfStatementsOnASingleLine: false + +# 如果为真(true), 对齐注释。 +AlignTrailingComments: true + +# 如果为真,对齐连续的宏定义 +AlignConsecutiveMacros: true + +# 如果为真(true),将会在“[”之后和“]”之前插入空格。 +SpacesInSquareBrackets: false + +# 如果为真(true), 将会在“(”之后和“)”之前插入空格。 +SpacesInParentheses : false + +# 如果为真(true), 校准连续的声明。 +# 这将会校准连续多行的声明的名字。这将会导致像下面这样的格式: +# int aaaa = 12; +# float b = 23; +# std::string ccc = 23; +AlignConsecutiveDeclarations: false + +# 如果为真(true),连续调整多行 +# 这将会调整连续行中的分配操作符。这将会导致像下面这样的格式: +# int aaaa = 12; +# int b = 23; +# int ccc = 23; +AlignConsecutiveAssignments: false + +# 如果为假(false),移除分配操作符(=)前空格。 +SpaceBeforeAssignmentOperators: true + +# 如果为真(true), 将会在字面量容器中插入空格(例如 OC和Javascript的数组和字典字面量)。 +SpacesInContainerLiterals: false + +# 缩进case标签 +IndentCaseLabels: true + +# 如果表达式中包含函数调用,并且函数调用因为表达式太长被放到了下一行,是否缩进 +IndentWrappedFunctionNames: true + +# 如果为真(true), 保持块的起始空行。 +# true: false: +# if (foo) { vs. if (foo) { +# bar(); +# bar(); } +# } +KeepEmptyLinesAtTheStartOfBlocks: true + +# 允许所有参数都被放在下一行 +AllowAllParametersOfDeclarationOnNextLine: false + +# 使用C风格强制类型转换后,是否在中间添加一个空格 +SpaceAfterCStyleCast: true + +# 在模板定义后换行 +AlwaysBreakTemplateDeclarations: Yes + +# Tab长度 +TabWidth: 4 + +# 是否使用Tab +UseTab: Never + +# 在括号后对齐参数 +# someLongFunction(argument1, +# argument2); +AlignAfterOpenBracket: Align + +# 名字空间内部缩进 +NamespaceIndentation: All + +# 一行最长列数 +ColumnLimit: 100 + +# 按层次缩进宏定义 +IndentPPDirectives: AfterHash + +# 预处理语句缩进为 2 +PPIndentWidth: 2 + +# 数组元素对齐 +AlignArrayOfStructures: Left + +# 不对头文件排序 +SortIncludes: Never + +FixNamespaceComments: false + +StatementMacros: ['__qas_attr__', '__qas_exclude__', '__qas_include__'] + +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ] \ No newline at end of file diff --git a/libs/qwindowkit/qmsetup/.gitignore b/libs/qwindowkit/qmsetup/.gitignore new file mode 100644 index 0000000..04490f0 --- /dev/null +++ b/libs/qwindowkit/qmsetup/.gitignore @@ -0,0 +1,98 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.log +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +# *.res +# *.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +__pycache__ +*.pyc + +# Binaries +# -------- +*.dll +*.exe + +.DS_Store +*/.DS_Store + +build-src* +build/ +cmake-build* +*.user +*.lnk +_workingDir* +.vscode +.idea +.cache +cache +.vs +out/ +CMakeSettings.json +# /vcpkg +/data +/*.natvis + +*.sublime-* +setup-vcpkg.json +setup-vcpkg-temp* \ No newline at end of file diff --git a/libs/qwindowkit/qmsetup/.gitmodules b/libs/qwindowkit/qmsetup/.gitmodules new file mode 100644 index 0000000..e44cf93 --- /dev/null +++ b/libs/qwindowkit/qmsetup/.gitmodules @@ -0,0 +1,4 @@ +[submodule "syscmdline"] + path = src/syscmdline + url = ../../SineStriker/syscmdline.git + branch = main \ No newline at end of file diff --git a/libs/qwindowkit/qmsetup/CMakeLists.txt b/libs/qwindowkit/qmsetup/CMakeLists.txt new file mode 100644 index 0000000..f10b40c --- /dev/null +++ b/libs/qwindowkit/qmsetup/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.19) + +project(qmsetup VERSION 1.0.0.0) + +# ---------------------------------- +# Configure Options +# ---------------------------------- +option(QMSETUP_VCPKG_TOOLS_HINT "Install executables to tools directory" OFF) +option(QMSETUP_STATIC_RUNTIME "Static link runtime libraries on Windows" ON) + +# ---------------------------------- +# CMake Settings +# ---------------------------------- +if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +endif() + +if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +endif() + +if(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +endif() + +if(MSVC) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /manifest:no") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /manifest:no") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /manifest:no") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") + + if(NOT DEFINED CMAKE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX "d") + endif() +endif() + +# ---------------------------------- +# Project Variables +# ---------------------------------- +set(QMSETUP_VERSION ${PROJECT_VERSION}) +set(QMSETUP_INSTALL_NAME ${PROJECT_NAME}) +set(QMSETUP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +include(cmake/QMSetupAPI.cmake) + +add_subdirectory(src) \ No newline at end of file diff --git a/libs/qwindowkit/qmsetup/LICENSE b/libs/qwindowkit/qmsetup/LICENSE new file mode 100644 index 0000000..e4412f6 --- /dev/null +++ b/libs/qwindowkit/qmsetup/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Stdware Collections + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/libs/qwindowkit/qmsetup/README.md b/libs/qwindowkit/qmsetup/README.md new file mode 100644 index 0000000..120c7d2 --- /dev/null +++ b/libs/qwindowkit/qmsetup/README.md @@ -0,0 +1,252 @@ +# QMSetup + +**QMSetup** is a set of CMake Modules and Basic Libraries for C/C++ projects. + +**This project is independent from Qt and other 3rdparty libraries.** Due to the fact that it encompasses some tools that need to be compiled, it's strongly not suggested to be included as a subproject. + +## Features + +### Helpful Functions ++ Path, Version functions ++ Target configuration functions ++ Qt related functions + +### Generators ++ Generate Windows RC files, manifest files ++ Generate MacOS Bundle info files ++ Generate configuration header files ++ Generate Git information header files + +### Filesystem Utilities ++ Reorganize header files ++ Copy files and directories after build + +### Install Utilities ++ Deploy project dependencies and fix rpaths + +### Extended Build Rules ++ Create translations with **Qt Linguist** tools ++ Create source files with **Protobuf** compiler ++ Create documentations with **Doxygen** + +## Support Platforms + ++ Microsoft Windows ++ Apple Macintosh ++ GNU/Linux + +## Dependencies + +### Required Packages + +#### Windows + +Windows deploy command acquires the shared library paths by reading the PE files and searching the specified paths so that it doesn't depend on `dumpbin` tool. + +#### Unix + +Unix deploy command acquires the shared library paths by running `ldd`/`otool` command and fixes the *rpath*s by runing the `patchelf`/`install_name_tool` command, make sure you have installed them. + +```sh +sudo apt install patchelf +``` + +### Build System + ++ C++ 17 ++ CMake 3.19 + +### Open-Source Libraries ++ https://github.com/SineStriker/syscmdline ++ https://github.com/jothepro/doxygen-awesome-css + +## Integrate + +### Clone + +Via Https +```sh +git clone --recursive https://github.com/stdware/qmsetup.git +``` +Via SSH +```sh +git clone --recursive git@github.com:stdware/qmsetup.git +``` + +### Preinstall (Suggested) + +#### Build & Install +```sh +cmake -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/path/to +cmake --build build --target all +cmake --build build --target install +``` + +#### Import +```sh +cmake -Dqmsetup_DIR=/path/to/lib/cmake/qmsetup ... +``` +```cmake +find_package(qmsetup REQUIRED) +``` + +### Sub-project + +It still needs to be installed, but the installation occurs during the CMake Configure phase and is executed only once. + +```cmake +find_package(qmsetup QUIET) + +if (NOT TARGET qmsetup::library) + # Modify this variable according to your project structure + set(_source_dir ${CMAKE_CURRENT_SOURCE_DIR}/qmsetup) + + # Import install function + include("${_source_dir}/cmake/modules/private/InstallPackage.cmake") + + # Install package in place + set(_package_path) + qm_install_package(qmsetup + SOURCE_DIR ${_source_dir} + BUILD_TYPE Release + RESULT_PATH _package_path + ) + + # Find package again + find_package(qmsetup REQUIRED PATHS ${_package_path}) + + # Update import path + set(qmsetup_DIR ${_package_path} CACHE PATH "" FORCE) +endif() +``` + +## Quick Start + +### Examples + +You can use the functions in this library to greatly simplify several kinds of common build rules. + +#### Generate Configuration Header +```cmake +qm_import(Preprocess) + +qm_add_definition(FOO false) +qm_add_definition(BAR 114514) +qm_add_definition(BAZ "ABC" STRING_LITERAL) + +qm_generate_config(${CMAKE_BINARY_DIR}/conf.h) +``` + +#### Reorganize Include Directory +```cmake +qm_import(Preprocess) + +qm_sync_include(src/core ${CMAKE_BINARY_DIR}/include/MyCore + INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/MyCore +) +``` + +#### Sync Resource Files After Build +```cmake +qm_import(Filesystem) + +qm_add_copy_command(${PROJECT_NAME} + SOURCES + file.txt + dir_to_copy + dir_contents_to_copy/ + DESTINATION . +) +``` + +#### Deploy Project And All Dependencies +```cmake +qm_import(Deploy) + +qm_deploy_directory("${CMAKE_INSTALL_PREFIX}" + COMMENT "Deploy project spectacularly" + PLUGINS "iconengines/qsvgicon" "bearer/qgenericbearer" + QML Qt QtQml + PLUGIN_DIR share/plugins + QML_DIR share/qml +) +``` + +#### Add Qt Translations +```cmake +qm_import(Translate) + +qm_find_qt(LinguistTools) +qm_add_translation(${PROJECT_NAME}_translations + LOCALES ja_JP zh_CN zh_TW + PREFIX ${PROJECT_NAME} + TARGETS ${PROJECT_NAME} + TS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/translations + QM_DIR ${CMAKE_CURRENT_BINARY_DIR}/translations +) +``` + +#### Generate Protubuf Source Files +```cmake +qm_import(Protobuf) + +find_package(Protobuf REQUIRED) +qm_create_protobuf(_proto_src + INPUT a.proto b.proto + INCLUDE_DIRECTORIES src/proto + OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/proto +) +target_sources(${PROJECT_NAME} PUBLIC ${_proto_src}) +``` + +#### Generate Doxygen HTML Documentations +```cmake +qm_import(Doxygen) + +find_package(Doxygen REQUIRED) +qm_setup_doxygen(${PROJECT_NAME}_RunDoxygen + NAME ${PROJECT_NAME} + DESCRIPTION "my project" + MDFILE "${CMAKE_SOURCE_DIR}/README.md" + OUTPUT_DIR "${CMAK_BINARY_DIR}/doc" + INPUT src + TARGETS ${PROJECT_NAME} + DEPENDS ${PROJECT_NAME} + NO_EXPAND_MACROS + Q_OBJECT + Q_GADGET + Q_DECLARE_TR_FUNCTIONS + COMPILE_DEFINITIONS + Q_SIGNALS=Q_SIGNALS + Q_SLOTS=Q_SLOTS + GENERATE_TAGFILE "${PROJECT_NAME}_tagfile.xml" + INSTALL_DIR "doc" +) +``` + +### Find Modules + +Use `qm_find_package` to find supported third-party packages. + ++ YY-Thunks: https://github.com/Chuyu-Team/YY-Thunks ++ VC-LTL5: https://github.com/Chuyu-Team/VC-LTL5 + +### Detailed Documentations + ++ [Core Command](docs/core-command.md) + +The CMake Modules documentations is provided in the comments. + +See `examples` to get detailed use cases. + +## Contributors + ++ [SineStriker](https://github.com/SineStriker) ++ [wangwenx190](https://github.com/wangwenx190) ++ [RigoLigoRLC](https://github.com/RigoLigoRLC) ++ [CrSjimo](https://github.com/CrSjimo) + +## License + +QMSetup is licensed under the MIT License. \ No newline at end of file diff --git a/libs/qwindowkit/qmsetup/cmake/QMSetupAPI.cmake b/libs/qwindowkit/qmsetup/cmake/QMSetupAPI.cmake new file mode 100644 index 0000000..81186be --- /dev/null +++ b/libs/qwindowkit/qmsetup/cmake/QMSetupAPI.cmake @@ -0,0 +1,1176 @@ +cmake_minimum_required(VERSION 3.19) + +#[[ + NOTICE + -------- + Since Qt official CMake modules sets private header directory variables when you call `find_package(Qt)` + only if the Qt targets hasn't been defined, if we place `find_package(Qt)` in a function, the variable + will be cleared while the target remains after the function returns, as a result, we can never get the + private header directory variables again. + + Therefore, never wrap `find_package(Qt)` in a function, use macro instead, any macros that wraps it also + shouldn't be wrapped in any function. +]] # +set(QMSETUP_MODULES_DIR ${CMAKE_CURRENT_LIST_DIR}) + +if(WIN32) + set(QMSETUP_SHARED_LIBRARY_CATEGORY bin) + set(QMSETUP_NULL_FILE "NUL") + set(QMSETUP_REGEX_ABSOLUTE_PATH "^[a-zA-Z]:|\\\\") +else() + set(QMSETUP_SHARED_LIBRARY_CATEGORY lib) + set(QMSETUP_NULL_FILE "/dev/null") + set(QMSETUP_REGEX_ABSOLUTE_PATH "^/") +endif() + +set(QMSETUP_IGNORE_STDOUT > ${QMSETUP_NULL_FILE}) +set(QMSETUP_IGNORE_STDERR 2> ${QMSETUP_NULL_FILE}) +set(QMSETUP_IGNORE_STDOUT_STDERR > ${QMSETUP_NULL_FILE} 2>&1) + +if(TARGET qmsetup::corecmd) + get_target_property(QMSETUP_CORECMD_EXECUTABLE qmsetup::corecmd LOCATION) +else() + set(QMSETUP_CORECMD_EXECUTABLE) +endif() + +if(NOT DEFINED QMSETUP_FIND_QT_ORDER) + set(QMSETUP_FIND_QT_ORDER Qt6 Qt5) +endif() + +include_guard(DIRECTORY) + +#[[ + Include modules of this library. + + qm_import() +]] # +macro(qm_import) + foreach(_module ${ARGN}) + if(NOT _module MATCHES "(.+)\\.cmake") + set(_module "${_module}.cmake") + endif() + + set(_module_path "${QMSETUP_MODULES_DIR}/modules/${_module}") + + if(NOT EXISTS "${_module_path}") + message(FATAL_ERROR "qm_import: module \"${_module}\" not found.") + endif() + + include("${_module_path}") + endforeach() +endmacro() + +#[[ + Include all modules of this library. + + qm_import_all() +]] # +macro(qm_import_all) + file(GLOB _tmp_modules "${QMSETUP_MODULES_DIR}/modules/*.cmake") + + foreach(_module IN LISTS _tmp_modules) + include("${_module}") + endforeach() + + unset(_tmp_modules) +endmacro() + +#[[ + Find third-party packages by including scripts in `find-modules`. + + qm_find_package() +]] # +macro(qm_find_package) + foreach(_module ${ARGN}) + if(NOT _module MATCHES "(.+)\\.cmake") + set(_module "${_module}.cmake") + endif() + + set(_module_path "${QMSETUP_MODULES_DIR}/find-modules/${_module}") + + # Prepend "Find" to the file name + if(NOT EXISTS "${_module_path}") + set(_module_path "${QMSETUP_MODULES_DIR}/find-modules/Find${_module}") + endif() + + if(NOT EXISTS "${_module_path}") + message(FATAL_ERROR "qm_find_package: find script \"${_module}\" not found.") + endif() + + include("${_module_path}") + endforeach() +endmacro() + +#[[ + Parse version and create seq vars with specified prefix. + + qm_parse_version( ) +]] # +function(qm_parse_version _prefix _version) + string(REPLACE "." ";" _version_list ${_version}) + list(LENGTH _version_list _version_count) + list(PREPEND _version_list 0) # Add placeholder + + foreach(_i RANGE 1 4) + if(_i LESS_EQUAL _version_count) + list(GET _version_list ${_i} _item) + else() + set(_item 0) + endif() + + set(${_prefix}_${_i} ${_item} PARENT_SCOPE) + endforeach() +endfunction() + +#[[ + Get shorter version number. + + qm_crop_version( ) +]] # +function(qm_crop_version _var _version _count) + qm_parse_version(FUNC ${_version}) + + set(_list) + + foreach(_i RANGE 1 ${_count}) + list(APPEND _list ${FUNC_${_i}}) + endforeach() + + string(JOIN "." _short_version ${_list}) + set(${_var} ${_short_version} PARENT_SCOPE) +endfunction() + +#[[ + Tell if the given paths are same in canonical form. + + qm_paths_equal( ) +]] # +function(qm_paths_equal _out _path1 _path2) + # cmake_path(NORMAL_PATH) is introduced in CMake 3.20, we don't use it + # We call `get_filename_component` twice to normalize the paths + get_filename_component(_path1 ${_path1} ABSOLUTE) + get_filename_component(_path1 ${_path1} REALPATH) + + get_filename_component(_path2 ${_path2} ABSOLUTE) + get_filename_component(_path2 ${_path2} REALPATH) + + if(_path1 STREQUAL _path2) + set(${_out} on PARENT_SCOPE) + else() + set(${_out} off PARENT_SCOPE) + endif() +endfunction() + +#[[ + Set value if valid, otherwise use default. + + qm_set_value( ) +]] # +function(qm_set_value _key) + set(_args "${ARGN}") + list(POP_BACK _args _default) + + foreach(_item IN LISTS _args) + if(${_item}) + set(${_key} ${${_item}} PARENT_SCOPE) + return() + endif() + endforeach() + + set(${_key} ${_default} PARENT_SCOPE) +endfunction() + +#[[ + Skip CMAKE_AUTOMOC for sources files or ones in directories. + + qm_skip_automoc() +]] # +function(qm_skip_automoc) + foreach(_item ${ARGN}) + get_filename_component(_item ${_item} ABSOLUTE) + + if(IS_DIRECTORY ${_item}) + file(GLOB _src + ${_item}/*.h ${_item}/*.hpp + ${_item}/*.hh ${_item}/*.hxx + ${_item}/*.cpp ${_item}/*.cxx + ${_item}/*.c ${_item}/*.cc + ${_item}/*.m ${_item}/*.mm + ) + set_source_files_properties( + ${_src} PROPERTIES SKIP_AUTOMOC ON + ) + elseif(EXISTS ${_item}) + set_source_files_properties( + ${_item} PROPERTIES SKIP_AUTOMOC ON + ) + endif() + endforeach() +endfunction() + +#[[ + Find Qt libraries. Don't wrap it in any functions. + + qm_find_qt( [QUIET | REQUIRED | EXACT]) +#]] +macro(qm_find_qt) + set(options QUIET REQUIRED EXACT) + set(oneValueArgs) + set(multiValueArgs) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set(_qm_find_qt_options) + + if(FUNC_QUIET) + list(APPEND _qm_find_qt_options QUIET) + elseif(FUNC_REQUIRED) + list(APPEND _qm_find_qt_options REQUIRED) + elseif(FUNC_EXACT) + list(APPEND _qm_find_qt_options EXACT) + endif() + + if(NOT _qm_find_qt_options) + set(_qm_find_qt_options REQUIRED) + endif() + + foreach(_module ${FUNC_UNPARSED_ARGUMENTS}) + if(NOT QT_VERSION_MAJOR) + find_package(QT NAMES ${QMSETUP_FIND_QT_ORDER} COMPONENTS ${_module} ${_qm_find_qt_options}) + endif() + + if(NOT TARGET Qt${QT_VERSION_MAJOR}::${_module}) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${_module} ${_qm_find_qt_options}) + endif() + endforeach() + + unset(_qm_find_qt_options) +endmacro() + +#[[ + Link Qt libraries. Don't wrap it in any functions. + + qm_link_qt( ) +#]] +macro(qm_link_qt _target _scope) + foreach(_module ${ARGN}) + qm_find_qt(${_module}) + target_link_libraries(${_target} ${_scope} Qt${QT_VERSION_MAJOR}::${_module}) + endforeach() +endmacro() + +#[[ + Include Qt private header directories. Don't wrap it in any functions. + + qm_include_qt_private( ) +#]] +macro(qm_include_qt_private _target _scope) + foreach(_module ${ARGN}) + qm_find_qt(${_module}Private QUIET) + + if(TARGET Qt${QT_VERSION_MAJOR}::${_module}Private) + target_link_libraries(${_target} ${_scope} Qt${QT_VERSION_MAJOR}::${_module}Private) + else() + qm_find_qt(${_module}) + set(_var_name Qt${QT_VERSION_MAJOR}${_module}_PRIVATE_INCLUDE_DIRS) + + if(${_var_name}) + target_include_directories(${_target} ${_scope} ${_var_name}) + else() + # On Linux, QtGuiPrivate depends on XKB which may not be installed, directly include the + # private headers as a workaround. + if(NOT QT_INSTALL_HEADERS) + if(NOT QT_QMAKE_EXECUTABLE) + if(TARGET Qt${QT_VERSION_MAJOR}::qmake) + qm_get_executable_location(Qt${QT_VERSION_MAJOR}::qmake _qmake_path) + set(QT_QMAKE_EXECUTABLE "${_qmake_path}" CACHE FILEPATH "Path to qmake executable" FORCE) + else() + message(WARNING "qm_include_qt_private: qmake not defined, can't include private headers.") + endif() + endif() + + execute_process( + COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_HEADERS + OUTPUT_VARIABLE _install_headers + OUTPUT_STRIP_TRAILING_WHITESPACE + COMMAND_ERROR_IS_FATAL ANY + ) + + set(QT_INSTALL_HEADERS ${_install_headers} CACHE PATH "Path to Qt headers" FORCE) + endif() + + target_include_directories(${_target} ${_scope} ${QT_INSTALL_HEADERS}/Qt${_module}/${QT_VERSION}) + target_include_directories(${_target} ${_scope} ${QT_INSTALL_HEADERS}/Qt${_module}/${QT_VERSION}/Qt${_module}) + target_include_directories(${_target} ${_scope} ${QT_INSTALL_HEADERS}/Qt${_module}/${QT_VERSION}/Qt${_module}/private) + endif() + endif() + endforeach() +endmacro() + +#[[ + Helper to set or append all kinds of attributes to a target. Don't wrap it in any functions. + + qm_configure_target( + [SOURCES ] + + [LINKS ] + [LINKS_INTERFACE ] + [LINKS_PRIVATE ] + + [INCLUDE ] + [INCLUDE_INTERFACE ] + [INCLUDE_PRIVATE ] + + [LINKDIR ] + [LINKDIR_INTERFACE ] + [LINKDIR_PRIVATE ] + + [DEFINES ] + [DEFINES_INTERFACE ] + [DEFINES_PRIVATE ] + + [FEATURES ] + [FEATURES_INTERFACE ] + [FEATURES_PRIVATE ] + + [CCFLAGS ] + [CCFLAGS_INTERFACE ] + [CCFLAGS_PUBLIC ] + + [LDFLAGS ] + [LDFLAGS_INTERFACE ] + [LDFLAGS_PUBLIC ] + + [QT_LINKS ] + [QT_LINKS_INTERFACE ] + [QT_LINKS_PRIVATE ] + + [QT_INCLUDE_PRIVATE ] + + [SKIP_AUTOMOC ] + ) + + INCLUDE/LINKDIR: `dir/*` will be expanded to all subdirectories + `dir/**` will be expanded to all descendent directories recursively +]] # +macro(qm_configure_target _target) + set(options) + set(oneValueArgs) + set(multiValueArgs + SOURCES + LINKS LINKS_INTERFACE LINKS_PRIVATE + INCLUDE INCLUDE_INTERFACE INCLUDE_PRIVATE + LINKDIR LINKDIR_INTERFACE LINKDIR_PRIVATE + DEFINES DEFINES_INTERFACE DEFINES_PRIVATE + FEATURES FEATURES_INTERFACE FEATURES_PRIVATE + CCFLAGS CCFLAGS_INTERFACE CCFLAGS_PUBLIC + LDFLAGS LDFLAGS_INTERFACE LDFLAGS_PUBLIC + QT_LINKS QT_LINKS_PRIVATE QT_LINKS_INTERFACE + QT_INCLUDE_PRIVATE + SKIP_AUTOMOC + ) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + target_sources(${_target} PRIVATE ${FUNC_SOURCES}) + + target_link_libraries(${_target} PUBLIC ${FUNC_LINKS}) + target_link_libraries(${_target} PRIVATE ${FUNC_LINKS_PRIVATE}) + + if(FUNC_INCLUDE) + _qm_resolve_dir_helper("${FUNC_INCLUDE}" _temp_dirs) + target_include_directories(${_target} PUBLIC ${_temp_dirs}) + unset(_temp_dirs) + endif() + + if(FUNC_INCLUDE_INTERFACE) + _qm_resolve_dir_helper("${FUNC_INCLUDE_INTERFACE}" _temp_dirs) + target_include_directories(${_target} INTERFACE ${_temp_dirs}) + unset(_temp_dirs) + endif() + + if(FUNC_INCLUDE_PRIVATE) + _qm_resolve_dir_helper("${FUNC_INCLUDE_PRIVATE}" _temp_dirs) + target_include_directories(${_target} PRIVATE ${_temp_dirs}) + unset(_temp_dirs) + endif() + + if(FUNC_LINKDIR) + _qm_resolve_dir_helper("${FUNC_LINKDIR}" _temp_dirs) + target_link_directories(${_target} PUBLIC ${_temp_dirs}) + unset(_temp_dirs) + endif() + + if(FUNC_LINKDIR_INTERFACE) + _qm_resolve_dir_helper("${FUNC_LINKDIR}" _temp_dirs) + target_link_directories(${_target} INTERFACE ${_temp_dirs}) + unset(_temp_dirs) + endif() + + if(FUNC_LINKDIR_PRIVATE) + _qm_resolve_dir_helper("${FUNC_LINKDIR_PRIVATE}" _temp_dirs) + target_link_directories(${_target} PRIVATE ${_temp_dirs}) + unset(_temp_dirs) + endif() + + target_compile_definitions(${_target} PUBLIC ${FUNC_DEFINES}) + target_compile_definitions(${_target} INTERFACE ${FUNC_DEFINES_INTERFACE}) + target_compile_definitions(${_target} PRIVATE ${FUNC_DEFINES_PRIVATE}) + + target_compile_features(${_target} PUBLIC ${FUNC_FEATURES}) + target_compile_features(${_target} INTERFACE ${FUNC_FEATURES_INTERFACE}) + target_compile_features(${_target} PRIVATE ${FUNC_FEATURES_PRIVATE}) + + # CMake won't add language standard flag if the compiler default mode supports the standard, + # however, if the -std argument is not explicitly specified, the clang language server will + # not work properly. + # https://discourse.cmake.org/t/cmake-does-not-set-the-compiler-option-std-to-gnu17-or-c-17-although-i-set-the-target-compile-features-to-cxx-std-17/3299/8 + foreach(_item IN LISTS FUNC_FEATURES FUNC_FEATURES_PRIVATE) + if(_item MATCHES "cxx_std_(.+)") + set_property(TARGET APPEND PROPERTY CXX_STANDARD ${CMAKE_MATCH_1}) + elseif(_item MATCHES "c_std_(.+)") + set_property(TARGET APPEND PROPERTY C_STANDARD ${CMAKE_MATCH_1}) + endif() + endforeach() + + target_compile_options(${_target} PUBLIC ${FUNC_CCFLAGS_PUBLIC}) + target_compile_options(${_target} INTERFACE ${FUNC_CCFLAGS_INTERFACE}) + target_compile_options(${_target} PRIVATE ${FUNC_CCFLAGS}) + + target_link_options(${_target} PUBLIC ${FUNC_LDFLAGS_PUBLIC}) + target_link_options(${_target} INTERFACE ${FUNC_LDFLAGS_INTERFACE}) + target_link_options(${_target} PRIVATE ${FUNC_LDFLAGS}) + + qm_link_qt(${_target} PUBLIC ${FUNC_QT_LINKS}) + qm_link_qt(${_target} INTERFACE ${FUNC_QT_LINKS_INTERFACE}) + qm_link_qt(${_target} PRIVATE ${FUNC_QT_LINKS_PRIVATE}) + + qm_include_qt_private(${_target} PRIVATE ${FUNC_QT_INCLUDE_PRIVATE}) + + if(FUNC_SKIP_AUTOMOC) + _qm_resolve_file_helper("${FUNC_SKIP_AUTOMOC}" _temp_files) + qm_skip_automoc(${_temp_files}) + unset(_temp_files) + endif() +endmacro() + +#[[ + Helper to define export macros. + + qm_export_defines( + [PREFIX ] + [STATIC ] + [LIBRARY ] + ) +]] # +function(qm_export_defines _target) + set(options) + set(oneValueArgs PREFIX STATIC LIBRARY) + set(multiValueArgs) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT FUNC_PREFIX) + string(TOUPPER ${_target} _prefix) + else() + set(_prefix ${FUNC_PREFIX}) + endif() + + string(MAKE_C_IDENTIFIER ${_prefix} _prefix) + + qm_set_value(_static_macro FUNC_STATIC ${_prefix}_STATIC) + qm_set_value(_library_macro FUNC_LIBRARY ${_prefix}_LIBRARY) + + get_target_property(_type ${_target} TYPE) + + if(_type STREQUAL "INTERFACE_LIBRARY") + return() + endif() + + if(_type STREQUAL "STATIC_LIBRARY") + target_compile_definitions(${_target} PUBLIC ${_static_macro}) + endif() + + target_compile_definitions(${_target} PRIVATE ${_library_macro}) +endfunction() + +#[[ + Attach windows RC file to a target. + + qm_add_win_rc( + [NAME name] + [VERSION version] + [DESCRIPTION desc] + [COPYRIGHT copyright] + [ICON ico] + [OUTPUT_DIR dir] + ) +]] # +function(qm_add_win_rc _target) + if(NOT WIN32) + return() + endif() + + _qm_check_target_type_helper(${_target} _ "EXECUTABLE" "SHARED_LIBRARY") + + set(options) + set(oneValueArgs NAME VERSION DESCRIPTION COPYRIGHT ICON OUTPUT_DIR) + set(multiValueArgs) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + qm_set_value(_name FUNC_NAME ${_target}) + qm_set_value(_version FUNC_VERSION PROJECT_VERSION "0.0.0.0") + qm_set_value(_desc FUNC_DESCRIPTION PROJECT_DESCRIPTION ${_name}) + qm_set_value(_copyright FUNC_COPYRIGHT ${_name}) + + qm_parse_version(_ver ${_version}) + set(RC_VERSION ${_ver_1},${_ver_2},${_ver_3},${_ver_4}) + + set(RC_APPLICATION_NAME ${_name}) + set(RC_VERSION_STRING ${_version}) + set(RC_DESCRIPTION ${_desc}) + set(RC_COPYRIGHT ${_copyright}) + + if(NOT FUNC_ICON) + set(RC_ICON_COMMENT "//") + set(RC_ICON_PATH) + else() + get_filename_component(RC_ICON_PATH ${FUNC_ICON} ABSOLUTE) + endif() + + qm_set_value(_out_dir OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + set(_out_path "${_out_dir}/${_target}_res.rc") + configure_file("${QMSETUP_MODULES_DIR}/windows/WinResource.rc.in" ${_out_path} @ONLY) + target_sources(${_target} PRIVATE ${_out_path}) + + if(FUNC_ICON) + if(${FUNC_ICON} IS_NEWER_THAN ${_out_path}) + file(TOUCH_NOCREATE ${_out_path}) + endif() + endif() +endfunction() + +#[[ + Attach windows RC file to a target, enhanced edition. + + qm_add_win_rc_enhanced( + [NAME name] + [VERSION version] + [DESCRIPTION description] + [COPYRIGHT copyright] + [COMMENTS comments] + [COMPANY company] + [INTERNAL_NAME internal name] + [TRADEMARK trademark] + [ORIGINAL_FILENAME original filename] + [ICONS icon file paths] + [OUTPUT_DIR dir] + ) +]] # +function(qm_add_win_rc_enhanced _target) + if(NOT WIN32) + return() + endif() + + _qm_check_target_type_helper(${_target} _type "EXECUTABLE" "SHARED_LIBRARY") + + set(options) + set(oneValueArgs + NAME VERSION DESCRIPTION COPYRIGHT COMMENTS COMPANY + INTERNAL_NAME TRADEMARK ORIGINAL_FILENAME OUTPUT_DIR + ) + set(multiValueArgs ICONS) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + qm_set_value(_name FUNC_NAME ${_target}) + qm_set_value(_version FUNC_VERSION PROJECT_VERSION "0.0.0.0") + qm_set_value(_desc FUNC_DESCRIPTION PROJECT_DESCRIPTION ${_name}) + qm_set_value(_copyright FUNC_COPYRIGHT ${_name}) + qm_set_value(_comments FUNC_COMMENTS "") + qm_set_value(_company FUNC_COMPANY "") + qm_set_value(_internal_name FUNC_INTERNAL_NAME "") + qm_set_value(_trademark FUNC_TRADEMARK "") + qm_set_value(_original_filename FUNC_ORIGINAL_FILENAME "") + + qm_parse_version(_ver ${_version}) + set(RC_VERSION ${_ver_1},${_ver_2},${_ver_3},${_ver_4}) + + set(RC_APPLICATION_NAME ${_name}) + set(RC_VERSION_STRING ${_version}) + set(RC_DESCRIPTION ${_desc}) + set(RC_COPYRIGHT ${_copyright}) + set(RC_COMMENTS ${_comments}) + set(RC_COMPANY ${_company}) + set(RC_INTERNAL_NAME ${_internal_name}) + set(RC_TRADEMARK ${_trademark}) + set(RC_ORIGINAL_FILENAME ${_original_filename}) + + set(_file_type) + + if(_type STREQUAL "EXECUTABLE") + set(_file_type "VFT_APP") + else() + set(_file_type "VFT_DLL") + endif() + + set(RC_FILE_TYPE ${_file_type}) + + set(_icons) + + if(FUNC_ICONS) + set(_index 1) + + foreach(_icon IN LISTS FUNC_ICONS) + get_filename_component(_icon_path ${_icon} ABSOLUTE) + string(APPEND _icons "IDI_ICON${_index} ICON \"${_icon_path}\"\n") + math(EXPR _index "${_index} +1") + endforeach() + endif() + + set(RC_ICONS ${_icons}) + + qm_set_value(_out_dir OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + set(_out_path "${_out_dir}/${_target}_res.rc") + configure_file("${QMSETUP_MODULES_DIR}/windows/WinResource2.rc.in" ${_out_path} @ONLY) + target_sources(${_target} PRIVATE ${_out_path}) + + foreach(_icon IN LISTS FUNC_ICONS) + if(${_icon} IS_NEWER_THAN ${_out_path}) + file(TOUCH_NOCREATE ${_out_path}) + break() + endif() + endforeach() +endfunction() + +#[[ + Attach windows manifest file to a target. + + qm_add_win_manifest( + [NAME name] + [VERSION version] + [DESCRIPTION desc] + [OUTPUT_DIR dir] + [UTF8] + [ADMIN] + ) +]] # +function(qm_add_win_manifest _target) + if(NOT WIN32) + return() + endif() + + _qm_check_target_type_helper(${_target} _ "EXECUTABLE") + + set(options UTF8 ADMIN) + set(oneValueArgs NAME VERSION DESCRIPTION OUTPUT_DIR) + set(multiValueArgs) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + qm_set_value(_name FUNC_NAME ${_target}) + qm_set_value(_version FUNC_VERSION PROJECT_VERSION "0.0.0.0") + qm_set_value(_desc FUNC_DESCRIPTION PROJECT_DESCRIPTION ${_name}) + + qm_crop_version(_version ${_version} 4) + + set(MANIFEST_IDENTIFIER ${_name}) + set(MANIFEST_VERSION ${_version}) + set(MANIFEST_DESCRIPTION ${_desc}) + + set(MANIFEST_UTF8) + + if(FUNC_UTF8) + set(MANIFEST_UTF8 "UTF-8") + endif() + + if(FUNC_ADMIN) + set(MANIFEST_PRIVILEGES "") + else() + set(MANIFEST_PRIVILEGES "") + endif() + + qm_set_value(_out_dir OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + set(_out_path "${_out_dir}/${_target}_manifest.exe.manifest") + configure_file("${QMSETUP_MODULES_DIR}/windows/WinManifest.manifest.in" ${_out_path} @ONLY) + + if(MSVC) + if(CMAKE_GENERATOR MATCHES "Visual Studio") + # Visual Studio + target_link_options(${_target} PRIVATE "/manifest" "/manifestinput:${_out_path}") + + # The manifest file contains a UAC field, we should prevent Ninja from embedding the + # automatically generated UAC field + target_link_options(${_target} PRIVATE "/manifest" "/manifestuac:no") + else() # Ninja + # https://cmake.org/cmake/help/latest/release/3.4.html#other + # CMake learned to honor *.manifest source files with MSVC tools. Manifest files named as sources + # of .exe and .dll targets will be merged with linker-generated manifests and embedded in the binary. + + # NOTE: CMake will automatically generate a default manifest file and embed it into the binary file + # when we are using MSVC toolchain, so it will conflict with the one we embed in the RC file. So in + # this case, we just follow the CMake documentation, add the manifest file into the sources and let + # CMake handle it. What's more, CMake can automatically merge all manifest files so we can actually + # add multiple manifest files, eg. each manifest file contains a separate section. + target_sources(${_target} PRIVATE ${_out_path}) + target_link_options(${_target} PRIVATE "/manifestuac:no") + endif() + else() + # For non-MSVC toolchains we can only embed the manifest file into the RC file, sadly we have + # to merge all manifest files into one by ourself if we have multiple of them, but luckily + # CMake won't embed a default one so we don't need to worry about resource conflicts. + set(_manifest_rc ${_out_path}.rc) + file(WRITE ${_manifest_rc} "#include \n\n1 RT_MANIFEST \"${_out_path}\"") + target_sources(${_target} PRIVATE ${_manifest_rc}) + endif() +endfunction() + +#[[ + Add Mac bundle info. + + qm_add_mac_bundle( + [NAME ] + [VERSION ] + [DESCRIPTION ] + [COPYRIGHT ] + [ICON ] + [INFO_PLIST ] + ) +]] # +function(qm_add_mac_bundle _target) + if(NOT APPLE) + return() + endif() + + _qm_check_target_type_helper(${_target} _ "EXECUTABLE") + + set(options) + set(oneValueArgs NAME VERSION DESCRIPTION COPYRIGHT ICON INFO_PLIST) + set(multiValueArgs) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + qm_set_value(_app_name FUNC_NAME ${_target}) + qm_set_value(_app_version FUNC_VERSION PROJECT_VERSION "0.0.0.0") + qm_set_value(_app_desc FUNC_DESCRIPTION PROJECT_DESCRIPTION ${_app_name}) + qm_set_value(_app_copyright FUNC_COPYRIGHT ${_app_name}) + + qm_parse_version(_app_version ${_app_version}) + + # configure mac plist + set_target_properties(${_target} PROPERTIES + MACOSX_BUNDLE TRUE + OUTPUT_NAME ${_app_name} + MACOSX_BUNDLE_BUNDLE_NAME ${_app_name} + MACOSX_BUNDLE_EXECUTABLE_NAME ${_app_name} + MACOSX_BUNDLE_INFO_STRING ${_app_desc} + MACOSX_BUNDLE_GUI_IDENTIFIER ${_app_name} + MACOSX_BUNDLE_BUNDLE_VERSION ${_app_version} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${_app_version_1}.${_app_version_2} + MACOSX_BUNDLE_COPYRIGHT ${_app_copyright} + ) + + if(FUNC_INFO_PLIST) + set_target_properties(${_target} PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${FUNC_INFO_PLIST} + ) + endif() + + if(FUNC_ICON) + # And this part tells CMake where to find and install the file itself + set_source_files_properties(${FUNC_ICON} PROPERTIES + MACOSX_PACKAGE_LOCATION "Resources" + ) + + # NOTE: Don't include the path in MACOSX_BUNDLE_ICON_FILE -- this is + # the property added to Info.plist + get_filename_component(_icns_name ${FUNC_ICON} NAME) + + # configure mac plist + set_target_properties(${_target} PROPERTIES + MACOSX_BUNDLE_ICON_FILE ${_icns_name} + ) + + # ICNS icon MUST be added to executable's sources list, for some reason + # Only apple can do + target_sources(${_target} PRIVATE ${FUNC_ICON}) + endif() +endfunction() + +#[[ + Generate Windows shortcut after building target. + + qm_create_win_shortcut( + [OUTPUT_NAME ) + + set(_vbs_name ${CMAKE_CURRENT_BINARY_DIR}/${_target}_shortcut_$.vbs) + set(_vbs_temp ${_vbs_name}.in) + + set(_lnk_path "${_dir}/${_output_name}.lnk") + + set(SHORTCUT_PATH ${_lnk_path}) + set(SHORTCUT_TARGET_PATH $) + set(SHORTCUT_WORKING_DIRECOTRY $) + set(SHORTCUT_DESCRIPTION $) + set(SHORTCUT_ICON_LOCATION $) + + configure_file( + "${QMSETUP_MODULES_DIR}/windows/WinCreateShortcut.vbs.in" + ${_vbs_temp} + @ONLY + ) + file(GENERATE OUTPUT ${_vbs_name} INPUT ${_vbs_temp}) + + add_custom_command( + TARGET ${_target} POST_BUILD + COMMAND cscript ${_vbs_name} ${QMSETUP_IGNORE_STDOUT} + BYPRODUCTS ${_lnk_path} + VERBATIM + ) +endfunction() + +#[[ + Collect targets of given types recursively in a directory. + + qm_collect_targets( [DIRECTORY directory] + [EXECUTABLE] [SHARED] [STATIC] [INTERFACE] [UTILITY]) + + If one or more types are specified, return targets matching the types. + If no type is specified, return all targets. +]] # +function(qm_collect_targets _var) + set(options EXECUTABLE SHARED STATIC INTERFACE UTILITY) + set(oneValueArgs DIR) + set(multiValueArgs) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(FUNC_DIRECTORY) + set(_dir ${FUNC_DIRECTORY}) + else() + set(_dir ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + set(_tmp_targets) + + macro(_get_targets_recursive _targets _dir) + get_property(_subdirs DIRECTORY ${_dir} PROPERTY SUBDIRECTORIES) + + foreach(_subdir IN LISTS _subdirs) + _get_targets_recursive(${_targets} ${_subdir}) + endforeach() + + get_property(_current_targets DIRECTORY ${_dir} PROPERTY BUILDSYSTEM_TARGETS) + list(APPEND ${_targets} ${_current_targets}) + endmacro() + + # Get targets + _get_targets_recursive(_tmp_targets ${_dir}) + set(_targets) + + if(NOT FUNC_EXECUTABLE AND NOT FUNC_SHARED AND NOT FUNC_STATIC AND NOT FUNC_INTERFACE AND NOT FUNC_UTILITY) + set(_targets ${_tmp_targets}) + else() + # Filter targets + foreach(_item IN LISTS _tmp_targets) + get_target_property(_type ${_item} TYPE) + + if(_type STREQUAL "EXECUTABLE") + if(FUNC_EXECUTABLE) + list(APPEND _targets ${_item}) + endif() + elseif(_type STREQUAL "SHARED_LIBRARY") + if(FUNC_SHARED) + list(APPEND _targets ${_item}) + endif() + elseif(_type STREQUAL "STATIC_LIBRARY") + if(FUNC_STATIC) + list(APPEND _targets ${_item}) + endif() + elseif(_type STREQUAL "INTERFACE_LIBRARY") + if(FUNC_INTERFACE) + list(APPEND _targets ${_item}) + endif() + elseif(_type STREQUAL "UTILITY") + if(FUNC_UTILITY) + list(APPEND _targets ${_item}) + endif() + endif() + endforeach() + endif() + + set(${_var} ${_targets} PARENT_SCOPE) +endfunction() + +#[[ + Get subdirectories' names or paths. + + qm_get_subdirs( + [DIRECTORY dir] + [EXCLUDE names...] + [REGEX_INCLUDE exps...] + [REGEX_EXLCUDE exps...] + [RELATIVE path] + [ABSOLUTE] + ) + + If `DIRECTORY` is not specified, consider `CMAKE_CURRENT_SOURCE_DIR`. + If `RELATIVE` is specified, return paths evaluated as a relative path to it. + If `ABSOLUTE` is specified, return absolute paths. + If neither of them is specified, return names. +]] # +function(qm_get_subdirs _var) + set(options ABSOLUTE) + set(oneValueArgs DIRECTORY RELATIVE) + set(multiValueArgs EXCLUDE REGEX_EXLCUDE) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(FUNC_DIRECTORY) + get_filename_component(_dir ${FUNC_DIRECTORY} ABSOLUTE) + else() + set(_dir ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + file(GLOB _entries LIST_DIRECTORIES true RELATIVE ${_dir} "${_dir}/*") + + if(FUNC_EXCLUDE) + foreach(_exclude_dir IN LISTS FUNC_EXCLUDE) + list(REMOVE_ITEM _entries ${_exclude_dir}) + endforeach() + endif() + + if(FUNC_REGEX_INCLUDE) + foreach(_exp IN LISTS FUNC_REGEX_INCLUDE) + list(FILTER _entries INCLUDE REGEX ${_exp}) + endforeach() + endif() + + if(FUNC_REGEX_EXCLUDE) + foreach(_exp IN LISTS FUNC_REGEX_EXCLUDE) + list(FILTER _entries EXCLUDE REGEX ${_exp}) + endforeach() + endif() + + set(_res) + + if(FUNC_RELATIVE) + get_filename_component(_relative ${FUNC_RELATIVE} ABSOLUTE) + else() + set(_relative) + endif() + + foreach(_sub IN LISTS _entries) + if(IS_DIRECTORY ${_dir}/${_sub}) + if(FUNC_ABSOLUTE) + list(APPEND _res ${_dir}/${_sub}) + elseif(_relative) + file(RELATIVE_PATH _rel_path ${_relative} ${_dir}/${_sub}) + list(APPEND _res ${_rel_path}) + else() + list(APPEND _res ${_sub}) + endif() + endif() + endforeach() + + set(${_var} ${_res} PARENT_SCOPE) +endfunction() + +#[[ + Basic template to install a CMake project. + + qm_basic_install( + [NAME ] + [VERSION ] + [COMPATIBILITY ] + [INSTALL_DIR ] + [CONFIG_TEMPLATE ] + [NAMESPACE ] + [EXPORT ] + + [WRITE_VERSION_OPTIONS ] + [WRITE_CONFIG_OPTIONS ] + ) + + Include `GNUInstallDirs`, `CMakePackageConfigHelpers` before calling this function. +]] # +function(qm_basic_install) + set(options) + set(oneValueArgs NAME VERSION COMPATIBILITY INSTALL_DIR CONFIG_TEMPLATE NAMESPACE) + set(multiValueArgs WRITE_VERSION_OPTIONS WRITE_CONFIG_OPTIONS EXPORT) + cmake_parse_arguments(FUNC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + qm_set_value(_lib_dir CMAKE_INSTALL_LIBDIR lib) + + qm_set_value(_name FUNC_NAME PROJECT_NAME "unknown") + qm_set_value(_version FUNC_VERSION PROJECT_VERSION "0.0.0.0") + qm_set_value(_compatibility FUNC_COMPATIBILITY AnyNewerVersion) + qm_set_value(_install_dir FUNC_INSTALL_DIR "${_lib_dir}/cmake/${_name}") + qm_set_value(_config_template FUNC_CONFIG_TEMPLATE "${CMAKE_CURRENT_LIST_DIR}/${_name}Config.cmake.in") + + set(_namespace) + + if(FUNC_NAMESPACE) + set(_namespace NAMESPACE ${FUNC_NAMESPACE}) + endif() + + set(_export_files) + + # Install cmake targets files + foreach(_item IN LISTS FUNC_EXPORT) + install(EXPORT ${_item} + FILE "${_item}.cmake" + DESTINATION ${_install_dir} + ${_namespace} + ) + list(APPEND _export_files "${_item}.cmake") + endforeach() + + # Prepare config template file + get_filename_component(_config_template ${_config_template} ABSOLUTE) + + if(NOT EXISTS ${_config_template}) + set(_config_content "@PACKAGE_INIT@\n\n") + + foreach(_item IN LISTS _export_files) + string(APPEND _config_content "include(\"\${CMAKE_CURRENT_LIST_DIR}/${_item}\")\n") + endforeach() + + set(_config_template "${CMAKE_CURRENT_BINARY_DIR}/${_name}Config.cmake.in") + file(WRITE ${_config_template} ${_config_content}) + endif() + + # Add version file + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/${_name}ConfigVersion.cmake" + VERSION ${_version} + COMPATIBILITY ${_compatibility} + ${FUNC_WRITE_VERSION_OPTIONS} + ) + + # Add configuration file + configure_package_config_file( + ${_config_template} + "${CMAKE_CURRENT_BINARY_DIR}/${_name}Config.cmake" + INSTALL_DESTINATION ${_install_dir} + ${FUNC_WRITE_CONFIG_OPTIONS} + ) + + # Install cmake files + install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/${_name}Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${_name}ConfigVersion.cmake" + DESTINATION ${_install_dir} + ) +endfunction() + +#[[ + Recursively include directories in a target. + + qm_include_recursive( [ ...]) +#]] +function(qm_include_recursive _target _scope) + foreach(_dir ${ARGN}) + if(IS_DIRECTORY ${_dir}) + target_include_directories(${_target} ${_scope} ${_dir}) + file(GLOB_RECURSE _subdirs LIST_DIRECTORIES TRUE RELATIVE ${_dir} ${_dir}/*) + + foreach(_subdir IN LISTS _subdirs) + if(IS_DIRECTORY ${_dir}/${_subdir}) + target_include_directories(${_target} ${_scope} ${_dir}/${_subdir}) + endif() + endforeach() + endif() + endforeach() +endfunction() + +#[[ + Get the location of an executable target. + + qm_get_executable_location( ) +#]] +function(qm_get_executable_location _target _var) + set(_path) + + foreach(_type IMPORTED_LOCATION IMPORTED_LOCATION_RELEASE IMPORTED_LOCATION_RELWITHDEBINFO IMPORTED_LOCATION_MINSIZEREL IMPORTED_LOCATION_DEBUG) + get_target_property(_path ${_target} ${_type}) + + if(_path) + break() + endif() + endforeach() + + if(NOT _path) + message(FATAL_ERROR "Could not find imported location of target: ${_target}") + endif() + + set(${_var} ${_path} PARENT_SCOPE) +endfunction() + +# ---------------------------------- +# Private functions +# ---------------------------------- +macro(_qm_check_target_type_helper _target _type) + set(_tmp_target_type_list ${ARGN}) + get_target_property(_tmp_target_type ${_target} TYPE) + + if(NOT "${_tmp_target_type}" IN_LIST _tmp_target_type_list) + return() + endif() + + set(${_type} ${_tmp_target_type}) + unset(_tmp_target_type) + unset(_tmp_target_type_list) +endmacro() + +function(_qm_resolve_file_helper _dirs _out) + set(_res) + + foreach(_item ${_dirs}) + if(_item STREQUAL "*") + set(_cur_dir ".") + file(GLOB _files LIST_DIRECTORIES true "*") + elseif(_item STREQUAL "**") + set(_cur_dir ".") + file(GLOB_RECURSE _files LIST_DIRECTORIES true "*") + elseif(_item MATCHES "(.+)[/\\]\\*$") + set(_cur_dir ${CMAKE_MATCH_1}) + file(GLOB _files LIST_DIRECTORIES true "${_cur_dir}/*") + elseif(_item MATCHES "(.+)[/\\]\\*\\*$") + set(_cur_dir ${CMAKE_MATCH_1}) + file(GLOB_RECURSE _files LIST_DIRECTORIES true "${_cur_dir}/*") + else() + get_filename_component(_item ${_item} ABSOLUTE) + list(APPEND _res ${_item}) + continue() + endif() + + get_filename_component(_cur_dir ${_cur_dir} ABSOLUTE) + list(APPEND _res ${_cur_dir}) + + foreach(_item IN LISTS _files) + get_filename_component(_item ${_item} ABSOLUTE) + list(APPEND _res ${_item}) + endforeach() + endforeach() + + set(${_out} ${_res} PARENT_SCOPE) +endfunction() + +function(_qm_resolve_dir_helper _dirs _out) + set(_files) + _qm_resolve_file_helper("${_dirs}" _files) + + foreach(_item IN LISTS _files) + if(IS_DIRECTORY ${_item}) + list(APPEND _res ${_item}) + endif() + endforeach() + + set(${_out} ${_res} PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/libs/qwindowkit/qmsetup/cmake/doxygen/Doxyfile b/libs/qwindowkit/qmsetup/cmake/doxygen/Doxyfile new file mode 100644 index 0000000..d812cfa --- /dev/null +++ b/libs/qwindowkit/qmsetup/cmake/doxygen/Doxyfile @@ -0,0 +1,2867 @@ +# Doxyfile 1.9.8 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +@INCLUDE = "$(DOXY_INCLUDE_FILE)" + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "$(DOXY_PROJECT_NAME)" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = "$(DOXY_PROJECT_VERSION)" + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "$(DOXY_PROJECT_BRIEF)" + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = "$(DOXY_PROJECT_LOGO)" + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = "$(DOXY_OUTPUT_DIR)" + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:^^" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to +# generate identifiers for the Markdown headings. Note: Every identifier is +# unique. +# Possible values are: DOXYGEN use a fixed 'autotoc_md' string followed by a +# sequence number starting at 0 and GITHUB use the lower case version of title +# with any whitespace replaced by '-' and punctuation characters removed. +# The default value is: DOXYGEN. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +MARKDOWN_ID_STYLE = DOXYGEN + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +# If the TIMESTAMP tag is set different from NO then each generated page will +# contain the date or date and time when the page was generated. Setting this to +# NO can help when comparing the output of multiple runs. +# Possible values are: YES, NO, DATETIME and DATE. +# The default value is: NO. + +TIMESTAMP = NO + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = YES + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. + +CASE_SENSE_NAMES = SYSTEM + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = YES + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves +# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not +# write the warning messages in between other messages but write them at the end +# of a run, in case a WARN_LOGFILE is defined the warning messages will be +# besides being in the defined file also be shown at the end of a run, unless +# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case +# the behavior will remain as with the setting FAIL_ON_WARNINGS. +# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +# INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cxxm, +# *.cpp, *.cppm, *.c++, *.c++m, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, +# *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.ixx, *.l, *.cs, *.d, *.php, +# *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be +# provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cxxm \ + *.cpp \ + *.cppm \ + *.c++ \ + *.c++m \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.ixx \ + *.l \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f18 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# ANamespace::AClass, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = "$(DOXY_MAINPAGE_MD_FILE)" + +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS +# tag is set to YES then doxygen will add the directory of each input to the +# include path. +# The default value is: YES. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = "$(DOXY_FILE_DIR)/header.html" + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = \ + "$(DOXY_FILE_DIR)/doxygen-awesome.css" \ + "$(DOXY_FILE_DIR)/doxygen-awesome-sidebar-only-darkmode-toggle.css" \ + "$(DOXY_FILE_DIR)/extra-stylesheet.css" + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = "$(DOXY_FILE_DIR)/doxygen-awesome-darkmode-toggle.js" + +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = LIGHT + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use gray-scales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# If the HTML_CODE_FOLDING tag is set to YES then classes and functions can be +# dynamically folded and expanded in the generated HTML source code. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_CODE_FOLDING = YES + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# The SITEMAP_URL tag is used to specify the full URL of the place where the +# generated documentation will be placed on the server by the user during the +# deployment of the documentation. The generated sitemap is called sitemap.xml +# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL +# is specified no sitemap is generated. For information about the sitemap +# protocol see https://www.sitemaps.org +# This tag requires that the tag GENERATE_HTML is set to YES. + +SITEMAP_URL = + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = YES + +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /