-
Notifications
You must be signed in to change notification settings - Fork 2
Integrate Qt6 UI engine and add NSIS installer #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| cmake_minimum_required(VERSION 3.16) | ||
| project(DirectDesktopSuite) | ||
|
|
||
| # 1. New Qt6 Engine (Optional) | ||
| find_package(Qt6 COMPONENTS Core Gui Quick Widgets QUIET) | ||
| if(NOT Qt6_FOUND) | ||
| message(STATUS "Qt6 not found. DirectDesktop will build without Qt engine.") | ||
| endif() | ||
|
|
||
| # 2. Main DirectUI + Qt Application | ||
| add_subdirectory(DirectDesktop) | ||
|
|
||
| # 3. Consolidation (Install to 'bin' folder in build directory) | ||
| set(OUTPUT_DIR "bin") | ||
|
|
||
| install(TARGETS DirectDesktop RUNTIME DESTINATION "${OUTPUT_DIR}") | ||
| if(Qt6_FOUND) | ||
| # Deploy Qt libraries | ||
| get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) | ||
| get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) | ||
| find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}") | ||
|
|
||
| if(WINDEPLOYQT_EXECUTABLE) | ||
| install(CODE " | ||
| execute_process(COMMAND \"${WINDEPLOYQT_EXECUTABLE}\" | ||
| --release | ||
| --no-translations | ||
| --no-compiler-runtime | ||
| --no-opengl-sw | ||
| --no-system-d3d-compiler | ||
| \"\${CMAKE_INSTALL_PREFIX}/${OUTPUT_DIR}/DirectDesktop.exe\") | ||
| ") | ||
| endif() | ||
| endif() | ||
|
|
||
| # Copy UI files for DirectUI | ||
| install(DIRECTORY "${CMAKE_SOURCE_DIR}/DirectDesktop/ui" DESTINATION "${OUTPUT_DIR}/DirectDesktop") | ||
| install(DIRECTORY "${CMAKE_SOURCE_DIR}/DirectDesktop/ImageResources" DESTINATION "${OUTPUT_DIR}/DirectDesktop") | ||
|
|
||
| # Copy C# binaries if they exist | ||
| find_program(DOTNET_EXE dotnet) | ||
| if(DOTNET_EXE) | ||
| install(CODE " | ||
| file(GLOB_RECURSE CS_BINS \"${CMAKE_SOURCE_DIR}/DirectDesktopSettings/bin/Release/net11.0-windows/*\") | ||
| foreach(file \${CS_BINS}) | ||
| file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${OUTPUT_DIR}\" TYPE FILE FILES \"\${file}\") | ||
| endforeach() | ||
| ") | ||
| endif() | ||
|
|
||
| # 4. CPack Installer Configuration | ||
| set(CPACK_PACKAGE_NAME "DirectDesktop") | ||
| set(CPACK_PACKAGE_VENDOR "Rectify11") | ||
| set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DirectDesktop Custom Desktop Shell") | ||
| set(CPACK_PACKAGE_VERSION "1.0.0") | ||
| set(CPACK_PACKAGE_INSTALL_DIRECTORY "DirectDesktop") | ||
| set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/.gitignore") # Placeholder if no LICENSE file | ||
|
|
||
| # NSIS Specifics | ||
| set(CPACK_GENERATOR "NSIS") | ||
| set(CPACK_NSIS_DISPLAY_NAME "DirectDesktop") | ||
| set(CPACK_NSIS_PACKAGE_NAME "DirectDesktop") | ||
| set(CPACK_NSIS_HELP_LINK "https://github.com/Rectify11/DirectDesktop") | ||
| set(CPACK_NSIS_URL_INFO_ABOUT "https://github.com/Rectify11/DirectDesktop") | ||
| set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/DirectDesktop/DirectDesktop.ico") | ||
| set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/DirectDesktop/DirectDesktop.ico") | ||
|
|
||
| # Shortcuts: Point to the Settings app so users know what it's doing | ||
| set(CPACK_NSIS_CREATE_ICONS_EXTRA " | ||
| CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\DirectDesktop Control Panel.lnk' '$INSTDIR\\\\bin\\\\DirectDesktopSettings.exe' | ||
| CreateShortCut '$DESKTOP\\\\DirectDesktop Control Panel.lnk' '$INSTDIR\\\\bin\\\\DirectDesktopSettings.exe' | ||
| ") | ||
| set(CPACK_NSIS_DELETE_ICONS_EXTRA " | ||
| Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\DirectDesktop Control Panel.lnk' | ||
| Delete '$DESKTOP\\\\DirectDesktop Control Panel.lnk' | ||
| ") | ||
|
|
||
| # Registry entry for auto-start or identification | ||
| set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " | ||
| WriteRegStr HKLM 'Software\\\\DirectDesktop' 'InstallDir' '$INSTDIR' | ||
| ") | ||
|
|
||
| include(CPack) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| cmake_minimum_required(VERSION 3.16) | ||
| project(DirectDesktopWin32 LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
|
|
||
| # MSVC specific flags to match .vcxproj | ||
| if(MSVC) | ||
| add_definitions(-DUNICODE -D_UNICODE -DDIRECTUI_STATIC -DDUSER_STATIC) | ||
| endif() | ||
|
|
||
| # Collect source files | ||
| file(GLOB SRC_FILES_ROOT "*.cpp") | ||
| file(GLOB SRC_FILES_BACKEND "backend/*.cpp") | ||
| file(GLOB SRC_FILES_COREUI "coreui/*.cpp") | ||
| file(GLOB SRC_FILES_UI "ui/*.cpp") | ||
|
|
||
| # Exclude QtEngine.cpp from the main list as it is built separately | ||
| list(REMOVE_ITEM SRC_FILES_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/QtEngine.cpp") | ||
|
|
||
| set(SRC_FILES | ||
| ${SRC_FILES_ROOT} | ||
| ${SRC_FILES_BACKEND} | ||
| ${SRC_FILES_COREUI} | ||
| ${SRC_FILES_UI} | ||
| "Include/dui70/DirectUI/DirectUI.cpp" | ||
| ) | ||
|
|
||
| # Main executable target | ||
| add_executable(DirectDesktop WIN32 | ||
| ${SRC_FILES} | ||
| DirectDesktop.rc | ||
| DirectDesktop.manifest | ||
| ) | ||
|
|
||
| # Apply compiler options to the main target | ||
| if(MSVC) | ||
| target_compile_options(DirectDesktop PRIVATE /Zc:wchar_t-) | ||
| target_compile_definitions(DirectDesktop PRIVATE _HAS_STD_BYTE=0) | ||
| endif() | ||
|
|
||
| # Include directories | ||
| target_include_directories(DirectDesktop PRIVATE | ||
| ${CMAKE_CURRENT_SOURCE_DIR} | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/backend | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/coreui | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/ui | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/Include | ||
| ) | ||
|
|
||
| # Link the provided and system libraries | ||
| target_link_libraries(DirectDesktop PRIVATE | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/dui70.lib | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/DUser.lib | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/Everything64.lib | ||
| user32 | ||
| shell32 | ||
| gdi32 | ||
| comctl32 | ||
| ole32 | ||
| shlwapi | ||
| dwmapi | ||
| uxtheme | ||
| windowscodecs | ||
| gdiplus | ||
| advapi32 | ||
| shcore | ||
| wtsapi32 | ||
| powrprof | ||
| oleaut32 | ||
| ) | ||
|
|
||
| # Embed Qt Engine if available | ||
| if(Qt6_FOUND) | ||
| add_library(DirectDesktopQtEngine STATIC QtEngine.cpp ui/qml.qrc) | ||
|
|
||
| # Qt requires _HAS_STD_BYTE=1 and doesn't use the /Zc:wchar_t- flag | ||
| target_compile_definitions(DirectDesktopQtEngine PRIVATE _HAS_STD_BYTE=1 ENABLE_QT DIRECTUI_STATIC DUSER_STATIC) | ||
| set_target_properties(DirectDesktopQtEngine PROPERTIES AUTOMOC ON AUTORCC ON AUTOUIC ON) | ||
|
|
||
| target_link_libraries(DirectDesktopQtEngine PRIVATE | ||
| Qt6::Core | ||
| Qt6::Gui | ||
| Qt6::Quick | ||
| Qt6::Widgets | ||
| ) | ||
|
|
||
| target_compile_definitions(DirectDesktop PRIVATE ENABLE_QT) | ||
| target_link_libraries(DirectDesktop PRIVATE DirectDesktopQtEngine) | ||
| endif() | ||
|
|
||
| # Build the C# Control Panel as a post-step | ||
| find_program(DOTNET_EXE dotnet) | ||
| if(DOTNET_EXE) | ||
| add_custom_command(TARGET DirectDesktop POST_BUILD | ||
| COMMAND ${DOTNET_EXE} build ${CMAKE_SOURCE_DIR}/DirectDesktopSettings/DirectDesktopSettings.csproj -c Release | ||
| COMMENT "Building C# Control Panel..." | ||
| ) | ||
| endif() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,10 @@ | |
|
|
||
| #include "DirectDesktop.h" | ||
|
|
||
| #ifdef ENABLE_QT | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. self explanatory |
||
| #include "QtEngine.h" | ||
| #endif | ||
|
|
||
| #include <cmath> | ||
| #include <list> | ||
| #include <powrprof.h> | ||
|
|
@@ -778,7 +782,7 @@ namespace DirectDesktop | |
| } | ||
| if (wParam == SPI_SETFONTSMOOTHING) | ||
| { | ||
| WCHAR* fontsmoothingStr; | ||
| WCHAR* fontsmoothingStr = nullptr; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C23 nullptr damn |
||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"FontSmoothing", &fontsmoothingStr); | ||
| g_fontsmoothing = _wtoi(fontsmoothingStr); | ||
| free(fontsmoothingStr); | ||
|
|
@@ -1406,9 +1410,10 @@ namespace DirectDesktop | |
| } | ||
| case WM_USER + 5: | ||
| { | ||
| WCHAR *cxDragStr{}, *cyDragStr{}; | ||
| WCHAR *cxDragStr = nullptr, *cyDragStr = nullptr; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same thing C23 nullptr |
||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"DragWidth", &cxDragStr); | ||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"DragHeight", &cyDragStr); | ||
|
|
||
| static const int dragWidth = _wtoi(cxDragStr); | ||
| static const int dragHeight = _wtoi(cyDragStr); | ||
| free(cxDragStr), free(cyDragStr); | ||
|
|
@@ -1531,9 +1536,10 @@ namespace DirectDesktop | |
| POINT ppt; | ||
| GetCursorPos(&ppt); | ||
| ScreenToClient(wnd->GetHWND(), &ppt); | ||
| WCHAR *cxDragStr{}, *cyDragStr{}; | ||
| WCHAR *cxDragStr = nullptr, *cyDragStr = nullptr; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C23 |
||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"DragWidth", &cxDragStr); | ||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"DragHeight", &cyDragStr); | ||
|
|
||
| static const int dragWidth = _wtoi(cxDragStr); | ||
| static const int dragHeight = _wtoi(cyDragStr); | ||
| free(cxDragStr), free(cyDragStr); | ||
|
|
@@ -2635,8 +2641,9 @@ namespace DirectDesktop | |
| DWORD WINAPI MultiClickHandler(LPVOID lpParam) | ||
| { | ||
| int clicks = *(int*)lpParam; | ||
| wchar_t* dcms{}; | ||
| wchar_t* dcms = nullptr; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c23 and also i dont know why u did wchar_t* dcms{}; thats bad code btw |
||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Control Panel\\Mouse", L"DoubleClickSpeed", &dcms); | ||
|
|
||
| Sleep(_wtoi(dcms)); | ||
| free(dcms); | ||
| if (clicks == *(int*)lpParam) | ||
|
|
@@ -3636,9 +3643,10 @@ namespace DirectDesktop | |
| POINT ppt, ppt2; | ||
| GetCursorPos(&ppt); | ||
| ScreenToClient(wnd->GetHWND(), &ppt); | ||
| WCHAR *cxDragStr{}, *cyDragStr{}; | ||
| WCHAR *cxDragStr = nullptr, *cyDragStr = nullptr; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same thing |
||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"DragWidth", &cxDragStr); | ||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"DragHeight", &cyDragStr); | ||
|
|
||
| static const int dragWidth = _wtoi(cxDragStr); | ||
| static const int dragHeight = _wtoi(cyDragStr); | ||
| free(cxDragStr), free(cyDragStr); | ||
|
|
@@ -4377,12 +4385,13 @@ namespace DirectDesktop | |
| pm.clear(); | ||
| GetFontHeight(); | ||
| if (logging == IDYES) MainLogger.WriteLine(L"Information: Initialization: 1 of 6 complete: Prepared DirectDesktop to receive desktop data."); | ||
| WCHAR* path{}; | ||
| WCHAR* path = nullptr; | ||
| GetRegistryStrValues(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", L"Desktop", &path); | ||
| WCHAR* secondaryPath = new WCHAR[260]; | ||
| WCHAR* cBuffer = new WCHAR[260]; | ||
|
|
||
| BYTE* value{}; | ||
| BYTE* value = nullptr; | ||
|
|
||
| GetRegistryBinValues(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\Shell\\Bags\\1\\Desktop", L"IconLayouts", &value); | ||
| size_t offset = 0x10; | ||
| vector<uint16_t> head; | ||
|
|
@@ -4811,6 +4820,8 @@ namespace DirectDesktop | |
| keyHold[pKeyInfo->vkCode] = true; | ||
| } | ||
| } | ||
| if (pKeyInfo->vkCode == VK_BACK && g_renameactive) return CallNextHookEx(KeyHook, nCode, wParam, lParam); | ||
|
|
||
| if (pKeyInfo->vkCode == 'N' && GetAsyncKeyState(VK_SHIFT) & 0x8000 && GetAsyncKeyState(VK_CONTROL) & 0x8000) | ||
| { | ||
| if (!keyHold[pKeyInfo->vkCode]) | ||
|
|
@@ -5005,8 +5016,21 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, | |
| _In_ LPWSTR lpCmdLine, | ||
| _In_ int nCmdShow) | ||
| { | ||
| WCHAR* WindowsBuildStr; | ||
| // Check if the user has selected the Qt6 engine in the Control Panel | ||
| int uiMode = GetRegistryValues(HKEY_CURRENT_USER, L"Software\\DirectDesktop", L"UIMode"); | ||
| if (uiMode == 1) | ||
| { | ||
| #ifdef ENABLE_QT | ||
| return RunQtEngine(__argc, __argv); | ||
| #else | ||
| MessageBoxW(nullptr, L"DirectDesktop was not built with Qt support.", L"Error", MB_OK | MB_ICONERROR); | ||
| return 0; // Exit DirectUI process | ||
| #endif | ||
| } | ||
|
|
||
| WCHAR* WindowsBuildStr = nullptr; | ||
| GetRegistryStrValues(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"CurrentBuildNumber", &WindowsBuildStr); | ||
|
|
||
| int WindowsBuild = _wtoi(WindowsBuildStr); | ||
| free(WindowsBuildStr); | ||
| if (WindowsBuild < 18362) | ||
|
|
@@ -5236,8 +5260,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, | |
| SystemParametersInfoW(SPI_GETCOMBOBOXANIMATION, NULL, &g_comboAnim, NULL); | ||
| SystemParametersInfoW(SPI_GETMENUANIMATION, NULL, &g_menuAnim, NULL); | ||
| SystemParametersInfoW(SPI_GETTOOLTIPANIMATION, NULL, &g_tooltipAnim, NULL); | ||
| WCHAR* fontsmoothingStr; | ||
| GetRegistryStrValues(DDKey.GetHKeyName(), L"Control Panel\\Desktop", L"FontSmoothing", &fontsmoothingStr); | ||
| WCHAR* fontsmoothingStr = nullptr; GetRegistryStrValues(DDKey.GetHKeyName(), L"Control Panel\\Desktop", L"FontSmoothing", &fontsmoothingStr); | ||
| g_fontsmoothing = _wtoi(fontsmoothingStr); | ||
| free(fontsmoothingStr); | ||
| g_hiddenIcons = GetRegistryValues(DDKey.GetHKeyName(), DDKey.GetPath(), L"HideIcons"); | ||
|
|
@@ -5319,7 +5342,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, | |
| else StringCchPrintfW(DesktopLayoutWithSize, 24, L"DesktopLayout_Touch"); | ||
| if (EnsureRegValueExists(HKEY_CURRENT_USER, L"Software\\DirectDesktop", DesktopLayoutWithSize)) | ||
| { | ||
| BYTE* value2; | ||
| BYTE* value2 = nullptr; | ||
| GetRegistryBinValues(HKEY_CURRENT_USER, L"Software\\DirectDesktop", DesktopLayoutWithSize, &value2); | ||
| g_currentPageID = *reinterpret_cast<unsigned short*>(&value2[2]); | ||
| free(value2); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM might not work on ur sys if path or toolchain differ so pay a bit of an attention here might need to tweak if needed
**Quick note do not remove the ones about the qt6 as it need its libraries(dlls) to be bundled with to actually work