From 5b3d3a0710ed15ae2a7fbf0132a0515a6f9b40c1 Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Fri, 19 Jun 2026 16:39:15 +0300 Subject: [PATCH 01/13] feat: add CMakePresets.json for mac/linux/windows Adds simple per-OS presets with compile_commands export for a better dev experience: - mac/linux: Ninja Multi-Config (Debug;Release;RelWithDebInfo) - windows: Visual Studio 18 2026 - CMAKE_EXPORT_COMPILE_COMMANDS enabled on all presets - CMAKE_POLICY_VERSION_MINIMUM=3.5 so bundled/fetched modules configure under CMake 4.x Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 1 + CMakePresets.json | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 CMakePresets.json diff --git a/.gitignore b/.gitignore index c0ae6ca75..65af074aa 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ object_script.glogg.Debug object_script.glogg.Release +/build/ build_root/ build_root_clang/ build_root_gcc/ diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..c5936a001 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,106 @@ +{ + "$schema": "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json", + "version": 11, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "mac", + "displayName": "macOS (Ninja Multi-Config)", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/build/mac", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + }, + "cacheVariables": { + "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", + "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_POLICY_VERSION_MINIMUM": "3.5" + } + }, + { + "name": "linux", + "displayName": "Linux (Ninja Multi-Config)", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/build/linux", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + }, + "cacheVariables": { + "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", + "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_POLICY_VERSION_MINIMUM": "3.5" + } + }, + { + "name": "windows", + "displayName": "Windows (Visual Studio 2026)", + "generator": "Visual Studio 18 2026", + "binaryDir": "${sourceDir}/build/windows", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + }, + "cacheVariables": { + "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", + "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_POLICY_VERSION_MINIMUM": "3.5" + } + } + ], + "buildPresets": [ + { + "name": "mac-debug", + "configurePreset": "mac", + "configuration": "Debug" + }, + { + "name": "mac-release", + "configurePreset": "mac", + "configuration": "Release" + }, + { + "name": "mac-relwithdebinfo", + "configurePreset": "mac", + "configuration": "RelWithDebInfo" + }, + { + "name": "linux-debug", + "configurePreset": "linux", + "configuration": "Debug" + }, + { + "name": "linux-release", + "configurePreset": "linux", + "configuration": "Release" + }, + { + "name": "linux-relwithdebinfo", + "configurePreset": "linux", + "configuration": "RelWithDebInfo" + }, + { + "name": "windows-debug", + "configurePreset": "windows", + "configuration": "Debug" + }, + { + "name": "windows-release", + "configurePreset": "windows", + "configuration": "Release" + }, + { + "name": "windows-relwithdebinfo", + "configurePreset": "windows", + "configuration": "RelWithDebInfo" + } + ] +} From 623551e2704fccae3b5a458bb4d4db5b9aecc360 Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Fri, 19 Jun 2026 17:15:43 +0300 Subject: [PATCH 02/13] feat: migrate dependencies from CPM to vcpkg manifest Add a vcpkg.json manifest and resolve dependencies through the vcpkg toolchain (wired into the CMake presets via VCPKG_ROOT). 3rdparty/CMakeLists.txt now uses find_package() for the migrated ports and keeps thin wrapper targets so src/ is unchanged. Migrated to vcpkg: simdutf, type-safe, roaring, uchardet, robin-hood-hashing, xxhash, whereami, exprtk, efsw, tbb, mimalloc, vectorscan (non-Windows) / hyperscan (Windows), plus catch2 + backward-cpp (tests feature) and sentry-native (sentry feature). Kept on CPM (no usable vcpkg port): - streamvbyte, kdtoolbox: no port. - maddy: used as a doc-generation executable, not the header-only lib. - KDSingleApplication, KArchive: link Qt; vcpkg would pull a second/Qt5 Qt conflicting with the app's system Qt. KArchive also gets a small idempotent source fix for QString::arg(QIODevice::OpenMode) under Qt 6.9+. Version pins: efsw 1.4.1 (handleFileAction signature) and catch2 2.13.9 (v2 API). Imported targets promoted to global scope so sibling dirs can link them. Relax a few brand-new Clang -Werror diagnostics (Clang only) so klogg's existing sources build under very recent toolchains. Co-Authored-By: Claude Opus 4.8 (1M context) --- 3rdparty/CMakeLists.txt | 486 ++++++++++++----------------------- CMakePresets.json | 12 + cmake/CompilerWarnings.cmake | 23 ++ vcpkg.json | 57 ++++ 4 files changed, 263 insertions(+), 315 deletions(-) create mode 100644 vcpkg.json diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 23f33f2d8..14e17d9c4 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -2,12 +2,154 @@ set(QAPPLICATION_CLASS QApplication) include(CPM) -set(_TMP_CPM_USE_LOCAL_PACKAGES ${CPM_USE_LOCAL_PACKAGES}) +# Imported targets from find_package() are directory-scoped by default; the rest +# of the tree (src/, tests/) links them from sibling directories, so promote +# them to global scope. +set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL ON) + +# --------------------------------------------------------------------------- +# Dependencies provided by vcpkg (see ../vcpkg.json) +# +# Each find_package() below resolves to a vcpkg-installed config package. Thin +# INTERFACE "wrapper" targets re-expose them under the exact names the rest of +# the source tree already links against, so no changes are needed in src/. +# +# A few dependencies have no usable vcpkg port and stay on CPM (see the bottom +# of this file): streamvbyte, kdtoolbox (KDSignalThrottler), maddy (used as a +# doc-generation executable), macdeployqtfix, and KArchive (vcpkg only ships a +# Qt5 build which conflicts with klogg's Qt6). +# --------------------------------------------------------------------------- + +# Create an INTERFACE target named ${alias} forwarding to ${real}, unless a +# target named ${alias} already exists (e.g. the config package defined it). +macro(klogg_alias alias real) + if(NOT TARGET ${alias}) + add_library(${alias} INTERFACE) + target_link_libraries(${alias} INTERFACE ${real}) + endif() +endmacro() -cpmaddpackage("gh:simdutf/simdutf@5.6.2") -cpmaddpackage("gh:foonathan/type_safe@0.2.4") -cpmaddpackage("gh:RoaringBitmap/CRoaring@4.2.1") -cpmaddpackage("gh:lemire/streamvbyte@1.0.0") +# --- simdutf --------------------------------------------------------------- +find_package(simdutf CONFIG REQUIRED) +klogg_alias(simdutf simdutf::simdutf) + +# --- type_safe (foonathan) ------------------------------------------------- +find_package(type_safe CONFIG REQUIRED) +if(NOT TARGET type_safe AND TARGET foonathan::type_safe) + klogg_alias(type_safe foonathan::type_safe) +endif() + +# --- CRoaring -------------------------------------------------------------- +# klogg includes the C++ headers without the roaring/ prefix (), +# so expose the roaring subdirectory on the include path. +find_package(roaring CONFIG REQUIRED) +find_path(KLOGG_ROARING_INCLUDE_DIR NAMES roaring.hh PATH_SUFFIXES roaring) +foreach(roaring_target roaring roaring-headers roaring-headers-cpp) + if(NOT TARGET ${roaring_target}) + add_library(${roaring_target} INTERFACE) + target_link_libraries(${roaring_target} INTERFACE roaring::roaring) + if(KLOGG_ROARING_INCLUDE_DIR) + target_include_directories(${roaring_target} SYSTEM INTERFACE ${KLOGG_ROARING_INCLUDE_DIR}) + endif() + endif() +endforeach() + +# --- uchardet -------------------------------------------------------------- +find_package(uchardet CONFIG REQUIRED) +add_library(klogg_uchardet_wrapper INTERFACE) +if(TARGET uchardet::libuchardet) + target_link_libraries(klogg_uchardet_wrapper INTERFACE uchardet::libuchardet) +elseif(TARGET uchardet::uchardet) + target_link_libraries(klogg_uchardet_wrapper INTERFACE uchardet::uchardet) +elseif(TARGET uchardet) + target_link_libraries(klogg_uchardet_wrapper INTERFACE uchardet) +endif() +find_path(KLOGG_UCHARDET_INCLUDE_DIR NAMES uchardet.h PATH_SUFFIXES uchardet) +if(KLOGG_UCHARDET_INCLUDE_DIR) + target_include_directories(klogg_uchardet_wrapper SYSTEM INTERFACE ${KLOGG_UCHARDET_INCLUDE_DIR}) +endif() + +# --- robin_hood ------------------------------------------------------------ +find_package(robin_hood CONFIG REQUIRED) +klogg_alias(robin_hood robin_hood::robin_hood) + +# --- xxHash ---------------------------------------------------------------- +find_package(xxHash CONFIG REQUIRED) +klogg_alias(xxhash xxHash::xxhash) + +# --- whereami -------------------------------------------------------------- +find_package(unofficial-whereami CONFIG REQUIRED) +klogg_alias(whereami unofficial::whereami::whereami) + +# --- efsw ------------------------------------------------------------------ +find_package(efsw CONFIG REQUIRED) +klogg_alias(efsw efsw::efsw) + +# --- oneTBB ---------------------------------------------------------------- +find_package(TBB CONFIG REQUIRED) +klogg_alias(tbb TBB::tbb) + +# --- mimalloc -------------------------------------------------------------- +find_package(mimalloc CONFIG REQUIRED) +add_library(klogg_mimalloc_wrapper INTERFACE) +if(TARGET mimalloc-static) + target_link_libraries(klogg_mimalloc_wrapper INTERFACE mimalloc-static) +elseif(TARGET mimalloc) + target_link_libraries(klogg_mimalloc_wrapper INTERFACE mimalloc) +endif() + +# --- exprtk (header only, no CMake config) --------------------------------- +add_library(exprtk INTERFACE) +target_link_libraries(exprtk INTERFACE robin_hood) +find_path(KLOGG_EXPRTK_INCLUDE_DIR NAMES exprtk.hpp) +if(KLOGG_EXPRTK_INCLUDE_DIR) + target_include_directories(exprtk SYSTEM INTERFACE ${KLOGG_EXPRTK_INCLUDE_DIR}) +endif() +target_compile_definitions( + exprtk + INTERFACE -Dexprtk_disable_caseinsensitivity + -Dexprtk_disable_comments + -Dexprtk_disable_break_continue + -Dexprtk_disable_return_statement + -Dexprtk_disable_superscalar_unroll + -Dexprtk_disable_rtl_io_file + -Dexprtk_disable_rtl_vecops + -Dexprtk_disable_string_capabilities +) + +# --- hyperscan / vectorscan (no CMake config, pkg-config/lib only) --------- +if(KLOGG_USE_HYPERSCAN) + message("Adding alias for hyperscan (vcpkg)") + find_library(KLOGG_HS_LIBRARY NAMES hs libhs REQUIRED) + find_path(KLOGG_HS_INCLUDE_DIR NAMES hs.h PATH_SUFFIXES hs REQUIRED) + add_library(klogg_hyperscan INTERFACE) + target_link_libraries(klogg_hyperscan INTERFACE ${KLOGG_HS_LIBRARY}) + target_include_directories(klogg_hyperscan SYSTEM INTERFACE ${KLOGG_HS_INCLUDE_DIR}) +elseif(KLOGG_USE_VECTORSCAN) + message("Adding alias for vectorscan (vcpkg)") + find_library(KLOGG_HS_LIBRARY NAMES hs libhs REQUIRED) + find_path(KLOGG_HS_INCLUDE_DIR NAMES hs.h PATH_SUFFIXES hs REQUIRED) + add_library(klogg_vectorscan INTERFACE) + target_link_libraries(klogg_vectorscan INTERFACE ${KLOGG_HS_LIBRARY}) + target_include_directories(klogg_vectorscan SYSTEM INTERFACE ${KLOGG_HS_INCLUDE_DIR}) +endif() + +# --- tests: Catch2 (pinned to 2.x) + backward-cpp -------------------------- +if(KLOGG_BUILD_TESTS) + find_package(Catch2 CONFIG REQUIRED) + klogg_alias(Catch2 Catch2::Catch2) + # Provides the add_backward() helper used by tests/ui. + find_package(Backward CONFIG REQUIRED) +endif() + +# --- sentry (optional, off by default) ------------------------------------- +if(KLOGG_USE_SENTRY) + find_package(sentry CONFIG REQUIRED) +endif() + +# --------------------------------------------------------------------------- +# Dependencies that stay on CPM (no usable vcpkg port) +# --------------------------------------------------------------------------- if(APPLE) cpmaddpackage( @@ -25,6 +167,8 @@ if(APPLE) endif() endif() +# maddy is consumed as a documentation-conversion executable ($), +# so the header-only vcpkg port cannot replace it. cpmaddpackage( NAME maddy @@ -36,81 +180,10 @@ cpmaddpackage( YES ) -if(KLOGG_USE_HYPERSCAN) - cpmaddpackage( - NAME - hyperscan - GITHUB_REPOSITORY - variar/hyperscan - GIT_TAG - 0931a40e0cf1d7f92189bc546c3491ed5c113f8b - EXCLUDE_FROM_ALL - YES - ) - message("Adding alias for hyperscan") - add_library(klogg_hyperscan INTERFACE) - target_link_libraries(klogg_hyperscan INTERFACE hs) - target_include_directories(klogg_hyperscan INTERFACE ${hyperscan_SOURCE_DIR}/src) -elseif(KLOGG_USE_VECTORSCAN) - cpmaddpackage( - NAME - vectorscan - GITHUB_REPOSITORY - VectorCamp/vectorscan - GIT_TAG - d29730e1cb9daaa66bda63426cdce83505d2c809 - EXCLUDE_FROM_ALL - YES - OPTIONS - "BUILD_STATIC_LIBS ON" - "BUILD_UNIT OFF" - "BUILD_TOOLS OFF" - "BUILD_EXAMPLES OFF" - "BUILD_BENCHMARKS OFF" - "BUILD_DOC OFF" - "BUILD_CHIMERA OFF" - "BUIlD_AVX2 OFF" - "BUIlD_AVX512 OFF" - "BUIlD_AVX512VBMI OFF" - "FAT_RUNTIME OFF" - ) - - message("Adding alias for vectorscan") - add_library(klogg_vectorscan INTERFACE) - target_link_libraries(klogg_vectorscan INTERFACE hs) - target_include_directories(klogg_vectorscan INTERFACE - ${vectorscan_SOURCE_DIR}/src - ${vectorscan_BINARY_DIR} - ) -endif() - -cpmaddpackage( - NAME - Uchardet - GIT_REPOSITORY - https://gitlab.freedesktop.org/uchardet/uchardet - VERSION - 0.0.8 - EXCLUDE_FROM_ALL - YES - OPTIONS - "BUILD_BINARY OFF" -) -if(Uchardet_ADDED) - message("Adding alias for uchardet") - add_library(klogg_uchardet_wrapper INTERFACE) - target_link_libraries(klogg_uchardet_wrapper INTERFACE libuchardet) - target_include_directories(klogg_uchardet_wrapper INTERFACE ${Uchardet_SOURCE_DIR}/src) -else() - add_library(klogg_uchardet_wrapper INTERFACE) - target_link_libraries(klogg_uchardet_wrapper INTERFACE ${UCHARDET_LIBRARY}) - target_include_directories(klogg_uchardet_wrapper INTERFACE ${UCHARDET_INCLUDE_DIR}) -endif() - -if(${QT_VERSION_MAJOR} EQUAL 6) -set(CPM_USE_LOCAL_PACKAGES OFF) -endif() - +# KArchive: vcpkg only ships a Qt5 build (kf5archive) which conflicts with the +# Qt6 application, so keep the standalone fork on CPM. The fork predates Qt 6.9, +# where QString::arg() no longer accepts a QIODevice::OpenMode implicitly; apply +# a small, idempotent source fix after fetching. cpmaddpackage( NAME KF5Archive @@ -121,52 +194,22 @@ cpmaddpackage( EXCLUDE_FROM_ALL YES ) -if(NOT KF5Archive_ADDED) - find_package(KF5Archive) - add_library(klogg_karchive INTERFACE) - target_link_libraries(klogg_karchive INTERFACE KF5::Archive) -endif() - -if(${QT_VERSION_MAJOR} EQUAL 6) -message("Resetting CPM_USE_LOCAL_PACKAGES to ${_TMP_CPM_USE_LOCAL_PACKAGES}") -set(CPM_USE_LOCAL_PACKAGES ${_TMP_CPM_USE_LOCAL_PACKAGES}) +if(KF5Archive_ADDED) + file(GLOB_RECURSE _klogg_karchive_sources "${KF5Archive_SOURCE_DIR}/karchive/src/*.cpp") + foreach(_src ${_klogg_karchive_sources}) + file(READ "${_src}" _contents) + string(REPLACE ".arg(mode)" ".arg(static_cast(mode))" _patched "${_contents}") + string(REPLACE ".arg(d->mode)" ".arg(static_cast(d->mode))" _patched "${_patched}") + if(NOT _patched STREQUAL _contents) + file(WRITE "${_src}" "${_patched}") + endif() + endforeach() endif() -cpmaddpackage( - NAME - robin_hood - GITHUB_REPOSITORY - martinus/robin-hood-hashing - GIT_TAG - 3.11.2 - EXCLUDE_FROM_ALL - YES -) -if(NOT TARGET robin_hood) - message("Adding imported target for robin_hood") - add_library(robin_hood INTERFACE) - target_include_directories(robin_hood INTERFACE ${ROBIN_HOOD_INCLUDE_DIRS}) -endif(NOT TARGET robin_hood) - -if(KLOGG_BUILD_TESTS) - cpmaddpackage("gh:bombela/backward-cpp@1.6") - cpmaddpackage( - NAME - Catch2 - GITHUB_REPOSITORY - catchorg/Catch2 - VERSION - 2.13.8 - EXCLUDE_FROM_ALL - YES - ) - if(NOT TARGET Catch2) - message("Adding imported target for catch2") - add_library(Catch2 INTERFACE) - target_include_directories(Catch2 INTERFACE ${CATCH2_INCLUDE_DIRS}) - endif(NOT TARGET Catch2) -endif() +cpmaddpackage("gh:lemire/streamvbyte@1.0.0") +# KDSingleApplication links Qt, so it is compiled against the application's own +# (system) Qt rather than pulling a second Qt through vcpkg. cpmaddpackage( NAME KDSingleApplication @@ -190,65 +233,6 @@ if(KDSingleApplication_ADDED) set_target_properties(kdsingleapp PROPERTIES AUTOMOC ON) endif() - -cpmaddpackage( - NAME - xxHash - GITHUB_REPOSITORY - Cyan4973/xxHash - VERSION - 0.8.1 - DOWNLOAD_ONLY - YES -) -if(xxHash_ADDED) - set(XXHASH_BUILD_ENABLE_INLINE_API OFF) - set(XXHASH_BUILD_XXHSUM OFF) - add_subdirectory(${xxHash_SOURCE_DIR}/cmake_unofficial ${CMAKE_BINARY_DIR}/xxhash EXCLUDE_FROM_ALL) -endif() - -cpmaddpackage( - NAME - whereami - GITHUB_REPOSITORY - gpakosz/whereami - GIT_TAG - dcb52a058dc14530ba9ae05e4339bd3ddfae0e0e - DOWNLOAD_ONLY - YES -) -if(whereami_ADDED) - add_library(whereami STATIC ${whereami_SOURCE_DIR}/src/whereami.h ${whereami_SOURCE_DIR}/src/whereami.c) - target_include_directories(whereami PUBLIC ${whereami_SOURCE_DIR}/src) -endif() - -cpmaddpackage( - NAME - exprtk - GITHUB_REPOSITORY - variar/klogg_exprtk - GIT_TAG - 1f9f4cd7d2620b7b24232de9ea22908d63913459 - DOWNLOAD_ONLY - YES -) -if(exprtk_ADDED) - add_library(exprtk INTERFACE) - target_link_libraries(exprtk INTERFACE robin_hood) - target_include_directories(exprtk SYSTEM INTERFACE ${exprtk_SOURCE_DIR}) - target_compile_definitions( - exprtk - INTERFACE -Dexprtk_disable_caseinsensitivity - -Dexprtk_disable_comments - -Dexprtk_disable_break_continue - -Dexprtk_disable_return_statement - -Dexprtk_disable_superscalar_unroll - -Dexprtk_disable_rtl_io_file - -Dexprtk_disable_rtl_vecops - -Dexprtk_disable_string_capabilities - ) -endif() - cpmaddpackage( NAME KDToolBox @@ -270,138 +254,13 @@ if(KDToolBox_ADDED) set_target_properties(kdtoolbox PROPERTIES AUTOMOC ON) endif() -cpmaddpackage( - NAME - efsw - GITHUB_REPOSITORY - SpartanJ/efsw - GIT_TAG - 1.4.1 - EXCLUDE_FROM_ALL - YES - OPTIONS - "BUILD_TEST_APP OFF" -) -if(efsw_ADDED) - target_compile_definitions(efsw PRIVATE EFSW_FSEVENTS_NOT_SUPPORTED) -endif() - -if(WIN32) - set(BUILD_SHARED_LIBS ON) -endif() -cpmaddpackage( - NAME - tbb - GITHUB_REPOSITORY - variar/oneTBB - GIT_TAG - c9be1ac2930f02dea523003ed801b4489f3e6b6e - EXCLUDE_FROM_ALL - YES - OPTIONS - "TBB_TEST OFF" - "TBB_EXAMPLES OFF" - "TBB_STRICT OFF" -) - -if(WIN32) - set(BUILD_SHARED_LIBS OFF) -endif() - -set(CPM_USE_LOCAL_PACKAGES OFF) -cpmaddpackage( - NAME - mimalloc - GITHUB_REPOSITORY - microsoft/mimalloc - VERSION - 2.1.7 - EXCLUDE_FROM_ALL - YES - OPTIONS - "MI_BUILD_TESTS OFF" - "MI_SECURE OFF" - "MI_BUILD_SHARED OFF" - "MI_BUILD_STATIC ON" - "MI_BUILD_OBJECT OFF" - "MI_OVERRIDE OFF" -) -if(mimalloc_ADDED) - message("Adding alias for mimalloc") - add_library(klogg_mimalloc_wrapper INTERFACE) - target_link_libraries(klogg_mimalloc_wrapper INTERFACE mimalloc-static) - target_include_directories(klogg_mimalloc_wrapper INTERFACE ${mimalloc_SOURCE_DIR}/include) -else() - add_library(klogg_mimalloc_wrapper INTERFACE) - target_link_libraries(klogg_mimalloc_wrapper INTERFACE ${MIMALLOC_LIBRARY}) - target_include_directories(klogg_mimalloc_wrapper INTERFACE ${MIMALLOC_INCLUDE_DIR}) -endif() - -set(CPM_USE_LOCAL_PACKAGES ${_TMP_CPM_USE_LOCAL_PACKAGES}) - -if(KLOGG_USE_SENTRY) - set(SENTRY_BACKEND - "crashpad" - CACHE INTERNAL "" FORCE - ) - set(SENTRY_TRANSPORT - "none" - CACHE INTERNAL "" FORCE - ) - set(SENTRY_BUILD_EXAMPLES - OFF - CACHE INTERNAL "" FORCE - ) - set(CRASHPAD_ENABLE_INSTALL - OFF - CACHE INTERNAL "" FORCE - ) - set(CRASHPAD_ENABLE_INSTALL_DEV - OFF - CACHE INTERNAL "" FORCE - ) - - cpmaddpackage( - NAME - sentry - GITHUB_REPOSITORY - getsentry/sentry-native - GIT_TAG - a3d58622a807b9dda174cb9fc18fa0f98c89d043 - EXCLUDE_FROM_ALL - YES - ) - - if(WIN32) - set_target_properties(crashpad_handler PROPERTIES OUTPUT_NAME "klogg_crashpad_handler.exe") - else() - set_target_properties(crashpad_handler PROPERTIES OUTPUT_NAME "klogg_crashpad_handler") - endif() -endif(KLOGG_USE_SENTRY) - +# --------------------------------------------------------------------------- +# Mark remaining CPM-built dependency includes as system to silence warnings. +# (vcpkg config packages already export their includes as SYSTEM.) +# --------------------------------------------------------------------------- set(klogg_cpm_targets - xxhash - Catch2 - roaring - roaring-headers-cpp - libuchardet - robin_hood - whereami - simdutf - efsw - SingleApplication - hs - tbb - exprtk - type_safe - mimalloc-static - sentry - crashpad_client - crashpad_compat - crashpad_util - mini_chromium streamvbyte - FastPFor + kdtoolbox ) foreach(target ${klogg_cpm_targets}) if(TARGET ${target}) @@ -410,9 +269,6 @@ foreach(target ${klogg_cpm_targets}) TARGET ${target} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ) - #message("Marking ${${target}_include_dirs} as system incldue") set_property(TARGET ${target} PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${${target}_include_dirs}) endif() endforeach() - - diff --git a/CMakePresets.json b/CMakePresets.json index c5936a001..34db8143c 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -17,6 +17,10 @@ "lhs": "${hostSystemName}", "rhs": "Darwin" }, + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "environment": { + "VCPKG_ROOT": "/Users/danielaviv/dev/deps/vcpkg" + }, "cacheVariables": { "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", "CMAKE_EXPORT_COMPILE_COMMANDS": true, @@ -33,6 +37,10 @@ "lhs": "${hostSystemName}", "rhs": "Linux" }, + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "environment": { + "VCPKG_ROOT": "/Users/danielaviv/dev/deps/vcpkg" + }, "cacheVariables": { "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", "CMAKE_EXPORT_COMPILE_COMMANDS": true, @@ -49,6 +57,10 @@ "lhs": "${hostSystemName}", "rhs": "Windows" }, + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "environment": { + "VCPKG_ROOT": "/Users/danielaviv/dev/deps/vcpkg" + }, "cacheVariables": { "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", "CMAKE_EXPORT_COMPILE_COMMANDS": true, diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index 9c43efb73..8eb649f1d 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -80,6 +80,29 @@ function(set_project_warnings project_name) # probably wanted ) + # Keep -Werror, but don't let brand-new Clang/Qt diagnostics (which older + # klogg sources trip on under very recent toolchains) break the build. They + # stay visible as warnings. Scoped to Clang so GCC builds are unaffected. + if(WARNINGS_AS_ERRORS AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") + list( + APPEND + CLANG_WARNINGS + -Wno-unknown-warning-option + -Wno-error=unnecessary-virtual-specifier + -Wno-error=unused-result + -Wno-error=deprecated-declarations + -Wno-error=deprecated-literal-operator + -Wno-error=deprecated-this-capture + -Wno-error=deprecated-copy + -Wno-error=deprecated-copy-with-user-provided-copy + -Wno-error=deprecated-enum-enum-conversion + -Wno-error=deprecated-volatile + -Wno-error=enum-constexpr-conversion + -Wno-error=vexing-parse + -Wno-error=missing-template-arg-list-after-template-kw + ) + endif() + if(MSVC) set(PROJECT_WARNINGS ${MSVC_WARNINGS}) elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..7579096ed --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "klogg", + "version": "24.11.0", + "description": "klogg log viewer", + "homepage": "https://github.com/variar/klogg", + "builtin-baseline": "32305df7d0b9a308e6ac454dd98ebfe550342c09", + "dependencies": [ + "simdutf", + "type-safe", + "roaring", + "uchardet", + "robin-hood-hashing", + "xxhash", + "whereami", + "exprtk", + "efsw", + "tbb", + "mimalloc", + { + "name": "vectorscan", + "platform": "!windows" + }, + { + "name": "hyperscan", + "platform": "windows" + } + ], + "default-features": [ + "tests" + ], + "features": { + "tests": { + "description": "Build unit and integration tests", + "dependencies": [ + "catch2", + "backward-cpp" + ] + }, + "sentry": { + "description": "Crash reporting via sentry-native", + "dependencies": [ + "sentry-native" + ] + } + }, + "overrides": [ + { + "name": "catch2", + "version": "2.13.9" + }, + { + "name": "efsw", + "version": "1.4.1" + } + ] +} From 7338366462585845ff88c068c84b09142a900f5d Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Fri, 19 Jun 2026 17:17:56 +0300 Subject: [PATCH 03/13] removed hard coded path --- CMakePresets.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 34db8143c..0fe88913d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -18,9 +18,6 @@ "rhs": "Darwin" }, "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "environment": { - "VCPKG_ROOT": "/Users/danielaviv/dev/deps/vcpkg" - }, "cacheVariables": { "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", "CMAKE_EXPORT_COMPILE_COMMANDS": true, @@ -38,9 +35,6 @@ "rhs": "Linux" }, "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "environment": { - "VCPKG_ROOT": "/Users/danielaviv/dev/deps/vcpkg" - }, "cacheVariables": { "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", "CMAKE_EXPORT_COMPILE_COMMANDS": true, @@ -58,9 +52,6 @@ "rhs": "Windows" }, "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "environment": { - "VCPKG_ROOT": "/Users/danielaviv/dev/deps/vcpkg" - }, "cacheVariables": { "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", "CMAKE_EXPORT_COMPILE_COMMANDS": true, From 484494ea368742acfe327224ae845476d6a302db Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Fri, 19 Jun 2026 17:27:17 +0300 Subject: [PATCH 04/13] make cmake presets shorter --- CMakePresets.json | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 0fe88913d..2557a2c4e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -8,54 +8,46 @@ }, "configurePresets": [ { + "hidden": true, + "name": "__base", + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "cacheVariables": { + "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", + "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_POLICY_VERSION_MINIMUM": "3.5" + }, + "binaryDir": "${sourceDir}/build" + }, + { + "inherits": "__base", "name": "mac", - "displayName": "macOS (Ninja Multi-Config)", + "displayName": "macOS", "generator": "Ninja Multi-Config", - "binaryDir": "${sourceDir}/build/mac", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" - }, - "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", - "CMAKE_EXPORT_COMPILE_COMMANDS": true, - "CMAKE_POLICY_VERSION_MINIMUM": "3.5" } }, { + "inherits": "__base", "name": "linux", - "displayName": "Linux (Ninja Multi-Config)", + "displayName": "Linux", "generator": "Ninja Multi-Config", - "binaryDir": "${sourceDir}/build/linux", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux" - }, - "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", - "CMAKE_EXPORT_COMPILE_COMMANDS": true, - "CMAKE_POLICY_VERSION_MINIMUM": "3.5" } }, { "name": "windows", - "displayName": "Windows (Visual Studio 2026)", + "displayName": "Windows", "generator": "Visual Studio 18 2026", - "binaryDir": "${sourceDir}/build/windows", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" - }, - "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo", - "CMAKE_EXPORT_COMPILE_COMMANDS": true, - "CMAKE_POLICY_VERSION_MINIMUM": "3.5" } } ], From fb1ad078610a059a523319421eef46556c1d6833 Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Fri, 19 Jun 2026 17:38:06 +0300 Subject: [PATCH 05/13] fix: move logdata_test moc include out of anonymous namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qt 6.9+ moc helpers (qtmochelpers.h -> q20algorithm.h) reopen namespace q20; when the generated .moc was included inside the test's anonymous namespace, q20 nested into it and q20::identity failed to resolve under Qt 6.11. Include the .moc at file scope instead — the Q_OBJECT classes remain visible there. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/ui/logdata_test.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/ui/logdata_test.cpp b/tests/ui/logdata_test.cpp index f81dc7edd..cf5ffa715 100644 --- a/tests/ui/logdata_test.cpp +++ b/tests/ui/logdata_test.cpp @@ -82,8 +82,6 @@ class WriteFileThread : public QThread { int result_{}; }; -#include "logdata_test.moc" - #ifdef _WIN32 void writeDataToFileBackground( QFile& file, int numberOfLines = 200, WriteFileModification flag = WriteFileModification::None ) @@ -104,6 +102,11 @@ void writeDataToFile( QFile& file, int numberOfLines = 200, } } // namespace +// Included at file scope (not inside the anonymous namespace above): Qt 6.9+ +// moc helpers pull in headers that reopen namespace q20, which breaks if nested +// in an unnamed namespace. The Q_OBJECT classes remain visible here. +#include "logdata_test.moc" + TEST_CASE( "Logdata decoding lines", "[logdata]" ) { QTemporaryFile file{ "testdecode_XXXXXX" }; From 2f61b339b05fec0c332782c9e5d338edfd4485ed Mon Sep 17 00:00:00 2001 From: Daniel Aviv <76743397+o3wiz@users.noreply.github.com> Date: Fri, 19 Jun 2026 17:51:16 +0300 Subject: [PATCH 06/13] fixed QColor assignment of main, and quick find background colors (#2) --- src/settings/src/configuration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/settings/src/configuration.cpp b/src/settings/src/configuration.cpp index 723602eb1..f107bc6cf 100644 --- a/src/settings/src/configuration.cpp +++ b/src/settings/src/configuration.cpp @@ -145,7 +145,7 @@ void Configuration::retrieveFromStorage( QSettings& settings ) #if QT_VERSION <= QT_VERSION_CHECK( 6, 4, 0 ) .setNamedColor( #else - .fromString( + = QColor::fromString( #endif settings .value( "regexpType.mainBackColor", @@ -156,7 +156,7 @@ void Configuration::retrieveFromStorage( QSettings& settings ) #if QT_VERSION <= QT_VERSION_CHECK( 6, 4, 0 ) .setNamedColor( #else - .fromString( + = QColor::fromString( #endif settings .value( "regexpType.quickfindBackColor", From 38a8bdbbaad7ac40d5e72c893c503a21e1adcd72 Mon Sep 17 00:00:00 2001 From: Daniel Aviv <76743397+o3wiz@users.noreply.github.com> Date: Sat, 20 Jun 2026 21:19:58 +0300 Subject: [PATCH 07/13] Resolving warnings (#3) * resolved some compile warnings * release new versions --- .github/actions/agent-package-mac/action.yml | 46 ++++-- .github/actions/agent-setup/action.yml | 2 +- .github/actions/klogg-version/action.yml | 7 +- .../actions/prepare-workspace-env/action.yml | 2 +- .github/workflows/ci-build.yml | 58 +++++-- .github/workflows/ci-release.yml | 154 ------------------ CMakePresets.json | 42 ++++- packaging/windows/7z_klogg_listfile.txt | 2 - packaging/windows/prepare_release.cmd | 3 - src/logdata/include/linetypes.h | 10 +- src/logdata/src/fileholder.cpp | 5 +- src/ui/src/abstractlogview.cpp | 3 +- src/ui/src/quickfindwidget.cpp | 2 +- src/ui/src/scratchpad.cpp | 2 +- src/versioncheck/include/versionchecker.h | 10 +- src/versioncheck/src/versionchecker.cpp | 4 +- tests/helpers/file_write_helper.cpp | 9 +- 17 files changed, 137 insertions(+), 224 deletions(-) delete mode 100644 .github/workflows/ci-release.yml diff --git a/.github/actions/agent-package-mac/action.yml b/.github/actions/agent-package-mac/action.yml index 56ef9ffc2..fe90bceb2 100644 --- a/.github/actions/agent-package-mac/action.yml +++ b/.github/actions/agent-package-mac/action.yml @@ -1,23 +1,32 @@ name: "Prepare klogg mac packages" description: "" inputs: + sign: + description: "Set to 'true' to code-sign and notarize (requires Apple Developer ID secrets). Defaults to unsigned." + required: false + default: "false" p12-file-base64: - required: true + required: false + default: "" p12-password: - required: true + required: false + default: "" notarization-username: - required: true + required: false + default: "" notarization-team: - required: true + required: false + default: "" notarization-password: - required: true - + required: false + default: "" + runs: using: "composite" steps: - name: Mac prepare codesign id: prepare-codesign - if: ${{ github.event_name != 'pull_request' }} + if: ${{ inputs.sign == 'true' }} uses: apple-actions/import-codesign-certs@v1 with: p12-file-base64: ${{ inputs.p12-file-base64 }} @@ -50,28 +59,33 @@ runs: echo "KLOGG_PKG=klogg-${{ env.KLOGG_VERSION }}-mac-${{ env.KLOGG_ARCH }}.pkg" >> $GITHUB_ENV - name: Mac codesign binaries - if: ${{ github.event_name != 'pull_request' }} + if: ${{ inputs.sign == 'true' }} shell: sh run: | cd $KLOGG_BUILD_ROOT codesign -v -f -o runtime --deep --timestamp -s "${{ env.KLOGG_CODESIGN }}" ./output/klogg.app; - + - name: Mac pack dmg shell: sh run: | cd $KLOGG_BUILD_ROOT cpack --verbose -G "DragNDrop" - - name: Mac codesign dmg - if: ${{ github.event_name != 'pull_request' }} + - name: Mac rename dmg shell: sh run: | cd $KLOGG_BUILD_ROOT mv ./packages/klogg-${{ env.KLOGG_VERSION }}-OSX.dmg ./packages/${{ env.KLOGG_DMG }} + + - name: Mac codesign dmg + if: ${{ inputs.sign == 'true' }} + shell: sh + run: | + cd $KLOGG_BUILD_ROOT codesign -v -f -o runtime --timestamp -s "${{ env.KLOGG_CODESIGN }}" ./packages/${{ env.KLOGG_DMG }} - - - name: Mac notarize DMG - if: ${{ github.event_name != 'pull_request' }} + + - name: Mac notarize DMG + if: ${{ inputs.sign == 'true' }} shell: sh run: | xcrun notarytool submit --wait --apple-id "${{ inputs.notarization-username }}" --team-id "${{ inputs.notarization-team }}" --password "${{ inputs.notarization-password }}" "${{ env.KLOGG_BUILD_ROOT }}/packages/${{ env.KLOGG_DMG }}" | tee dmg_notary.log @@ -79,8 +93,8 @@ runs: xcrun notarytool log --apple-id "${{ inputs.notarization-username }}" --team-id "${{ inputs.notarization-team }}" --password "${{ inputs.notarization-password }}" "$dmg_notary_id" "dmg_notary.log.json" cat "dmg_notary.log.json" - - name: Mac staple DMG - if: ${{ github.event_name != 'pull_request' }} + - name: Mac staple DMG + if: ${{ inputs.sign == 'true' }} shell: sh run: | xcrun stapler staple "${{ env.KLOGG_BUILD_ROOT }}/packages/${{ env.KLOGG_DMG }}" diff --git a/.github/actions/agent-setup/action.yml b/.github/actions/agent-setup/action.yml index 7669e2de1..bd723a72c 100644 --- a/.github/actions/agent-setup/action.yml +++ b/.github/actions/agent-setup/action.yml @@ -30,7 +30,7 @@ runs: echo "BOOST_URL=https://sourceforge.net/projects/boost/files/boost/1.86.0/boost_1_86_0.tar.bz2/download" >> $GITHUB_ENV - name: Restore Boost cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: cache-boost with: path: ${{env.BOOST_ROOT}} diff --git a/.github/actions/klogg-version/action.yml b/.github/actions/klogg-version/action.yml index c1e933a9f..6f67311cf 100644 --- a/.github/actions/klogg-version/action.yml +++ b/.github/actions/klogg-version/action.yml @@ -6,4 +6,9 @@ runs: - name: Set klogg version shell: sh run: | - echo "KLOGG_VERSION=24.11.0.$((${{ github.run_number }} + 717))" >> $GITHUB_ENV + if [ "$GITHUB_REF_TYPE" = "tag" ]; then + # Tag release: derive version from the tag name, e.g. v1.0.0 -> 1.0.0 + echo "KLOGG_VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV + else + echo "KLOGG_VERSION=24.11.0.$((${{ github.run_number }} + 717))" >> $GITHUB_ENV + fi diff --git a/.github/actions/prepare-workspace-env/action.yml b/.github/actions/prepare-workspace-env/action.yml index af4285d83..80b30c83e 100644 --- a/.github/actions/prepare-workspace-env/action.yml +++ b/.github/actions/prepare-workspace-env/action.yml @@ -9,7 +9,7 @@ runs: echo "KLOGG_WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV echo "KLOGG_BUILD_ROOT=build_root" >> $GITHUB_ENV echo "KLOGG_ARCH=${{ matrix.config.arch }}" >> $GITHUB_ENV - echo "KLOGG_CMAKE_OPTS=-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DKLOGG_GENERIC_CPU=ON -DKLOGG_USE_SENTRY=ON -DCMAKE_INSTALL_PREFIX=/usr ${{ matrix.config.cmake_opts }}" >> $GITHUB_ENV + echo "KLOGG_CMAKE_OPTS=-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DKLOGG_GENERIC_CPU=ON -DKLOGG_USE_SENTRY=OFF -DCMAKE_INSTALL_PREFIX=/usr ${{ matrix.config.cmake_opts }}" >> $GITHUB_ENV - name: Set qt env var if: "startsWith(matrix.config.qt_version, '5')" diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 27090b427..503a36b87 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -3,6 +3,7 @@ name: "CI Build" on: push: branches: [ master ] + tags: [ 'v*' ] paths-ignore: - 'website/**' - BUILD.md @@ -28,13 +29,13 @@ jobs: if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/klogg-version - name: Save version run: echo $KLOGG_VERSION > klogg_version.txt - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: klogg_version path: 'klogg_version.txt' @@ -118,7 +119,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 #- uses: satackey/action-docker-layer-caching@v0.0.11 # # Ignore the failure of a step and avoid terminating the job. @@ -136,7 +137,7 @@ jobs: - uses: ./.github/actions/docker-package # Final upload of all packages - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: packages-${{ matrix.config.artifacts_id }} path: '${{ env.KLOGG_BUILD_ROOT }}/packages/*' @@ -167,7 +168,7 @@ jobs: runs-on: ${{ matrix.config.os }}-${{ matrix.config.os_version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Xcode shell: sh @@ -190,14 +191,10 @@ jobs: - uses: ./.github/actions/agent-build - uses: ./.github/actions/agent-run-tests - uses: ./.github/actions/agent-package-mac - with: - p12-file-base64: ${{ secrets.CODESIGN_BASE64 }} - p12-password: ${{ secrets.CODESIGN_PASSWORD }} - notarization-username: ${{ secrets.NOTARIZATION_USERNAME }} - notarization-team: ${{ secrets.NOTARIZATION_TEAM }} - notarization-password: ${{ secrets.NOTARIZATION_PASSWORD }} + # Unsigned build (sign defaults to 'false'). To produce signed/notarized + # artifacts, set `sign: 'true'` and supply the Apple Developer ID secrets. - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: packages-${{ matrix.config.artifacts_id }} path: '${{ env.KLOGG_BUILD_ROOT }}/packages/*' @@ -229,11 +226,11 @@ jobs: runs-on: ${{ matrix.config.os }}-${{ matrix.config.os_version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache openssl id: cache-openssl - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ github.workspace }}\openssl-1.1 key: OpensslCache-1-1-1w @@ -268,8 +265,39 @@ jobs: s3-bucket: ${{ secrets.WIN_CS_BUCKET }} # Final upload of all packages - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: packages-${{ matrix.config.artifacts_id }} path: '${{ env.KLOGG_BUILD_ROOT }}/packages/*' if-no-files-found: error + +# Publish a GitHub Release when a tag like v1.0.0 is pushed. +# Uses the built-in GITHUB_TOKEN, so no extra secrets are required. + Release: + if: startsWith(github.ref, 'refs/tags/v') + needs: [ Linux, Mac, Windows ] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download all platform artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + pattern: packages-* + + - name: Generate checksums + run: | + cd artifacts + find . -type f -print0 | xargs -0 sha256sum > ../SHA256SUMS.txt + cat ../SHA256SUMS.txt + + - name: Publish release + uses: softprops/action-gh-release@v2 + with: + files: | + artifacts/**/* + SHA256SUMS.txt + generate_release_notes: true + prerelease: false + fail_on_unmatched_files: true diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml deleted file mode 100644 index fadf25adf..000000000 --- a/.github/workflows/ci-release.yml +++ /dev/null @@ -1,154 +0,0 @@ -name: "Make CI Release" - -on: - workflow_dispatch: - inputs: - ci-run-id: - description: "Run ID of CI workflow" - required: false - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Download artifacts for last successful CI workflow - if: ${{ !github.event.inputs.ci-run-id }} - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ci-build.yml - workflow_conclusion: success - - - name: Download artifacts for CI workflow with provided run id - if: ${{ github.event.inputs.ci-run-id }} - uses: dawidd6/action-download-artifact@v6 - with: - workflow: ci-build.yml - run_id: ${{ github.event.inputs.ci-run-id }} - - - name: Initialize version - run: echo "KLOGG_VERSION=`cat klogg_version/klogg_version.txt`" >> $GITHUB_ENV - - - name: Display structure of downloaded files - run: ls -R ./packages-* - - - name: Setup Sentry CLI - uses: mathrix-education/setup-sentry-cli@0.1.0 - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' - with: - token: ${{ secrets.SENTRY_TOKEN }} - organization: anton-filimonov - project: klogg - - - name: Create Sentry release - shell: sh - run: | - sentry-cli releases new $KLOGG_VERSION - sentry-cli releases set-commits --auto $KLOGG_VERSION - - - name: Upload symbols linux - shell: sh - run: | - xz -d ./packages-focal/klogg_focal.debug.xz - xz -d ./packages-jammy/klogg_jammy.debug.xz - xz -d ./packages-noble/klogg_noble.debug.xz - xz -d ./packages-oracle/klogg_oracle.debug.xz - xz -d ./packages-appimage/klogg_appimage.debug.xz - sentry-cli upload-dif ./packages-focal/klogg_focal.debug ./packages-focal/klogg_focal - sentry-cli upload-dif ./packages-jammy/klogg_jammy.debug ./packages-jammy/klogg_jammy - sentry-cli upload-dif ./packages-noble/klogg_noble.debug ./packages-noble/klogg_noble - sentry-cli upload-dif ./packages-oracle/klogg_oracle.debug ./packages-oracle/klogg_oracle - sentry-cli upload-dif ./packages-appimage/klogg_appimage.debug ./packages-appimage/klogg_appimage - - - name: Upload symbols mac - shell: sh - run: | - sentry-cli upload-dif ./packages-macos-intel-qt6/klogg-x64.app/Contents/MacOS/klogg ./packages-macos-intel-qt6/klogg-x64.dSym - sentry-cli upload-dif ./packages-macos-arm-qt6/klogg-arm64.app/Contents/MacOS/klogg ./packages-macos-arm-qt6/klogg-arm64.dSym - - - name: Upload symbols win - shell: sh - run: | - sentry-cli upload-dif ./packages-windows-x86-qt5/klogg-$KLOGG_VERSION-x86-Qt5-pdb.zip - sentry-cli upload-dif ./packages-windows-x64-qt6/klogg-$KLOGG_VERSION-x64-Qt6-pdb.zip - - - name: Cleanup release artifacts - shell: sh - run: | - rm -rf ./packages-focal/klogg_focal - rm -rf ./packages-jammy/klogg_jammy - rm -rf ./packages-noble/klogg_noble - rm -rf ./packages-oracle/klogg_oracle - rm -rf ./packages-appimage/klogg_appimage - rm -rf ./packages-macos-intel-qt6/klogg-x64.app - rm -rf ./packages-macos-arm-qt6/klogg-arm64.app - mkdir ./linux-debug - mv ./packages-focal/klogg_focal.debug ./linux-debug - mv ./packages-jammy/klogg_jammy.debug ./linux-debug - mv ./packages-noble/klogg_noble.debug ./linux-debug - mv ./packages-oracle/klogg_oracle.debug ./linux-debug - mv ./packages-appimage/klogg_appimage.debug ./linux-debug - tar -cJf ./linux-debug/klogg-$KLOGG_VERSION-symbols.tar.xz ./linux-debug/* - rm ./linux-debug/*.debug - - - name: Prepare binary artifacts - shell: sh - run: | - mkdir ./packages-bin - mv ./packages-appimage/klogg_deps.tar.xz ./packages-bin/klogg-$KLOGG_VERSION-deps.tar.xz - ar p ./packages-focal/klogg-$KLOGG_VERSION-focal.deb data.tar.gz > ./packages-bin/klogg-$KLOGG_VERSION-bin.tar.gz - mv ./klogg_version/klogg_version.txt ./packages-bin - - - name: Prepare checksums - shell: sh - run: | - sha256sum --binary ./packages-bin/* ./packages-focal/* ./packages-jammy/* ./packages-noble/* ./packages-oracle/* ./packages-appimage/* > ./packages-bin/klogg-$KLOGG_VERSION-sha256.txt - - - name: Release win - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: ${{ secrets.KLOGG_GITHUB_TOKEN }} - automatic_release_tag: continuous-win - prerelease: true - files: | - ./packages-windows-x86-qt5/* - ./packages-windows-x64-qt6/* - - - name: Release linux - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: ${{ secrets.KLOGG_GITHUB_TOKEN }} - automatic_release_tag: continuous-linux - prerelease: true - files: | - ./packages-focal/* - ./packages-jammy/* - ./packages-noble/* - ./packages-oracle/* - ./packages-appimage/* - ./packages-bin/* - ./linux-debug/* - - - name: Release mac - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: ${{ secrets.KLOGG_GITHUB_TOKEN }} - automatic_release_tag: continuous-osx - prerelease: true - files: | - ./packages-macos-intel-qt6/* - ./packages-macos-arm-qt6/* - - - name: Discord notification - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_NEW_VERSIONS_WEBHOOK }} - DISCORD_EMBEDS: '[{"title": "Windows", "url": "https://github.com/variar/klogg/releases/tag/continuous-win"}, {"title": "Linux", "url": "https://github.com/variar/klogg/releases/tag/continuous-linux"}, {"title": "Mac", "url": "https://github.com/variar/klogg/releases/tag/continuous-osx"}]' - uses: Ilshidur/action-discord@master - with: - args: 'New CI build {{KLOGG_VERSION}} has been released!' - - - - - diff --git a/CMakePresets.json b/CMakePresets.json index 2557a2c4e..afef7490e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -41,6 +41,7 @@ } }, { + "inherits": "__base", "name": "windows", "displayName": "Windows", "generator": "Visual Studio 18 2026", @@ -53,48 +54,71 @@ ], "buildPresets": [ { + "hidden": true, + "name": "__base", + "jobs": 0 + }, + { + "hidden": true, + "inherits": "__base", + "name": "__mac_base", + "configurePreset": "mac" + }, + { + "hidden": true, + "inherits": "__base", + "name": "__linux_base", + "configurePreset": "linux" + }, + { + "hidden": true, + "inherits": "__base", + "name": "__windows_base", + "configurePreset": "windows" + }, + { + "inherits": "__mac_base", "name": "mac-debug", - "configurePreset": "mac", "configuration": "Debug" }, { + "inherits": "__mac_base", "name": "mac-release", - "configurePreset": "mac", "configuration": "Release" }, { + "inherits": "__mac_base", "name": "mac-relwithdebinfo", - "configurePreset": "mac", "configuration": "RelWithDebInfo" }, { + "inherits": "__linux_base", "name": "linux-debug", - "configurePreset": "linux", "configuration": "Debug" }, { + "inherits": "__linux_base", "name": "linux-release", - "configurePreset": "linux", "configuration": "Release" }, { + "inherits": "__linux_base", "name": "linux-relwithdebinfo", - "configurePreset": "linux", "configuration": "RelWithDebInfo" }, { + "inherits": "__windows_base", "name": "windows-debug", - "configurePreset": "windows", "configuration": "Debug" }, { + "inherits": "__windows_base", "name": "windows-release", - "configurePreset": "windows", "configuration": "Release" }, { + "inherits": "__windows_base", "name": "windows-relwithdebinfo", - "configurePreset": "windows", "configuration": "RelWithDebInfo" } ] diff --git a/packaging/windows/7z_klogg_listfile.txt b/packaging/windows/7z_klogg_listfile.txt index 46ad3514a..4e3137a19 100644 --- a/packaging/windows/7z_klogg_listfile.txt +++ b/packaging/windows/7z_klogg_listfile.txt @@ -1,7 +1,5 @@ .\release\*.dll .\release\klogg_portable.exe -.\release\klogg_crashpad_handler.exe -.\release\klogg_minidump_dump.exe .\release\documentation.html .\release\COPYING .\release\NOTICE diff --git a/packaging/windows/prepare_release.cmd b/packaging/windows/prepare_release.cmd index 9b5338bae..72b95abb4 100644 --- a/packaging/windows/prepare_release.cmd +++ b/packaging/windows/prepare_release.cmd @@ -9,9 +9,6 @@ xcopy %KLOGG_WORKSPACE%\%KLOGG_BUILD_ROOT%\output\klogg_portable.pdb %KLOGG_WORK xcopy %KLOGG_WORKSPACE%\%KLOGG_BUILD_ROOT%\output\klogg.exe %KLOGG_WORKSPACE%\release\ /y xcopy %KLOGG_WORKSPACE%\%KLOGG_BUILD_ROOT%\output\klogg.pdb %KLOGG_WORKSPACE%\release\ /y -xcopy %KLOGG_WORKSPACE%\%KLOGG_BUILD_ROOT%\output\klogg_crashpad_handler.exe %KLOGG_WORKSPACE%\release\ /y -xcopy %KLOGG_WORKSPACE%\%KLOGG_BUILD_ROOT%\output\klogg_minidump_dump.exe %KLOGG_WORKSPACE%\release\ /y - xcopy %KLOGG_WORKSPACE%\%KLOGG_BUILD_ROOT%\msvc_19.41_cxx17_64_md_relwithdebinfo\tbb12.dll %KLOGG_WORKSPACE%\release\ /y xcopy %KLOGG_WORKSPACE%\%KLOGG_BUILD_ROOT%\msvc_19.41_cxx17_64_md_relwithdebinfo\tbb12.pdb %KLOGG_WORKSPACE%\release\ /y xcopy %KLOGG_WORKSPACE%\%KLOGG_BUILD_ROOT%\msvc_19.41_cxx17_32_md_relwithdebinfo\tbb12.dll %KLOGG_WORKSPACE%\release\ /y diff --git a/src/logdata/include/linetypes.h b/src/logdata/include/linetypes.h index c8689d688..c38e16919 100644 --- a/src/logdata/include/linetypes.h +++ b/src/logdata/include/linetypes.h @@ -172,23 +172,23 @@ struct LineColumn : type_safe::strong_typedef( value ) ); } -inline constexpr LineNumber operator"" _lnum( unsigned long long int value ) +inline constexpr LineNumber operator""_lnum( unsigned long long int value ) { return LineNumber( static_cast( value ) ); } -inline constexpr LinesCount operator"" _lcount( unsigned long long int value ) +inline constexpr LinesCount operator""_lcount( unsigned long long int value ) { return LinesCount( static_cast( value ) ); } -inline constexpr LineLength operator"" _length( unsigned long long int value ) +inline constexpr LineLength operator""_length( unsigned long long int value ) { return LineLength( static_cast( value ) ); } -inline constexpr LineColumn operator"" _lcol( unsigned long long int value ) +inline constexpr LineColumn operator""_lcol( unsigned long long int value ) { return LineColumn( static_cast( value ) ); } diff --git a/src/logdata/src/fileholder.cpp b/src/logdata/src/fileholder.cpp index 649a6b448..552a77fc4 100644 --- a/src/logdata/src/fileholder.cpp +++ b/src/logdata/src/fileholder.cpp @@ -56,7 +56,10 @@ void openFileByHandle( QFile* file ) } #endif if ( !openedByHandle ) { - file->open( QIODevice::ReadOnly ); + if ( !file->open( QIODevice::ReadOnly ) ) { + LOG_WARNING << "Failed to open file " << file->fileName(); + return; + } } LOG_INFO << "QFile opened"; } diff --git a/src/ui/src/abstractlogview.cpp b/src/ui/src/abstractlogview.cpp index c2dd00d91..bf83a3d32 100644 --- a/src/ui/src/abstractlogview.cpp +++ b/src/ui/src/abstractlogview.cpp @@ -1438,8 +1438,7 @@ void AbstractLogView::saveLinesToFile( LineNumber begin, LineNumber end ) } QSaveFile saveFile{ filename }; - saveFile.open( QIODevice::WriteOnly | QIODevice::Truncate ); - if ( !saveFile.isOpen() ) { + if ( !saveFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) { LOG_ERROR << "Failed to open file to save"; return; } diff --git a/src/ui/src/quickfindwidget.cpp b/src/ui/src/quickfindwidget.cpp index 0e47526de..1b448db45 100644 --- a/src/ui/src/quickfindwidget.cpp +++ b/src/ui/src/quickfindwidget.cpp @@ -104,7 +104,7 @@ QuickFindWidget::QuickFindWidget( QWidget* parent ) connect( editQuickFind_, &QLineEdit::textEdited, this, &QuickFindWidget::textChanged ); connect( editQuickFind_, &QLineEdit::returnPressed, this, &QuickFindWidget::returnHandler ); - connect( ignoreCaseCheck_, &QCheckBox::stateChanged, this, [ this ] { + connect( ignoreCaseCheck_, &QCheckBox::checkStateChanged, this, [ this ] { textChanged(); Configuration::get().setQfIgnoreCase( ignoreCaseCheck_->isChecked() ); Configuration::get().save(); diff --git a/src/ui/src/scratchpad.cpp b/src/ui/src/scratchpad.cpp index f43fd5732..ead4bc1b7 100644 --- a/src/ui/src/scratchpad.cpp +++ b/src/ui/src/scratchpad.cpp @@ -289,7 +289,7 @@ void ScratchPad::fileTime() const auto time = text.toUtf8().toLongLong( &isOk ); if ( isOk ) { QDateTime dateTime; - dateTime.setTimeSpec( Qt::UTC ); + dateTime.setTimeZone( QTimeZone::UTC ); dateTime.setSecsSinceEpoch( windowsTickToUnixSeconds( time ) ); return dateTime.toString( Qt::ISODate ); } diff --git a/src/versioncheck/include/versionchecker.h b/src/versioncheck/include/versionchecker.h index 486e25eeb..b12c343e7 100644 --- a/src/versioncheck/include/versionchecker.h +++ b/src/versioncheck/include/versionchecker.h @@ -56,19 +56,19 @@ class VersionCheckerConfig final : public Persistable( next_deadline_ ) ); + settings.setValue( "VersionChecker/nextDeadline", static_cast( nextDeadline_ ) ); } VersionChecker::VersionChecker() diff --git a/tests/helpers/file_write_helper.cpp b/tests/helpers/file_write_helper.cpp index 53b9ec753..7c71174c5 100644 --- a/tests/helpers/file_write_helper.cpp +++ b/tests/helpers/file_write_helper.cpp @@ -43,9 +43,7 @@ int main( int argc, const char** argv ) QFile file{ argv[ 1 ] }; - file.open( QIODevice::Unbuffered | QIODevice::WriteOnly | QIODevice::Append ); - - if ( !file.isOpen() ) { + if ( !file.open( QIODevice::Unbuffered | QIODevice::WriteOnly | QIODevice::Append ) ) { return -1; } @@ -85,10 +83,11 @@ int main( int argc, const char** argv ) file.close(); - file.open( QIODevice::Unbuffered | QIODevice::ReadOnly | QIODevice::Append ); + if ( !file.open( QIODevice::Unbuffered | QIODevice::ReadOnly | QIODevice::Append ) ) { + return -1; + } LOG_INFO << "Write to " << argv[ 1 ] << " finished, size " << file.size(); - file.close(); return 0; From 42661a329c539c0d00e24a1ab071d482e4eee87c Mon Sep 17 00:00:00 2001 From: Daniel Aviv <76743397+o3wiz@users.noreply.github.com> Date: Sun, 21 Jun 2026 08:16:41 +0300 Subject: [PATCH 08/13] Vcpkg migrate qt (#5) * ignore DS_Store * qt6 vcpkg * discard older qt versions if defs --- .gitignore | 1 + src/app/main.cpp | 24 ---------------------- src/filewatch/src/filewatcher.cpp | 3 --- src/settings/src/configuration.cpp | 32 ++++++++++-------------------- src/ui/include/fontutils.h | 13 ------------ src/ui/src/crawlerwidget.cpp | 4 ---- src/ui/src/quickfind.cpp | 21 +++----------------- src/utils/include/active_screen.h | 12 +---------- vcpkg.json | 22 ++++++++++++++++---- 9 files changed, 34 insertions(+), 98 deletions(-) diff --git a/.gitignore b/.gitignore index 65af074aa..978af9da8 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ cmake-build-relwithdebinfo/ #website website/hugo website/resources/ +.DS_Store diff --git a/src/app/main.cpp b/src/app/main.cpp index a4545a118..f96a62cc0 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -83,32 +83,8 @@ void setApplicationAttributes( bool enableQtHdpi, int scaleFactorRounding ) // - https://bugreports.qt.io/browse/QTBUG-46015 qputenv( "QT_BEARER_POLL_TIMEOUT", QByteArray::number( std::numeric_limits::max() ) ); -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) -#ifdef Q_OS_WIN - QCoreApplication::setAttribute( Qt::AA_DisableWindowContextHelpButton ); -#endif - - if ( !enableQtHdpi ) { - QCoreApplication::setAttribute( Qt::AA_DisableHighDpiScaling ); - } - else { - -#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) - QGuiApplication::setHighDpiScaleFactorRoundingPolicy( - static_cast( scaleFactorRounding ) ); -#else - Q_UNUSED( scaleFactorRounding ); -#endif - - // This attribute must be set before QGuiApplication is constructed: - QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling ); - // We support high-dpi (aka Retina) displays - QCoreApplication::setAttribute( Qt::AA_UseHighDpiPixmaps ); - } -#else Q_UNUSED( enableQtHdpi ); Q_UNUSED( scaleFactorRounding ); -#endif QCoreApplication::setAttribute( Qt::AA_DontShowIconsInMenus ); } diff --git a/src/filewatch/src/filewatcher.cpp b/src/filewatch/src/filewatcher.cpp index b30015d61..d43766c23 100644 --- a/src/filewatch/src/filewatcher.cpp +++ b/src/filewatch/src/filewatcher.cpp @@ -29,9 +29,6 @@ #include -#if QT_VERSION_MAJOR < 6 -#include // Qt5 use -#endif #include #include #include diff --git a/src/settings/src/configuration.cpp b/src/settings/src/configuration.cpp index f107bc6cf..04f142af4 100644 --- a/src/settings/src/configuration.cpp +++ b/src/settings/src/configuration.cpp @@ -141,27 +141,17 @@ void Configuration::retrieveFromStorage( QSettings& settings ) DefaultConfiguration.enableMainSearchHighlightVariance_ ) .toBool(); - mainSearchBackColor_ -#if QT_VERSION <= QT_VERSION_CHECK( 6, 4, 0 ) - .setNamedColor( -#else - = QColor::fromString( -#endif - settings - .value( "regexpType.mainBackColor", - DefaultConfiguration.mainSearchBackColor_.name( QColor::HexArgb ) ) - .toString() ); - - qfBackColor_ -#if QT_VERSION <= QT_VERSION_CHECK( 6, 4, 0 ) - .setNamedColor( -#else - = QColor::fromString( -#endif - settings - .value( "regexpType.quickfindBackColor", - DefaultConfiguration.qfBackColor_.name( QColor::HexArgb ) ) - .toString() ); + mainSearchBackColor_ = QColor::fromString( + settings + .value( "regexpType.mainBackColor", + DefaultConfiguration.mainSearchBackColor_.name( QColor::HexArgb ) ) + .toString() ); + + qfBackColor_ = QColor::fromString( + settings + .value( "regexpType.quickfindBackColor", + DefaultConfiguration.qfBackColor_.name( QColor::HexArgb ) ) + .toString() ); qfIgnoreCase_ = settings.value( "quickfind.ignore_case", DefaultConfiguration.qfIgnoreCase_ ).toBool(); diff --git a/src/ui/include/fontutils.h b/src/ui/include/fontutils.h index 1e0ffd66d..b8f537f7a 100644 --- a/src/ui/include/fontutils.h +++ b/src/ui/include/fontutils.h @@ -35,31 +35,18 @@ class FontUtils { // We only show the fixed fonts QStringList fixedFamilies; -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - QFontDatabase database; - const auto families = database.families(); - for ( const auto& family : families ) { - if ( database.isFixedPitch( family ) ) - fixedFamilies << family; - } -#else const auto families = QFontDatabase::families(); for ( const auto& family : families ) { if ( QFontDatabase::isFixedPitch( family ) ) fixedFamilies << family; } -#endif return fixedFamilies; } static QList availableFontSizes( const QString& family ) { -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - auto sizes = QFontDatabase().pointSizes( family, "" ); -#else auto sizes = QFontDatabase::pointSizes( family, "" ); -#endif if ( sizes.empty() ) { sizes = QFontDatabase::standardSizes(); diff --git a/src/ui/src/crawlerwidget.cpp b/src/ui/src/crawlerwidget.cpp index c8d86f0f3..e720c6d56 100644 --- a/src/ui/src/crawlerwidget.cpp +++ b/src/ui/src/crawlerwidget.cpp @@ -449,11 +449,7 @@ void CrawlerWidget::editSearchHistory() if ( ok ) { savedSearches_->clear(); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 ) auto items = newHistory.split( QChar::LineFeed, Qt::SkipEmptyParts ); -#else - auto items = newHistory.split( QChar::LineFeed, QString::SkipEmptyParts ); -#endif std::for_each( items.rbegin(), items.rend(), [ this ]( const auto& item ) { savedSearches_->addRecent( item ); LOG_INFO << item; diff --git a/src/ui/src/quickfind.cpp b/src/ui/src/quickfind.cpp index 0e3beebed..98511f43a 100644 --- a/src/ui/src/quickfind.cpp +++ b/src/ui/src/quickfind.cpp @@ -200,15 +200,10 @@ void QuickFind::incrementallySearchForward( Selection selection, QuickFindMatche incrementalSearchStatus_ = IncrementalSearchStatus( Forward, start_position, selection ); } -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - operationFuture_ = QtConcurrent::run( this, &QuickFind::doSearchForward, start_position, - selection, matcher ); -#else operationFuture_ = QtConcurrent::run( qOverload( &QuickFind::doSearchForward ), this, start_position, selection, matcher ); -#endif operationWatcher_.setFuture( operationFuture_ ); } @@ -234,15 +229,11 @@ void QuickFind::incrementallySearchBackward( Selection selection, QuickFindMatch incrementalSearchStatus_ = IncrementalSearchStatus( Backward, start_position, selection ); } -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - operationFuture_ = QtConcurrent::run( this, &QuickFind::doSearchBackward, start_position, - selection, matcher ); -#else operationFuture_ = QtConcurrent::run( qOverload( &QuickFind::doSearchBackward ), this, start_position, selection, matcher ); -#endif + operationWatcher_.setFuture( operationFuture_ ); } @@ -252,13 +243,10 @@ void QuickFind::searchForward( Selection selection, QuickFindMatcher matcher ) interruptRequested_.set(); operationWatcher_.waitForFinished(); -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - operationFuture_ = QtConcurrent::run( this, &QuickFind::doSearchForward, selection, matcher ); -#else operationFuture_ = QtConcurrent::run( qOverload( &QuickFind::doSearchForward ), this, selection, matcher ); -#endif + operationWatcher_.setFuture( operationFuture_ ); } @@ -268,13 +256,10 @@ void QuickFind::searchBackward( Selection selection, QuickFindMatcher matcher ) interruptRequested_.set(); operationWatcher_.waitForFinished(); -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - operationFuture_ = QtConcurrent::run( this, &QuickFind::doSearchBackward, selection, matcher ); -#else operationFuture_ = QtConcurrent::run( qOverload( &QuickFind::doSearchBackward ), this, selection, matcher ); -#endif + operationWatcher_.setFuture( operationFuture_ ); } diff --git a/src/utils/include/active_screen.h b/src/utils/include/active_screen.h index da115d91e..e82fca071 100644 --- a/src/utils/include/active_screen.h +++ b/src/utils/include/active_screen.h @@ -24,17 +24,7 @@ #include static inline QScreen* activeScreen(QWidget* widget) { - if (widget == nullptr) return nullptr; - - QScreen* screen = nullptr; -#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) - screen = widget->screen(); -#else - (void) widget->winId(); // make Qt create native window - QWindow* window = widget->windowHandle(); - screen = window ? window->screen() : nullptr; -#endif - return screen; + return widget == nullptr ? nullptr : widget->screen(); } #endif diff --git a/vcpkg.json b/vcpkg.json index 7579096ed..4124b7de0 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,9 +1,5 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", - "name": "klogg", - "version": "24.11.0", - "description": "klogg log viewer", - "homepage": "https://github.com/variar/klogg", "builtin-baseline": "32305df7d0b9a308e6ac454dd98ebfe550342c09", "dependencies": [ "simdutf", @@ -17,6 +13,24 @@ "efsw", "tbb", "mimalloc", + "qtbase", + { + "name": "qt5compat", + "default-features": false, + "features": [ + "big-codecs", + "codecs", + "textcodec" + ] + }, + { + "name": "qttools", + "host": true, + "default-features": false, + "features": [ + "linguist" + ] + }, { "name": "vectorscan", "platform": "!windows" From 36c437b207f0f0f07276491d6d66489ae3dd4aa6 Mon Sep 17 00:00:00 2001 From: Daniel Aviv <76743397+o3wiz@users.noreply.github.com> Date: Sun, 21 Jun 2026 10:44:12 +0300 Subject: [PATCH 09/13] Keyboard shortcuts (#6) * previous and next tabs shortcuts * move tab shortcuts --- src/settings/include/shortcuts.h | 4 +++ src/settings/src/shortcuts.cpp | 30 +++++++++++++++++ src/ui/include/tabbedcrawlerwidget.h | 8 +++++ src/ui/src/mainwindow.cpp | 12 +++++++ src/ui/src/tabbedcrawlerwidget.cpp | 49 ++++++++++++++++++++++++++-- 5 files changed, 101 insertions(+), 2 deletions(-) diff --git a/src/settings/include/shortcuts.h b/src/settings/include/shortcuts.h index 1142f0a5f..22acc394d 100644 --- a/src/settings/include/shortcuts.h +++ b/src/settings/include/shortcuts.h @@ -76,6 +76,10 @@ struct ShortcutAction { static constexpr auto MainWindowCopyPathToClipboard = "mainwindow.copy_path_to_clipboard"; static constexpr auto MainWindowOpenFromClipboard = "mainwindow.open_from_clipboard"; static constexpr auto MainWindowOpenFromUrl = "mainwindow.open_from_url"; + static constexpr auto MainWindowNextTab = "mainwindow.next_tab"; + static constexpr auto MainWindowPreviousTab = "mainwindow.previous_tab"; + static constexpr auto MainWindowMoveTabLeft = "mainwindow.move_tab_left"; + static constexpr auto MainWindowMoveTabRight = "mainwindow.move_tab_right"; static constexpr auto LogViewMark = "logview.mark"; static constexpr auto LogViewNextMark = "logview.next_mark"; diff --git a/src/settings/src/shortcuts.cpp b/src/settings/src/shortcuts.cpp index 8241c6517..db6bb8402 100644 --- a/src/settings/src/shortcuts.cpp +++ b/src/settings/src/shortcuts.cpp @@ -244,6 +244,36 @@ const ShortcutAction::ShortcutList& ShortcutAction::defaultShortcutList() QStringList{}, }, }, + { + MainWindowNextTab, + { + QApplication::tr( "Switch to next tab" ), + QStringList{ QKeySequence( Qt::CTRL | Qt::SHIFT | Qt::Key_BracketRight ).toString() }, + }, + }, + { + MainWindowPreviousTab, + { + QApplication::tr( "Switch to previous tab" ), + QStringList{ QKeySequence( Qt::CTRL | Qt::SHIFT | Qt::Key_BracketLeft ).toString() }, + }, + }, + { + MainWindowMoveTabLeft, + { + QApplication::tr( "Move current tab left" ), + QStringList{ QKeySequence( Qt::CTRL | Qt::SHIFT | Qt::ALT | Qt::Key_BracketLeft ) + .toString() }, + }, + }, + { + MainWindowMoveTabRight, + { + QApplication::tr( "Move current tab right" ), + QStringList{ QKeySequence( Qt::CTRL | Qt::SHIFT | Qt::ALT | Qt::Key_BracketRight ) + .toString() }, + }, + }, { MainWindowFollowFile, { diff --git a/src/ui/include/tabbedcrawlerwidget.h b/src/ui/include/tabbedcrawlerwidget.h index fa10eafc7..c92433023 100644 --- a/src/ui/include/tabbedcrawlerwidget.h +++ b/src/ui/include/tabbedcrawlerwidget.h @@ -71,6 +71,14 @@ class TabbedCrawlerWidget : public QTabWidget { void removeCrawler( int index ); + // Switch to the next/previous tab, wrapping around at the ends. + void selectNextTab(); + void selectPreviousTab(); + + // Relocate the current tab one position left/right. Does not wrap around. + void moveCurrentTabLeft(); + void moveCurrentTabRight(); + protected: void keyPressEvent( QKeyEvent* event ) override; void mouseReleaseEvent( QMouseEvent* event ) override; diff --git a/src/ui/src/mainwindow.cpp b/src/ui/src/mainwindow.cpp index 92d0786c9..96e9b9643 100644 --- a/src/ui/src/mainwindow.cpp +++ b/src/ui/src/mainwindow.cpp @@ -698,6 +698,18 @@ void MainWindow::updateShortcuts() ShortcutAction::registerShortcut( shortcuts, shortcuts_, this, Qt::WindowShortcut, ShortcutAction::MainWindowMin, [ this ] { this->showMinimized(); } ); + ShortcutAction::registerShortcut( shortcuts, shortcuts_, this, Qt::WindowShortcut, + ShortcutAction::MainWindowNextTab, + [ this ] { mainTabWidget_.selectNextTab(); } ); + ShortcutAction::registerShortcut( shortcuts, shortcuts_, this, Qt::WindowShortcut, + ShortcutAction::MainWindowPreviousTab, + [ this ] { mainTabWidget_.selectPreviousTab(); } ); + ShortcutAction::registerShortcut( shortcuts, shortcuts_, this, Qt::WindowShortcut, + ShortcutAction::MainWindowMoveTabLeft, + [ this ] { mainTabWidget_.moveCurrentTabLeft(); } ); + ShortcutAction::registerShortcut( shortcuts, shortcuts_, this, Qt::WindowShortcut, + ShortcutAction::MainWindowMoveTabRight, + [ this ] { mainTabWidget_.moveCurrentTabRight(); } ); auto setShortcuts = [ &shortcuts ]( auto* action, const auto& actionName ) { action->setShortcuts( ShortcutAction::shortcutKeys( actionName, shortcuts ) ); diff --git a/src/ui/src/tabbedcrawlerwidget.cpp b/src/ui/src/tabbedcrawlerwidget.cpp index b85301fea..3a42b127f 100644 --- a/src/ui/src/tabbedcrawlerwidget.cpp +++ b/src/ui/src/tabbedcrawlerwidget.cpp @@ -274,6 +274,51 @@ void TabbedCrawlerWidget::showContextMenu( int tab, QPoint globalPoint ) menu.exec( globalPoint ); } +void TabbedCrawlerWidget::selectNextTab() +{ + const int tabCount = count(); + if ( tabCount <= 1 ) { + return; + } + + const int currTabIdx = currentIndex(); + const int nextTabIdx = ( currTabIdx + 1 ) % tabCount; + setCurrentIndex( nextTabIdx ); +} + +void TabbedCrawlerWidget::selectPreviousTab() +{ + const int tabCount = count(); + if ( tabCount <= 1 ) { + return; + } + + const int currTabIdx = currentIndex(); + const int prevTabIdx = ( currTabIdx + ( tabCount - 1 ) ) % tabCount; + setCurrentIndex( prevTabIdx ); +} + +void TabbedCrawlerWidget::moveCurrentTabLeft() +{ + const int currTabIdx = currentIndex(); + if ( currTabIdx <= 0 ) { + return; + } + + tabBar()->moveTab( currTabIdx, currTabIdx - 1 ); +} + +void TabbedCrawlerWidget::moveCurrentTabRight() +{ + const int tabCount = count(); + const int currTabIdx = currentIndex(); + if ( !( 0 <= currTabIdx && currTabIdx + 1 < tabCount ) ) { + return; + } + + tabBar()->moveTab( currTabIdx, currTabIdx + 1 ); +} + void TabbedCrawlerWidget::keyPressEvent( QKeyEvent* event ) { const auto mod = event->modifiers(); @@ -286,14 +331,14 @@ void TabbedCrawlerWidget::keyPressEvent( QKeyEvent* event ) || ( mod == Qt::ControlModifier && key == Qt::Key_PageDown ) || ( mod == ( Qt::ControlModifier | Qt::AltModifier | Qt::KeypadModifier ) && key == Qt::Key_Right ) ) { - setCurrentIndex( ( currentIndex() + 1 ) % count() ); + selectNextTab(); } // Ctrl + shift + tab else if ( ( mod == ( Qt::ControlModifier | Qt::ShiftModifier ) && key == Qt::Key_Tab ) || ( mod == Qt::ControlModifier && key == Qt::Key_PageUp ) || ( mod == ( Qt::ControlModifier | Qt::AltModifier | Qt::KeypadModifier ) && key == Qt::Key_Left ) ) { - setCurrentIndex( ( currentIndex() - 1 >= 0 ) ? currentIndex() - 1 : count() - 1 ); + selectPreviousTab(); } // Ctrl + numbers else if ( mod == Qt::ControlModifier && ( key >= Qt::Key_1 && key <= Qt::Key_8 ) ) { From a37847091f3914667352310dff3122fa5dbf28fe Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Sun, 21 Jun 2026 12:22:04 +0300 Subject: [PATCH 10/13] enhanced filter buttons look and feel --- src/ui/src/crawlerwidget.cpp | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/ui/src/crawlerwidget.cpp b/src/ui/src/crawlerwidget.cpp index e720c6d56..d69d97af0 100644 --- a/src/ui/src/crawlerwidget.cpp +++ b/src/ui/src/crawlerwidget.cpp @@ -47,8 +47,8 @@ #include "log.h" #include +#include #include -#include #include #include @@ -79,6 +79,30 @@ static constexpr char AnsiColorSequenceRegex[] = "\\x1B\\[([0-9]{1,4}((;|:)[0-9]{1,3})*)?[mK]"; +static constexpr char SearchOptionButtonStyle[] = R"( +QToolButton { + border: 1px solid transparent; + border-radius: 3px; + padding: 2px; + margin: 1px; + background: transparent; +} +QToolButton:hover { + background: rgba(128, 128, 128, 0.25); +} +QToolButton:checked { + border: 1px solid #007ACC; + background: rgba(0, 122, 204, 0.35); +} +QToolButton:checked:hover { + border: 1px solid #007ACC; + background: rgba(0, 122, 204, 0.45); +} +QToolButton:pressed { + background: rgba(0, 122, 204, 0.55); +} +)"; + // Palette for error signaling (yellow background) const QPalette CrawlerWidget::ErrorPalette( Qt::darkYellow ); @@ -1070,6 +1094,17 @@ void CrawlerWidget::setup() searchRefreshButton_->setFocusPolicy( Qt::NoFocus ); searchRefreshButton_->setContentsMargins( 2, 2, 2, 2 ); + const std::array filterOptButtons{ + matchCaseButton_, // + useRegexpButton_, // + inverseButton_, // + booleanButton_, // + searchRefreshButton_, // + }; + for ( QToolButton* optionButton : filterOptButtons ) { + optionButton->setStyleSheet( SearchOptionButtonStyle ); + } + // Construct the Search line searchLineCompleter_ = new QCompleter( savedSearches_->recentSearches(), this ); searchLineEdit_ = new QComboBox; From 45e61e88135db7872f8825f18d2d6a5a1699e0f6 Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Sun, 21 Jun 2026 12:36:46 +0300 Subject: [PATCH 11/13] dim main window when filtered window is focused and vice versa --- src/ui/include/abstractlogview.h | 10 +++++++++ src/ui/include/crawlerwidget.h | 2 ++ src/ui/src/abstractlogview.cpp | 35 ++++++++++++++++++++++++++++++++ src/ui/src/crawlerwidget.cpp | 16 +++++++++++++++ 4 files changed, 63 insertions(+) diff --git a/src/ui/include/abstractlogview.h b/src/ui/include/abstractlogview.h index de1a5867a..f3f3a3cfd 100644 --- a/src/ui/include/abstractlogview.h +++ b/src/ui/include/abstractlogview.h @@ -130,6 +130,9 @@ class AbstractLogView : public QAbstractScrollArea, public SearchableWidgetInter // Instructs the widget to update it's content geometry, // used when the font is changed. void updateDisplaySize(); + + // Dim the view (drawn faded) to indicate it does not hold focus. + void setDimmed( bool dimmed ); // Return the line number of the top line of the view LineNumber getTopLine() const; // Return the text of the current selection. @@ -165,6 +168,8 @@ class AbstractLogView : public QAbstractScrollArea, public SearchableWidgetInter void mouseDoubleClickEvent( QMouseEvent* mouseEvent ) override; void timerEvent( QTimerEvent* timerEvent ) override; void changeEvent( QEvent* changeEvent ) override; + void focusInEvent( QFocusEvent* focusEvent ) override; + void focusOutEvent( QFocusEvent* focusEvent ) override; void paintEvent( QPaintEvent* paintEvent ) override; void resizeEvent( QResizeEvent* resizeEvent ) override; void scrollContentsBy( int dx, int dy ) override; @@ -229,6 +234,9 @@ class AbstractLogView : public QAbstractScrollArea, public SearchableWidgetInter // (switch to the next one) void exitView(); + // Sent up when this view gains or loses keyboard focus. + void focusChanged(); + void changeSearchLimits( LineNumber startLine, LineNumber endLine ); void clearSearchLimits(); @@ -367,6 +375,8 @@ class AbstractLogView : public QAbstractScrollArea, public SearchableWidgetInter LineNumber firstLine_; bool lastLineAligned_ = false; bool useTextWrap_ = false; + // When true the view is drawn faded to show it does not hold focus. + bool dimmed_ = false; LineColumn firstCol_ = 0_lcol; struct WrappedLineData { diff --git a/src/ui/include/crawlerwidget.h b/src/ui/include/crawlerwidget.h index 7fe1a4dd6..edd0633fb 100644 --- a/src/ui/include/crawlerwidget.h +++ b/src/ui/include/crawlerwidget.h @@ -190,6 +190,8 @@ class CrawlerWidget : public QSplitter, // Stop the currently ongoing search (if one exists) void stopSearch(); void loadIcons(); + // Dim whichever of the two views does not currently hold focus. + void updateInactiveViewDimming(); // QuickFind is being entered, save the focus for incremental qf. void enteringQuickFind(); // QuickFind is being closed. diff --git a/src/ui/src/abstractlogview.cpp b/src/ui/src/abstractlogview.cpp index bf83a3d32..3c98b5fd7 100644 --- a/src/ui/src/abstractlogview.cpp +++ b/src/ui/src/abstractlogview.cpp @@ -136,6 +136,10 @@ inline int countLeadingZeroes( uint64_t value ) namespace { +// Opacity of the overlay painted over a view that does not hold focus, so the +// inactive view fades toward the background. Tunable: higher = more dimming. +constexpr int InactiveViewDimAlpha = 100; // out of 255 (~0.4) + int mapPullToFollowLength( int length ); int intLog2( uint64_t x ) @@ -467,6 +471,30 @@ void AbstractLogView::changeEvent( QEvent* changeEvent ) viewport()->update(); } +void AbstractLogView::focusInEvent( QFocusEvent* focusEvent ) +{ + QAbstractScrollArea::focusInEvent( focusEvent ); + Q_EMIT focusChanged(); +} + +void AbstractLogView::focusOutEvent( QFocusEvent* focusEvent ) +{ + QAbstractScrollArea::focusOutEvent( focusEvent ); + Q_EMIT focusChanged(); +} + +void AbstractLogView::setDimmed( bool dimmed ) +{ + if ( dimmed_ == dimmed ) { + return; + } + + dimmed_ = dimmed; + // The dim overlay is painted on top of the cached pixmap, so a repaint of + // the viewport is enough; the text cache does not need invalidating. + viewport()->update(); +} + void AbstractLogView::mousePressEvent( QMouseEvent* mouseEvent ) { auto line = convertCoordToLine( mouseEvent->pos().y() ); @@ -1157,6 +1185,13 @@ void AbstractLogView::paintEvent( QPaintEvent* paintEvent ) devicePainter.drawPixmap( 0, drawingPullToFollowTopPosition, pullToFollowCache_.pixmap_ ); } + // Fade the view when it does not hold focus, so the active view stands out. + if ( dimmed_ ) { + QColor dimColor = viewport()->palette().color( QPalette::Window ); + dimColor.setAlpha( InactiveViewDimAlpha ); + devicePainter.fillRect( viewport()->rect(), dimColor ); + } + LOG_DEBUG << "End of repaint " << std::chrono::duration_cast( std::chrono::system_clock::now() - start ) diff --git a/src/ui/src/crawlerwidget.cpp b/src/ui/src/crawlerwidget.cpp index d69d97af0..803010115 100644 --- a/src/ui/src/crawlerwidget.cpp +++ b/src/ui/src/crawlerwidget.cpp @@ -795,6 +795,15 @@ AbstractLogView* CrawlerWidget::activeView() const } } +void CrawlerWidget::updateInactiveViewDimming() +{ + const bool filteredFocused = filteredView_->hasFocus(); + logMainView_->setDimmed( filteredFocused ); + + const bool mainFocused = logMainView_->hasFocus(); + filteredView_->setDimmed( mainFocused ); +} + void CrawlerWidget::searchForward() { LOG_DEBUG << "CrawlerWidget::searchForward"; @@ -1264,6 +1273,10 @@ void CrawlerWidget::setup() // Detect activity in the views connect( logMainView_, &LogMainView::activity, this, &CrawlerWidget::activityDetected ); + // Keep the inactive view dimmed as focus moves between the views. + connect( logMainView_, &LogMainView::focusChanged, this, + &CrawlerWidget::updateInactiveViewDimming ); + connect( logMainView_, &LogMainView::changeSearchLimits, this, &CrawlerWidget::setSearchLimits ); @@ -1449,6 +1462,9 @@ void CrawlerWidget::connectAllFilteredViewSlots( FilteredView* view ) connect( view, &AbstractLogView::clearColorLabels, this, &CrawlerWidget::clearColorLabels ); + connect( view, &AbstractLogView::focusChanged, this, + &CrawlerWidget::updateInactiveViewDimming ); + connect( logMainView_, &LogMainView::exitView, view, QOverload<>::of( &FilteredView::setFocus ) ); } From 6c7285ab40eafcb78ff5133b7e8f92b182b3d87b Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Sun, 21 Jun 2026 12:52:24 +0300 Subject: [PATCH 12/13] added cpack --- CMakePresets.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index afef7490e..7c67628dc 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -121,5 +121,33 @@ "name": "windows-relwithdebinfo", "configuration": "RelWithDebInfo" } + ], + "packagePresets": [ + { + "hidden": true, + "name": "__package_base", + "configurations": [ + "Release" + ], + "packageDirectory": "packages" + }, + { + "inherits": "__package_base", + "name": "mac-package", + "displayName": "macOS DMG (Release)", + "configurePreset": "mac", + "generators": [ + "DragNDrop" + ] + }, + { + "inherits": "__package_base", + "name": "linux-package", + "displayName": "Linux DEB (Release)", + "configurePreset": "linux", + "generators": [ + "DEB" + ] + } ] } From 062bca3039e4802a1f057ea0ef6fef0c8b39fdb7 Mon Sep 17 00:00:00 2001 From: Daniel Aviv Date: Sun, 21 Jun 2026 12:55:37 +0300 Subject: [PATCH 13/13] minor++ --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6bd50783..3b4c7f49d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12) project( klogg - VERSION 24.11.0 + VERSION 24.12.0 DESCRIPTION "klogg log viewer" LANGUAGES C CXX ASM )