deskflow/src/apps/deskflow-gui/MainWindow.cpp

1183 lines
37 KiB
C++
Raw Normal View History

2012-06-10 16:50:54 +00:00
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2024 - 2025 Chris Rizzitello <sithord48@gmail.com>
* SPDX-FileCopyrightText: (C) 2012 - 2024 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2008 Volker Lanz <vl@fidra.de>
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
2012-06-10 16:50:54 +00:00
*/
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include "dialogs/AboutDialog.h"
2025-02-09 16:16:15 +00:00
#include "dialogs/FingerprintDialog.h"
#include "dialogs/ServerConfigDialog.h"
#include "dialogs/SettingsDialog.h"
#include "base/String.h"
#include "common/Settings.h"
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
#include "gui/Logger.h"
#include "gui/config/ConfigScopes.h"
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
#include "gui/constants.h"
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
#include "gui/core/CoreProcess.h"
#include "gui/diagnostic.h"
#include "gui/ipc/DaemonIpcClient.h"
#include "gui/messages.h"
#include "gui/string_utils.h"
#include "gui/style_utils.h"
#include "gui/styles.h"
#include "net/FingerprintDatabase.h"
#include "platform/wayland.h"
2012-06-10 16:50:54 +00:00
#if defined(Q_OS_LINUX)
#include "config.h"
#endif
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
#include <QApplication>
#include <QDesktopServices>
#include <QFileDialog>
#include <QLocalServer>
#include <QLocalSocket>
2014-02-14 16:21:02 +00:00
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkInterface>
Implement safer memory use, improve dev env, fixed GUI bugs (#7407) * Improve dev script for daemon * Ignore `.user` files created by Qt * Add `FORCE_DESKTOP_PROCESS` option * Catch errors related to getting profile dir * Disable IPC entirely if forced desktop * Use in-class init for AppConfig members * Refactor config to use safer memory management * Improve launch config to make OS-specific debugger usage clearer * Re-enable MainWindowTests on Windows, further refactor for memory safety, fixed some include orders * Remove dead singleton code * Swap order of tests * Use HTTPs for URLs * Fixed compile errors for `SYNERGY_ENABLE_LICENSING` compile path * Restore exec function call * Remove extra link in cancel dialog * Fixed broken link on activation cancel UI * Close dialog if activated * Fixed macOS enum ref to kCurrentProcess * Improve wording on cancel activation dialog * WIP - Test timeout (compile error) * Finished timeout logic (with smart pointer) * Include string_view * Switch to thread from jthread (maybe not supported by macOS compiler?) * Improve comment * Disable test on Windows * Add TODO related to jthread on macOS * Refactor settings and paths on Windows * Launch in desktop mode on Windows * Remove arg quote wraps which break desktop mode * Fixed qFatal on Linux * Remove test value * Follow original `AppConfig` accessor convention * Disable service checkbox if not Windows * Simplify TLS control enable logic * Update command and Git ignore * Fixed code style * Fixed include consistency * Fixed includes in validator * Fixed lint errors * Update ChangeLog * Use smart pointer for core process * Remove unneccesary default operators * Don't halt on stderr
2024-07-22 16:48:02 +00:00
#include <QPushButton>
#include <QRegularExpression>
#include <QRegularExpressionValidator>
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
#include <QScrollBar>
#include <memory>
2012-06-10 16:50:54 +00:00
#if defined(Q_OS_MAC)
#include <ApplicationServices/ApplicationServices.h>
#endif
using namespace deskflow::gui;
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
using CoreConnectionState = CoreProcess::ConnectionState;
using CoreProcessState = CoreProcess::ProcessState;
MainWindow::MainWindow(ConfigScopes &configScopes, AppConfig &appConfig)
: ui{std::make_unique<Ui::MainWindow>()},
m_configScopes(configScopes),
m_appConfig(appConfig),
m_serverConfig(*this),
m_coreProcess(m_serverConfig),
m_serverConnection(this, m_serverConfig),
m_clientConnection(this),
m_tlsUtility(this),
m_trayIcon{new QSystemTrayIcon(this)},
m_guiDupeChecker{new QLocalServer(this)},
m_daemonIpcClient{new ipc::DaemonIpcClient(this)},
m_lblSecurityStatus{new QLabel(this)},
m_lblStatus{new QLabel(this)},
2025-02-19 22:46:13 +00:00
m_btnFingerprint{new QToolButton(this)},
m_btnUpdate{new QPushButton(this)},
m_actionAbout{new QAction(this)},
m_actionClearSettings{new QAction(tr("Clear settings"), this)},
m_actionReportBug{new QAction(tr("Report a Bug"), this)},
m_actionMinimize{new QAction(tr("&Minimize to tray"), this)},
m_actionQuit{new QAction(tr("&Quit"), this)},
m_actionTrayQuit{new QAction(tr("&Quit"), this)},
m_actionRestore{new QAction(tr("&Open Deskflow"), this)},
m_actionSettings{new QAction(tr("Preferences"), this)},
m_actionStartCore{new QAction(tr("&Start"), this)},
m_actionStopCore{new QAction(tr("S&top"), this)},
m_actionTestCriticalError{new QAction(tr("Test Critical Error"), this)},
m_actionTestFatalError{new QAction(tr("Test Fatal Error"), this)}
{
const auto themeName = QStringLiteral("deskflow-%1").arg(iconMode());
if (QIcon::themeName().isEmpty())
QIcon::setThemeName(themeName);
else
QIcon::setFallbackThemeName(themeName);
ui->setupUi(this);
// Setup Actions
m_actionAbout->setText(tr("About %1...").arg(kAppName));
m_actionAbout->setMenuRole(QAction::AboutRole);
m_actionAbout->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::HelpAbout));
#ifndef Q_OS_WIN
m_actionQuit->setShortcut(QKeySequence::Quit);
m_actionTrayQuit->setShortcut(QKeySequence::Quit);
#else
m_actionQuit->setShortcut(QKeySequence(QStringLiteral("Ctrl+Q")));
m_actionTrayQuit->setShortcut(QKeySequence(QStringLiteral("Ctrl+Q")));
#endif
m_actionQuit->setMenuRole(QAction::QuitRole);
m_actionQuit->setIcon(QIcon(QIcon::fromTheme("application-exit")));
m_actionTrayQuit->setIcon(QIcon(QIcon::fromTheme("application-exit")));
m_actionClearSettings->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-all")));
m_actionSettings->setMenuRole(QAction::PreferencesRole);
m_actionSettings->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
m_actionStartCore->setShortcut(QKeySequence(tr("Ctrl+S")));
m_actionStartCore->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
m_actionStopCore->setShortcut(QKeySequence(tr("Ctrl+T")));
m_actionStopCore->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::ProcessStop));
m_actionReportBug->setIcon(QIcon(QIcon::fromTheme(QStringLiteral("tools-report-bug"))));
#ifdef Q_OS_MAC
ui->btnToggleLog->setFixedHeight(ui->lblLog->height() * 0.6);
#endif
// Setup the Instance Checking
// In case of a previous crash remove first
m_guiDupeChecker->removeServer(m_guiSocketName);
m_guiDupeChecker->listen(m_guiSocketName);
createMenuBar();
setupControls();
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
connectSlots();
setupTrayIcon();
m_configScopes.signalReady();
updateScreenName();
applyConfig();
restoreWindow();
qDebug().noquote() << "active settings path:" << m_configScopes.activeFilePath();
updateSize();
// Force generation of SHA256 for the localhost
if (Settings::value(Settings::Security::TlsEnabled).toBool()) {
if (!QFile::exists(localFingerprintDb())) {
regenerateLocalFingerprints();
return;
}
deskflow::FingerprintDatabase db;
db.read(localFingerprintDb().toStdString());
if (db.fingerprints().size() != kTlsDbSize) {
regenerateLocalFingerprints();
}
}
}
MainWindow::~MainWindow()
{
m_guiDupeChecker->close();
m_coreProcess.cleanup();
}
void MainWindow::restoreWindow()
{
const auto windowGeometry = Settings::value(Settings::Gui::WindowGeometry).toRect();
if (!windowGeometry.isValid()) {
// center main window in middle of screen
const auto screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
move(screenGeometry.center() - rect().center());
return;
}
m_expandedSize = windowGeometry.size();
int x = 0;
int y = 0;
int w = 0;
int h = 0;
const auto screens = QGuiApplication::screens();
for (auto screen : screens) {
auto geo = screen->geometry();
x = std::min(geo.x(), x);
y = std::min(geo.y(), y);
w = std::max(geo.x() + geo.width(), w);
h = std::max(geo.y() + geo.height(), h);
}
const QRect screensGeometry(x, y, w, h);
if (screensGeometry.contains(windowGeometry)) {
qDebug() << "restoring main window position";
move(windowGeometry.topLeft());
}
}
void MainWindow::setupControls()
{
setWindowTitle(kAppName);
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
secureSocket(false);
ui->btnConfigureServer->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
ui->lblIpAddresses->setText(tr("This computer's IP addresses: %1").arg(getIPAddresses()));
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
if (Settings::value(Settings::Core::LastVersion).toString() != kVersion) {
Settings::setValue(Settings::Core::LastVersion, kVersion);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
// Setup the log toggle, set its initial state to closed
ui->btnToggleLog->setStyleSheet(kStyleFlatButton);
if (Settings::value(Settings::Gui::LogExpanded).toBool()) {
ui->btnToggleLog->setArrowType(Qt::DownArrow);
ui->textLog->setVisible(true);
ui->btnToggleLog->click();
} else {
ui->textLog->setVisible(false);
}
ui->serverOptions->setVisible(false);
ui->clientOptions->setVisible(false);
const auto coreMode = Settings::value(Settings::Core::CoreMode).value<Settings::CoreMode>();
ui->rbModeClient->setChecked(coreMode == Settings::CoreMode::Client);
ui->rbModeServer->setChecked(coreMode == Settings::CoreMode::Server);
if (coreMode != Settings::CoreMode::None)
updateModeControls(coreMode == Settings::CoreMode::Server);
ui->lineEditName->setValidator(new QRegularExpressionValidator(m_nameRegEx, this));
ui->lineEditName->setVisible(false);
#if defined(Q_OS_MAC)
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
ui->rbModeServer->setAttribute(Qt::WA_MacShowFocusRect, 0);
ui->rbModeClient->setAttribute(Qt::WA_MacShowFocusRect, 0);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
#endif
const auto trayItemSize = QSize(24, 24);
m_btnFingerprint->setStyleSheet(kStyleFlatButtonHoverable);
2025-02-19 22:46:13 +00:00
m_btnFingerprint->setIcon(QIcon::fromTheme(QStringLiteral("fingerprint")));
m_btnFingerprint->setFixedSize(trayItemSize);
m_btnFingerprint->setIconSize(trayItemSize);
2025-02-19 22:46:13 +00:00
m_btnFingerprint->setAutoRaise(true);
m_btnFingerprint->setToolTip(tr("View local fingerprint"));
ui->statusBar->insertPermanentWidget(0, m_btnFingerprint);
m_lblSecurityStatus->setVisible(false);
m_lblSecurityStatus->setFixedSize(trayItemSize);
m_lblSecurityStatus->setScaledContents(true);
2025-02-19 22:46:13 +00:00
ui->statusBar->insertPermanentWidget(1, m_lblSecurityStatus);
2025-02-19 22:46:13 +00:00
ui->statusBar->insertPermanentWidget(2, m_lblStatus, 1);
m_btnUpdate->setVisible(false);
m_btnUpdate->setStyleSheet(kStyleFlatButtonHoverable);
m_btnUpdate->setFlat(true);
m_btnUpdate->setText(tr("Update available"));
m_btnUpdate->setLayoutDirection(Qt::RightToLeft);
m_btnUpdate->setIcon(QIcon::fromTheme(QStringLiteral("software-updates-release")));
m_btnUpdate->setFixedHeight(24);
m_btnUpdate->setIconSize(trayItemSize);
ui->statusBar->insertPermanentWidget(3, m_btnUpdate);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
//////////////////////////////////////////////////////////////////////////////
// Begin slots
//////////////////////////////////////////////////////////////////////////////
// remember: using queued connection allows the render loop to run before
// executing the slot. the default is to instantly call the slot when the
// signal is emitted from the thread that owns the receiver's object.
void MainWindow::connectSlots()
{
connect(&Logger::instance(), &Logger::newLine, this, &MainWindow::handleLogLine);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
connect(this, &MainWindow::shown, this, &MainWindow::firstShown, Qt::QueuedConnection);
2012-06-10 16:50:54 +00:00
connect(Settings::instance(), &Settings::serverSettingsChanged, this, &MainWindow::serverConfigSaving);
connect(Settings::instance(), &Settings::settingsChanged, this, &MainWindow::settingsChanged);
connect(&m_coreProcess, &CoreProcess::starting, this, &MainWindow::coreProcessStarting, Qt::DirectConnection);
connect(&m_coreProcess, &CoreProcess::error, this, &MainWindow::coreProcessError);
connect(&m_coreProcess, &CoreProcess::logLine, this, &MainWindow::handleLogLine);
connect(&m_coreProcess, &CoreProcess::processStateChanged, this, &MainWindow::coreProcessStateChanged);
connect(&m_coreProcess, &CoreProcess::connectionStateChanged, this, &MainWindow::coreConnectionStateChanged);
connect(&m_coreProcess, &CoreProcess::secureSocket, this, &MainWindow::secureSocket);
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
connect(m_actionAbout, &QAction::triggered, this, &MainWindow::openAboutDialog);
connect(m_actionClearSettings, &QAction::triggered, this, &MainWindow::clearSettings);
connect(m_actionReportBug, &QAction::triggered, this, &MainWindow::openHelpUrl);
connect(m_actionMinimize, &QAction::triggered, this, &MainWindow::hide);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
connect(m_actionQuit, &QAction::triggered, this, &MainWindow::close);
connect(m_actionTrayQuit, &QAction::triggered, this, &MainWindow::close);
connect(m_actionRestore, &QAction::triggered, this, &MainWindow::showAndActivate);
connect(m_actionSettings, &QAction::triggered, this, &MainWindow::openSettings);
connect(m_actionStartCore, &QAction::triggered, this, &MainWindow::startCore);
connect(m_actionStopCore, &QAction::triggered, this, &MainWindow::stopCore);
connect(m_actionTestFatalError, &QAction::triggered, this, &MainWindow::testFatalError);
connect(m_actionTestCriticalError, &QAction::triggered, this, &MainWindow::testCriticalError);
connect(&m_versionChecker, &VersionChecker::updateFound, this, &MainWindow::versionCheckerUpdateFound);
// Mac os tray will only show a menu
#ifndef Q_OS_MAC
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconActivated);
#endif
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
connect(&m_serverConnection, &ServerConnection::configureClient, this, &MainWindow::serverConnectionConfigureClient);
connect(&m_serverConnection, &ServerConnection::messageShowing, this, &MainWindow::showAndActivate);
connect(&m_clientConnection, &ClientConnection::messageShowing, this, &MainWindow::showAndActivate);
connect(ui->btnToggleCore, &QPushButton::clicked, m_actionStartCore, &QAction::trigger, Qt::UniqueConnection);
connect(ui->btnApplySettings, &QPushButton::clicked, this, &MainWindow::resetCore);
connect(ui->btnConnect, &QPushButton::clicked, this, &MainWindow::resetCore);
connect(ui->lineHostname, &QLineEdit::returnPressed, ui->btnConnect, &QPushButton::click);
connect(ui->lineHostname, &QLineEdit::textChanged, &m_coreProcess, &deskflow::gui::CoreProcess::setAddress);
connect(ui->btnSaveServerConfig, &QPushButton::clicked, this, &MainWindow::saveServerConfig);
connect(ui->btnConfigureServer, &QPushButton::clicked, this, [this] { showConfigureServer(""); });
connect(ui->lblComputerName, &QLabel::linkActivated, this, &MainWindow::openSettings);
2025-02-19 22:46:13 +00:00
connect(m_btnFingerprint, &QToolButton::clicked, this, &MainWindow::showMyFingerprint);
connect(ui->rbModeServer, &QRadioButton::toggled, this, &MainWindow::coreModeToggled);
connect(ui->rbModeClient, &QRadioButton::toggled, this, &MainWindow::coreModeToggled);
connect(ui->btnToggleLog, &QAbstractButton::toggled, this, &MainWindow::toggleLogVisible);
connect(m_btnUpdate, &QPushButton::clicked, this, &MainWindow::openGetNewVersionUrl);
connect(m_guiDupeChecker, &QLocalServer::newConnection, this, &MainWindow::showAndActivate);
connect(ui->btnEditName, &QPushButton::clicked, this, &MainWindow::showHostNameEditor);
connect(ui->lineEditName, &QLineEdit::editingFinished, this, &MainWindow::setHostName);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::toggleLogVisible(bool visible)
{
if (visible) {
ui->btnToggleLog->setArrowType(Qt::DownArrow);
} else {
ui->btnToggleLog->setArrowType(Qt::RightArrow);
m_expandedSize = size();
}
ui->textLog->setVisible(visible);
Settings::setValue(Settings::Gui::LogExpanded, visible);
// 15 ms delay is to make sure we have left the function before calling updateSize
QTimer::singleShot(15, this, &MainWindow::updateSize);
}
void MainWindow::firstShown()
{
// if a critical error was shown just before the main window (i.e. on app
// load), it will be hidden behind the main window. therefore we need to raise
// it up in front of the main window.
// HACK: because the `onShown` event happens just as the window is shown, the
// message box has a chance of being raised under the main window. to solve
// this we delay the error dialog raise by a split second. this seems a bit
// hacky and fragile, so maybe there's a better approach.
const auto kCriticalDialogDelay = 100;
QTimer::singleShot(kCriticalDialogDelay, this, &messages::raiseCriticalDialog);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::settingsChanged(const QString &key)
{
if (key == Settings::Log::Level) {
m_coreProcess.applyLogLevel();
return;
}
if (key == Settings::Core::ScreenName)
updateScreenName();
if ((key == Settings::Security::Certificate) || (key == Settings::Security::KeySize) ||
(key == Settings::Security::TlsEnabled) || (key == Settings::Security::CheckPeers)) {
const auto certificate = Settings::value(Settings::Security::Certificate).toString();
if (m_tlsUtility.isEnabled() && !QFile::exists(certificate)) {
m_tlsUtility.generateCertificate();
}
updateSecurityIcon(m_lblSecurityStatus->isVisible());
return;
}
}
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
void MainWindow::serverConfigSaving()
{
m_serverConfig.commit();
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
if (reason != QSystemTrayIcon::Trigger)
return;
isVisible() ? hide() : showAndActivate();
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::versionCheckerUpdateFound(const QString &version)
{
m_btnUpdate->setVisible(true);
m_btnUpdate->setToolTip(tr("A new version v%1 is available").arg(version));
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::coreProcessError(CoreProcess::Error error)
{
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
if (error == CoreProcess::Error::AddressMissing) {
QMessageBox::warning(
this, tr("Address missing"), tr("Please enter the hostname or IP address of the other computer.")
);
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
} else if (error == CoreProcess::Error::StartFailed) {
show();
QMessageBox::warning(
this, tr("Core cannot be started"),
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
"The Core executable could not be successfully started, "
"although it does exist. "
"Please check if you have sufficient permissions to run this program."
);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
}
void MainWindow::startCore()
{
m_clientConnection.setShowMessage();
m_coreProcess.start();
}
void MainWindow::stopCore()
{
qDebug() << "stopping core process";
m_coreProcess.stop();
}
void MainWindow::testFatalError() const
{
qFatal() << "test fatal error";
}
void MainWindow::testCriticalError() const
{
qCritical() << "test critical error";
}
void MainWindow::clearSettings()
{
if (!messages::showClearSettings(this)) {
qDebug() << "clear settings cancelled";
return;
}
m_coreProcess.stop();
m_coreProcess.clearSettings();
m_saveOnExit = false;
diagnostic::clearSettings(m_configScopes, true);
}
bool MainWindow::saveServerConfig()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Save server configuration as..."));
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
if (!fileName.isEmpty() && !m_serverConfig.save(fileName)) {
QMessageBox::warning(this, tr("Save failed"), tr("Could not save server configuration to file."));
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
return true;
}
return false;
}
void MainWindow::openAboutDialog()
{
AboutDialog about(this);
about.exec();
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::openHelpUrl() const
{
QDesktopServices::openUrl(QUrl(kUrlHelp));
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::openGetNewVersionUrl() const
{
QDesktopServices::openUrl(kUrlDownload);
}
void MainWindow::openSettings()
{
auto dialog = SettingsDialog(this, m_serverConfig, m_coreProcess);
if (dialog.exec() == QDialog::Accepted) {
Settings::save();
applyConfig();
if (m_coreProcess.isStarted()) {
m_coreProcess.restart();
}
}
2012-06-10 16:50:54 +00:00
}
void MainWindow::resetCore()
{
m_clientConnection.setShowMessage();
m_coreProcess.restart();
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::updateSize()
{
if (Settings::value(Settings::Gui::LogExpanded).toBool()) {
setMaximumHeight(16777215);
setMaximumWidth(16777215);
2025-01-08 16:27:11 +00:00
resize(m_expandedSize);
} else {
adjustSize();
// Prevent Resize with log collapsed
setMaximumHeight(height());
setMaximumWidth(width());
}
}
void MainWindow::showMyFingerprint()
{
if (!QFile::exists(localFingerprintDb())) {
if (regenerateLocalFingerprints())
showMyFingerprint();
return;
}
deskflow::FingerprintDatabase db;
db.read(localFingerprintDb().toStdString());
if (db.fingerprints().size() != kTlsDbSize) {
if (regenerateLocalFingerprints())
showMyFingerprint();
return;
}
2025-02-09 16:16:15 +00:00
QList<deskflow::FingerprintData> fingerprints;
fingerprints.reserve(db.fingerprints().size());
std::copy(db.fingerprints().begin(), db.fingerprints().end(), std::back_inserter(fingerprints));
2025-02-09 16:16:15 +00:00
FingerprintDialog fingerprintDialog(this, fingerprints);
fingerprintDialog.exec();
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::coreModeToggled()
{
auto serverMode = ui->rbModeServer->isChecked();
const auto mode = serverMode ? QStringLiteral("server enabled") : QStringLiteral("client enabled");
qDebug() << mode;
const auto coreMode = serverMode ? Settings::CoreMode::Server : Settings::CoreMode::Client;
Settings::setValue(Settings::Core::CoreMode, coreMode);
Settings::save();
updateModeControls(serverMode);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::updateModeControls(bool serverMode)
{
ui->serverOptions->setVisible(serverMode);
ui->clientOptions->setVisible(!serverMode);
ui->lblNoMode->setVisible(false);
ui->btnToggleCore->setEnabled(true);
m_actionStartCore->setEnabled(true);
auto expectedCoreMode = serverMode ? Settings::CoreMode::Server : Settings::CoreMode::Client;
if (m_coreProcess.isStarted() && m_coreProcess.mode() != expectedCoreMode)
m_coreProcess.stop();
m_coreProcess.setMode(expectedCoreMode);
if (serverMode) {
// The server can run without any clients configured, and this is actually
// what you'll want to do the first time since you'll be prompted when an
// unrecognized client tries to connect.
const auto startedBefore = Settings::value(Settings::Core::StartedBefore).toBool();
if (!startedBefore && !m_coreProcess.isStarted()) {
qDebug() << "auto-starting core server for first time";
m_coreProcess.start();
messages::showFirstServerStartMessage(this);
}
}
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
}
void MainWindow::updateSecurityIcon(bool visible)
{
m_lblSecurityStatus->setVisible(visible);
if (!visible)
return;
bool secureSocket = Settings::value(Settings::Security::TlsEnabled).toBool();
const auto txt =
secureSocket ? tr("%1 Encryption Enabled").arg(m_coreProcess.secureSocketVersion()) : tr("Encryption Disabled");
m_lblSecurityStatus->setToolTip(txt);
const auto icon = QIcon::fromTheme(secureSocket ? QIcon::ThemeIcon::SecurityHigh : QIcon::ThemeIcon::SecurityLow);
m_lblSecurityStatus->setPixmap(icon.pixmap(QSize(32, 32)));
}
void MainWindow::serverConnectionConfigureClient(const QString &clientName)
{
Settings::setValue(Settings::Server::ConfigVisible, true);
ServerConfigDialog dialog(this, m_serverConfig);
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
if (dialog.addClient(clientName) && dialog.exec() == QDialog::Accepted) {
m_coreProcess.restart();
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
}
Settings::setValue(Settings::Server::ConfigVisible, false);
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
}
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
//////////////////////////////////////////////////////////////////////////////
// End slots
//////////////////////////////////////////////////////////////////////////////
void MainWindow::open()
{
if (!Settings::value(Settings::Gui::AutoUpdateCheck).isValid()) {
showAndActivate();
Settings::setValue(Settings::Gui::AutoUpdateCheck, messages::showUpdateCheckOption(this));
}
if (Settings::value(Settings::Gui::AutoUpdateCheck).toBool()) {
m_versionChecker.checkLatest();
} else {
qDebug() << "update check disabled";
}
m_coreProcess.applyLogLevel();
if (Settings::value(Settings::Core::StartedBefore).toBool()) {
m_coreProcess.start();
}
Settings::value(Settings::Gui::Autohide).toBool() ? hide() : showAndActivate();
}
void MainWindow::coreProcessStarting()
{
if (deskflow::platform::isWayland()) {
m_waylandWarnings.showOnce(this);
}
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
saveSettings();
}
void MainWindow::setStatus(const QString &status)
{
m_lblStatus->setText(status);
2012-06-10 16:50:54 +00:00
}
void MainWindow::createMenuBar()
{
auto menuFile = new QMenu(tr("File"));
menuFile->addAction(m_actionStartCore);
menuFile->addAction(m_actionStopCore);
menuFile->addSeparator();
menuFile->addAction(m_actionSave);
menuFile->addSeparator();
menuFile->addAction(m_actionQuit);
auto menuEdit = new QMenu(tr("Edit"));
menuEdit->addAction(m_actionSettings);
auto menuHelp = new QMenu(tr("Help"));
menuHelp->addAction(m_actionAbout);
menuHelp->addAction(m_actionReportBug);
menuHelp->addSeparator();
menuHelp->addAction(m_actionClearSettings);
auto menuBar = new QMenuBar(this);
menuBar->addMenu(menuFile);
menuBar->addMenu(menuEdit);
menuBar->addMenu(menuHelp);
const auto enableTestMenu = strToTrue(qEnvironmentVariable("DESKFLOW_TEST_MENU"));
if (enableTestMenu || kDebugBuild) {
auto testMenu = new QMenu(tr("Test"));
menuBar->addMenu(testMenu);
testMenu->addAction(m_actionTestFatalError);
testMenu->addAction(m_actionTestCriticalError);
}
setMenuBar(menuBar);
2012-06-10 16:50:54 +00:00
}
void MainWindow::setupTrayIcon()
{
auto trayMenu = new QMenu(this);
trayMenu->addActions({m_actionStartCore, m_actionStopCore, m_actionMinimize, m_actionRestore, m_actionTrayQuit});
trayMenu->insertSeparator(m_actionMinimize);
trayMenu->insertSeparator(m_actionTrayQuit);
m_trayIcon->setContextMenu(trayMenu);
setIcon();
m_trayIcon->show();
}
void MainWindow::applyConfig()
{
ui->lineHostname->setText(Settings::value(Settings::Client::RemoteHost).toString());
updateLocalFingerprint();
setIcon();
const auto coreMode = Settings::value(Settings::Core::CoreMode).value<Settings::CoreMode>();
if (coreMode == Settings::CoreMode::None)
return;
updateModeControls(coreMode == Settings::CoreMode::Server);
}
void MainWindow::saveSettings()
{
if (ui->rbModeClient->isChecked()) {
Settings::setValue(Settings::Core::CoreMode, Settings::CoreMode::Client);
} else if (ui->rbModeServer->isChecked()) {
Settings::setValue(Settings::Core::CoreMode, Settings::CoreMode::Server);
}
Settings::setValue(Settings::Client::RemoteHost, ui->lineHostname->text());
Settings::save();
2012-06-10 16:50:54 +00:00
}
void MainWindow::setIcon()
{
// Using a theme icon that is packed in exe renders an invisible icon
// Instead use the resource path of the packed icon
// TODO Report to Qt ref the bug here
const bool symbolicIcon = Settings::value(Settings::Gui::SymbolicTrayIcon).toBool();
#ifndef Q_OS_MAC
QString iconString = QStringLiteral(":/icons/deskflow-%1/apps/64/deskflow").arg(iconMode());
if (symbolicIcon)
iconString.append(QStringLiteral("-symbolic"));
m_trayIcon->setIcon(QIcon(iconString));
#else
if (symbolicIcon) {
2025-03-07 03:44:26 +00:00
auto icon = QIcon::fromTheme(QStringLiteral("deskflow-symbolic"));
icon.setIsMask(true);
m_trayIcon->setIcon(icon);
} else {
m_trayIcon->setIcon(QIcon::fromTheme(QStringLiteral("deskflow")));
}
#endif
}
void MainWindow::handleLogLine(const QString &line)
{
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
const int kScrollBottomThreshold = 2;
QScrollBar *verticalScroll = ui->textLog->verticalScrollBar();
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
int currentScroll = verticalScroll->value();
int maxScroll = verticalScroll->maximum();
const auto scrollAtBottom = qAbs(currentScroll - maxScroll) <= kScrollBottomThreshold;
2014-11-27 10:36:43 +00:00
// only trim end instead of the whole line to prevent tab-indented debug
// filenames from losing their indentation.
ui->textLog->appendPlainText(trimEnd(line));
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
if (scrollAtBottom) {
verticalScroll->setValue(verticalScroll->maximum());
ui->textLog->horizontalScrollBar()->setValue(0);
}
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
updateFromLogLine(line);
}
void MainWindow::updateFromLogLine(const QString &line)
{
checkConnected(line);
checkFingerprint(line);
}
void MainWindow::checkConnected(const QString &line)
{
if (ui->rbModeServer->isChecked()) {
m_serverConnection.handleLogLine(line);
} else {
m_clientConnection.handleLogLine(line);
}
}
void MainWindow::checkFingerprint(const QString &line)
{
static const QRegularExpression re(R"(.*peer fingerprint: \(SHA1\) ([A-F0-9:]+) \(SHA256\) ([A-F0-9:]+))");
auto match = re.match(line);
if (!match.hasMatch()) {
return;
}
const deskflow::FingerprintData sha1 = {
deskflow::fingerprintTypeToString(deskflow::FingerprintType::SHA1),
deskflow::string::fromHex(match.captured(1).toStdString())
};
const auto sha256Text = match.captured(2);
const deskflow::FingerprintData sha256 = {
deskflow::fingerprintTypeToString(deskflow::FingerprintType::SHA256),
deskflow::string::fromHex(sha256Text.toStdString())
};
const bool isClient = m_coreProcess.mode() == CoreMode::Client;
if ((isClient && m_checkedServers.contains(sha256Text)) || (!isClient && m_checkedClients.contains(sha256Text))) {
qDebug("ignoring fingerprint, already handled");
return;
}
deskflow::FingerprintDatabase db;
db.read(trustedFingerprintDb().toStdString());
if (db.isTrusted(sha256)) {
qDebug("fingerprint is trusted");
return;
}
if (isClient) {
m_checkedServers.append(sha256Text);
m_coreProcess.stop();
} else {
m_checkedClients.append(sha256Text);
}
auto dialogMode = isClient ? FingerprintDialogMode::Client : FingerprintDialogMode::Server;
FingerprintDialog fingerprintDialog(this, {sha1, sha256}, dialogMode);
connect(&fingerprintDialog, &FingerprintDialog::requestLocalPrintsDialog, this, &MainWindow::showMyFingerprint);
2025-02-09 16:16:15 +00:00
if (fingerprintDialog.exec() == QDialog::Accepted) {
db.addTrusted(sha256);
db.write(trustedFingerprintDb().toStdString());
if (isClient) {
m_checkedServers.removeAll(sha256Text);
m_coreProcess.start();
} else {
m_checkedClients.removeAll(sha256Text);
}
}
2012-06-10 16:50:54 +00:00
}
QString MainWindow::getTimeStamp() const
{
return QStringLiteral("[%1]").arg(QDateTime::currentDateTime().toString(Qt::ISODate));
2015-07-06 22:50:21 +00:00
}
void MainWindow::showEvent(QShowEvent *event)
{
QMainWindow::showEvent(event);
2024-10-21 04:08:10 +00:00
Q_EMIT shown();
}
void MainWindow::closeEvent(QCloseEvent *event)
{
if (Settings::value(Settings::Gui::CloseToTray).toBool() && event->spontaneous()) {
if (Settings::value(Settings::Gui::CloseReminder).toBool()) {
messages::showCloseReminder(this);
Settings::setValue(Settings::Gui::CloseReminder, false);
}
qDebug() << "hiding to tray";
hide();
event->ignore();
return;
}
if (m_saveOnExit) {
Settings::setValue(Settings::Gui::WindowGeometry, frameGeometry());
}
qDebug() << "quitting application";
event->accept();
QApplication::quit();
}
void MainWindow::showFirstConnectedMessage()
{
if (Settings::value(Settings::Core::StartedBefore).toBool())
return;
Settings::setValue(Settings::Core::StartedBefore, true);
const auto isServer = m_coreProcess.mode() == CoreMode::Server;
const auto closeToTray = Settings::value(Settings::Gui::CloseToTray).toBool();
using ProcessMode = Settings::ProcessMode;
const auto enableService = Settings::value(Settings::Core::ProcessMode).value<ProcessMode>() == ProcessMode::Service;
messages::showFirstConnectedMessage(this, closeToTray, enableService, isServer);
}
void MainWindow::updateStatus()
{
const auto connection = m_coreProcess.connectionState();
const auto process = m_coreProcess.processState();
2012-06-10 16:50:54 +00:00
updateSecurityIcon(false);
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
switch (process) {
using enum CoreProcessState;
2012-06-10 16:50:54 +00:00
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
case Starting:
setStatus(tr("%1 is starting...").arg(kAppName));
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
break;
case RetryPending:
setStatus(tr("%1 will retry in a moment...").arg(kAppName));
break;
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
case Stopping:
setStatus(tr("%1 is stopping...").arg(kAppName));
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
break;
Implement safer memory use, improve dev env, fixed GUI bugs (#7407) * Improve dev script for daemon * Ignore `.user` files created by Qt * Add `FORCE_DESKTOP_PROCESS` option * Catch errors related to getting profile dir * Disable IPC entirely if forced desktop * Use in-class init for AppConfig members * Refactor config to use safer memory management * Improve launch config to make OS-specific debugger usage clearer * Re-enable MainWindowTests on Windows, further refactor for memory safety, fixed some include orders * Remove dead singleton code * Swap order of tests * Use HTTPs for URLs * Fixed compile errors for `SYNERGY_ENABLE_LICENSING` compile path * Restore exec function call * Remove extra link in cancel dialog * Fixed broken link on activation cancel UI * Close dialog if activated * Fixed macOS enum ref to kCurrentProcess * Improve wording on cancel activation dialog * WIP - Test timeout (compile error) * Finished timeout logic (with smart pointer) * Include string_view * Switch to thread from jthread (maybe not supported by macOS compiler?) * Improve comment * Disable test on Windows * Add TODO related to jthread on macOS * Refactor settings and paths on Windows * Launch in desktop mode on Windows * Remove arg quote wraps which break desktop mode * Fixed qFatal on Linux * Remove test value * Follow original `AppConfig` accessor convention * Disable service checkbox if not Windows * Simplify TLS control enable logic * Update command and Git ignore * Fixed code style * Fixed include consistency * Fixed includes in validator * Fixed lint errors * Update ChangeLog * Use smart pointer for core process * Remove unneccesary default operators * Don't halt on stderr
2024-07-22 16:48:02 +00:00
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
case Stopped:
setStatus(tr("%1 is not running").arg(kAppName));
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
break;
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
case Started: {
switch (connection) {
using enum CoreConnectionState;
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
case Listening: {
if (m_coreProcess.mode() == CoreMode::Server) {
updateSecurityIcon(true);
setStatus(tr("%1 is waiting for clients").arg(kAppName));
}
break;
}
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
case Connecting:
setStatus(tr("%1 is connecting...").arg(kAppName));
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
break;
2012-06-10 16:50:54 +00:00
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
case Connected: {
updateSecurityIcon(true);
setStatus(tr("%1 is connected").arg(kAppName));
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
break;
SYNERGY-885 mac client listens on ipv4 only but attempts to connect on ipv6 (#6983) * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Fix ipv6 port parsing * Fix ipv6 server bind * SYNERGY 885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Add ipv6 scope checker * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Update changelog * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Refactor network address logic * SYNERGY-885-Mac client listens on ipv4 only but attempts to connect on ipv6 * Build fix * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Fix code smells * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Fix empty ipv4 hostname * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Fix build * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Add test for new logic * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Upgrade network adress parser tests * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Fix sonar code smells in tests * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 * Fix code smells * SYNERGY-885 Mac client listens on ipv4 only but attempts to connect on ipv6 *Fix comment Co-authored-by: user <user@users-Mac-mini.local> Co-authored-by: Andrii Batyiev <andrii-external@symless.com>
2021-04-26 07:37:34 +00:00
}
2012-06-10 16:50:54 +00:00
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
case Disconnected:
setStatus(tr("%1 is disconnected").arg(kAppName));
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
break;
}
} break;
}
}
void MainWindow::coreProcessStateChanged(CoreProcessState state)
{
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
updateStatus();
if (state == CoreProcessState::Started) {
qDebug() << "recording that core has started";
Settings::setValue(Settings::Core::StartedBefore, true);
}
if (state == CoreProcessState::Started || state == CoreProcessState::Starting ||
state == CoreProcessState::RetryPending) {
disconnect(ui->btnToggleCore, &QPushButton::clicked, m_actionStartCore, &QAction::trigger);
connect(ui->btnToggleCore, &QPushButton::clicked, m_actionStopCore, &QAction::trigger, Qt::UniqueConnection);
Implement safer memory use, improve dev env, fixed GUI bugs (#7407) * Improve dev script for daemon * Ignore `.user` files created by Qt * Add `FORCE_DESKTOP_PROCESS` option * Catch errors related to getting profile dir * Disable IPC entirely if forced desktop * Use in-class init for AppConfig members * Refactor config to use safer memory management * Improve launch config to make OS-specific debugger usage clearer * Re-enable MainWindowTests on Windows, further refactor for memory safety, fixed some include orders * Remove dead singleton code * Swap order of tests * Use HTTPs for URLs * Fixed compile errors for `SYNERGY_ENABLE_LICENSING` compile path * Restore exec function call * Remove extra link in cancel dialog * Fixed broken link on activation cancel UI * Close dialog if activated * Fixed macOS enum ref to kCurrentProcess * Improve wording on cancel activation dialog * WIP - Test timeout (compile error) * Finished timeout logic (with smart pointer) * Include string_view * Switch to thread from jthread (maybe not supported by macOS compiler?) * Improve comment * Disable test on Windows * Add TODO related to jthread on macOS * Refactor settings and paths on Windows * Launch in desktop mode on Windows * Remove arg quote wraps which break desktop mode * Fixed qFatal on Linux * Remove test value * Follow original `AppConfig` accessor convention * Disable service checkbox if not Windows * Simplify TLS control enable logic * Update command and Git ignore * Fixed code style * Fixed include consistency * Fixed includes in validator * Fixed lint errors * Update ChangeLog * Use smart pointer for core process * Remove unneccesary default operators * Don't halt on stderr
2024-07-22 16:48:02 +00:00
ui->btnToggleCore->setText(tr("&Stop"));
ui->btnToggleCore->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::ProcessStop));
ui->btnApplySettings->setEnabled(true);
Implement safer memory use, improve dev env, fixed GUI bugs (#7407) * Improve dev script for daemon * Ignore `.user` files created by Qt * Add `FORCE_DESKTOP_PROCESS` option * Catch errors related to getting profile dir * Disable IPC entirely if forced desktop * Use in-class init for AppConfig members * Refactor config to use safer memory management * Improve launch config to make OS-specific debugger usage clearer * Re-enable MainWindowTests on Windows, further refactor for memory safety, fixed some include orders * Remove dead singleton code * Swap order of tests * Use HTTPs for URLs * Fixed compile errors for `SYNERGY_ENABLE_LICENSING` compile path * Restore exec function call * Remove extra link in cancel dialog * Fixed broken link on activation cancel UI * Close dialog if activated * Fixed macOS enum ref to kCurrentProcess * Improve wording on cancel activation dialog * WIP - Test timeout (compile error) * Finished timeout logic (with smart pointer) * Include string_view * Switch to thread from jthread (maybe not supported by macOS compiler?) * Improve comment * Disable test on Windows * Add TODO related to jthread on macOS * Refactor settings and paths on Windows * Launch in desktop mode on Windows * Remove arg quote wraps which break desktop mode * Fixed qFatal on Linux * Remove test value * Follow original `AppConfig` accessor convention * Disable service checkbox if not Windows * Simplify TLS control enable logic * Update command and Git ignore * Fixed code style * Fixed include consistency * Fixed includes in validator * Fixed lint errors * Update ChangeLog * Use smart pointer for core process * Remove unneccesary default operators * Don't halt on stderr
2024-07-22 16:48:02 +00:00
m_actionStartCore->setEnabled(false);
m_actionStopCore->setEnabled(true);
Implement safer memory use, improve dev env, fixed GUI bugs (#7407) * Improve dev script for daemon * Ignore `.user` files created by Qt * Add `FORCE_DESKTOP_PROCESS` option * Catch errors related to getting profile dir * Disable IPC entirely if forced desktop * Use in-class init for AppConfig members * Refactor config to use safer memory management * Improve launch config to make OS-specific debugger usage clearer * Re-enable MainWindowTests on Windows, further refactor for memory safety, fixed some include orders * Remove dead singleton code * Swap order of tests * Use HTTPs for URLs * Fixed compile errors for `SYNERGY_ENABLE_LICENSING` compile path * Restore exec function call * Remove extra link in cancel dialog * Fixed broken link on activation cancel UI * Close dialog if activated * Fixed macOS enum ref to kCurrentProcess * Improve wording on cancel activation dialog * WIP - Test timeout (compile error) * Finished timeout logic (with smart pointer) * Include string_view * Switch to thread from jthread (maybe not supported by macOS compiler?) * Improve comment * Disable test on Windows * Add TODO related to jthread on macOS * Refactor settings and paths on Windows * Launch in desktop mode on Windows * Remove arg quote wraps which break desktop mode * Fixed qFatal on Linux * Remove test value * Follow original `AppConfig` accessor convention * Disable service checkbox if not Windows * Simplify TLS control enable logic * Update command and Git ignore * Fixed code style * Fixed include consistency * Fixed includes in validator * Fixed lint errors * Update ChangeLog * Use smart pointer for core process * Remove unneccesary default operators * Don't halt on stderr
2024-07-22 16:48:02 +00:00
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
} else {
disconnect(ui->btnToggleCore, &QPushButton::clicked, m_actionStopCore, &QAction::trigger);
connect(ui->btnToggleCore, &QPushButton::clicked, m_actionStartCore, &QAction::trigger, Qt::UniqueConnection);
Implement safer memory use, improve dev env, fixed GUI bugs (#7407) * Improve dev script for daemon * Ignore `.user` files created by Qt * Add `FORCE_DESKTOP_PROCESS` option * Catch errors related to getting profile dir * Disable IPC entirely if forced desktop * Use in-class init for AppConfig members * Refactor config to use safer memory management * Improve launch config to make OS-specific debugger usage clearer * Re-enable MainWindowTests on Windows, further refactor for memory safety, fixed some include orders * Remove dead singleton code * Swap order of tests * Use HTTPs for URLs * Fixed compile errors for `SYNERGY_ENABLE_LICENSING` compile path * Restore exec function call * Remove extra link in cancel dialog * Fixed broken link on activation cancel UI * Close dialog if activated * Fixed macOS enum ref to kCurrentProcess * Improve wording on cancel activation dialog * WIP - Test timeout (compile error) * Finished timeout logic (with smart pointer) * Include string_view * Switch to thread from jthread (maybe not supported by macOS compiler?) * Improve comment * Disable test on Windows * Add TODO related to jthread on macOS * Refactor settings and paths on Windows * Launch in desktop mode on Windows * Remove arg quote wraps which break desktop mode * Fixed qFatal on Linux * Remove test value * Follow original `AppConfig` accessor convention * Disable service checkbox if not Windows * Simplify TLS control enable logic * Update command and Git ignore * Fixed code style * Fixed include consistency * Fixed includes in validator * Fixed lint errors * Update ChangeLog * Use smart pointer for core process * Remove unneccesary default operators * Don't halt on stderr
2024-07-22 16:48:02 +00:00
ui->btnToggleCore->setText(tr("&Start"));
ui->btnToggleCore->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
ui->btnApplySettings->setEnabled(false);
m_actionStartCore->setEnabled(true);
m_actionStopCore->setEnabled(false);
}
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
}
void MainWindow::coreConnectionStateChanged(CoreConnectionState state)
{
qDebug() << "core connection state changed: " << static_cast<int>(state);
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
2024-07-26 22:53:52 +00:00
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
updateStatus();
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
2024-08-07 14:05:18 +00:00
// always assume connection is not secure when connection changes
// to anything except connected. the only way the padlock shows is
// when the correct TLS version string is detected.
if (state != CoreConnectionState::Connected) {
secureSocket(false);
} else if (isVisible()) {
showFirstConnectedMessage();
}
2012-06-10 16:50:54 +00:00
}
QString MainWindow::getIPAddresses() const
{
QStringList result;
bool hinted = false;
const auto localnet = QHostAddress::parseSubnet("192.168.0.0/16");
const QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
2021-04-16 11:41:36 +00:00
for (const auto &address : addresses) {
if (address.protocol() == QAbstractSocket::IPv4Protocol && address != QHostAddress(QHostAddress::LocalHost) &&
!address.isInSubnet(QHostAddress::parseSubnet("169.254.0.0/16"))) {
2021-04-16 11:41:36 +00:00
// usually 192.168.x.x is a useful ip for the user, so indicate
// this by making it bold.
if (!hinted && address.isInSubnet(localnet)) {
QString format = R"(<span style="color:%1;">%2</span>)";
result.append(format.arg(kColorTertiary, address.toString()));
hinted = true;
} else {
result.append(address.toString());
}
}
}
if (result.isEmpty()) {
result.append("Unknown");
}
return result.join(", ");
}
void MainWindow::updateLocalFingerprint()
{
const bool tlsEnabled = Settings::value(Settings::Security::TlsEnabled).toBool();
m_btnFingerprint->setVisible(tlsEnabled && QFile::exists(localFingerprintDb()));
}
void MainWindow::autoAddScreen(const QString name)
{
int r = m_serverConfig.autoAddScreen(name);
if (r != kAutoAddScreenOk) {
switch (r) {
case kAutoAddScreenManualServer:
showConfigureServer(
tr("Please add the server (%1) to the grid.").arg(Settings::value(Settings::Core::ScreenName).toString())
);
break;
case kAutoAddScreenManualClient:
showConfigureServer(
tr("Please add the server (%1) to the grid.").arg(Settings::value(Settings::Core::ScreenName).toString())
);
break;
}
}
}
void MainWindow::hide()
{
#ifdef Q_OS_MAC
macOSNativeHide();
#else
QMainWindow::hide();
#endif
m_actionRestore->setVisible(true);
m_actionMinimize->setVisible(false);
}
void MainWindow::showConfigureServer(const QString &message)
{
ServerConfigDialog dialog(this, serverConfig());
dialog.message(message);
if ((dialog.exec() == QDialog::Accepted) && m_coreProcess.isStarted()) {
m_coreProcess.restart();
}
2012-06-10 16:50:54 +00:00
}
void MainWindow::secureSocket(bool secureSocket)
{
m_secureSocket = secureSocket;
updateSecurityIcon(m_lblSecurityStatus->isVisible());
}
void MainWindow::updateScreenName()
{
const auto screenName = Settings::value(Settings::Core::ScreenName).toString();
ui->lblComputerName->setText(screenName);
ui->lineEditName->setText(screenName);
m_serverConfig.updateServerName();
}
void MainWindow::showAndActivate()
{
#ifdef Q_OS_MAC
forceAppActive();
#endif
2024-12-22 21:30:52 +00:00
showNormal();
raise();
activateWindow();
m_actionRestore->setVisible(false);
m_actionMinimize->setVisible(true);
}
void MainWindow::showHostNameEditor()
{
ui->lineEditName->show();
ui->lblComputerName->hide();
ui->btnEditName->hide();
ui->lineEditName->setFocus();
}
void MainWindow::setHostName()
{
ui->lineEditName->hide();
ui->lblComputerName->show();
ui->btnEditName->show();
QString text = ui->lineEditName->text();
const auto screenName = Settings::value(Settings::Core::ScreenName).toString();
bool existingScreen = serverConfig().screenExists(text) && (text != screenName);
if (!ui->lineEditName->hasAcceptableInput() || text.isEmpty() || existingScreen) {
blockSignals(true);
ui->lineEditName->setText(screenName);
blockSignals(false);
const auto title = tr("Invalid Screen Name");
QString body;
if (existingScreen) {
body = tr("Screen name already exists");
} else {
body =
tr("The name you have chosen is invalid.\n\n"
"Valid names:\n"
"• Use letters and numbers\n"
"• May also use _ or -\n"
"• Are between 1 and 255 characters");
}
QMessageBox::information(this, title, body);
return;
}
ui->lblComputerName->setText(ui->lineEditName->text());
Settings::setValue(Settings::Core::ScreenName, ui->lineEditName->text());
applyConfig();
}
QString MainWindow::getTlsPath()
{
return QStringLiteral("%1/%2").arg(Settings::settingsPath(), kTlsDirName);
}
QString MainWindow::localFingerprintDb()
{
return QStringLiteral("%1/%2").arg(getTlsPath(), kTlsFingerprintLocalFilename);
}
QString MainWindow::trustedFingerprintDb()
{
const bool isClient = m_coreProcess.mode() == CoreMode::Client;
const auto trustFile = isClient ? kTlsFingerprintTrustedServersFilename : kTlsFingerprintTrustedClientsFilename;
return QStringLiteral("%1/%2").arg(getTlsPath(), trustFile);
}
bool MainWindow::regenerateLocalFingerprints()
{
const auto certificate = Settings::value(Settings::Security::Certificate).toString();
if (!QFile::exists(certificate) && !m_tlsUtility.generateCertificate()) {
return false;
}
TlsCertificate tls;
if (!tls.generateFingerprint(certificate)) {
return false;
}
updateLocalFingerprint();
return true;
}