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 - name: Configure
env: env:
CMAKE_OSX_DEPLOYMENT_TARGET: ${{ matrix.target.version }} 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 - name: Build
run: cmake --build build -j8 run: cmake --build build -j8
@ -186,17 +186,6 @@ jobs:
strategy: strategy:
matrix: matrix:
distro: 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 - name: debian-12-arm64
container: arm64v8/debian:12 container: arm64v8/debian:12
runs-on: buildjet-4vcpu-ubuntu-2204-arm runs-on: buildjet-4vcpu-ubuntu-2204-arm
@ -207,11 +196,16 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
install-deps-apt: true install-deps-apt: true
- name: debian-11-amd64 - name: ubuntu-24.04-amd64
container: debian:11 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 runs-on: ubuntu-latest
install-deps-apt: true install-deps-apt: true
legacy-cmake: true
- name: fedora-40-arm64 - name: fedora-40-arm64
container: arm64v8/fedora:40 container: arm64v8/fedora:40
@ -270,15 +264,9 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: ./scripts/install_deps.py run: ./scripts/install_deps.py
- name: Configure (modern) - name: Configure
if: ${{ !matrix.distro.legacy-cmake }}
run: cmake -B build --preset=linux-release 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 - name: Build
run: cmake --build build -j8 run: cmake --build build -j8

View file

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

View file

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

View file

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

View file

@ -49,11 +49,6 @@ macro(configure_definitions)
add_definitions(-DSYNERGY_PRODUCT_NAME="${PRODUCT_NAME}") add_definitions(-DSYNERGY_PRODUCT_NAME="${PRODUCT_NAME}")
endif() 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") if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Disabling debug build") message(STATUS "Disabling debug build")
add_definitions(-DNDEBUG) add_definitions(-DNDEBUG)
@ -127,7 +122,4 @@ macro(configure_options)
option(ENABLE_LICENSING "Enable licensing" ${DEFAULT_ENABLE_LICENSING}) option(ENABLE_LICENSING "Enable licensing" ${DEFAULT_ENABLE_LICENSING})
option(ENABLE_COVERAGE "Enable test coverage" ${DEFAULT_ENABLE_COVERAGE}) 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() endmacro()

View file

@ -3,9 +3,11 @@ config:
dependencies: dependencies:
command: choco install Chocolatey.config -y command: choco install Chocolatey.config -y
qt: qt:
version: 5.15.2 version: 6.7.2
mirror: https://qt.mirror.constant.com/ mirror: https://qt.mirror.constant.com/
install-dir: C:\Qt install-dir: C:\Qt
modules:
- qt5compat
choco-ci: choco-ci:
edit-config: Chocolatey.config edit-config: Chocolatey.config
skip-packages: skip-packages:
@ -13,7 +15,7 @@ config:
- visualstudio2022buildtools - visualstudio2022buildtools
mac: mac:
qt-prefix-command: brew --prefix qt@5 qt-prefix-command: brew --prefix qt@6
dependencies: dependencies:
command: brew bundle --file=Brewfile command: brew bundle --file=Brewfile
@ -33,8 +35,9 @@ config:
libgdk-pixbuf-2.0-dev \ libgdk-pixbuf-2.0-dev \
libnotify-dev \ libnotify-dev \
libxkbfile-dev \ libxkbfile-dev \
qtbase5-dev \ qt6-base-dev \
qttools5-dev \ qt6-tools-dev \
libqt6core5compat6-dev \
libgtk-3-dev libgtk-3-dev
ubuntu: ubuntu:
@ -53,8 +56,9 @@ config:
libXtst-devel \ libXtst-devel \
libnotify-devel \ libnotify-devel \
libxkbfile-devel \ libxkbfile-devel \
qt5-qtbase-devel \ qt6-qtbase-devel \
qt5-qttools-devel \ qt6-qttools-devel \
qt6-qt5compat-devel \
gtk3-devel \ gtk3-devel \
rpm-build rpm-build
@ -66,14 +70,15 @@ config:
cmake \ cmake \
make \ make \
gcc-c++ \ gcc-c++ \
openssl-devel \ libopenssl-devel \
glib2-devel \ glib2-devel \
gdk-pixbuf-devel \ gdk-pixbuf-devel \
libXtst-devel \ libXtst-devel \
libnotify-devel \ libnotify-devel \
libxkbfile-devel \ libxkbfile-devel \
libqt5-qtbase-devel \ qt6-base-devel \
libqt5-qttools-devel \ qt6-tools-devel \
qt6-qt5compat-devel \
gtk3-devel \ gtk3-devel \
rpm-build rpm-build
@ -89,8 +94,9 @@ config:
libxtst \ libxtst \
libnotify \ libnotify \
libxkbfile \ libxkbfile \
qt5-base \ qt6-base \
qt5-tools \ qt6-tools \
qt6-5compat \
gtk3 gtk3
manjaro: 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' 'libxkbcommon-x11'
'libnotify' 'libnotify'
'hicolor-icon-theme' 'hicolor-icon-theme'
'qt5-base' 'qt6-base'
'qt6-tools'
) )
conflicts=('synergy-git' 'synergy1-bin' 'synergy2-bin' 'synergy3-bin') 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"/> <fire:FirewallException Id="GuiFirewallException" IgnoreFailure="yes" Name="$(var.Name)" Scope="any"/>
</File> </File>
<?if $(var.Configuration) = "Debug" ?> <?if $(var.Configuration) = "Debug" ?>
<File Source="$(var.BinPath)\Qt5Cored.dll"/> <File Source="$(var.BinPath)\Qt6Cored.dll"/>
<File Source="$(var.BinPath)\Qt5Guid.dll"/> <File Source="$(var.BinPath)\Qt6Guid.dll"/>
<File Source="$(var.BinPath)\Qt5Networkd.dll"/> <File Source="$(var.BinPath)\Qt6Networkd.dll"/>
<File Source="$(var.BinPath)\Qt5Svgd.dll"/> <File Source="$(var.BinPath)\Qt6Svgd.dll"/>
<File Source="$(var.BinPath)\Qt5Widgetsd.dll"/> <File Source="$(var.BinPath)\Qt6Widgetsd.dll"/>
<File Source="$(var.BinPath)\libGLESv2d.dll"/> <File Source="$(var.BinPath)\styles\qmodernwindowsstyle.dll"/>
<File Source="$(var.BinPath)\libEGLd.dll"/>
<!-- HACK: Normally the C++ redistributable solves this dependency, including it can cause problems --> <!-- 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"/> <File Source="C:\Program Files (x86)\Windows Kits\10\bin\$(var.Platform)\ucrt\ucrtbased.dll"/>
<?else ?> <?else ?>
<File Source="$(var.BinPath)\Qt5Core.dll"/> <File Source="$(var.BinPath)\Qt6Core.dll"/>
<File Source="$(var.BinPath)\Qt5Gui.dll"/> <File Source="$(var.BinPath)\Qt6Gui.dll"/>
<File Source="$(var.BinPath)\Qt5Network.dll"/> <File Source="$(var.BinPath)\Qt6Network.dll"/>
<File Source="$(var.BinPath)\Qt5Svg.dll"/> <File Source="$(var.BinPath)\Qt6Svg.dll"/>
<File Source="$(var.BinPath)\Qt5Widgets.dll"/> <File Source="$(var.BinPath)\Qt6Widgets.dll"/>
<File Source="$(var.BinPath)\libGLESv2.dll"/> <File Source="$(var.BinPath)\styles\qmodernwindowsstyle.dll"/>
<File Source="$(var.BinPath)\libEGL.dll"/>
<?endif ?> <?endif ?>
</Component> </Component>
</ComponentGroup> </ComponentGroup>
<ComponentGroup Directory="QTStylesDir" Id="ProductQtStylesComponents"> <ComponentGroup Directory="QTStylesDir" Id="ProductQtStylesComponents">
<Component Guid="96E0F8D8-64FD-4CE8-94D1-F6EDCBBB4995" Id="Styles"> <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> </Component>
</ComponentGroup> </ComponentGroup>
<ComponentGroup Directory="PlatformsDir" Id="ProductQtPluginComponents"> <ComponentGroup Directory="PlatformsDir" Id="ProductQtPluginComponents">

View file

@ -23,7 +23,7 @@ def main():
if args.set_qt_version: if args.set_qt_version:
config = Config() 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) github.set_env(qt_version_key, qt_version)
else: else:
raise RuntimeError("No option selected") raise RuntimeError("No option selected")

View file

@ -51,8 +51,9 @@ class Config:
mirror_url = _get(qt, "mirror", parent_key) mirror_url = _get(qt, "mirror", parent_key)
version = _get(qt, "version", parent_key) version = _get(qt, "version", parent_key)
base_dir = _get(qt, "install-dir", 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): def get_os_deps_value(self, key):
deps = self.get_os_value(deps_key) deps = self.get_os_value(deps_key)

View file

@ -50,12 +50,18 @@ def set_env_var(name, value):
def package(filename_base): def package(filename_base):
cert_base64 = env.get_env("WINDOWS_PFX_CERTIFICATE") cert_env_key = "WINDOWS_PFX_CERTIFICATE"
cert_password = env.get_env("WINDOWS_PFX_PASSWORD") 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) 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): def assert_vs_cmd(cmd):
@ -187,9 +193,10 @@ class WindowsChoco:
class WindowsQt: class WindowsQt:
"""Qt for Windows.""" """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.mirror_url = mirror_url
self.version = version self.version = version
self.modules = modules
# allows ci to override the qt base dir path # allows ci to override the qt base dir path
self.base_dir = os.environ.get(qt_base_dir_env_var) self.base_dir = os.environ.get(qt_base_dir_env_var)
@ -215,7 +222,11 @@ class WindowsQt:
args = ["python", "-m", "aqt", "install-qt"] args = ["python", "-m", "aqt", "install-qt"]
args.extend(["--outputdir", self.base_dir]) args.extend(["--outputdir", self.base_dir])
args.extend(["--base", self.mirror_url]) 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( cmd_utils.run(
args, args,
shell=True, 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_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC 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_SOURCE_FILES src/*.cpp src/*.h src/validators/* src/widgets/*)
file(GLOB GUI_UI_FILES src/*.ui) file(GLOB GUI_UI_FILES src/*.ui)
file(GLOB ACTIVATION_FILES src/*Activation* src/*License*) 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") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file(GLOB GUI_MAC_SOURCE_FILES src/*.mm) 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 # Retrieve the absolute path to qmake and then use that path to find the
# binaries # 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) get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}") find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt 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}) list(REMOVE_ITEM GUI_UI_FILES ${ACTIVATION_FILES})
endif() endif()
list(REMOVE_ITEM GUI_SOURCE_FILES ${ZEROCONF_FILES})
if(WIN32) if(WIN32)
set(GUI_RC_FILES res/win/Synergy.rc ${CMAKE_BINARY_DIR}/src/version.rc) set(GUI_RC_FILES res/win/Synergy.rc ${CMAKE_BINARY_DIR}/src/version.rc)
endif() endif()
add_executable( add_executable(synergy WIN32 ${GUI_SOURCE_FILES} ${GUI_UI_FILES}
synergy WIN32 ${GUI_RC_FILES} res/Synergy.qrc ${QM_FILES})
${GUI_SOURCE_FILES} ${GUI_UI_FILES} ${GUI_RC_FILES} res/Synergy.qrc
${CMAKE_CURRENT_BINARY_DIR}/res/Languages.qrc ${QM_FILES})
include_directories(./src) include_directories(./src)
target_link_libraries(synergy shared) 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( target_compile_definitions(
synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_VERSION_STAGE}") synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_VERSION_STAGE}")
target_compile_definitions(synergy target_compile_definitions(synergy
@ -73,34 +62,34 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
endif() endif()
if(WIN32) if(WIN32)
if(Qt5_FOUND if(Qt6_FOUND
AND WIN32 AND WIN32
AND TARGET Qt5::qmake AND TARGET Qt6::qmake
AND NOT TARGET Qt5::windeployqt) AND NOT TARGET Qt6::windeployqt)
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION) get_target_property(_qt6_qmake_location Qt6::qmake IMPORTED_LOCATION)
execute_process( execute_process(
COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX COMMAND "${_qt6_qmake_location}" -query QT_INSTALL_PREFIX
RESULT_VARIABLE return_code RESULT_VARIABLE return_code
OUTPUT_VARIABLE qt5_install_prefix OUTPUT_VARIABLE qt6_install_prefix
OUTPUT_STRIP_TRAILING_WHITESPACE) 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}) 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}) ${imported_location})
endif() endif()
endif() endif()
if(TARGET Qt5::windeployqt) if(TARGET Qt6::windeployqt)
# execute windeployqt in a tmp directory after build # execute windeployqt in a tmp directory after build
add_custom_command( add_custom_command(
TARGET synergy TARGET synergy
POST_BUILD POST_BUILD
COMMAND set PATH=%PATH%$<SEMICOLON>${qt5_install_prefix}/bin COMMAND set PATH=%PATH%$<SEMICOLON>${qt6_install_prefix}/bin
COMMAND Qt5::windeployqt COMMAND Qt6::windeployqt
"$<TARGET_FILE_DIR:synergy>/$<TARGET_FILE_NAME:synergy>") "$<TARGET_FILE_DIR:synergy>/$<TARGET_FILE_NAME:synergy>")
endif() endif()
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>icons/256x256/synergy.ico</file>
<file>image/about.png</file> <file>image/about.png</file>
<file>image/about-dark.png</file> <file>image/about-dark.png</file>
<file>lang/Languages.xml</file>
<file>image/spinning-wheel.gif</file> <file>image/spinning-wheel.gif</file>
<file>icons/16x16/padlock.png</file> <file>icons/16x16/padlock.png</file>
<file>icons/16x16/synergy-transfering.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(); QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified();
QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy"); QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy");
m_pLabelBuildDate->setText(buildDate.toString(Qt::SystemLocaleLongDate)); m_pLabelBuildDate->setText(
buildDate.toString(QLocale::system().dateFormat(QLocale::LongFormat)));
textEliteBackers->hide();
labelEliteBackers->hide();
labelEliteBackerLink->hide();
labelCreditsLink->hide();
} }
int AboutDialog::exec() { int AboutDialog::exec() {
// Sets the current build year into the copyright text m_pDevelopersLabel->setText(getImportantDevelopers());
label_3->setText(getCopyrights() + getKeyContributors()); m_pCopyrightLabel->setText(getCopyright());
resizeWindow(); resizeWindow();
updateLogo(); updateLogo();
@ -64,26 +60,37 @@ void AboutDialog::updateLogo() const {
if (isOSXInterfaceStyleDark()) { if (isOSXInterfaceStyleDark()) {
QPixmap logo(":/res/image/about-dark.png"); QPixmap logo(":/res/image/about-dark.png");
if (!logo.isNull()) { if (!logo.isNull()) {
label_Logo->setPixmap(logo); m_pLabel_Logo->setPixmap(logo);
} }
} }
#endif #endif
} }
QString AboutDialog::getKeyContributors() const { QString AboutDialog::getImportantDevelopers() const {
return QString(R"(<p style="font-size: 14px">Key contributors<br> return QString(
<span style="font-size: 11px">Chris Schoeneman, Nick Bolton, Richard Lee, Adam Feder, Volker Lanz, // The ultimate creator
Ryan Breen, Guido Poschta, Bertrand Landry Hetu, Tom Chadwick, Brent Priddy, Kyle Bloom, "Chris Schoeneman, "
Daun Chung, Serhii Hadzhylov, Oleksandr Lysytsia, Olena Kutytska, Francisco Magalhães.</span>
</p>)"); // 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(); QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified();
QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy"); QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy");
QString copyrights( QString copyright("Copyright © 2012-%%YEAR%% Symless Ltd.\n"
R"(<p>Keyboard and mouse sharing application.<br /><br />Copyright © %%YEAR%% Symless Ltd.</p>)"); "Copyright © 2009-2012 Nick Bolton\n"
return copyrights.replace(QString("%%YEAR%%"), "Copyright © 2002-2009 Chris Schoeneman");
QString::number(buildDate.year())); return copyright.replace(QString("%%YEAR%%"),
QString::number(buildDate.year()));
} }

View file

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

View file

@ -41,148 +41,14 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout">
<item row="10" column="1"> <item row="5" column="1">
<widget class="QLabel" name="labelCreditsLink"> <widget class="QLabel" name="m_pCopyrightLabel">
<property name="text"> <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> <string>Copyright</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="15" 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">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
@ -220,23 +86,103 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="11" column="1" colspan="2"> <item row="7" column="1">
<spacer> <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"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Preferred</enum> <enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>100</height> <height>5</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </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"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
@ -285,6 +231,38 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
<resources> <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) AddClientDialog::AddClientDialog(const QString &clientName, QWidget *parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AddClientDialog(), m_AddResult(kAddClientIgnore), Ui::AddClientDialog(), m_AddResult(kAddClientIgnore) {
m_IgnoreAutoConfigClient(false) {
setupUi(this); setupUi(this);
m_pLabelHead->setText("A client wants to connect. " m_pLabelHead->setText("A client wants to connect. "
@ -79,17 +78,6 @@ AddClientDialog::~AddClientDialog() {
delete m_pLabelCenter; 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() { void AddClientDialog::handleButtonLeft() {
m_AddResult = kAddClientLeft; m_AddResult = kAddClientLeft;
close(); close();
@ -114,7 +102,3 @@ void AddClientDialog::handleButtonAdvanced() {
m_AddResult = kAddClientOther; m_AddResult = kAddClientOther;
close(); close();
} }
void AddClientDialog::on_m_pCheckBoxIgnoreClient_toggled(bool checked) {
m_IgnoreAutoConfigClient = checked;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -28,7 +28,8 @@
namespace { namespace {
std::string getMaintenanceMessage(const SerialKey &serialKey) { std::string getMaintenanceMessage(const SerialKey &serialKey) {
auto expiration = QDateTime::fromTime_t(serialKey.getExpiration()).date(); auto expiration =
QDateTime::fromSecsSinceEpoch(serialKey.getExpiration()).date();
QString message = QString message =
"The license key you used will only work with versions of Synergy " "The license key you used will only work with versions of Synergy "
"released before %1." "released before %1."
@ -42,7 +43,9 @@ std::string getMaintenanceMessage(const SerialKey &serialKey) {
void checkSerialKey(const SerialKey &serialKey, bool acceptExpired) { void checkSerialKey(const SerialKey &serialKey, bool acceptExpired) {
if (serialKey.isMaintenance()) { 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()) { if (buildDate > serialKey.getExpiration()) {
throw std::runtime_error(getMaintenanceMessage(serialKey)); throw std::runtime_error(getMaintenanceMessage(serialKey));

View file

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

View file

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

View file

@ -49,7 +49,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>2</number> <number>10</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="m_pIconUpdate"> <widget class="QLabel" name="m_pIconUpdate">
@ -123,7 +123,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>14</height> <height>10</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -146,7 +146,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>0</height> <height>220</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -163,7 +163,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>28</number> <number>15</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>0</number>
@ -176,7 +176,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>250</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -229,7 +229,7 @@ background-color: rgba(192,192,192, 0.1);
</property> </property>
<property name="text"> <property name="text">
<string>Use this computer's keyboard and mouse <string>Use this computer's keyboard and mouse
(Make this computer the server).</string> (make this computer the server)</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -244,7 +244,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>20</height> <height>10</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -252,7 +252,7 @@ background-color: rgba(192,192,192, 0.1);
<item> <item>
<widget class="QLabel" name="m_pLabelClientIp"> <widget class="QLabel" name="m_pLabelClientIp">
<property name="text"> <property name="text">
<string>Client IP address or name:</string> <string>Client IP address or hostname:</string>
</property> </property>
<property name="indent"> <property name="indent">
<number>20</number> <number>20</number>
@ -304,7 +304,7 @@ background-color: rgba(192,192,192, 0.1);
</size> </size>
</property> </property>
<property name="text"> <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>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
@ -322,7 +322,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>10</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -371,7 +371,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>250</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -424,7 +424,7 @@ background-color: rgba(192,192,192, 0.1);
</property> </property>
<property name="text"> <property name="text">
<string>Use another computer’s mouse and keyboard <string>Use another computer’s mouse and keyboard
(Make this computer the client).</string> (make this computer the client)</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -439,7 +439,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>10</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -461,7 +461,7 @@ background-color: rgba(192,192,192, 0.1);
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Server IP address or name:</string> <string>&amp;Server IP address or hostname:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>m_pLineEditHostname</cstring> <cstring>m_pLineEditHostname</cstring>
@ -487,35 +487,12 @@ background-color: rgba(192,192,192, 0.1);
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item> <item>
<widget class="synergy_widgets::ClientStateLabel" name="m_pLabelClientState"> <widget class="synergy_widgets::ClientStateLabel" name="m_pLabelClientState">
<property name="text"> <property name="text">
<string>Connected to the server</string> <string>Connected to server</string>
</property> </property>
<property name="indent"> <property name="indent">
<number>20</number> <number>20</number>
@ -533,7 +510,7 @@ background-color: rgba(192,192,192, 0.1);
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>10</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -715,6 +692,7 @@ background-color: rgba(192,192,192, 0.1);
<font> <font>
<family>Arial</family> <family>Arial</family>
<pointsize>-1</pointsize> <pointsize>-1</pointsize>
<weight>88</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>

View file

@ -25,7 +25,7 @@
QSynergyApplication *QSynergyApplication::s_Instance = NULL; QSynergyApplication *QSynergyApplication::s_Instance = NULL;
QSynergyApplication::QSynergyApplication(int &argc, char **argv) QSynergyApplication::QSynergyApplication(int &argc, char **argv)
: QApplication(argc, argv), m_Translator(NULL) { : QApplication(argc, argv) {
s_Instance = this; s_Instance = this;
QFontDatabase::addApplicationFont(":/res/fonts/Arial.ttf"); QFontDatabase::addApplicationFont(":/res/fonts/Arial.ttf");
@ -35,7 +35,7 @@ QSynergyApplication::QSynergyApplication(int &argc, char **argv)
setFont(Arial); setFont(Arial);
} }
QSynergyApplication::~QSynergyApplication() { delete m_Translator; } QSynergyApplication::~QSynergyApplication() {}
void QSynergyApplication::commitData(QSessionManager &) { void QSynergyApplication::commitData(QSessionManager &) {
foreach (QWidget *widget, topLevelWidgets()) { foreach (QWidget *widget, topLevelWidgets()) {
@ -46,20 +46,3 @@ void QSynergyApplication::commitData(QSessionManager &) {
} }
QSynergyApplication *QSynergyApplication::getInstance() { return s_Instance; } 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: public:
void commitData(QSessionManager &manager); void commitData(QSessionManager &manager);
void switchTranslator(QString lang);
void setTranslator(QTranslator *translator);
static QSynergyApplication *getInstance(); static QSynergyApplication *getInstance();
private: private:
QTranslator *m_Translator;
static QSynergyApplication *s_Instance; static QSynergyApplication *s_Instance;
}; };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>778</width> <width>799</width>
<height>508</height> <height>508</height>
</rect> </rect>
</property> </property>
@ -137,22 +137,6 @@
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </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> <item>
<widget class="QPushButton" name="m_pButtonAddComputer"> <widget class="QPushButton" name="m_pButtonAddComputer">
<property name="text"> <property name="text">

View file

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

View file

@ -25,11 +25,9 @@
#include <memory> #include <memory>
#include "CoreInterface.h" #include "CoreInterface.h"
#include "SynergyLocale.h"
class MainWindow; class MainWindow;
class AppConfig; class AppConfig;
class BonjourWindows;
class SettingsDialog : public QDialog, public Ui::SettingsDialogBase { class SettingsDialog : public QDialog, public Ui::SettingsDialogBase {
Q_OBJECT Q_OBJECT
@ -40,12 +38,10 @@ public:
const QString &synergycName); const QString &synergycName);
static QString browseForSynergys(QWidget *parent, const QString &programDir, static QString browseForSynergys(QWidget *parent, const QString &programDir,
const QString &synergysName); const QString &synergysName);
void allowAutoConfig();
protected: protected:
void accept() override; void accept() override;
void reject() override; void reject() override;
void changeEvent(QEvent *event) override;
AppConfig &appConfig() { return m_appConfig; } AppConfig &appConfig() { return m_appConfig; }
/// @brief Causes the dialog to load all the settings from m_appConfig /// @brief Causes the dialog to load all the settings from m_appConfig
@ -75,9 +71,7 @@ protected:
private: private:
MainWindow *m_pMainWindow; MainWindow *m_pMainWindow;
AppConfig &m_appConfig; AppConfig &m_appConfig;
SynergyLocale m_Locale;
CoreInterface m_CoreInterface; CoreInterface m_CoreInterface;
BonjourWindows *m_pBonjourWindows;
/// @brief Stores settings scope at start of settings dialog /// @brief Stores settings scope at start of settings dialog
/// This is neccessary to restore state if user changes /// This is neccessary to restore state if user changes
@ -86,10 +80,8 @@ private:
private slots: private slots:
void on_m_pCheckBoxEnableCrypto_clicked(bool checked); void on_m_pCheckBoxEnableCrypto_clicked(bool checked);
void on_m_pComboLanguage_currentIndexChanged(int index);
void on_m_pCheckBoxLogToFile_stateChanged(int); void on_m_pCheckBoxLogToFile_stateChanged(int);
void on_m_pButtonBrowseLog_clicked(); void on_m_pButtonBrowseLog_clicked();
void on_m_pLabelInstallBonjour_linkActivated(const QString &link);
/// @brief Handles the toggling of the system scoped radio button /// @brief Handles the toggling of the system scoped radio button
/// As the user scope radio is connected this will fire for either /// 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> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <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"> <widget class="QComboBox" name="m_pComboElevate">
<property name="toolTip"> <property name="toolTip">
<string>Specify when the Synergy service should run at an elevated privilege level</string> <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> </item>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="3"> <item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="m_pCheckBoxLanguageSync"> <widget class="QCheckBox" name="m_pCheckBoxLanguageSync">
<property name="text"> <property name="text">
<string>&amp;Use server's keyboard language on this machine</string> <string>&amp;Use server's keyboard language on this machine</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QCheckBox" name="m_pCheckBoxClientHostMode"> <widget class="QCheckBox" name="m_pCheckBoxServerClientMode">
<property name="text"> <property name="text">
<string>Host mode</string> <string>Client mode</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="5" 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">
<widget class="QLabel" name="m_pLabelElevate"> <widget class="QLabel" name="m_pLabelElevate">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -402,45 +416,6 @@ background-color: rgba(192,192,192, 0.1);
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>
@ -644,7 +619,7 @@ background-color: rgba(192,192,192, 0.1);
<item> <item>
<widget class="QPushButton" name="m_pPushButtonRegenCert"> <widget class="QPushButton" name="m_pPushButtonRegenCert">
<property name="text"> <property name="text">
<string>Regenerate cert</string> <string>Regenerate certificate</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -709,6 +684,7 @@ background-color: rgba(192,192,192, 0.1);
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </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 <QNetworkReply>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QProcess> #include <QProcess>
#include <QRegularExpression>
VersionChecker::VersionChecker() { VersionChecker::VersionChecker() {
m_manager = new QNetworkAccessManager(this); m_manager = new QNetworkAccessManager(this);
@ -63,14 +64,14 @@ int VersionChecker::getStageVersion(QString stage) const {
const int betaValue = 1; const int betaValue = 1;
const int otherValue = 0; const int otherValue = 0;
if (stage == stableName) { if (stage.isEmpty() || stage == stableName) {
return stableValue; return stableValue;
} else if (stage.toLower().startsWith(rcName)) { } else if (stage.toLower().startsWith(rcName)) {
QRegExp rx("\\d*", Qt::CaseInsensitive); QRegularExpression re("\\d*", QRegularExpression::CaseInsensitiveOption);
if (rx.indexIn(stage) != -1) { if (re.match(stage).hasMatch()) {
// return the rc value plus the rc number (e.g. 2 + 1) // return the rc value plus the rc number (e.g. 2 + 1)
// this should be ok since stable is max int. // 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) { } else if (stage == betaName) {
return betaValue; return betaValue;
@ -86,26 +87,24 @@ int VersionChecker::compareVersions(const QString &left, const QString &right) {
QStringList leftParts = left.split("-"); QStringList leftParts = left.split("-");
QStringList rightParts = right.split("-"); QStringList rightParts = right.split("-");
if (leftParts.size() < 1 || rightParts.size() < 1)
return 0; // versions are same.
QString leftNumber = leftParts.at(0); QString leftNumber = leftParts.at(0);
QString rightNumber = rightParts.at(0); QString rightNumber = rightParts.at(0);
QStringList leftNumberParts = left.split("."); QStringList leftNumberParts = left.split(".");
QStringList rightNumberParts = right.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 leftMajor = leftNumberParts.at(0).toInt();
const int leftMinor = leftNumberParts.at(1).toInt(); const int leftMinor = leftNumberParts.at(1).toInt();
const int leftPatch = leftNumberParts.at(2).toInt(); const int leftPatch = leftNumberParts.at(2).toInt();
const int leftStage = const int leftStage = getStageVersion(leftStagePart);
leftParts.size() > 1 ? getStageVersion(leftParts.at(1)) : 0;
const int rightMajor = rightNumberParts.at(0).toInt(); const int rightMajor = rightNumberParts.at(0).toInt();
const int rightMinor = rightNumberParts.at(1).toInt(); const int rightMinor = rightNumberParts.at(1).toInt();
const int rightPatch = rightNumberParts.at(2).toInt(); const int rightPatch = rightNumberParts.at(2).toInt();
const int rightStage = const int rightStage = getStageVersion(rightStagePart);
rightParts.size() > 1 ? getStageVersion(rightParts.at(1)) : 0;
const bool rightWins = const bool rightWins =
(rightMajor > leftMajor) || (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