Refactor Native Messages (#4738)

* refactor: move ipc queue into its own class

* refactor: move windows.h related functions to AW

* refactor: make NM-Client methods static

* refactor: json access

* refactor: use struct initializer

* refactor: move `handleMessage` to anon-namespace

* refactor: clean-up includes

* refactor: move action handler to functions

* refactor: cleanup `handleSelect`

* fix: cleanup clang-tidy warnings

* chore: simplify json

* revert: keep handlers as methods

This is more readable and extensible.

* fix: typo

* fix: namespace

* fix: rename define

* refactor: `IpcQueue` to be simpler

* fix: rename cmake option

* fix: use variant when constructing

* fix: make it a ref

* fix: its a pair now
This commit is contained in:
nerix
2023-07-30 13:14:58 +02:00
committed by GitHub
parent c496a68633
commit 378aee7ab1
9 changed files with 301 additions and 186 deletions
+8
View File
@@ -3,6 +3,9 @@ set(VERSION_PROJECT "${LIBRARY_PROJECT}-version")
set(EXECUTABLE_PROJECT "${PROJECT_NAME}")
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00)
# registers the native messageing host
option(CHATTERINO_DEBUG_NATIVE_MESSAGES "Debug native messages" OFF)
set(SOURCE_FILES
Application.cpp
Application.hpp
@@ -408,6 +411,8 @@ set(SOURCE_FILES
util/IncognitoBrowser.hpp
util/InitUpdateButton.cpp
util/InitUpdateButton.hpp
util/IpcQueue.cpp
util/IpcQueue.hpp
util/LayoutHelper.cpp
util/LayoutHelper.hpp
util/NuulsUploader.cpp
@@ -847,6 +852,9 @@ if (WIN32)
set_target_properties(${EXECUTABLE_PROJECT} PROPERTIES WIN32_EXECUTABLE TRUE)
endif ()
endif ()
if (CHATTERINO_DEBUG_NATIVE_MESSAGES)
target_compile_definitions(${LIBRARY_PROJECT} PRIVATE CHATTERINO_DEBUG_NM)
endif ()
if (MSVC)
target_compile_options(${LIBRARY_PROJECT} PUBLIC /EHsc /bigobj)