Skip to content

Simplify hooks and call activation hook on Core start #14

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

Merged
merged 24 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d84cf48
Update subproject commit reference in synergy-extra
nbolton Apr 2, 2025
f939a9d
Move activation to core start and save activate setting
nbolton Apr 3, 2025
d6f23ca
Update subproject commit reference in synergy-extra
nbolton Apr 7, 2025
ae2cc6e
Remove gui_config.h and simplify hook header macros
nbolton Apr 7, 2025
c9bb133
Update subproject commit reference in synergy-extra
nbolton Apr 7, 2025
dd3ae0d
Update subproject commit reference in synergy-extra
nbolton Apr 7, 2025
40895c5
Update subproject commit reference in synergy-extra
nbolton Apr 7, 2025
e80abb6
Update subproject commit reference in synergy-extra
nbolton Apr 7, 2025
a69c12d
fix: build issue on Qt 6.9
sithlord48 Apr 5, 2025
89a723d
Merge branch 'master' into S1-1940-online-activation
nbolton Apr 7, 2025
9d317ab
Update subproject commit reference in synergy-extra
nbolton Apr 7, 2025
eaa77a9
Update subproject commit reference in synergy-extra
nbolton Apr 7, 2025
b4acd63
update: change subproject commit reference in synergy-extra
nbolton Apr 8, 2025
ffde9f8
update: change subproject commit reference in synergy-extra
nbolton Apr 8, 2025
07da24b
update: conditionally upload artifacts based on PACKAGE_BUILD environ…
nbolton Apr 8, 2025
168184e
update: change subproject commit reference in synergy-extra
nbolton Apr 9, 2025
97d44d5
Improve include order and add main window hook
nbolton Apr 9, 2025
08a6a09
Show first server start message only on initial start
nbolton Apr 9, 2025
a194991
Update subproject commit reference in synergy-extra
nbolton Apr 9, 2025
63c7cb4
Update subproject commit reference in synergy-extra
nbolton Apr 9, 2025
d61c469
Update subproject commit reference in synergy-extra
nbolton Apr 9, 2025
62d1d59
Update subproject commit reference in synergy-extra
nbolton Apr 9, 2025
43a9d1a
Update subproject commit reference in synergy-extra
nbolton Apr 10, 2025
161f6ef
Update subproject commit reference in synergy-extra
nbolton Apr 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ jobs:
WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASS }}

- name: Upload to GitHub
if: ${{ env.PACKAGE_BUILD == 'true' }}
uses: actions/upload-artifact@v4
with:
name: "package-${{ env.SYNERGY_PACKAGE_PREFIX }}-${{ matrix.target.name }}"
Expand Down Expand Up @@ -230,6 +231,7 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

- name: Upload to GitHub
if: ${{ env.PACKAGE_BUILD == 'true' }}
uses: actions/upload-artifact@v4
with:
name: "package-${{ env.SYNERGY_PACKAGE_PREFIX }}-${{ matrix.target.name }}"
Expand Down Expand Up @@ -327,6 +329,7 @@ jobs:
run: ./scripts/package.py

- name: Upload to GitHub
if: ${{ env.PACKAGE_BUILD == 'true' }}
uses: actions/upload-artifact@v4
with:
name: "package-${{ env.SYNERGY_PACKAGE_PREFIX }}-${{ matrix.distro.name }}"
Expand Down
6 changes: 0 additions & 6 deletions cmake/Build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ macro(configure_build)

warnings_as_errors()
set_build_date()
configure_file_shared()

endmacro()

Expand All @@ -50,8 +49,3 @@ macro(set_build_date)
message(STATUS "Build date: ${BUILD_DATE}")
add_definitions(-DBUILD_DATE="${BUILD_DATE}")
endmacro()

macro(configure_file_shared)
configure_file(${PROJECT_SOURCE_DIR}/src/lib/gui/gui_config.h.in
${PROJECT_BINARY_DIR}/config/gui_config.h)
endmacro()
11 changes: 9 additions & 2 deletions src/gui/src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

#include "MainWindow.h"

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include "AboutDialog.h"
#include "ServerConfigDialog.h"
#include "common/constants.h"
Expand Down Expand Up @@ -81,6 +85,9 @@ MainWindow::MainWindow(ConfigScopes &configScopes, AppConfig &appConfig)
m_TlsUtility(appConfig),
m_WindowSaveTimer(this)
{
#ifdef DESKFLOW_GUI_HOOK_MAIN_WINDOW
DESKFLOW_GUI_HOOK_MAIN_WINDOW
#endif

setupUi(this);
createMenuBar();
Expand Down Expand Up @@ -849,10 +856,11 @@ void MainWindow::onCoreProcessStateChanged(CoreProcessState state)
{
updateStatus();

if (state == CoreProcessState::Started) {
if (state == CoreProcessState::Started && !m_AppConfig.startedBefore()) {
qDebug("recording that core has started");
m_AppConfig.setStartedBefore(true);
m_ConfigScopes.save();
messages::showFirstServerStartMessage(this);
}

if (state == CoreProcessState::Started || state == CoreProcessState::Starting ||
Expand Down Expand Up @@ -1032,7 +1040,6 @@ void MainWindow::enableServer(bool enable)
if (!m_AppConfig.startedBefore()) {
qDebug("auto-starting core server for first time");
m_CoreProcess.start();
messages::showFirstServerStartMessage(this);
}
}
}
Expand Down
13 changes: 6 additions & 7 deletions src/gui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include "DeskflowApplication.h"
#include "MainWindow.h"
#include "SetupWizard.h"
Expand All @@ -29,11 +33,6 @@
#include "gui/dotenv.h"
#include "gui/messages.h"
#include "gui/string_utils.h"
#include "gui_config.h" // IWYU pragma: keep

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include <QApplication>
#include <QDebug>
Expand Down Expand Up @@ -147,8 +146,8 @@ int main(int argc, char *argv[])

mainWindow.open();

#ifdef DESKFLOW_GUI_HOOK_START
DESKFLOW_GUI_HOOK_START
#ifdef DESKFLOW_GUI_HOOK_APP_START
DESKFLOW_GUI_HOOK_APP_START
#endif

#ifdef SYNERGY_VERSION_CHECK
Expand Down
5 changes: 2 additions & 3 deletions src/lib/gui/VersionChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@

#include "VersionChecker.h"

#include "common/constants.h"
#include "gui_config.h" // IWYU pragma: keep

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include "common/constants.h"

#include <QLocale>
#include <QNetworkAccessManager>
#include <QNetworkReply>
Expand Down
8 changes: 8 additions & 0 deletions src/lib/gui/core/CoreProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include "CoreProcess.h"

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include "common/constants.h"
#include "gui/config/IAppConfig.h"
#include "gui/core/CoreTool.h"
Expand Down Expand Up @@ -347,6 +351,10 @@ void CoreProcess::handleLogLines(const QString &text)

void CoreProcess::start(std::optional<ProcessMode> processModeOption)
{
#ifdef DESKFLOW_GUI_HOOK_CORE_START
DESKFLOW_GUI_HOOK_CORE_START
#endif

QMutexLocker locker(&m_processMutex);

const auto processMode = processModeOption.value_or(m_appConfig.processMode());
Expand Down
9 changes: 4 additions & 5 deletions src/lib/gui/dialogs/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@

#include "SettingsDialog.h"

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include "gui/core/CoreProcess.h"
#include "gui/messages.h"
#include "gui/tls/TlsCertificate.h"
#include "gui/tls/TlsUtility.h"
#include "gui/validators/ScreenNameValidator.h"
#include "gui/validators/ValidationError.h"
#include "gui_config.h" // IWYU pragma: keep

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include <QDir>
#include <QFileDialog>
Expand Down
27 changes: 0 additions & 27 deletions src/lib/gui/gui_config.h.in

This file was deleted.

8 changes: 8 additions & 0 deletions src/test/integtests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include "arch/Arch.h"
#include "base/Log.h"
#include "shared/ExitTimeout.h"
Expand All @@ -33,6 +37,10 @@ const auto testDir = "tmp/test";

int main(int argc, char **argv)
{
#ifdef DESKFLOW_GUI_HOOK_TEST_START
DESKFLOW_GUI_HOOK_TEST_START
#endif

// HACK: Unit tests should not use the filesystem.
std::filesystem::create_directories(testDir);

Expand Down
8 changes: 8 additions & 0 deletions src/test/unittests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef DESKFLOW_GUI_HOOK_HEADER
#include DESKFLOW_GUI_HOOK_HEADER
#endif

#include "arch/Arch.h"
#include "base/Log.h"
#include "shared/ExitTimeout.h"
Expand All @@ -33,6 +37,10 @@ const auto testDir = "tmp/test";

int main(int argc, char **argv)
{
#ifdef DESKFLOW_GUI_HOOK_TEST_START
DESKFLOW_GUI_HOOK_TEST_START
#endif

// HACK: Unit tests should not use the filesystem.
std::filesystem::create_directories(testDir);

Expand Down
Loading