Upgrade from Qt5 to Qt6 for more modern UI (#7373)

* Use Qt 6

* Fixed some Qt6 deps

* Fixed minor compile issues for Qt6

* Drop Debian 11 support (no Qt6 lib)

* Move Debian to top

* Delete expensive to maintain code that yeilds low UX gain

* Unpack all values

* Use %lld instead of %u

* Minor UI improvements

* Add deps for Fedora, OpenSUSE, and Arch

* Fixed CMake lint issue

* Use package name from build.opensuse.org

* Used `zypper search` to find correct package names
This commit is contained in:
Nick Bolton 2024-07-08 15:37:51 +01:00 committed by GitHub
parent d1abddde84
commit 6e82f64ec8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
118 changed files with 418 additions and 63713 deletions

View file

@ -142,7 +142,7 @@ jobs:
- name: Configure
env:
CMAKE_OSX_DEPLOYMENT_TARGET: ${{ matrix.target.version }}
run: cmake -B build --preset=macos-release -DCMAKE_PREFIX_PATH=$(brew --prefix qt@5)
run: cmake -B build --preset=macos-release -DCMAKE_PREFIX_PATH=$(brew --prefix qt@6)
- name: Build
run: cmake --build build -j8
@ -186,17 +186,6 @@ jobs:
strategy:
matrix:
distro:
- name: ubuntu-24.04-amd64
container: ubuntu:24.04
runs-on: ubuntu-latest
install-deps-apt: true
extra-packages: true
- name: ubuntu-22.04-amd64
container: ubuntu:22.04
runs-on: ubuntu-latest
install-deps-apt: true
- name: debian-12-arm64
container: arm64v8/debian:12
runs-on: buildjet-4vcpu-ubuntu-2204-arm
@ -207,11 +196,16 @@ jobs:
runs-on: ubuntu-latest
install-deps-apt: true
- name: debian-11-amd64
container: debian:11
- name: ubuntu-24.04-amd64
container: ubuntu:24.04
runs-on: ubuntu-latest
install-deps-apt: true
extra-packages: true
- name: ubuntu-22.04-amd64
container: ubuntu:22.04
runs-on: ubuntu-latest
install-deps-apt: true
legacy-cmake: true
- name: fedora-40-arm64
container: arm64v8/fedora:40
@ -270,15 +264,9 @@ jobs:
- name: Install dependencies
run: ./scripts/install_deps.py
- name: Configure (modern)
if: ${{ !matrix.distro.legacy-cmake }}
- name: Configure
run: cmake -B build --preset=linux-release
# Some older Linux distro versions don't support modern CMake presets.
- name: Configure (legacy)
if: ${{ matrix.distro.legacy-cmake }}
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build -j8

View file

@ -1,4 +1,4 @@
brew 'make'
brew 'cmake'
brew 'openssl'
brew 'qt@5'
brew 'qt@6'

View file

@ -42,6 +42,7 @@ Enhancements:
- #7368 Make version check URL v1-specific and configurable
- #7369 Re-implement packaging for GitHub workflows (Linux ARM)
- #7372 Add Git SHA to about screen and --version
- #7373 Upgrade from Qt5 to Qt6 for more modern UI
# 1.14.6

View file

@ -4,11 +4,8 @@
<packages>
<package id="cmake" />
<package id="ninja" />
<!-- lock openssl to 3.1.1. as of 19th jan 2024, 3.2.0 breaks cmake configure. -->
<package id="openssl" version="3.1.1" />
<package id="openssl" />
<package id="wixtoolset" />
<package id="visualstudio2022buildtools"
packageParameters="--includeRecommended --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools " />
</packages>

View file

@ -49,11 +49,6 @@ macro(configure_definitions)
add_definitions(-DSYNERGY_PRODUCT_NAME="${PRODUCT_NAME}")
endif()
if(ENABLE_AUTO_CONFIG)
message(STATUS "Auto config enabled")
add_definitions(-DSYNERGY_ENABLE_AUTO_CONFIG=1)
endif()
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Disabling debug build")
add_definitions(-DNDEBUG)
@ -127,7 +122,4 @@ macro(configure_options)
option(ENABLE_LICENSING "Enable licensing" ${DEFAULT_ENABLE_LICENSING})
option(ENABLE_COVERAGE "Enable test coverage" ${DEFAULT_ENABLE_COVERAGE})
# auto config is off by default because it requires bonjour, which sucks.
option(ENABLE_AUTO_CONFIG "Enable auto config (zeroconf)" OFF)
endmacro()

View file

@ -3,9 +3,11 @@ config:
dependencies:
command: choco install Chocolatey.config -y
qt:
version: 5.15.2
version: 6.7.2
mirror: https://qt.mirror.constant.com/
install-dir: C:\Qt
modules:
- qt5compat
choco-ci:
edit-config: Chocolatey.config
skip-packages:
@ -13,7 +15,7 @@ config:
- visualstudio2022buildtools
mac:
qt-prefix-command: brew --prefix qt@5
qt-prefix-command: brew --prefix qt@6
dependencies:
command: brew bundle --file=Brewfile
@ -33,8 +35,9 @@ config:
libgdk-pixbuf-2.0-dev \
libnotify-dev \
libxkbfile-dev \
qtbase5-dev \
qttools5-dev \
qt6-base-dev \
qt6-tools-dev \
libqt6core5compat6-dev \
libgtk-3-dev
ubuntu:
@ -53,8 +56,9 @@ config:
libXtst-devel \
libnotify-devel \
libxkbfile-devel \
qt5-qtbase-devel \
qt5-qttools-devel \
qt6-qtbase-devel \
qt6-qttools-devel \
qt6-qt5compat-devel \
gtk3-devel \
rpm-build
@ -66,14 +70,15 @@ config:
cmake \
make \
gcc-c++ \
openssl-devel \
libopenssl-devel \
glib2-devel \
gdk-pixbuf-devel \
libXtst-devel \
libnotify-devel \
libxkbfile-devel \
libqt5-qtbase-devel \
libqt5-qttools-devel \
qt6-base-devel \
qt6-tools-devel \
qt6-qt5compat-devel \
gtk3-devel \
rpm-build
@ -89,8 +94,9 @@ config:
libxtst \
libnotify \
libxkbfile \
qt5-base \
qt5-tools \
qt6-base \
qt6-tools \
qt6-5compat \
gtk3
manjaro:

View file

@ -1,3 +0,0 @@
files:
- source: /src/gui/gui.ts
translation: /src/gui/res/lang/gui_%locale%.ts

View file

@ -20,7 +20,8 @@ depends=(
'libxkbcommon-x11'
'libnotify'
'hicolor-icon-theme'
'qt5-base'
'qt6-base'
'qt6-tools'
)
conflicts=('synergy-git' 'synergy1-bin' 'synergy2-bin' 'synergy3-bin')

View file

@ -105,29 +105,27 @@
<fire:FirewallException Id="GuiFirewallException" IgnoreFailure="yes" Name="$(var.Name)" Scope="any"/>
</File>
<?if $(var.Configuration) = "Debug" ?>
<File Source="$(var.BinPath)\Qt5Cored.dll"/>
<File Source="$(var.BinPath)\Qt5Guid.dll"/>
<File Source="$(var.BinPath)\Qt5Networkd.dll"/>
<File Source="$(var.BinPath)\Qt5Svgd.dll"/>
<File Source="$(var.BinPath)\Qt5Widgetsd.dll"/>
<File Source="$(var.BinPath)\libGLESv2d.dll"/>
<File Source="$(var.BinPath)\libEGLd.dll"/>
<File Source="$(var.BinPath)\Qt6Cored.dll"/>
<File Source="$(var.BinPath)\Qt6Guid.dll"/>
<File Source="$(var.BinPath)\Qt6Networkd.dll"/>
<File Source="$(var.BinPath)\Qt6Svgd.dll"/>
<File Source="$(var.BinPath)\Qt6Widgetsd.dll"/>
<File Source="$(var.BinPath)\styles\qmodernwindowsstyle.dll"/>
<!-- HACK: Normally the C++ redistributable solves this dependency, including it can cause problems -->
<File Source="C:\Program Files (x86)\Windows Kits\10\bin\$(var.Platform)\ucrt\ucrtbased.dll"/>
<?else ?>
<File Source="$(var.BinPath)\Qt5Core.dll"/>
<File Source="$(var.BinPath)\Qt5Gui.dll"/>
<File Source="$(var.BinPath)\Qt5Network.dll"/>
<File Source="$(var.BinPath)\Qt5Svg.dll"/>
<File Source="$(var.BinPath)\Qt5Widgets.dll"/>
<File Source="$(var.BinPath)\libGLESv2.dll"/>
<File Source="$(var.BinPath)\libEGL.dll"/>
<File Source="$(var.BinPath)\Qt6Core.dll"/>
<File Source="$(var.BinPath)\Qt6Gui.dll"/>
<File Source="$(var.BinPath)\Qt6Network.dll"/>
<File Source="$(var.BinPath)\Qt6Svg.dll"/>
<File Source="$(var.BinPath)\Qt6Widgets.dll"/>
<File Source="$(var.BinPath)\styles\qmodernwindowsstyle.dll"/>
<?endif ?>
</Component>
</ComponentGroup>
<ComponentGroup Directory="QTStylesDir" Id="ProductQtStylesComponents">
<Component Guid="96E0F8D8-64FD-4CE8-94D1-F6EDCBBB4995" Id="Styles">
<File Id="qwindowsvistastyle" Source="$(var.BinPath)\styles\qwindowsvistastyle.dll"/>
<File Id="qmodernwindowsstyle" Source="$(var.BinPath)\styles\qmodernwindowsstyle.dll"/>
</Component>
</ComponentGroup>
<ComponentGroup Directory="PlatformsDir" Id="ProductQtPluginComponents">

View file

@ -23,7 +23,7 @@ def main():
if args.set_qt_version:
config = Config()
_qt_mirror, qt_version, _qt_install_dir = config.get_qt_config()
_, qt_version, _, _ = config.get_qt_config()
github.set_env(qt_version_key, qt_version)
else:
raise RuntimeError("No option selected")

View file

@ -51,8 +51,9 @@ class Config:
mirror_url = _get(qt, "mirror", parent_key)
version = _get(qt, "version", parent_key)
base_dir = _get(qt, "install-dir", parent_key)
modules = _get(qt, "modules", parent_key)
return mirror_url, version, base_dir
return mirror_url, version, base_dir, modules
def get_os_deps_value(self, key):
deps = self.get_os_value(deps_key)

View file

@ -50,12 +50,18 @@ def set_env_var(name, value):
def package(filename_base):
cert_base64 = env.get_env("WINDOWS_PFX_CERTIFICATE")
cert_password = env.get_env("WINDOWS_PFX_PASSWORD")
cert_env_key = "WINDOWS_PFX_CERTIFICATE"
cert_base64 = env.get_env(cert_env_key, required=False)
if cert_base64:
cert_password = env.get_env("WINDOWS_PFX_PASSWORD")
sign_binaries(cert_base64, cert_password)
sign_binaries(cert_base64, cert_password)
build_msi(filename_base)
sign_msi(filename_base, cert_base64, cert_password)
if cert_base64:
sign_msi(filename_base, cert_base64, cert_password)
else:
print(f"Skipped code signing, env var not set: {cert_env_key}")
def assert_vs_cmd(cmd):
@ -187,9 +193,10 @@ class WindowsChoco:
class WindowsQt:
"""Qt for Windows."""
def __init__(self, mirror_url, version, base_dir):
def __init__(self, mirror_url, version, base_dir, modules):
self.mirror_url = mirror_url
self.version = version
self.modules = modules
# allows ci to override the qt base dir path
self.base_dir = os.environ.get(qt_base_dir_env_var)
@ -215,7 +222,11 @@ class WindowsQt:
args = ["python", "-m", "aqt", "install-qt"]
args.extend(["--outputdir", self.base_dir])
args.extend(["--base", self.mirror_url])
args.extend(["windows", "desktop", self.version, "win64_msvc2019_64"])
args.extend(
["windows", "desktop", self.version, "win64_msvc2019_64", "-m"]
+ self.modules
)
cmd_utils.run(
args,
shell=True,

View file

@ -1,4 +1,8 @@
find_package(Qt5 COMPONENTS Core Widgets Network LinguistTools)
find_package(
Qt6
COMPONENTS Core Widgets Network Core5Compat
REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
@ -7,18 +11,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
file(GLOB GUI_SOURCE_FILES src/*.cpp src/*.h src/validators/* src/widgets/*)
file(GLOB GUI_UI_FILES src/*.ui)
file(GLOB ACTIVATION_FILES src/*Activation* src/*License*)
file(GLOB ZEROCONF_FILES src/Zeroconf*)
file(GLOB LANGUAGE_FILES res/lang/*.ts)
configure_file(res/Languages.qrc res/Languages.qrc)
set_source_files_properties(
${LANGUAGE_FILES} PROPERTIES OUTPUT_LOCATION
"${CMAKE_CURRENT_BINARY_DIR}/res/lang")
qt5_add_translation(QM_FILES ${LANGUAGE_FILES})
add_custom_target(translations ALL DEPENDS ${QM_FILES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file(GLOB GUI_MAC_SOURCE_FILES src/*.mm)
@ -27,7 +19,7 @@ endif()
# Retrieve the absolute path to qmake and then use that path to find the
# binaries
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
@ -37,21 +29,18 @@ if(NOT ENABLE_LICENSING)
list(REMOVE_ITEM GUI_UI_FILES ${ACTIVATION_FILES})
endif()
list(REMOVE_ITEM GUI_SOURCE_FILES ${ZEROCONF_FILES})
if(WIN32)
set(GUI_RC_FILES res/win/Synergy.rc ${CMAKE_BINARY_DIR}/src/version.rc)
endif()
add_executable(
synergy WIN32
${GUI_SOURCE_FILES} ${GUI_UI_FILES} ${GUI_RC_FILES} res/Synergy.qrc
${CMAKE_CURRENT_BINARY_DIR}/res/Languages.qrc ${QM_FILES})
add_executable(synergy WIN32 ${GUI_SOURCE_FILES} ${GUI_UI_FILES}
${GUI_RC_FILES} res/Synergy.qrc ${QM_FILES})
include_directories(./src)
target_link_libraries(synergy shared)
target_link_libraries(synergy Qt5::Core Qt5::Widgets Qt5::Network)
target_link_libraries(synergy Qt6::Core Qt6::Widgets Qt6::Network
Qt6::Core5Compat)
target_compile_definitions(
synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_VERSION_STAGE}")
target_compile_definitions(synergy
@ -73,34 +62,34 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
endif()
if(WIN32)
if(Qt5_FOUND
if(Qt6_FOUND
AND WIN32
AND TARGET Qt5::qmake
AND NOT TARGET Qt5::windeployqt)
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
AND TARGET Qt6::qmake
AND NOT TARGET Qt6::windeployqt)
get_target_property(_qt6_qmake_location Qt6::qmake IMPORTED_LOCATION)
execute_process(
COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX
COMMAND "${_qt6_qmake_location}" -query QT_INSTALL_PREFIX
RESULT_VARIABLE return_code
OUTPUT_VARIABLE qt5_install_prefix
OUTPUT_VARIABLE qt6_install_prefix
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe")
set(imported_location "${qt6_install_prefix}/bin/windeployqt.exe")
if(EXISTS ${imported_location})
add_executable(Qt5::windeployqt IMPORTED)
add_executable(Qt6::windeployqt IMPORTED)
set_target_properties(Qt5::windeployqt PROPERTIES IMPORTED_LOCATION
set_target_properties(Qt6::windeployqt PROPERTIES IMPORTED_LOCATION
${imported_location})
endif()
endif()
if(TARGET Qt5::windeployqt)
if(TARGET Qt6::windeployqt)
# execute windeployqt in a tmp directory after build
add_custom_command(
TARGET synergy
POST_BUILD
COMMAND set PATH=%PATH%$<SEMICOLON>${qt5_install_prefix}/bin
COMMAND Qt5::windeployqt
COMMAND set PATH=%PATH%$<SEMICOLON>${qt6_install_prefix}/bin
COMMAND Qt6::windeployqt
"$<TARGET_FILE_DIR:synergy>/$<TARGET_FILE_NAME:synergy>")
endif()
endif()

File diff suppressed because it is too large Load diff

View file

@ -1,2 +0,0 @@
lupdate -noobsolete gui.pro -ts gui.ts res/lang/*.ts
sed -i "s/filename\=\"\.\.\/\.\.\//filename\=\"/g" res/lang/*.ts

View file

@ -1,2 +0,0 @@
cd res/lang
lrelease *.ts

View file

@ -1,46 +0,0 @@
<RCC>
<qresource prefix="/res">
<file>lang/gui_ar-SA.qm</file>
<file>lang/gui_lv-LV.qm</file>
<file>lang/gui_bg-BG.qm</file>
<file>lang/gui_mr-IN.qm</file>
<file>lang/gui_ca-ES.qm</file>
<file>lang/gui_nl-NL.qm</file>
<file>lang/gui_cs-CZ.qm</file>
<file>lang/gui_no-NO.qm</file>
<file>lang/gui_cy-GB.qm</file>
<file>lang/gui_pl-PL.qm</file>
<file>lang/gui_da-DK.qm</file>
<file>lang/gui_pt-BR.qm</file>
<file>lang/gui_de-DE.qm</file>
<file>lang/gui_pt-PT.qm</file>
<file>lang/gui_el-GR.qm</file>
<file>lang/gui_ro-RO.qm</file>
<file>lang/gui_ru-RU.qm</file>
<file>lang/gui_es-ES.qm</file>
<file>lang/gui_sk-SK.qm</file>
<file>lang/gui_et-EE.qm</file>
<file>lang/gui_sl-SI.qm</file>
<file>lang/gui_fi-FI.qm</file>
<file>lang/gui_sq-AL.qm</file>
<file>lang/gui_fr-FR.qm</file>
<file>lang/gui_sr-SP.qm</file>
<file>lang/gui_gl-ES.qm</file>
<file>lang/gui_sv-SE.qm</file>
<file>lang/gui_he-IL.qm</file>
<file>lang/gui_th-TH.qm</file>
<file>lang/gui_hr-HR.qm</file>
<file>lang/gui_tr-TR.qm</file>
<file>lang/gui_hu-HU.qm</file>
<file>lang/gui_uk-UA.qm</file>
<file>lang/gui_id-ID.qm</file>
<file>lang/gui_ur-IN.qm</file>
<file>lang/gui_it-IT.qm</file>
<file>lang/gui_vi-VN.qm</file>
<file>lang/gui_ja-JP.qm</file>
<file>lang/gui_zh-CN.qm</file>
<file>lang/gui_ko-KR.qm</file>
<file>lang/gui_zh-TW.qm</file>
<file>lang/gui_lt-LT.qm</file>
</qresource>
</RCC>

View file

@ -8,7 +8,6 @@
<file>icons/256x256/synergy.ico</file>
<file>image/about.png</file>
<file>image/about-dark.png</file>
<file>lang/Languages.xml</file>
<file>image/spinning-wheel.gif</file>
<file>icons/16x16/padlock.png</file>
<file>icons/16x16/synergy-transfering.png</file>

View file

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<languages>
<language ietfCode="en" name="English" />
<language ietfCode="ca-ES" name="Català (Andorra)" />
<language ietfCode="cs-CZ" name="Čeština" />
<language ietfCode="cy-GB" name="Cymraeg" />
<language ietfCode="da-DK" name="Dansk" />
<language ietfCode="de-DE" name="Deutsch" />
<language ietfCode="es-ES" name="Español" />
<language ietfCode="fr-FR" name="Français" />
<language ietfCode="hr-HR" name="Hrvatski" />
<language ietfCode="id-ID" name="Indonesia" />
<language ietfCode="it-IT" name="Italiano" />
<language ietfCode="lv-LV" name="Latvijas" />
<language ietfCode="lt-LT" name="Lietuvos" />
<language ietfCode="hu-HU" name="Magyar" />
<language ietfCode="nl-NL" name="Nederlands" />
<language ietfCode="no-NO" name="Norsk" />
<language ietfCode="pl-PL" name="Polski" />
<language ietfCode="pt-PT" name="Português" />
<language ietfCode="pt-BR" name="Português (Brasil)" />
<language ietfCode="ro-RO" name="Română" />
<language ietfCode="sq-AL" name="Shqiptar" />
<language ietfCode="sl-SI" name="Slovenščina" />
<language ietfCode="sk-SK" name="Slovenčina" />
<language ietfCode="fi-FI" name="Suomi" />
<language ietfCode="sv-SE" name="Svenska" />
<language ietfCode="vi-VN" name="Tiếng Việt" />
<language ietfCode="tr-TR" name="Türkçe" />
<language ietfCode="bg-BG" name="български" />
<language ietfCode="ru-RU" name="Русский" />
<language ietfCode="sr-SP" name="српски" />
<language ietfCode="uk-UA" name="Український" />
<language ietfCode="el-GR" name="Ελληνικά" />
<language ietfCode="he-IL" name="עברית" />
<language ietfCode="ar-SA" name="العربية" />
<language ietfCode="ur-IN" name="اردو" />
<language ietfCode="th-TH" name="ภาษาไทย" />
<language ietfCode="zh-CN" name="中文 (简体)" />
<language ietfCode="zh-TW" name="中文 (繁體)" />
<language ietfCode="ja-JP" name="日本語" />
<language ietfCode="ko-KR" name="한국어" />
</languages>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -35,17 +35,13 @@ AboutDialog::AboutDialog(MainWindow *parent, const AppConfig &config)
QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified();
QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy");
m_pLabelBuildDate->setText(buildDate.toString(Qt::SystemLocaleLongDate));
textEliteBackers->hide();
labelEliteBackers->hide();
labelEliteBackerLink->hide();
labelCreditsLink->hide();
m_pLabelBuildDate->setText(
buildDate.toString(QLocale::system().dateFormat(QLocale::LongFormat)));
}
int AboutDialog::exec() {
// Sets the current build year into the copyright text
label_3->setText(getCopyrights() + getKeyContributors());
m_pDevelopersLabel->setText(getImportantDevelopers());
m_pCopyrightLabel->setText(getCopyright());
resizeWindow();
updateLogo();
@ -64,26 +60,37 @@ void AboutDialog::updateLogo() const {
if (isOSXInterfaceStyleDark()) {
QPixmap logo(":/res/image/about-dark.png");
if (!logo.isNull()) {
label_Logo->setPixmap(logo);
m_pLabel_Logo->setPixmap(logo);
}
}
#endif
}
QString AboutDialog::getKeyContributors() const {
return QString(R"(<p style="font-size: 14px">Key contributors<br>
<span style="font-size: 11px">Chris Schoeneman, Nick Bolton, Richard Lee, Adam Feder, Volker Lanz,
Ryan Breen, Guido Poschta, Bertrand Landry Hetu, Tom Chadwick, Brent Priddy, Kyle Bloom,
Daun Chung, Serhii Hadzhylov, Oleksandr Lysytsia, Olena Kutytska, Francisco Magalhães.</span>
</p>)");
QString AboutDialog::getImportantDevelopers() const {
return QString(
// The ultimate creator
"Chris Schoeneman, "
// Precursor developers
"Richard Lee, Adam Feder, "
// Contributors
"Nick Bolton, Volker Lanz, Ryan Breen, Guido Poschta, "
"Bertrand Landry Hetu, Tom Chadwick, Brent Priddy, Jason Axelson, "
"Jake Petroules, Sorin Sbârnea, "
// Symless employees
"Kyle Bloom, Daun Chung, Serhii Hadzhylov, "
"Oleksandr Lysytsia, Olena Kutytska, Francisco Magalhães.");
}
QString AboutDialog::getCopyrights() const {
QString AboutDialog::getCopyright() const {
QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified();
QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy");
QString copyrights(
R"(<p>Keyboard and mouse sharing application.<br /><br />Copyright © %%YEAR%% Symless Ltd.</p>)");
return copyrights.replace(QString("%%YEAR%%"),
QString::number(buildDate.year()));
QString copyright("Copyright © 2012-%%YEAR%% Symless Ltd.\n"
"Copyright © 2009-2012 Nick Bolton\n"
"Copyright © 2002-2009 Chris Schoeneman");
return copyright.replace(QString("%%YEAR%%"),
QString::number(buildDate.year()));
}

View file

@ -40,8 +40,8 @@ private:
void updateLogo() const;
virtual void resizeWindow();
virtual QString getCopyrights() const;
virtual QString getKeyContributors() const;
virtual QString getCopyright() const;
virtual QString getImportantDevelopers() const;
};
#endif

View file

@ -41,148 +41,14 @@
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="10" column="1">
<widget class="QLabel" name="labelCreditsLink">
<item row="5" column="1">
<widget class="QLabel" name="m_pCopyrightLabel">
<property name="text">
<string notr="true">&lt;a href=&quot;https://symless.com/synergy/credits?source=gui&quot; style=&quot;color: #4285F4;&quot;&gt;View the complete credits&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
<string>Copyright</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="labelEliteBackerLink">
<property name="text">
<string>&lt;a href=&quot;https://symless.com/synergy/account-status?source=gui&quot; style=&quot;color: #4285F4;&quot;&gt;Become an Elite Backer&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>9</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>1</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelEliteBackers">
<property name="font">
<font>
<pointsize>-1</pointsize>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-size: 14px</string>
</property>
<property name="text">
<string>Elite Backers</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textEliteBackers">
<property name="styleSheet">
<string notr="true">font-size: 11px;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_Logo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="pixmap">
<pixmap resource="../res/Synergy.qrc">:/res/image/about.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="15" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_5">
@ -220,23 +86,103 @@
</item>
</layout>
</item>
<item row="11" column="1" colspan="2">
<spacer>
<item row="7" column="1">
<widget class="QLabel" name="m_pTitleLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Important developers</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="m_pDescriptionLabel">
<property name="text">
<string>Keyboard and mouse sharing application.</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<spacer name="verticalSpacer_1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>100</height>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="13" column="1" colspan="2">
<item row="0" column="1">
<widget class="QLabel" name="m_pLabel_Logo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="pixmap">
<pixmap resource="../res/Synergy.qrc">:/res/image/about.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="8" column="1" colspan="2">
<widget class="QLabel" name="m_pDevelopersLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Developers</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item row="9" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="14" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
@ -285,6 +231,38 @@
</item>
</layout>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>

View file

@ -1,72 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2022 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AboutDialogEliteBackers.h"
#include "CreditsLoader.h"
AboutDialogEliteBackers::AboutDialogEliteBackers(MainWindow *parent,
const AppConfig &config)
: AboutDialog(parent, config), credits(*parent, config) {
setupCreditsLoader();
textEliteBackers->show();
labelEliteBackers->show();
labelEliteBackerLink->show();
labelCreditsLink->show();
}
void AboutDialogEliteBackers::setupCreditsLoader() {
this->textEliteBackers->setText("Loading...");
this->textEliteBackers->viewport()->setAutoFillBackground(false);
this->textEliteBackers->document()->setDocumentMargin(0);
connect(&credits, SIGNAL(loaded(const QString &)), this,
SLOT(updateEliteBackers(const QString &)));
credits.loadEliteBackers();
}
void AboutDialogEliteBackers::updateEliteBackers(
const QString &eliteBackers) const {
this->textEliteBackers->setText(eliteBackers);
}
QString AboutDialogEliteBackers::getCopyrights() const {
QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified();
QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy");
QString aboutText(
R"(<p>Keyboard and mouse sharing application. Cross platform and open source since 2001.<br /><br />
Copyright © %%YEAR%% Symless Ltd.<br /><br />
Synergy is released under the GNU General Public License (GPLv2).</p>)");
return aboutText.replace(QString("%%YEAR%%"),
QString::number(buildDate.year()));
}
void AboutDialogEliteBackers::resizeWindow() {
// change default size based on os
#if defined(Q_OS_MAC)
QSize size(600, 490);
setMaximumSize(size);
setMinimumSize(size);
resize(size);
#elif defined(Q_OS_LINUX)
QSize size(600, 420);
setMaximumSize(size);
setMinimumSize(size);
resize(size);
#endif
}

View file

@ -1,36 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2022 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "AboutDialog.h"
#include "CreditsLoader.h"
class AboutDialogEliteBackers : public AboutDialog {
Q_OBJECT
public:
AboutDialogEliteBackers(MainWindow *parent, const AppConfig &config);
public slots:
void updateEliteBackers(const QString &eliteBackers) const;
private:
CreditsLoader credits;
void setupCreditsLoader();
void resizeWindow() override;
QString getCopyrights() const override;
};

View file

@ -23,8 +23,7 @@
AddClientDialog::AddClientDialog(const QString &clientName, QWidget *parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AddClientDialog(), m_AddResult(kAddClientIgnore),
m_IgnoreAutoConfigClient(false) {
Ui::AddClientDialog(), m_AddResult(kAddClientIgnore) {
setupUi(this);
m_pLabelHead->setText("A client wants to connect. "
@ -79,17 +78,6 @@ AddClientDialog::~AddClientDialog() {
delete m_pLabelCenter;
}
void AddClientDialog::changeEvent(QEvent *e) {
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
retranslateUi(this);
break;
default:
break;
}
}
void AddClientDialog::handleButtonLeft() {
m_AddResult = kAddClientLeft;
close();
@ -114,7 +102,3 @@ void AddClientDialog::handleButtonAdvanced() {
m_AddResult = kAddClientOther;
close();
}
void AddClientDialog::on_m_pCheckBoxIgnoreClient_toggled(bool checked) {
m_IgnoreAutoConfigClient = checked;
}

View file

@ -41,13 +41,8 @@ public:
~AddClientDialog();
int addResult() { return m_AddResult; }
bool ignoreAutoConfigClient() { return m_IgnoreAutoConfigClient; }
protected:
void changeEvent(QEvent *e);
private slots:
void on_m_pCheckBoxIgnoreClient_toggled(bool checked);
void handleButtonLeft();
void handleButtonUp();
void handleButtonRight();
@ -61,7 +56,6 @@ private:
QPushButton *m_pButtonDown;
QLabel *m_pLabelCenter;
int m_AddResult;
bool m_IgnoreAutoConfigClient;
};
#endif // ADDCLIENTDIALOG_H

View file

@ -53,10 +53,7 @@ const char *AppConfig::m_SynergySettingsName[] = {
"logToFile",
"logFilename",
"wizardLastRun",
"language",
"startedBefore",
"autoConfig",
"autoConfigServer",
"elevateMode",
"elevateModeEnum",
"edition",
@ -80,7 +77,6 @@ const char *AppConfig::m_SynergySettingsName[] = {
"preventSleep",
"languageSync",
"invertScrollDirection",
"eliteBackersUrl",
"guid",
"licenseRegistryUrl",
"licenseNextCheck",
@ -93,12 +89,11 @@ static const char *logLevelNames[] = {"INFO", "DEBUG", "DEBUG1", "DEBUG2"};
AppConfig::AppConfig()
: m_ScreenName(), m_Port(24800), m_Interface(), m_LogLevel(0),
m_LogToFile(), m_WizardLastRun(0), m_ProcessMode(DEFAULT_PROCESS_MODE),
m_StartedBefore(), m_AutoConfig(true), m_AutoConfigServer(),
m_ElevateMode(defaultElevateMode), m_Edition(kUnregistered),
m_CryptoEnabled(false), m_AutoHide(false), m_LastExpiringWarningTime(0),
m_ActivationHasRun(), m_MinimizeToTray(false), m_ServerGroupChecked(),
m_UseExternalConfig(), m_UseInternalConfig(), m_ClientGroupChecked(),
m_LoadFromSystemScope() {
m_StartedBefore(), m_ElevateMode(defaultElevateMode),
m_Edition(kUnregistered), m_CryptoEnabled(false), m_AutoHide(false),
m_LastExpiringWarningTime(0), m_ActivationHasRun(),
m_MinimizeToTray(false), m_ServerGroupChecked(), m_UseExternalConfig(),
m_UseInternalConfig(), m_ClientGroupChecked(), m_LoadFromSystemScope() {
auto writer = ConfigWriter::make();
@ -166,20 +161,8 @@ bool AppConfig::wizardShouldRun() const {
return m_WizardLastRun < kWizardVersion;
}
const QString &AppConfig::language() const { return m_Language; }
bool AppConfig::startedBefore() const { return m_StartedBefore; }
bool AppConfig::autoConfig() const {
#ifdef ENABLE_AUTO_CONFIG
return m_AutoConfig;
#else
return false;
#endif
}
QString AppConfig::autoConfigServer() const { return m_AutoConfigServer; }
void AppConfig::loadSettings() {
m_ScreenName =
loadSetting(kScreenName, QHostInfo::localHostName()).toString();
@ -194,10 +177,7 @@ void AppConfig::loadSettings() {
m_LogFilename =
loadSetting(kLogFilename, synergyLogDir() + "synergy.log").toString();
m_WizardLastRun = loadCommonSetting(kWizardLastRun, 0).toInt();
m_Language = loadSetting(kLanguage, QLocale::system().name()).toString();
m_StartedBefore = loadSetting(kStartedBefore, false).toBool();
m_AutoConfig = loadSetting(kAutoConfig, false).toBool();
m_AutoConfigServer = loadSetting(kAutoConfigServer, "").toString();
{ // Scope related code together
// TODO Investigate why kElevateModeEnum isn't loaded fully
@ -229,10 +209,6 @@ void AppConfig::loadSettings() {
m_PreventSleep = loadSetting(kPreventSleep, false).toBool();
m_LanguageSync = loadSetting(kLanguageSync, false).toBool();
m_InvertScrollDirection = loadSetting(kInvertScrollDirection, false).toBool();
m_eliteBackersUrl =
loadCommonSetting(kEliteBackersUrl,
"https://api2.prod.symless.com/credits/elite-backers")
.toString();
m_guid = loadCommonSetting(kGuid, QUuid::createUuid()).toString();
m_licenseRegistryUrl =
loadCommonSetting(kLicenseRegistryUrl,
@ -276,7 +252,6 @@ void AppConfig::saveSettings() {
setCommonSetting(kLoadSystemSettings, m_LoadFromSystemScope);
setCommonSetting(kGroupClientCheck, m_ClientGroupChecked);
setCommonSetting(kGroupServerCheck, m_ServerGroupChecked);
setCommonSetting(kEliteBackersUrl, m_eliteBackersUrl);
setCommonSetting(kGuid, m_guid);
setCommonSetting(kLicenseRegistryUrl, m_licenseRegistryUrl);
setCommonSetting(kLicenseNextCheck, m_licenseNextCheck);
@ -288,10 +263,7 @@ void AppConfig::saveSettings() {
setSetting(kLogLevel, m_LogLevel);
setSetting(kLogToFile, m_LogToFile);
setSetting(kLogFilename, m_LogFilename);
setSetting(kLanguage, m_Language);
setSetting(kStartedBefore, m_StartedBefore);
setSetting(kAutoConfig, m_AutoConfig);
setSetting(kAutoConfigServer, m_AutoConfigServer);
// Refer to enum ElevateMode declaration for insight in to why this
// flag is mapped this way
setSetting(kElevateModeSetting, m_ElevateMode == ElevateAlways);
@ -356,10 +328,6 @@ void AppConfig::setWizardHasRun() {
setSettingModified(m_WizardLastRun, kWizardVersion);
}
void AppConfig::setLanguage(const QString &language) {
setSettingModified(m_Language, language);
}
void AppConfig::setStartedBefore(bool b) {
setSettingModified(m_StartedBefore, b);
}
@ -368,15 +336,6 @@ void AppConfig::setElevateMode(ElevateMode em) {
setSettingModified(m_ElevateMode, em);
}
void AppConfig::setAutoConfig(bool autoConfig) {
setSettingModified(m_AutoConfig, autoConfig);
emit zeroConfToggled();
}
void AppConfig::setAutoConfigServer(const QString &autoConfigServer) {
setSettingModified(m_AutoConfigServer, autoConfigServer);
}
#ifdef SYNERGY_ENABLE_LICENSING
void AppConfig::setEdition(Edition e) {
setSettingModified(m_Edition, e);
@ -445,18 +404,10 @@ bool AppConfig::getInvertScrollDirection() const {
return m_InvertScrollDirection;
}
void AppConfig::setEliteBackersUrl(const QString &newValue) {
setSettingModified(m_eliteBackersUrl, newValue);
}
void AppConfig::setLicenseNextCheck(unsigned long long time) {
setSettingModified(m_licenseNextCheck, time);
}
const QString &AppConfig::getEliteBackersUrl() const {
return m_eliteBackersUrl;
}
const QString &AppConfig::getLicenseRegistryUrl() const {
return m_licenseRegistryUrl;
}

View file

@ -79,12 +79,7 @@ public:
QString logLevelText() const;
ProcessMode processMode() const;
bool wizardShouldRun() const;
const QString &language() const;
bool startedBefore() const;
bool autoConfig() const;
void setAutoConfig(bool autoConfig);
QString autoConfigServer() const;
void setAutoConfigServer(const QString &autoConfigServer);
#ifdef SYNERGY_ENABLE_LICENSING
void setEdition(Edition);
@ -112,9 +107,7 @@ public:
bool getAutoHide();
void setInvertScrollDirection(bool b);
bool getInvertScrollDirection() const;
void setEliteBackersUrl(const QString &);
void setLicenseNextCheck(unsigned long long);
const QString &getEliteBackersUrl() const;
const QString &getLicenseRegistryUrl() const;
unsigned long long getLicenseNextCheck() const;
const QString &getGuid() const;
@ -191,10 +184,7 @@ protected:
kLogToFile,
kLogFilename,
kWizardLastRun,
kLanguage,
kStartedBefore,
kAutoConfig,
kAutoConfigServer,
kElevateModeSetting,
kElevateModeEnum,
kEditionSetting,
@ -218,7 +208,6 @@ protected:
kPreventSleep,
kLanguageSync,
kInvertScrollDirection,
kEliteBackersUrl,
kGuid,
kLicenseRegistryUrl,
kLicenseNextCheck,
@ -234,7 +223,6 @@ protected:
void setLogToFile(bool b);
void setLogFilename(const QString &s);
void setWizardHasRun();
void setLanguage(const QString &language);
void setStartedBefore(bool b);
void setElevateMode(ElevateMode em);
@ -253,10 +241,7 @@ private:
QString m_LogFilename;
int m_WizardLastRun;
ProcessMode m_ProcessMode;
QString m_Language;
bool m_StartedBefore;
bool m_AutoConfig;
QString m_AutoConfigServer;
ElevateMode m_ElevateMode;
Edition m_Edition;
QString m_ActivateEmail;
@ -264,7 +249,6 @@ private:
bool m_AutoHide;
QString m_Serialkey;
QString m_lastVersion;
QString m_eliteBackersUrl;
QString m_guid;
QString m_licenseRegistryUrl;
unsigned long long m_licenseNextCheck;
@ -352,7 +336,6 @@ private:
signals:
void sslToggled() const;
void zeroConfToggled();
void screenNameChanged() const;
};

View file

@ -1,190 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2018 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "BonjourWindows.h"
#if defined(Q_OS_WIN)
#include "CommandProcess.h"
#include "DataDownloader.h"
#include "MainWindow.h"
#include "QUtility.h"
#include "SettingsDialog.h"
#include <QDir>
#include <QMessageBox>
#include <QStandardPaths>
#include <QThread>
#include <QUrl>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
BonjourWindows::BonjourWindows(SettingsDialog *settingsDialog,
MainWindow *mainWindow, AppConfig &appConfig)
: m_pSettingsDialog(settingsDialog), m_pMainWindow(mainWindow),
m_pBonjourInstall(nullptr), m_pDownloadMessageBox(nullptr),
m_pDataDownloader(nullptr), m_appConfig(appConfig) {}
BonjourWindows::~BonjourWindows() {
if (m_pBonjourInstall != nullptr) {
delete m_pBonjourInstall;
}
if (m_pDownloadMessageBox != nullptr) {
delete m_pDownloadMessageBox;
}
if (m_pDataDownloader != nullptr) {
delete m_pDataDownloader;
}
}
void BonjourWindows::downloadAndInstall() {
QUrl url;
int arch = getProcessorArch();
if (arch == kProcessorArchWin32) {
url.setUrl(bonjourBaseUrl + bonjourFilename32);
m_pMainWindow->appendLogInfo("downloading bonjour (32-bit)");
} else if (arch == kProcessorArchWin64) {
url.setUrl(bonjourBaseUrl + bonjourFilename64);
m_pMainWindow->appendLogInfo("downloading bonjour (64-bit)");
} else {
QMessageBox::critical(m_pSettingsDialog, tr("Synergy Auto Config"),
tr("Failed to detect system architecture."));
return;
}
if (m_pDataDownloader == nullptr) {
m_pDataDownloader = new DataDownloader(this);
connect(m_pDataDownloader, SIGNAL(isComplete()), SLOT(downloadFinished()));
}
m_pDataDownloader->download(url);
if (m_pDownloadMessageBox != nullptr) {
delete m_pDownloadMessageBox;
m_pDownloadMessageBox = nullptr;
}
m_pDownloadMessageBox = new QMessageBox(m_pSettingsDialog);
m_pDownloadMessageBox->setWindowTitle("Synergy Auto Config");
m_pDownloadMessageBox->setIcon(QMessageBox::Information);
m_pDownloadMessageBox->setText("Installing Bonjour, please wait...");
QAbstractButton *cancel =
m_pDownloadMessageBox->addButton(tr("Cancel"), QMessageBox::RejectRole);
m_pDownloadMessageBox->exec();
if (cancel == m_pDownloadMessageBox->clickedButton()) {
m_pDataDownloader->cancel();
}
}
void BonjourWindows::downloadFinished() {
m_pMainWindow->appendLogInfo("bonjour downloaded");
install();
}
void BonjourWindows::install() {
m_pMainWindow->appendLogInfo("installing bonjour");
QString tempLocation =
QStandardPaths::writableLocation(QStandardPaths::TempLocation);
QString filename = tempLocation;
filename.append("\\").append(bonjourTargetFilename);
QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) {
m_pDownloadMessageBox->hide();
QMessageBox::warning(
m_pSettingsDialog, "Synergy",
tr("Failed to download Bonjour installer to location: %1")
.arg(tempLocation));
return;
}
file.write(m_pDataDownloader->data());
file.close();
QStringList arguments;
arguments.append("/i");
QString winFilename = QDir::toNativeSeparators(filename);
arguments.append(winFilename);
arguments.append("/passive");
if (m_pBonjourInstall != nullptr) {
delete m_pBonjourInstall;
m_pBonjourInstall = nullptr;
}
m_pBonjourInstall = new CommandProcess("msiexec", arguments);
QThread *thread = new QThread;
connect(m_pBonjourInstall, SIGNAL(finished()), this, SLOT(installFinished()));
connect(m_pBonjourInstall, SIGNAL(finished()), thread, SLOT(quit()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
m_pBonjourInstall->moveToThread(thread);
thread->start();
QMetaObject::invokeMethod(m_pBonjourInstall, "run", Qt::QueuedConnection);
m_pDownloadMessageBox->hide();
}
bool BonjourWindows::isRunning() const {
QString name = "Bonjour Service";
SC_HANDLE hSCManager;
hSCManager = OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
if (hSCManager == nullptr) {
m_pMainWindow->appendLogError(
QString("failed to open a service controller manager, error: %1")
.arg(GetLastError()));
return false;
}
auto array = name.toLocal8Bit();
SC_HANDLE hService =
OpenService(hSCManager, array.data(), SERVICE_QUERY_STATUS);
if (hService == nullptr) {
m_pMainWindow->appendLogDebug(
QString("failed to open service: %1").arg(name));
return false;
}
SERVICE_STATUS status;
if (QueryServiceStatus(hService, &status)) {
if (status.dwCurrentState == SERVICE_RUNNING) {
return true;
}
}
return false;
}
void BonjourWindows::installFinished() {
m_pMainWindow->appendLogInfo("bonjour installed");
m_appConfig.setAutoConfig(true);
m_pSettingsDialog->allowAutoConfig();
}
#endif // Q_OS_WIN

View file

@ -1,65 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2018 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QtCore/QObject>
#if defined(Q_OS_WIN)
#include <QMessageBox>
static QString bonjourBaseUrl = "http://binaries.symless.com/bonjour/";
static const char bonjourFilename32[] = "Bonjour.msi";
static const char bonjourFilename64[] = "Bonjour64.msi";
static const char bonjourTargetFilename[] = "Bonjour.msi";
class SettingsDialog;
class MainWindow;
class CommandProcess;
class DataDownloader;
class AppConfig;
class BonjourWindows : public QObject {
Q_OBJECT
public:
BonjourWindows(SettingsDialog *settingsDialog, MainWindow *mainWindow,
AppConfig &appConfig);
virtual ~BonjourWindows();
public:
void downloadAndInstall();
bool isRunning() const;
protected slots:
void downloadFinished();
void installFinished();
private:
void install();
private:
SettingsDialog *m_pSettingsDialog;
MainWindow *m_pMainWindow;
CommandProcess *m_pBonjourInstall;
QMessageBox *m_pDownloadMessageBox;
DataDownloader *m_pDataDownloader;
AppConfig &m_appConfig;
};
#endif // Q_OS_WIN

View file

@ -1,98 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015-2022 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreditsLoader.h"
#include "AppConfig.h"
#include "MainWindow.h"
#include <QJsonDocument>
#include <QJsonParseError>
#include <QNetworkReply>
#include <QNetworkRequest>
namespace {
class CreditsResponse {
public:
explicit CreditsResponse(const QByteArray &response) {
auto data = parseJson(response);
m_status = data["status"].toString();
if (isSuccess()) {
m_data = data["data"].toString();
} else if (isFailed()) {
m_data = data["message"].toString();
} else {
m_data = "Unknown response from the server";
}
}
bool isSuccess() const { return (m_status == "success"); }
bool isFailed() const { return (m_status == "failed"); }
const QString &getData() const { return m_data; }
private:
QMap<QString, QVariant> parseJson(const QByteArray &json) const {
QJsonParseError jsonError;
auto data = QJsonDocument::fromJson(json, &jsonError);
if (jsonError.error == QJsonParseError::NoError) {
return data.toVariant().toMap();
}
return QMap<QString, QVariant>();
}
QString m_data;
QString m_status;
};
} // namespace
CreditsLoader::CreditsLoader(MainWindow &mainWindow, const AppConfig &config)
: m_mainWindow(mainWindow), m_config(config) {
connect(&m_manager, SIGNAL(finished(QNetworkReply *)), this,
SLOT(replyFinished(QNetworkReply *)));
}
void CreditsLoader::loadEliteBackers() {
const auto ELITE_BACKERS_URL = m_config.getEliteBackersUrl();
m_mainWindow.appendLogDebug(
QString("Send request: %1").arg(ELITE_BACKERS_URL));
const auto url = QUrl(ELITE_BACKERS_URL);
const auto request = QNetworkRequest(url);
m_manager.get(request);
}
void CreditsLoader::replyFinished(QNetworkReply *reply) const {
auto response = reply->readAll();
m_mainWindow.appendLogDebug(
QString("Received response: %1").arg(response.toStdString().c_str()));
CreditsResponse creditsResponse(response);
if (creditsResponse.isSuccess()) {
emit loaded(creditsResponse.getData());
} else {
error(QString("Server error: %1").arg(creditsResponse.getData()));
}
}
void CreditsLoader::error(const QString &error) const {
m_mainWindow.appendLogError(error);
emit loaded("Something went wrong when retrieving the list of Elite Backers. "
"Check the logs for more info.");
}

View file

@ -1,44 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015-2022 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QNetworkAccessManager>
#include <QObject>
class QNetworkReply;
class MainWindow;
class AppConfig;
class CreditsLoader : public QObject {
Q_OBJECT
public:
explicit CreditsLoader(MainWindow &mainWindow, const AppConfig &config);
void loadEliteBackers();
signals:
void loaded(const QString &eliteBakers) const;
public slots:
void replyFinished(QNetworkReply *reply) const;
private:
MainWindow &m_mainWindow;
const AppConfig &m_config;
QNetworkAccessManager m_manager;
void error(const QString &error) const;
};

View file

@ -63,7 +63,8 @@ bool Hotkey::operator==(const Hotkey &hk) const {
QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey) {
for (int i = 0; i < hotkey.actions().size(); i++)
outStream << "\t" << hotkey.text() << " = " << hotkey.actions()[i] << endl;
outStream << "\t" << hotkey.text() << " = " << hotkey.actions()[i]
<< Qt::endl;
return outStream;
}

View file

@ -28,7 +28,7 @@
IpcClient::IpcClient() : m_ReaderStarted(false), m_Enabled(false) {
m_Socket = new QTcpSocket(this);
connect(m_Socket, SIGNAL(connected()), this, SLOT(connected()));
connect(m_Socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
connect(m_Socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this,
SLOT(error(QAbstractSocket::SocketError)));
m_Reader = new IpcReader(m_Socket);

View file

@ -164,7 +164,7 @@ QString KeySequence::keyToString(int key) {
return "1";
case Qt::RightButton:
return "2";
case Qt::MidButton:
case Qt::MiddleButton:
return "3";
}

View file

@ -28,7 +28,8 @@
namespace {
std::string getMaintenanceMessage(const SerialKey &serialKey) {
auto expiration = QDateTime::fromTime_t(serialKey.getExpiration()).date();
auto expiration =
QDateTime::fromSecsSinceEpoch(serialKey.getExpiration()).date();
QString message =
"The license key you used will only work with versions of Synergy "
"released before %1."
@ -42,7 +43,9 @@ std::string getMaintenanceMessage(const SerialKey &serialKey) {
void checkSerialKey(const SerialKey &serialKey, bool acceptExpired) {
if (serialKey.isMaintenance()) {
auto buildDate = QDateTime::fromString(__TIMESTAMP__).toTime_t();
auto buildDate =
QDateTime::fromString(__TIMESTAMP__, "ddd MMM dd hh:mm:ss yyyy")
.toSecsSinceEpoch();
if (buildDate > serialKey.getExpiration()) {
throw std::runtime_error(getMaintenanceMessage(serialKey));

View file

@ -24,7 +24,6 @@
#include "MainWindow.h"
#include "AboutDialog.h"
#include "AboutDialogEliteBackers.h"
#include "ActivationDialog.h"
#include "CommandProcess.h"
#include "DataDownloader.h"
@ -35,7 +34,6 @@
#include "ServerConfigDialog.h"
#include "SettingsDialog.h"
#include "SslCertificate.h"
#include "Zeroconf.h"
#include <QPushButton>
#include <shared/EditionType.h>
@ -44,12 +42,12 @@
#endif
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QRegularExpression>
#include <QtCore>
#include <QtGui>
#include <QtNetwork>
@ -94,16 +92,13 @@ MainWindow::MainWindow(AppConfig &appConfig)
#ifdef SYNERGY_ENABLE_LICENSING
m_LicenseManager(&licenseManager), m_ActivationDialogRunning(false),
#endif
m_pZeroconf(nullptr), m_AppConfig(&appConfig), m_pSynergy(NULL),
m_AppConfig(&appConfig), m_pSynergy(NULL),
m_SynergyState(synergyDisconnected),
m_ServerConfig(5, 3, m_AppConfig, this), m_AlreadyHidden(false),
m_pMenuBar(NULL), m_pMenuFile(NULL), m_pMenuEdit(NULL),
m_pMenuWindow(NULL), m_pMenuHelp(NULL), m_pCancelButton(NULL),
m_ExpectedRunningState(kStopped), m_SecureSocket(false),
m_serverConnection(*this), m_clientConnection(*this) {
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
m_pZeroconf = new Zeroconf(this);
#endif
setupUi(this);
@ -112,8 +107,6 @@ MainWindow::MainWindow(AppConfig &appConfig)
m_pRadioGroupClient->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
updateAutoConfigWidgets();
createMenuBar();
loadSettings();
initConnections();
@ -171,9 +164,6 @@ MainWindow::MainWindow(AppConfig &appConfig)
connect(m_AppConfig, SIGNAL(sslToggled()), this,
SLOT(updateLocalFingerprint()), Qt::QueuedConnection);
connect(m_AppConfig, SIGNAL(zeroConfToggled()), this, SLOT(zeroConfToggled()),
Qt::QueuedConnection);
updateWindowTitle();
QString lastVersion = m_AppConfig->lastVersion();
@ -188,14 +178,6 @@ MainWindow::MainWindow(AppConfig &appConfig)
#ifndef SYNERGY_ENABLE_LICENSING
m_pActivate->setVisible(false);
#endif
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
updateZeroconfService();
addZeroconfServer(m_AppConfig->autoConfigServer());
updateAutoConfigWidgets();
#endif
}
MainWindow::~MainWindow() {
@ -209,10 +191,6 @@ MainWindow::~MainWindow() {
qCritical() << "error stopping desktop in main window destructor";
}
}
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
delete m_pZeroconf;
#endif
}
void MainWindow::open() {
@ -247,20 +225,12 @@ void MainWindow::setStatus(const QString &status) {
m_pStatusLabel->setText(status);
}
void MainWindow::retranslateMenuBar() {
m_pMenuFile->setTitle(tr("&File"));
m_pMenuEdit->setTitle(tr("&Edit"));
m_pMenuWindow->setTitle(tr("&Window"));
m_pMenuHelp->setTitle(tr("&Help"));
}
void MainWindow::createMenuBar() {
m_pMenuBar = new QMenuBar(this);
m_pMenuFile = new QMenu("", m_pMenuBar);
m_pMenuEdit = new QMenu("", m_pMenuBar);
m_pMenuWindow = new QMenu("", m_pMenuBar);
m_pMenuHelp = new QMenu("", m_pMenuBar);
retranslateMenuBar();
m_pMenuFile = new QMenu("File", m_pMenuBar);
m_pMenuEdit = new QMenu("Edit", m_pMenuBar);
m_pMenuWindow = new QMenu("Window", m_pMenuBar);
m_pMenuHelp = new QMenu("Help", m_pMenuBar);
m_pMenuBar->addAction(m_pMenuFile->menuAction());
m_pMenuBar->addAction(m_pMenuEdit->menuAction());
@ -316,16 +286,6 @@ void MainWindow::saveSettings() {
GUI::Config::ConfigWriter::make()->globalSave();
}
void MainWindow::zeroConfToggled() {
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
updateZeroconfService();
addZeroconfServer(m_AppConfig->autoConfigServer());
updateAutoConfigWidgets();
#endif
}
void MainWindow::setIcon(qSynergyState state) const {
QIcon icon;
@ -364,7 +324,7 @@ void MainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason) {
void MainWindow::logOutput() {
if (m_pSynergy) {
QString text(m_pSynergy->readAllStandardOutput());
foreach (QString line, text.split(QRegExp("\r|\n|\r\n"))) {
for (QString line : text.split(QRegularExpression("\r|\n|\r\n"))) {
if (!line.isEmpty()) {
appendLogRaw(line);
}
@ -402,7 +362,7 @@ void MainWindow::appendLogError(const QString &text) {
}
void MainWindow::appendLogRaw(const QString &text) {
foreach (QString line, text.split(QRegExp("\r|\n|\r\n"))) {
foreach (QString line, text.split(QRegularExpression("\r|\n|\r\n"))) {
if (!line.isEmpty()) {
// HACK: macOS 10.13.4+ spamming error lines in logs making them
@ -418,7 +378,7 @@ void MainWindow::appendLogRaw(const QString &text) {
}
void MainWindow::handleIdleService(const QString &text) {
foreach (QString line, text.split(QRegExp("\r|\n|\r\n"))) {
foreach (QString line, text.split(QRegularExpression("\r|\n|\r\n"))) {
// only start if there is no active service running
if (!line.isEmpty() && line.contains("service status: idle") &&
appConfig().startedBefore()) {
@ -486,12 +446,13 @@ void MainWindow::checkLicense(const QString &line) {
#endif
void MainWindow::checkFingerprint(const QString &line) {
QRegExp fingerprintRegex(".*server fingerprint: ([A-F0-9:]+)");
if (!fingerprintRegex.exactMatch(line)) {
QRegularExpression re(".*server fingerprint: ([A-F0-9:]+)");
auto match = re.match(line);
if (!match.hasMatch()) {
return;
}
QString fingerprint = fingerprintRegex.cap(1);
auto fingerprint = match.captured(1);
if (Fingerprint::trustedServers().isTrusted(fingerprint)) {
return;
}
@ -570,12 +531,6 @@ void MainWindow::restartSynergy() {
startSynergy();
}
void MainWindow::proofreadInfo() {
int oldState = m_SynergyState;
m_SynergyState = synergyDisconnected;
setSynergyState((qSynergyState)oldState);
}
void MainWindow::showEvent(QShowEvent *event) {
QMainWindow::showEvent(event);
emit windowShown();
@ -765,41 +720,13 @@ bool MainWindow::clientArgs(QStringList &args, QString &app) {
args << "--invert-scroll";
}
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
// check auto config first, if it is disabled or no server detected,
// use line edit host name if it is not empty
if (appConfig().autoConfig()) {
if (m_pComboServerList->count() != 0) {
QString serverIp = m_pComboServerList->currentText();
args << serverIp + ":" + QString::number(appConfig().port());
return true;
} else {
show();
QMessageBox::warning(
this, tr("No server selected"),
tr("No auto config server was selected, try manual mode instead."));
return false;
}
}
#endif
if (m_pLineEditHostname->text().isEmpty() &&
!appConfig().getClientHostMode()) {
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
// check if autoconfig mode is enabled
if (!appConfig().autoConfig()) {
#endif
show();
QMessageBox::warning(this, tr("Hostname is empty"),
tr("Please fill in a hostname for the synergy "
"client to connect to."));
return false;
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
} else {
return false;
}
#endif
show();
QMessageBox::warning(this, tr("Hostname is empty"),
tr("Please fill in a hostname for the synergy "
"client to connect to."));
return false;
}
if (appConfig().getClientHostMode()) {
@ -1102,38 +1029,6 @@ QString MainWindow::getIPAddresses() {
return result.join(", ");
}
void MainWindow::changeEvent(QEvent *event) {
if (event != 0) {
switch (event->type()) {
case QEvent::LanguageChange: {
retranslateUi(this);
retranslateMenuBar();
updateWindowTitle();
proofreadInfo();
break;
}
case QEvent::WindowStateChange: {
windowStateChanged();
break;
}
}
}
// all that do not return are allowing the event to propagate
QMainWindow::changeEvent(event);
}
void MainWindow::addZeroconfServer(const QString name) {
// don't add yourself to the server list.
if (getIPAddresses().contains(name)) {
return;
}
if (m_pComboServerList->findText(name) == -1) {
m_pComboServerList->addItem(name);
}
}
void MainWindow::setEdition(Edition edition) {
#ifdef SYNERGY_ENABLE_LICENSING
setWindowTitle(m_LicenseManager->getEditionName(edition));
@ -1193,31 +1088,6 @@ void MainWindow::on_m_pActionHelp_triggered() {
QDesktopServices::openUrl(QUrl(HELP_URL));
}
void MainWindow::updateZeroconfService() {
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
// reset the server list in case one has gone away.
// it'll be re-added after the zeroconf service restarts.
m_pComboServerList->clear();
if (m_pZeroconf != nullptr) {
if (appConfig().autoConfig()) {
m_pZeroconf->startService();
} else {
m_pZeroconf->stopService();
}
}
#endif
}
void MainWindow::updateAutoConfigWidgets() {
m_pLabelServerName->show();
m_pLineEditHostname->show();
m_pLabelAutoDetected->hide();
m_pComboServerList->hide();
}
void MainWindow::updateWindowTitle() {
#ifdef SYNERGY_ENABLE_LICENSING
setWindowTitle(m_LicenseManager->activeEditionName());
@ -1244,10 +1114,6 @@ void MainWindow::on_m_pActionSettings_triggered() {
}
void MainWindow::autoAddScreen(const QString name) {
if (m_ServerConfig.ignoreAutoConfigClient()) {
appendLogDebug(QString("ignoring zeroconf screen: %1").arg(name));
return;
}
#ifdef SYNERGY_ENABLE_LICENSING
if (m_ActivationDialogRunning) {
@ -1367,11 +1233,6 @@ void MainWindow::on_m_pLabelFingerprint_linkActivated(const QString &) {
Fingerprint::local().readFirst());
}
void MainWindow::on_m_pComboServerList_currentIndexChanged(
const QString &server) {
appConfig().setAutoConfigServer(server);
}
void MainWindow::windowStateChanged() {
if (windowState() == Qt::WindowMinimized && appConfig().getMinimizeToTray())
hide();
@ -1380,7 +1241,7 @@ void MainWindow::windowStateChanged() {
void MainWindow::updateScreenName() {
m_pLabelComputerName->setText(
tr("This computer's name: %1 (<a href=\"#\" style=\"text-decoration: "
"none; color: #4285F4;\">Preferences</a>)")
"none; color: #4285F4;\">change</a>)")
.arg(appConfig().screenName()));
serverConfig().updateServerName();
}

View file

@ -59,7 +59,6 @@ class DataDownloader;
class CommandProcess;
class SslCertificate;
class LicenseManager;
class Zeroconf;
class MainWindow : public QMainWindow, public Ui::MainWindowBase {
Q_OBJECT
@ -111,15 +110,11 @@ public:
void showConfigureServer(const QString &message);
void showConfigureServer() { showConfigureServer(""); }
void autoAddScreen(const QString name);
void addZeroconfServer(const QString name);
Zeroconf &zeroconf() { return *m_pZeroconf; }
#ifdef SYNERGY_ENABLE_LICENSING
LicenseManager &licenseManager() const;
int raiseActivationDialog();
#endif
void updateZeroconfService();
public slots:
void setEdition(Edition edition);
#ifdef SYNERGY_ENABLE_LICENSING
@ -154,9 +149,6 @@ protected slots:
void updateFound(const QString &version);
void saveSettings();
/// @brief Receives the signal that the auto config option has changed
void zeroConfToggled();
protected:
// TODO This should be properly using the ConfigWriter system.
QSettings &settings() {
@ -183,8 +175,6 @@ protected:
QString getIPAddresses();
void stopService();
void stopDesktop();
void changeEvent(QEvent *event);
void retranslateMenuBar();
void enableServer(bool enable);
void enableClient(bool enable);
void closeEvent(QCloseEvent *event) override;
@ -207,7 +197,6 @@ protected:
#endif
QString getTimeStamp();
void restartSynergy();
void proofreadInfo();
void showEvent(QShowEvent *);
void secureSocket(bool secureSocket);
@ -220,7 +209,6 @@ private:
bool m_ActivationDialogRunning;
QStringList m_PendingClientNames;
#endif
Zeroconf *m_pZeroconf;
AppConfig *m_AppConfig;
QProcess *m_pSynergy;
int m_SynergyState;
@ -244,7 +232,6 @@ private:
ServerConnection m_serverConnection;
ClientConnection m_clientConnection;
void updateAutoConfigWidgets();
void updateWindowTitle();
private slots:
@ -253,7 +240,6 @@ private slots:
void on_m_pLabelComputerName_linkActivated(const QString &link);
void on_m_pLabelFingerprint_linkActivated(const QString &link);
void on_m_pComboServerList_currentIndexChanged(const QString &arg1);
void on_m_pButtonConnect_clicked();
void on_m_pButtonConnectToClient_clicked();

View file

@ -49,7 +49,7 @@
<number>0</number>
</property>
<property name="bottomMargin">
<number>2</number>
<number>10</number>
</property>
<item>
<widget class="QLabel" name="m_pIconUpdate">
@ -123,7 +123,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>14</height>
<height>10</height>
</size>
</property>
</spacer>
@ -146,7 +146,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>220</height>
</size>
</property>
<property name="maximumSize">
@ -163,7 +163,7 @@
<number>0</number>
</property>
<property name="topMargin">
<number>28</number>
<number>15</number>
</property>
<property name="rightMargin">
<number>0</number>
@ -176,7 +176,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>250</height>
<height>0</height>
</size>
</property>
<property name="maximumSize">
@ -229,7 +229,7 @@ background-color: rgba(192,192,192, 0.1);
</property>
<property name="text">
<string>Use this computer's keyboard and mouse
(Make this computer the server).</string>
(make this computer the server)</string>
</property>
</widget>
</item>
@ -244,7 +244,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
<height>10</height>
</size>
</property>
</spacer>
@ -252,7 +252,7 @@ background-color: rgba(192,192,192, 0.1);
<item>
<widget class="QLabel" name="m_pLabelClientIp">
<property name="text">
<string>Client IP address or name:</string>
<string>Client IP address or hostname:</string>
</property>
<property name="indent">
<number>20</number>
@ -304,7 +304,7 @@ background-color: rgba(192,192,192, 0.1);
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;TLS/SSL active - &lt;a href=&quot;#&quot; style=&quot;text-decoration:none; color: #4285F4;&quot;&gt;view&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;TLS enabled (&lt;a href=&quot;#&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#4285f4;&quot;&gt;fingerprint&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
@ -322,7 +322,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>10</height>
</size>
</property>
</spacer>
@ -371,7 +371,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="minimumSize">
<size>
<width>0</width>
<height>250</height>
<height>0</height>
</size>
</property>
<property name="maximumSize">
@ -424,7 +424,7 @@ background-color: rgba(192,192,192, 0.1);
</property>
<property name="text">
<string>Use another computer’s mouse and keyboard
(Make this computer the client).</string>
(make this computer the client)</string>
</property>
</widget>
</item>
@ -439,7 +439,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>10</height>
</size>
</property>
</spacer>
@ -461,7 +461,7 @@ background-color: rgba(192,192,192, 0.1);
</sizepolicy>
</property>
<property name="text">
<string>&amp;Server IP address or name:</string>
<string>&amp;Server IP address or hostname:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditHostname</cstring>
@ -487,35 +487,12 @@ background-color: rgba(192,192,192, 0.1);
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelAutoDetected">
<property name="text">
<string>Server:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_pComboServerList">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="synergy_widgets::ClientStateLabel" name="m_pLabelClientState">
<property name="text">
<string>Connected to the server</string>
<string>Connected to server</string>
</property>
<property name="indent">
<number>20</number>
@ -533,7 +510,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>10</height>
</size>
</property>
</spacer>
@ -715,6 +692,7 @@ background-color: rgba(192,192,192, 0.1);
<font>
<family>Arial</family>
<pointsize>-1</pointsize>
<weight>88</weight>
<bold>true</bold>
</font>
</property>

View file

@ -25,7 +25,7 @@
QSynergyApplication *QSynergyApplication::s_Instance = NULL;
QSynergyApplication::QSynergyApplication(int &argc, char **argv)
: QApplication(argc, argv), m_Translator(NULL) {
: QApplication(argc, argv) {
s_Instance = this;
QFontDatabase::addApplicationFont(":/res/fonts/Arial.ttf");
@ -35,7 +35,7 @@ QSynergyApplication::QSynergyApplication(int &argc, char **argv)
setFont(Arial);
}
QSynergyApplication::~QSynergyApplication() { delete m_Translator; }
QSynergyApplication::~QSynergyApplication() {}
void QSynergyApplication::commitData(QSessionManager &) {
foreach (QWidget *widget, topLevelWidgets()) {
@ -46,20 +46,3 @@ void QSynergyApplication::commitData(QSessionManager &) {
}
QSynergyApplication *QSynergyApplication::getInstance() { return s_Instance; }
void QSynergyApplication::switchTranslator(QString lang) {
if (m_Translator != NULL) {
removeTranslator(m_Translator);
delete m_Translator;
}
QResource locale(":/res/lang/gui_" + lang + ".qm");
m_Translator = new QTranslator();
m_Translator->load(locale.data(), locale.size());
installTranslator(m_Translator);
}
void QSynergyApplication::setTranslator(QTranslator *translator) {
m_Translator = translator;
installTranslator(m_Translator);
}

View file

@ -31,14 +31,10 @@ public:
public:
void commitData(QSessionManager &manager);
void switchTranslator(QString lang);
void setTranslator(QTranslator *translator);
static QSynergyApplication *getInstance();
private:
QTranslator *m_Translator;
static QSynergyApplication *s_Instance;
};

View file

@ -86,36 +86,36 @@ void Screen::saveSettings(QSettings &settings) const {
}
QTextStream &Screen::writeScreensSection(QTextStream &outStream) const {
outStream << "\t" << name() << ":" << endl;
outStream << "\t" << name() << ":" << Qt::endl;
for (int i = 0; i < modifiers().size(); i++)
if (modifier(i) != i)
outStream << "\t\t" << modifierName(i) << " = "
<< modifierName(modifier(i)) << endl;
<< modifierName(modifier(i)) << Qt::endl;
for (int i = 0; i < fixes().size(); i++)
outStream << "\t\t" << fixName(i) << " = "
<< (fixes()[i] ? "true" : "false") << endl;
<< (fixes()[i] ? "true" : "false") << Qt::endl;
outStream << "\t\t"
<< "switchCorners = none ";
for (int i = 0; i < switchCorners().size(); i++)
if (switchCorners()[i])
outStream << "+" << switchCornerName(i) << " ";
outStream << endl;
outStream << Qt::endl;
outStream << "\t\t"
<< "switchCornerSize = " << switchCornerSize() << endl;
<< "switchCornerSize = " << switchCornerSize() << Qt::endl;
return outStream;
}
QTextStream &Screen::writeAliasesSection(QTextStream &outStream) const {
if (!aliases().isEmpty()) {
outStream << "\t" << name() << ":" << endl;
outStream << "\t" << name() << ":" << Qt::endl;
foreach (const QString &alias, aliases())
outStream << "\t\t" << alias << endl;
outStream << "\t\t" << alias << Qt::endl;
}
return outStream;

View file

@ -29,9 +29,9 @@ ScreenSetupModel::ScreenSetupModel(ScreenList &screens, int numColumns,
: QAbstractTableModel(NULL), m_Screens(screens), m_NumColumns(numColumns),
m_NumRows(numRows) {
if (m_NumColumns * m_NumRows > screens.size())
qFatal(
"Not enough elements (%u) in screens QList for %d columns and %d rows",
screens.size(), m_NumColumns, m_NumRows);
qFatal("Not enough elements (%lld) in screens QList for %d columns and %d "
"rows",
screens.size(), m_NumColumns, m_NumRows);
}
QVariant ScreenSetupModel::data(const QModelIndex &index, int role) const {
@ -64,7 +64,7 @@ QVariant ScreenSetupModel::data(const QModelIndex &index, int role) const {
Qt::ItemFlags ScreenSetupModel::flags(const QModelIndex &index) const {
if (!index.isValid() || index.row() >= m_NumRows ||
index.column() >= m_NumColumns)
return 0;
return Qt::NoItemFlags;
if (!screen(index).isNull())
return Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable |

View file

@ -135,11 +135,9 @@ void ScreenSetupView::startDrag(Qt::DropActions) {
}
}
QStyleOptionViewItem ScreenSetupView::viewOptions() const {
QStyleOptionViewItem option = QTableView::viewOptions();
option.showDecorationSelected = true;
option.decorationPosition = QStyleOptionViewItem::Top;
option.displayAlignment = Qt::AlignCenter;
option.textElideMode = Qt::ElideMiddle;
return option;
}
void ScreenSetupView::initViewItemOption(QStyleOptionViewItem *option) const {
option->showDecorationSelected = true;
option->decorationPosition = QStyleOptionViewItem::Top;
option->displayAlignment = Qt::AlignCenter;
option->textElideMode = Qt::ElideMiddle;
}

View file

@ -48,7 +48,7 @@ protected:
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void startDrag(Qt::DropActions supportedActions) override;
QStyleOptionViewItem viewOptions() const override;
void initViewItemOption(QStyleOptionViewItem *option) const override;
void scrollTo(const QModelIndex &, ScrollHint) override {}
};

View file

@ -45,9 +45,8 @@ ServerConfig::ServerConfig(int numColumns, int numRows, AppConfig *appConfig,
:
m_Screens(numColumns), m_NumColumns(numColumns), m_NumRows(numRows),
m_pAppConfig(appConfig), m_IgnoreAutoConfigClient(false),
m_EnableDragAndDrop(false), m_DisableLockToScreen(false),
m_ClipboardSharing(true),
m_pAppConfig(appConfig), m_EnableDragAndDrop(false),
m_DisableLockToScreen(false), m_ClipboardSharing(true),
m_ClipboardSharingSize(defaultClipboardSharingSize()),
m_pMainWindow(mainWindow) {
GUI::Config::ConfigWriter::make()->registerClass(this);
@ -86,7 +85,6 @@ bool ServerConfig::operator==(const ServerConfig &sc) const {
m_SwitchCornerSize == sc.m_SwitchCornerSize &&
m_SwitchCorners == sc.m_SwitchCorners && m_Hotkeys == sc.m_Hotkeys &&
m_pAppConfig == sc.m_pAppConfig &&
m_IgnoreAutoConfigClient == sc.m_IgnoreAutoConfigClient &&
m_EnableDragAndDrop == sc.m_EnableDragAndDrop &&
m_DisableLockToScreen == sc.m_DisableLockToScreen &&
m_ClipboardSharing == sc.m_ClipboardSharing &&
@ -130,7 +128,6 @@ void ServerConfig::saveSettings() {
settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap());
settings().setValue("switchDoubleTap", switchDoubleTap());
settings().setValue("switchCornerSize", switchCornerSize());
settings().setValue("ignoreAutoConfigClient", ignoreAutoConfigClient());
settings().setValue("disableLockToScreen", disableLockToScreen());
settings().setValue("enableDragAndDrop", enableDragAndDrop());
settings().setValue("clipboardSharing", clipboardSharing());
@ -188,8 +185,6 @@ void ServerConfig::loadSettings() {
haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool());
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
setSwitchCornerSize(settings().value("switchCornerSize").toInt());
setIgnoreAutoConfigClient(
settings().value("ignoreAutoConfigClient").toBool());
setDisableLockToScreen(
settings().value("disableLockToScreen", false).toBool());
setEnableDragAndDrop(settings().value("enableDragAndDrop", false).toBool());
@ -247,27 +242,27 @@ int ServerConfig::adjacentScreenIndex(int idx, int deltaColumn,
}
QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config) {
outStream << "section: screens" << endl;
outStream << "section: screens" << Qt::endl;
foreach (const Screen &s, config.screens())
if (!s.isNull())
s.writeScreensSection(outStream);
outStream << "end" << endl << endl;
outStream << "end" << Qt::endl << Qt::endl;
outStream << "section: aliases" << endl;
outStream << "section: aliases" << Qt::endl;
foreach (const Screen &s, config.screens())
if (!s.isNull())
s.writeAliasesSection(outStream);
outStream << "end" << endl << endl;
outStream << "end" << Qt::endl << Qt::endl;
outStream << "section: links" << endl;
outStream << "section: links" << Qt::endl;
for (int i = 0; i < config.screens().size(); i++)
if (!config.screens()[i].isNull()) {
outStream << "\t" << config.screens()[i].name() << ":" << endl;
outStream << "\t" << config.screens()[i].name() << ":" << Qt::endl;
for (unsigned int j = 0;
j < sizeof(neighbourDirs) / sizeof(neighbourDirs[0]); j++) {
@ -275,61 +270,61 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config) {
neighbourDirs[j].y);
if (idx != -1 && !config.screens()[idx].isNull())
outStream << "\t\t" << neighbourDirs[j].name << " = "
<< config.screens()[idx].name() << endl;
<< config.screens()[idx].name() << Qt::endl;
}
}
outStream << "end" << endl << endl;
outStream << "end" << Qt::endl << Qt::endl;
outStream << "section: options" << endl;
outStream << "section: options" << Qt::endl;
if (config.hasHeartbeat())
outStream << "\t"
<< "heartbeat = " << config.heartbeat() << endl;
<< "heartbeat = " << config.heartbeat() << Qt::endl;
outStream << "\t"
<< "relativeMouseMoves = "
<< (config.relativeMouseMoves() ? "true" : "false") << endl;
<< (config.relativeMouseMoves() ? "true" : "false") << Qt::endl;
outStream << "\t"
<< "win32KeepForeground = "
<< (config.win32KeepForeground() ? "true" : "false") << endl;
<< (config.win32KeepForeground() ? "true" : "false") << Qt::endl;
outStream << "\t"
<< "disableLockToScreen = "
<< (config.disableLockToScreen() ? "true" : "false") << endl;
<< (config.disableLockToScreen() ? "true" : "false") << Qt::endl;
outStream << "\t"
<< "clipboardSharing = "
<< (config.clipboardSharing() ? "true" : "false") << endl;
<< (config.clipboardSharing() ? "true" : "false") << Qt::endl;
outStream << "\t"
<< "clipboardSharingSize = " << config.clipboardSharingSize()
<< endl;
<< Qt::endl;
if (!config.getClientAddress().isEmpty()) {
outStream << "\t"
<< "clientAddress = " << config.getClientAddress() << endl;
<< "clientAddress = " << config.getClientAddress() << Qt::endl;
}
if (config.hasSwitchDelay())
outStream << "\t"
<< "switchDelay = " << config.switchDelay() << endl;
<< "switchDelay = " << config.switchDelay() << Qt::endl;
if (config.hasSwitchDoubleTap())
outStream << "\t"
<< "switchDoubleTap = " << config.switchDoubleTap() << endl;
<< "switchDoubleTap = " << config.switchDoubleTap() << Qt::endl;
outStream << "\t"
<< "switchCorners = none ";
for (int i = 0; i < config.switchCorners().size(); i++)
if (config.switchCorners()[i])
outStream << "+" << config.switchCornerName(i) << " ";
outStream << endl;
outStream << Qt::endl;
outStream << "\t"
<< "switchCornerSize = " << config.switchCornerSize() << endl;
<< "switchCornerSize = " << config.switchCornerSize() << Qt::endl;
foreach (const Hotkey &hotkey, config.hotkeys())
outStream << hotkey;
outStream << "end" << endl << endl;
outStream << "end" << Qt::endl << Qt::endl;
return outStream;
}
@ -511,7 +506,6 @@ int ServerConfig::showAddClientDialog(const QString &clientName) {
AddClientDialog addClientDialog(clientName, m_pMainWindow);
addClientDialog.exec();
result = addClientDialog.addResult();
m_IgnoreAutoConfigClient = addClientDialog.ignoreAutoConfigClient();
return result;
}

View file

@ -69,7 +69,6 @@ public:
int switchCornerSize() const { return m_SwitchCornerSize; }
const QList<bool> &switchCorners() const { return m_SwitchCorners; }
const HotkeyList &hotkeys() const { return m_Hotkeys; }
bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; }
bool enableDragAndDrop() const { return m_EnableDragAndDrop; }
bool disableLockToScreen() const { return m_DisableLockToScreen; }
bool clipboardSharing() const { return m_ClipboardSharing; }
@ -110,7 +109,6 @@ protected:
void setSwitchDoubleTap(int val) { m_SwitchDoubleTap = val; }
void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; }
void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; }
void setIgnoreAutoConfigClient(bool on) { m_IgnoreAutoConfigClient = on; }
void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; }
void setDisableLockToScreen(bool on) { m_DisableLockToScreen = on; }
void setClipboardSharing(bool on) { m_ClipboardSharing = on; }
@ -145,7 +143,6 @@ private:
QList<bool> m_SwitchCorners;
HotkeyList m_Hotkeys;
AppConfig *m_pAppConfig;
bool m_IgnoreAutoConfigClient;
bool m_EnableDragAndDrop;
bool m_DisableLockToScreen;
bool m_ClipboardSharing;

View file

@ -70,9 +70,6 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config,
m_pCheckBoxDisableLockToScreen->setChecked(
serverConfig().disableLockToScreen());
m_pCheckBoxIgnoreAutoConfigClient->setChecked(
serverConfig().ignoreAutoConfigClient());
m_pCheckBoxEnableClipboard->setChecked(serverConfig().clipboardSharing());
int clipboardSharingSizeM =
static_cast<int>(serverConfig().clipboardSharingSize() / 1024);
@ -164,11 +161,6 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config,
serverConfig().setWin32KeepForeground(v);
onChange();
});
connect(m_pCheckBoxIgnoreAutoConfigClient, &QCheckBox::stateChanged, this,
[this](const int &v) {
serverConfig().setIgnoreAutoConfigClient(v);
onChange();
});
connect(m_pCheckBoxDisableLockToScreen, &QCheckBox::stateChanged, this,
[this](const int &v) {
serverConfig().setDisableLockToScreen(v);

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>778</width>
<width>799</width>
<height>508</height>
</rect>
</property>
@ -137,22 +137,6 @@
<property name="leftMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_pButtonAddComputer">
<property name="text">

View file

@ -19,15 +19,12 @@
#include "validators/ScreenNameValidator.h"
#include "AppConfig.h"
#include "BonjourWindows.h"
#include "CoreInterface.h"
#include "MainWindow.h"
#include "QSynergyApplication.h"
#include "QUtility.h"
#include "SslCertificate.h"
#include "SynergyLocale.h"
#include "UpgradeDialog.h"
#include "Zeroconf.h"
#include <QDir>
#include <QFileDialog>
@ -37,22 +34,19 @@
SettingsDialog::SettingsDialog(QWidget *parent, AppConfig &config)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::SettingsDialogBase(), m_appConfig(config),
m_pBonjourWindows(nullptr) {
Ui::SettingsDialogBase(), m_appConfig(config) {
setupUi(this);
// TODO: maybe just accept MainWindow type in ctor?
m_pMainWindow = dynamic_cast<MainWindow *>(parent);
m_Locale.fillLanguageComboBox(m_pComboLanguage);
loadFromConfig();
m_isSystemAtStart = appConfig().isSystemScoped();
buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
enableControls(appConfig().isWritable());
m_pCheckBoxLanguageSync->setVisible(isClientMode());
m_pCheckBoxScrollDirection->setVisible(isClientMode());
m_pCheckBoxLanguageSync->setEnabled(isClientMode());
m_pCheckBoxScrollDirection->setEnabled(isClientMode());
const auto &serveConfig = m_pMainWindow->serverConfig();
m_pLineEditScreenName->setValidator(new validators::ScreenNameValidator(
@ -64,7 +58,6 @@ SettingsDialog::SettingsDialog(QWidget *parent, AppConfig &config)
SLOT(onChange()));
connect(m_pLineEditCertificatePath, SIGNAL(textChanged(QString)), this,
SLOT(onChange()));
connect(m_pCheckBoxAutoConfig, SIGNAL(clicked()), this, SLOT(onChange()));
connect(m_pCheckBoxMinimizeToTray, SIGNAL(clicked()), this, SLOT(onChange()));
connect(m_pCheckBoxAutoHide, SIGNAL(clicked()), this, SLOT(onChange()));
connect(m_pCheckBoxPreventSleep, SIGNAL(clicked()), this, SLOT(onChange()));
@ -93,13 +86,10 @@ void SettingsDialog::accept() {
appConfig().setLogLevel(m_pComboLogLevel->currentIndex());
appConfig().setLogToFile(m_pCheckBoxLogToFile->isChecked());
appConfig().setLogFilename(m_pLineEditLogFilename->text());
appConfig().setLanguage(
m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
appConfig().setElevateMode(
static_cast<ElevateMode>(m_pComboElevate->currentIndex()));
appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked());
appConfig().setPreventSleep(m_pCheckBoxPreventSleep->isChecked());
appConfig().setAutoConfig(m_pCheckBoxAutoConfig->isChecked());
appConfig().setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked());
appConfig().setTLSCertPath(m_pLineEditCertificatePath->text());
appConfig().setTLSKeyLength(m_pComboBoxKeyLength->currentText());
@ -114,12 +104,6 @@ void SettingsDialog::accept() {
}
void SettingsDialog::reject() {
if (appConfig().language() !=
m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()) {
QSynergyApplication::getInstance()->switchTranslator(
appConfig().language());
}
// We should restore scope at start if the user rejects changes.
if (appConfig().isSystemScoped() != m_isSystemAtStart) {
appConfig().setLoadFromSystemScope(m_isSystemAtStart);
@ -128,26 +112,6 @@ void SettingsDialog::reject() {
QDialog::reject();
}
void SettingsDialog::changeEvent(QEvent *event) {
if (event != nullptr) {
switch (event->type()) {
case QEvent::LanguageChange: {
int logLevelIndex = m_pComboLogLevel->currentIndex();
m_pComboLanguage->blockSignals(true);
retranslateUi(this);
m_pComboLanguage->blockSignals(false);
m_pComboLogLevel->setCurrentIndex(logLevelIndex);
break;
}
default:
QDialog::changeEvent(event);
}
}
}
void SettingsDialog::loadFromConfig() {
m_pLineEditScreenName->setText(appConfig().screenName());
@ -156,7 +120,6 @@ void SettingsDialog::loadFromConfig() {
m_pComboLogLevel->setCurrentIndex(appConfig().logLevel());
m_pCheckBoxLogToFile->setChecked(appConfig().logToFile());
m_pLineEditLogFilename->setText(appConfig().logFilename());
setIndexFromItemData(m_pComboLanguage, appConfig().language());
m_pCheckBoxAutoHide->setChecked(appConfig().getAutoHide());
m_pCheckBoxPreventSleep->setChecked(appConfig().getPreventSleep());
m_pCheckBoxMinimizeToTray->setChecked(appConfig().getMinimizeToTray());
@ -177,27 +140,12 @@ void SettingsDialog::loadFromConfig() {
}
#if defined(Q_OS_WIN)
m_pBonjourWindows = new BonjourWindows(this, m_pMainWindow, m_appConfig);
if (m_pBonjourWindows->isRunning()) {
allowAutoConfig();
}
m_pComboElevate->setCurrentIndex(static_cast<int>(appConfig().elevateMode()));
#else
// elevate checkbox is only useful on ms windows.
m_pLabelElevate->hide();
m_pComboElevate->hide();
// for linux and mac, allow auto config by default
allowAutoConfig();
#endif
#ifdef SYNERGY_ENABLE_AUTO_CONFIG
m_pCheckBoxAutoConfig->setChecked(appConfig().autoConfig());
#else
m_pCheckBoxAutoConfig->hide();
m_pLabelInstallBonjour->hide();
#endif
m_pCheckBoxClientHostMode->setVisible(
@ -231,12 +179,6 @@ bool SettingsDialog::isClientMode() const {
return (m_pMainWindow->synergyType() == MainWindow::synergyClient);
}
void SettingsDialog::allowAutoConfig() {
m_pLabelInstallBonjour->hide();
m_pCheckBoxAutoConfig->setEnabled(true);
m_pCheckBoxAutoConfig->setChecked(m_appConfig.autoConfig());
}
void SettingsDialog::on_m_pCheckBoxLogToFile_stateChanged(int i) {
bool checked = i == 2;
@ -256,12 +198,6 @@ void SettingsDialog::on_m_pButtonBrowseLog_clicked() {
}
}
void SettingsDialog::on_m_pComboLanguage_currentIndexChanged(int index) {
QString ietfCode = m_pComboLanguage->itemData(index).toString();
QSynergyApplication::getInstance()->switchTranslator(ietfCode);
buttonBox->button(QDialogButtonBox::Save)->setEnabled(isModified());
}
void SettingsDialog::on_m_pCheckBoxEnableCrypto_clicked(bool checked) {
if (appConfig().isCryptoAvailable()) {
m_pLabelKeyLength->setEnabled(checked);
@ -291,12 +227,6 @@ void SettingsDialog::on_m_pCheckBoxEnableCrypto_clicked(bool checked) {
}
}
void SettingsDialog::on_m_pLabelInstallBonjour_linkActivated(const QString &) {
#if defined(Q_OS_WIN)
m_pBonjourWindows->downloadAndInstall();
#endif
}
void SettingsDialog::on_m_pRadioSystemScope_toggled(bool checked) {
// We only need to test the System scoped Radio as they are connected
appConfig().setLoadFromSystemScope(checked);
@ -363,14 +293,10 @@ bool SettingsDialog::isModified() {
appConfig().logLevel() != m_pComboLogLevel->currentIndex() ||
appConfig().logToFile() != m_pCheckBoxLogToFile->isChecked() ||
appConfig().logFilename() != m_pLineEditLogFilename->text() ||
appConfig().language() !=
m_pComboLanguage->itemData(m_pComboLanguage->currentIndex())
.toString() ||
appConfig().elevateMode() !=
static_cast<ElevateMode>(m_pComboElevate->currentIndex()) ||
appConfig().getAutoHide() != m_pCheckBoxAutoHide->isChecked() ||
appConfig().getPreventSleep() != m_pCheckBoxPreventSleep->isChecked() ||
appConfig().autoConfig() != m_pCheckBoxAutoConfig->isChecked() ||
appConfig().getMinimizeToTray() !=
m_pCheckBoxMinimizeToTray->isChecked() ||
appConfig().getTLSCertPath() != m_pLineEditCertificatePath->text() ||
@ -392,11 +318,9 @@ void SettingsDialog::enableControls(bool enable) {
m_pLineEditInterface->setEnabled(enable);
m_pComboLogLevel->setEnabled(enable);
m_pCheckBoxLogToFile->setEnabled(enable);
m_pComboLanguage->setEnabled(enable);
m_pComboElevate->setEnabled(enable);
m_pCheckBoxAutoHide->setEnabled(enable);
m_pCheckBoxPreventSleep->setEnabled(enable);
m_pCheckBoxAutoConfig->setEnabled(enable);
m_pCheckBoxMinimizeToTray->setEnabled(enable);
m_pLineEditCertificatePath->setEnabled(enable);
m_pComboBoxKeyLength->setEnabled(enable);

View file

@ -25,11 +25,9 @@
#include <memory>
#include "CoreInterface.h"
#include "SynergyLocale.h"
class MainWindow;
class AppConfig;
class BonjourWindows;
class SettingsDialog : public QDialog, public Ui::SettingsDialogBase {
Q_OBJECT
@ -40,12 +38,10 @@ public:
const QString &synergycName);
static QString browseForSynergys(QWidget *parent, const QString &programDir,
const QString &synergysName);
void allowAutoConfig();
protected:
void accept() override;
void reject() override;
void changeEvent(QEvent *event) override;
AppConfig &appConfig() { return m_appConfig; }
/// @brief Causes the dialog to load all the settings from m_appConfig
@ -75,9 +71,7 @@ protected:
private:
MainWindow *m_pMainWindow;
AppConfig &m_appConfig;
SynergyLocale m_Locale;
CoreInterface m_CoreInterface;
BonjourWindows *m_pBonjourWindows;
/// @brief Stores settings scope at start of settings dialog
/// This is neccessary to restore state if user changes
@ -86,10 +80,8 @@ private:
private slots:
void on_m_pCheckBoxEnableCrypto_clicked(bool checked);
void on_m_pComboLanguage_currentIndexChanged(int index);
void on_m_pCheckBoxLogToFile_stateChanged(int);
void on_m_pButtonBrowseLog_clicked();
void on_m_pLabelInstallBonjour_linkActivated(const QString &link);
/// @brief Handles the toggling of the system scoped radio button
/// As the user scope radio is connected this will fire for either

View file

@ -337,7 +337,34 @@ background-color: rgba(192,192,192, 0.1);
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="6" column="1">
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="m_pCheckBoxScrollDirection">
<property name="text">
<string>Invert scroll direction on this computer</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxClientHostMode">
<property name="text">
<string>Host mode</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="m_pComboElevate">
<property name="toolTip">
<string>Specify when the Synergy service should run at an elevated privilege level</string>
@ -362,34 +389,21 @@ background-color: rgba(192,192,192, 0.1);
</item>
</widget>
</item>
<item row="3" column="0" colspan="3">
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="m_pCheckBoxLanguageSync">
<property name="text">
<string>&amp;Use server's keyboard language on this machine</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="m_pCheckBoxClientHostMode">
<item row="6" column="0">
<widget class="QCheckBox" name="m_pCheckBoxServerClientMode">
<property name="text">
<string>Host mode</string>
<string>Client mode</string>
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<item row="5" column="0">
<widget class="QLabel" name="m_pLabelElevate">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -402,45 +416,6 @@ background-color: rgba(192,192,192, 0.1);
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="m_pComboLanguage"/>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="m_pCheckBoxScrollDirection">
<property name="text">
<string>Invert scroll direction on this computer</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_pLabel_27">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>User interface language</string>
</property>
<property name="buddy">
<cstring>m_pComboLanguage</cstring>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="m_pCheckBoxServerClientMode">
<property name="text">
<string>Client mode</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -644,7 +619,7 @@ background-color: rgba(192,192,192, 0.1);
<item>
<widget class="QPushButton" name="m_pPushButtonRegenCert">
<property name="text">
<string>Regenerate cert</string>
<string>Regenerate certificate</string>
</property>
</widget>
</item>
@ -709,6 +684,7 @@ background-color: rgba(192,192,192, 0.1);
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>

View file

@ -1,58 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013-2016 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#include "SynergyLocale.h"
#include <QDebug>
#include <QResource>
#include <QXmlStreamReader>
SynergyLocale::SynergyLocale() { loadLanguages(); }
void SynergyLocale::loadLanguages() {
QResource resource(":/res/lang/Languages.xml");
QByteArray bytes(reinterpret_cast<const char *>(resource.data()),
resource.size());
QXmlStreamReader xml(bytes);
while (!xml.atEnd()) {
QXmlStreamReader::TokenType token = xml.readNext();
if (xml.hasError()) {
qCritical() << xml.errorString();
throw std::exception();
}
if (xml.name() == "language" && token == QXmlStreamReader::StartElement) {
QXmlStreamAttributes attributes = xml.attributes();
addLanguage(attributes.value("ietfCode").toString(),
attributes.value("name").toString());
}
}
}
void SynergyLocale::addLanguage(const QString &ietfCode, const QString &name) {
m_Languages.push_back(SynergyLocale::Language(ietfCode, name));
}
void SynergyLocale::fillLanguageComboBox(QComboBox *comboBox) {
comboBox->blockSignals(true);
QVector<SynergyLocale::Language>::iterator it;
for (it = m_Languages.begin(); it != m_Languages.end(); ++it) {
comboBox->addItem((*it).m_Name, (*it).m_IetfCode);
}
comboBox->blockSignals(false);
}

View file

@ -1,46 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013-2016 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QComboBox>
#include <QString>
#include <QVector>
class SynergyLocale {
class Language {
public:
Language() {}
Language(const QString &IetfCode, const QString &name)
: m_IetfCode(IetfCode), m_Name(name) {}
public:
QString m_IetfCode;
QString m_Name;
};
public:
SynergyLocale();
void fillLanguageComboBox(QComboBox *comboBox);
private:
void loadLanguages();
void addLanguage(const QString &IetfCode, const QString &name);
private:
QVector<Language> m_Languages;
};

View file

@ -23,6 +23,7 @@
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QProcess>
#include <QRegularExpression>
VersionChecker::VersionChecker() {
m_manager = new QNetworkAccessManager(this);
@ -63,14 +64,14 @@ int VersionChecker::getStageVersion(QString stage) const {
const int betaValue = 1;
const int otherValue = 0;
if (stage == stableName) {
if (stage.isEmpty() || stage == stableName) {
return stableValue;
} else if (stage.toLower().startsWith(rcName)) {
QRegExp rx("\\d*", Qt::CaseInsensitive);
if (rx.indexIn(stage) != -1) {
QRegularExpression re("\\d*", QRegularExpression::CaseInsensitiveOption);
if (re.match(stage).hasMatch()) {
// return the rc value plus the rc number (e.g. 2 + 1)
// this should be ok since stable is max int.
return rcValue + rx.cap(1).toInt();
return rcValue + re.match(stage).captured(1).toInt();
}
} else if (stage == betaName) {
return betaValue;
@ -86,26 +87,24 @@ int VersionChecker::compareVersions(const QString &left, const QString &right) {
QStringList leftParts = left.split("-");
QStringList rightParts = right.split("-");
if (leftParts.size() < 1 || rightParts.size() < 1)
return 0; // versions are same.
QString leftNumber = leftParts.at(0);
QString rightNumber = rightParts.at(0);
QStringList leftNumberParts = left.split(".");
QStringList rightNumberParts = right.split(".");
auto leftStagePart = leftParts.size() > 1 ? leftParts.at(1) : "";
auto rightStagePart = rightParts.size() > 1 ? rightParts.at(1) : "";
const int leftMajor = leftNumberParts.at(0).toInt();
const int leftMinor = leftNumberParts.at(1).toInt();
const int leftPatch = leftNumberParts.at(2).toInt();
const int leftStage =
leftParts.size() > 1 ? getStageVersion(leftParts.at(1)) : 0;
const int leftStage = getStageVersion(leftStagePart);
const int rightMajor = rightNumberParts.at(0).toInt();
const int rightMinor = rightNumberParts.at(1).toInt();
const int rightPatch = rightNumberParts.at(2).toInt();
const int rightStage =
rightParts.size() > 1 ? getStageVersion(rightParts.at(1)) : 0;
const int rightStage = getStageVersion(rightStagePart);
const bool rightWins =
(rightMajor > leftMajor) ||

View file

@ -1,49 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2018 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Zeroconf.h"
#include "MainWindow.h"
#include "ZeroconfService.h"
Zeroconf::Zeroconf(MainWindow *mainWindow)
: m_pMainWindow(mainWindow), m_pZeroconfService(nullptr) {}
Zeroconf::~Zeroconf() { stopService(); }
void Zeroconf::startService() {
if (m_pZeroconfService != nullptr) {
m_pMainWindow->appendLogInfo("restarting zeroconf service");
delete m_pZeroconfService;
m_pZeroconfService = nullptr;
} else {
m_pMainWindow->appendLogInfo("starting zeroconf service");
}
m_pZeroconfService = new ZeroconfService(m_pMainWindow);
m_pMainWindow->appendLogInfo("started zeroconf service");
}
void Zeroconf::stopService() {
if (m_pZeroconfService != nullptr) {
m_pMainWindow->appendLogInfo("stopping zeroconf service");
delete m_pZeroconfService;
m_pZeroconfService = nullptr;
m_pMainWindow->appendLogInfo("stopped zeroconf service");
}
}

View file

@ -1,37 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2018 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QObject>
class MainWindow;
class ZeroconfService;
class Zeroconf : public QObject {
Q_OBJECT
public:
Zeroconf(MainWindow *mainWindow);
virtual ~Zeroconf();
void startService();
void stopService();
private:
MainWindow *m_pMainWindow;
ZeroconfService *m_pZeroconfService;
};

Some files were not shown because too many files have changed in this diff Show more