mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-12 06:35:04 +08:00
Compare commits
260 Commits
v1.8.3-sta
...
v1.8.8-sta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c30301e234 | ||
|
|
5909df9ee7 | ||
|
|
c5b83ce4c4 | ||
|
|
fc3cc78c3e | ||
|
|
ed17e9275d | ||
|
|
2d9ed0d335 | ||
|
|
2643cea67b | ||
|
|
4b913b5599 | ||
|
|
1499f7b27c | ||
|
|
f35e3e5e06 | ||
|
|
180d3e57d2 | ||
|
|
adf34eba40 | ||
|
|
b5a81579ed | ||
|
|
0eff5a95be | ||
|
|
ba55369d42 | ||
|
|
8e6bf53233 | ||
|
|
21d4e6a908 | ||
|
|
f5944278ed | ||
|
|
3d3b7ca881 | ||
|
|
3bb833b798 | ||
|
|
a5140aa1b9 | ||
|
|
9799e96903 | ||
|
|
487d8c99a1 | ||
|
|
fd6ea65f1a | ||
|
|
b69570ec2c | ||
|
|
ade4b7f8a2 | ||
|
|
2ab21aaa01 | ||
|
|
5061f51a66 | ||
|
|
c31f908fb2 | ||
|
|
74d63df244 | ||
|
|
3b92a87261 | ||
|
|
c764e26144 | ||
|
|
e1dc29799f | ||
|
|
4297673387 | ||
|
|
72b1ebcdb2 | ||
|
|
a49de58738 | ||
|
|
d8cd60f057 | ||
|
|
00db51cd93 | ||
|
|
e8145aa779 | ||
|
|
7c12608f20 | ||
|
|
265cc5c687 | ||
|
|
a279348cf9 | ||
|
|
e6ca9e417d | ||
|
|
f2f4b05c6f | ||
|
|
b8233fc146 | ||
|
|
5cccac360c | ||
|
|
24a548273e | ||
|
|
1a7920f80d | ||
|
|
7ce6905935 | ||
|
|
340ee43d90 | ||
|
|
514e2475c3 | ||
|
|
6a7703f229 | ||
|
|
a18eba7520 | ||
|
|
20a34e5abf | ||
|
|
771d2a419b | ||
|
|
c9bb421fb5 | ||
|
|
2f2dd7742f | ||
|
|
3e9815dfdd | ||
|
|
ef9842c819 | ||
|
|
af62174b59 | ||
|
|
af9037276c | ||
|
|
fa7daa48f7 | ||
|
|
73685c3d92 | ||
|
|
4206799ae3 | ||
|
|
2de06b9727 | ||
|
|
9f1e91cc76 | ||
|
|
906fd15b4a | ||
|
|
8d193c76b5 | ||
|
|
0d4fd6dcef | ||
|
|
c2372bc9a8 | ||
|
|
cf397a0d6f | ||
|
|
c62c4d503d | ||
|
|
640262dfff | ||
|
|
6b0cd35527 | ||
|
|
b7e0473cb4 | ||
|
|
f08f0b3f37 | ||
|
|
492df1f3fd | ||
|
|
b66043e000 | ||
|
|
a59c437fd3 | ||
|
|
1842a68a0e | ||
|
|
e17130f060 | ||
|
|
3048ca5fc6 | ||
|
|
bdf5546058 | ||
|
|
7bae07d34e | ||
|
|
868887155d | ||
|
|
ae590907a8 | ||
|
|
f2a1d962bc | ||
|
|
e01d0ce4c7 | ||
|
|
f441c24a23 | ||
|
|
984ca48f34 | ||
|
|
6a7d1dd43c | ||
|
|
47913e57b8 | ||
|
|
02c23905d6 | ||
|
|
dc4beba9e9 | ||
|
|
dfc7c31d67 | ||
|
|
020b7974df | ||
|
|
17961501f6 | ||
|
|
e5aae66ff7 | ||
|
|
880864a249 | ||
|
|
45f37c508c | ||
|
|
e48be9099d | ||
|
|
e65631c451 | ||
|
|
859608424d | ||
|
|
98610fabde | ||
|
|
fc67cdf56e | ||
|
|
5a34da3ce0 | ||
|
|
99dbdc5eb3 | ||
|
|
88c59b4ca6 | ||
|
|
599415f047 | ||
|
|
8b4d7abfb0 | ||
|
|
c7dc198d82 | ||
|
|
b5a6ae0a94 | ||
|
|
7eefa49c77 | ||
|
|
714b2f6440 | ||
|
|
e05ced287c | ||
|
|
e14ff8935b | ||
|
|
0dd0e65e2a | ||
|
|
b20d04d80c | ||
|
|
3ee9ac5d49 | ||
|
|
4ad7c7fe39 | ||
|
|
3b98a7b785 | ||
|
|
1f93b4a918 | ||
|
|
d244683ac4 | ||
|
|
dc31f395cc | ||
|
|
55414e4581 | ||
|
|
89851fddc3 | ||
|
|
2b1b0640ea | ||
|
|
92b29276d0 | ||
|
|
1e5dfd3cb5 | ||
|
|
dce4b382e6 | ||
|
|
33ebe61ef2 | ||
|
|
727fc5c220 | ||
|
|
540882056f | ||
|
|
743e96f277 | ||
|
|
fd8e778b2a | ||
|
|
719e64dc8f | ||
|
|
235f528dd9 | ||
|
|
2a452307cd | ||
|
|
92a885524b | ||
|
|
92680b2877 | ||
|
|
82e55702ef | ||
|
|
4be9fc1800 | ||
|
|
d92fcd2453 | ||
|
|
c7cd74ab5f | ||
|
|
817f8f2bcb | ||
|
|
c21fc4a6dd | ||
|
|
5ea1fdc7c6 | ||
|
|
df88faaad8 | ||
|
|
d1396c9767 | ||
|
|
2b9f48602c | ||
|
|
a50ae2ad36 | ||
|
|
fc879323bc | ||
|
|
a6ff90794f | ||
|
|
0e209aa903 | ||
|
|
fcd8153002 | ||
|
|
217eb475de | ||
|
|
42ba77ae04 | ||
|
|
9ae146add0 | ||
|
|
ef3b79e585 | ||
|
|
9837c982cd | ||
|
|
742cd70f98 | ||
|
|
176d7c9286 | ||
|
|
03b8788660 | ||
|
|
833c73f1bd | ||
|
|
6892664f4a | ||
|
|
360d5a7c17 | ||
|
|
dd88e324d7 | ||
|
|
5b7392d302 | ||
|
|
26c11ec3c9 | ||
|
|
602fd3f649 | ||
|
|
8072594008 | ||
|
|
23cf284a66 | ||
|
|
19b9be4593 | ||
|
|
788f6eab9f | ||
|
|
2a5dc62747 | ||
|
|
f7ad162634 | ||
|
|
2e30dc2c68 | ||
|
|
702f095efd | ||
|
|
7e386c0bf9 | ||
|
|
d77b5f1176 | ||
|
|
5a03e37d15 | ||
|
|
f1cd215f28 | ||
|
|
0568271506 | ||
|
|
a13dc92f2e | ||
|
|
16977788d3 | ||
|
|
5b8fb69124 | ||
|
|
5272c9dde4 | ||
|
|
50807bfcb6 | ||
|
|
055370412c | ||
|
|
fb5e2bb171 | ||
|
|
e81f7ab8c7 | ||
|
|
90c3dd6622 | ||
|
|
0371002497 | ||
|
|
f174614655 | ||
|
|
9ed9bde4e7 | ||
|
|
f3d1470e58 | ||
|
|
e6a3caaf75 | ||
|
|
b345eb4067 | ||
|
|
0c76f9feeb | ||
|
|
d99bd8e031 | ||
|
|
c288918d68 | ||
|
|
002bcebbd2 | ||
|
|
783056f7cc | ||
|
|
15f2e27d18 | ||
|
|
16ef224ba8 | ||
|
|
603b12dc59 | ||
|
|
15a6a27dc6 | ||
|
|
176d7e4725 | ||
|
|
912ed9be9c | ||
|
|
d1a180f652 | ||
|
|
32f143f52b | ||
|
|
d6bcdcbea7 | ||
|
|
c799041ce8 | ||
|
|
4924f2faff | ||
|
|
d6b7d8e357 | ||
|
|
2809530793 | ||
|
|
bcf2d5de0d | ||
|
|
02d75cd370 | ||
|
|
088ac82e18 | ||
|
|
6033f0c946 | ||
|
|
0f95c6e941 | ||
|
|
8788faffdd | ||
|
|
d48f6801f0 | ||
|
|
60a4e62779 | ||
|
|
0d5d7e11c0 | ||
|
|
d4646b1cc6 | ||
|
|
81ae0c211a | ||
|
|
663e3f5854 | ||
|
|
45da1dfc7c | ||
|
|
55a2d1231f | ||
|
|
0d84e4eed6 | ||
|
|
f4f57e1f95 | ||
|
|
3b5940ac18 | ||
|
|
e18f8c62e7 | ||
|
|
964e6d2f12 | ||
|
|
1fceb2b646 | ||
|
|
5db78acab4 | ||
|
|
52c8763d97 | ||
|
|
6456271141 | ||
|
|
79fc6239fd | ||
|
|
c3889667ba | ||
|
|
5f5153f450 | ||
|
|
b55b8f0038 | ||
|
|
b1a991e8cd | ||
|
|
45ef3e1080 | ||
|
|
77d6b83b0c | ||
|
|
aee8e2874e | ||
|
|
a2ad4cb0dc | ||
|
|
011da60cca | ||
|
|
85227f41a1 | ||
|
|
f7e588dfff | ||
|
|
dc93b063b7 | ||
|
|
5774f5a291 | ||
|
|
27ccddbea4 | ||
|
|
76b2558f1a | ||
|
|
665bd91dbd | ||
|
|
a70a2bf864 | ||
|
|
f58e95c96f | ||
|
|
5a03ece50b | ||
|
|
f00f60a8fe |
5
.github/ISSUE_TEMPLATE.md
vendored
5
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,8 +1,7 @@
|
||||
### Operating Systems ###
|
||||
|
||||
Client: Applesoft Windy OS 10
|
||||
|
||||
Server: microOS Tiara
|
||||
Client: Applesoft Windy OS 10
|
||||
|
||||
**READ ME, DELETE ME**: On Windows, hold the Windows key and press 'r', type 'winver' and hit return to get your OS version. On Mac, hit the Apple menu (top left of the screen) and check 'About this Mac'. Linux users... you know what you're using ;)
|
||||
|
||||
@@ -28,4 +27,6 @@ Server: microOS Tiara
|
||||
* Is there a way to work around it? No/Yes, you can...
|
||||
* Does this bug prevent you from using Synergy entirely? Yes/No
|
||||
|
||||
Please follow the link below to send us logs from both your server and client sides if it's appropriate. https://github.com/symless/synergy/wiki/Sending-logs
|
||||
|
||||
Put anything else you can think of here.
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,7 +1,10 @@
|
||||
config.h
|
||||
.DS_Store
|
||||
*.pyc
|
||||
*.o
|
||||
*~
|
||||
\.*.swp
|
||||
*build-gui-Desktop_Qt*
|
||||
/bin
|
||||
/lib
|
||||
/build
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# Version number for Synergy
|
||||
set(VERSION_MAJOR 1)
|
||||
set(VERSION_MINOR 8)
|
||||
set(VERSION_REV 3)
|
||||
set(VERSION_REV 8)
|
||||
set(VERSION_STAGE stable)
|
||||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
|
||||
|
||||
@@ -74,11 +74,6 @@ endif()
|
||||
|
||||
# Depending on the platform, pass in the required defines.
|
||||
if (UNIX)
|
||||
|
||||
# warnings as errors:
|
||||
# we have a problem with people checking in code with warnings.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-unused-local-typedef")
|
||||
|
||||
if (NOT APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
endif()
|
||||
@@ -205,7 +200,10 @@ if (UNIX)
|
||||
set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include")
|
||||
|
||||
set(XKBlib "X11/Xlib.h;X11/XKBlib.h")
|
||||
check_symbol_exists("XRRNotifyEvent" "${XKBlib};X11/extensions/Xrandr.h" HAVE_X11_EXTENSIONS_XRANDR_H)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h")
|
||||
check_type_size("XRRNotifyEvent" X11_EXTENSIONS_XRANDR_H)
|
||||
set(HAVE_X11_EXTENSIONS_XRANDR_H "${X11_EXTENSIONS_XRANDR_H}")
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
|
||||
check_include_files("${XKBlib};X11/extensions/dpms.h" HAVE_X11_EXTENSIONS_DPMS_H)
|
||||
check_include_files("X11/extensions/Xinerama.h" HAVE_X11_EXTENSIONS_XINERAMA_H)
|
||||
|
||||
48
ChangeLog
48
ChangeLog
@@ -1,3 +1,51 @@
|
||||
v1.8.8-rc1
|
||||
==========
|
||||
Bug #5196 - Some keys on Korean and Japanese keyboards have the same keycode
|
||||
Bug #5578 - Pressing Hangul key results in alt+'a'
|
||||
Bug #5785 - Can't switch screens when cursor is in a corner
|
||||
Bug #3992 - macOS: Dragging is broken in Unity 3D
|
||||
Bug #5075 - macOS: Build fails on macOS 10.9 due to unknown compiler flag
|
||||
Bug #5809 - macOS: No version number is shown in the App Info dialog
|
||||
Bug #3197 - Linux: switchDoubleTap option is not working
|
||||
Bug #4477 - Linux: Mouse buttons higher than id 10 result in crash
|
||||
Bug #5832 - Linux: Screen size misdetected on multi-monitor display
|
||||
Enhancement #4504 - Improved Korean language description
|
||||
Enhancement #5525 - Added support for precise screen positioning in config file
|
||||
Enhancement #4290 - Windows: Removed annoying alt+print screen functionality
|
||||
|
||||
v1.8.7-stable
|
||||
=============
|
||||
Bug #5784 - Edition changes when reopening GUI
|
||||
|
||||
v1.8.6-stable
|
||||
=============
|
||||
Bug #5592 - Some keys don't work for macOS Sierra clients
|
||||
Bug #5186 - Cursor stuck on client when using multi-DPI server
|
||||
Bug #5722 - Malformed serial key in registry will crash GUI on startup
|
||||
Bug #5752 - Tab order is incorrect on Settings dialog
|
||||
Enhancement #5699 - Unified installers on macOS
|
||||
Feature #4836 - macOS Sierra build
|
||||
|
||||
v1.8.5-stable
|
||||
=============
|
||||
Bug #5680 - Server crashes when disconnecting SSL clients
|
||||
Bug #5626 - Build fails using Xcode 8 and macOS SDK 10.12
|
||||
Feature #5657 - Trial version support
|
||||
Feature #5707 - User upgrade statistics
|
||||
|
||||
v1.8.4-stable
|
||||
=============
|
||||
Bug #5183 - Slowly moving the cursor has no effect on high DPI clients
|
||||
Bug #4041 - UHD/4K DPI scaling broken on Windows servers
|
||||
Bug #4420 - When XRandR adds a screen, it is inaccessible
|
||||
Bug #5603 - Activation notification depends on existence of /etc/os-release
|
||||
Bug #5624 - Update notification sometimes requests a downgrade
|
||||
Bug #5329 - Current date is shown for build date in the about dialog
|
||||
Enhancement #5617 - Remove redundant plugin infrastructure
|
||||
Enhancement #5627 - Move SSL certificate generation to main window
|
||||
Enhancement #5628 - Move SSL implementation into core binary
|
||||
Enhancement #5629 - Move activation from wizard into new dialog window
|
||||
|
||||
v1.8.3-stable
|
||||
=============
|
||||
Bug #2765 - A letter appears on macOS clients when the spacebar is pressed
|
||||
|
||||
@@ -5,10 +5,10 @@ To install on Mac OS X with the .zip distribution (first seen in 1.3.6) you must
|
||||
|
||||
1. Extract the zip file to any location (usually double click will do this)
|
||||
2. Open Terminal, and cd to the extracted directory (e.g. /Users/my-name/Downloads/extracted-dir/)
|
||||
3. Change to super user (use the su command)
|
||||
4. Copy the binaries to /usr/bin using: cp synergy* /usr/bin
|
||||
3. Copy the binaries to /usr/bin using: sudo cp synergy* /usr/bin
|
||||
4. Correct the permissions and ownership: sudo chown root:wheel /usr/bin/synergy*; sudo chmod 555 /usr/bin/synergy*
|
||||
|
||||
How to enable the root user in Mac OS X:
|
||||
Alternatively, you can copy the binaries as root. How to enable the root user in Mac OS X:
|
||||
http://support.apple.com/en-us/ht1528
|
||||
|
||||
Once the binaries have been copied to /usr/bin, you should follow the configuration guide:
|
||||
|
||||
@@ -41,7 +41,7 @@ class Toolchain:
|
||||
cmd_opt_dict = {
|
||||
'about' : ['', []],
|
||||
'setup' : ['g:', ['generator=']],
|
||||
'configure' : ['g:dr', ['generator=', 'debug', 'release', 'mac-sdk=', 'mac-identity=']],
|
||||
'configure' : ['g:dr', ['generator=', 'debug', 'release', 'mac-sdk=', 'mac-deploy=', 'mac-identity=']],
|
||||
'build' : ['dr', ['debug', 'release']],
|
||||
'clean' : ['dr', ['debug', 'release']],
|
||||
'update' : ['', []],
|
||||
@@ -244,6 +244,9 @@ class InternalCommands:
|
||||
# by default, unknown
|
||||
macSdk = None
|
||||
|
||||
# by default, unknown
|
||||
macDeploy = None
|
||||
|
||||
# by default, unknown
|
||||
macIdentity = None
|
||||
|
||||
@@ -306,7 +309,7 @@ class InternalCommands:
|
||||
' genlist Shows the list of available platform generators\n'
|
||||
' usage Shows the help screen\n'
|
||||
'\n'
|
||||
'Example: %s build -g 3'
|
||||
'Example: %s conf -g 3'
|
||||
) % (app, app)
|
||||
|
||||
def configureAll(self, targets, extraArgs=''):
|
||||
@@ -365,7 +368,7 @@ class InternalCommands:
|
||||
# ensure latest setup and do not ask config for generator (only fall
|
||||
# back to prompt if not specified as arg)
|
||||
self.ensure_setup_latest()
|
||||
|
||||
|
||||
if sys.platform == "darwin":
|
||||
config = self.getConfig()
|
||||
|
||||
@@ -374,6 +377,11 @@ class InternalCommands:
|
||||
elif config.has_option("hm", "macSdk"):
|
||||
self.macSdk = config.get('hm', 'macSdk')
|
||||
|
||||
if self.macDeploy:
|
||||
config.set('hm', 'macDeploy', self.macDeploy)
|
||||
elif config.has_option("hm", "macDeploy"):
|
||||
self.macSdk = config.get('hm', 'macDeploy')
|
||||
|
||||
if self.macIdentity:
|
||||
config.set('hm', 'macIdentity', self.macIdentity)
|
||||
elif config.has_option("hm", "macIdentity"):
|
||||
@@ -383,7 +391,10 @@ class InternalCommands:
|
||||
|
||||
if not self.macSdk:
|
||||
raise Exception("Arg missing: --mac-sdk <version>");
|
||||
|
||||
|
||||
if not self.macDeploy:
|
||||
self.macDeploy = self.macSdk
|
||||
|
||||
if not self.macIdentity:
|
||||
raise Exception("Arg missing: --mac-identity <name>");
|
||||
|
||||
@@ -430,14 +441,16 @@ class InternalCommands:
|
||||
if generator.cmakeName.find('Unix Makefiles') != -1:
|
||||
cmake_args += ' -DCMAKE_BUILD_TYPE=' + target.capitalize()
|
||||
|
||||
elif sys.platform == "darwin":
|
||||
if sys.platform == "darwin":
|
||||
macSdkMatch = re.match("(\d+)\.(\d+)", self.macSdk)
|
||||
if not macSdkMatch:
|
||||
raise Exception("unknown osx version: " + self.macSdk)
|
||||
|
||||
sdkDir = self.getMacSdkDir()
|
||||
cmake_args += " -DCMAKE_OSX_SYSROOT=" + sdkDir
|
||||
cmake_args += " -DCMAKE_OSX_DEPLOYMENT_TARGET=" + self.macSdk
|
||||
if generator.cmakeName.find('Unix Makefiles') == -1:
|
||||
sdkDir = self.getMacSdkDir()
|
||||
cmake_args += " -DCMAKE_OSX_SYSROOT=" + sdkDir
|
||||
cmake_args += " -DCMAKE_OSX_DEPLOYMENT_TARGET=" + self.macDeploy
|
||||
|
||||
cmake_args += " -DOSX_TARGET_MAJOR=" + macSdkMatch.group(1)
|
||||
cmake_args += " -DOSX_TARGET_MINOR=" + macSdkMatch.group(2)
|
||||
|
||||
@@ -496,8 +509,8 @@ class InternalCommands:
|
||||
sdkDir = self.getMacSdkDir()
|
||||
shortForm = "macosx" + self.macSdk
|
||||
version = str(major) + "." + str(minor)
|
||||
|
||||
qmake_cmd_string += " QMAKE_MACOSX_DEPLOYMENT_TARGET=" + version
|
||||
|
||||
qmake_cmd_string += " QMAKE_MACOSX_DEPLOYMENT_TARGET=" + self.macDeploy
|
||||
|
||||
(qMajor, qMinor, qRev) = self.getQmakeVersion()
|
||||
if qMajor <= 4:
|
||||
@@ -551,6 +564,7 @@ class InternalCommands:
|
||||
if os.path.exists(sdkPath):
|
||||
return sdkPath
|
||||
|
||||
# return os.popen('xcodebuild -version -sdk macosx' + self.macSdk + ' Path').read().strip()
|
||||
return "/Developer/SDKs/" + sdkDirName + ".sdk"
|
||||
|
||||
# http://tinyurl.com/cs2rxxb
|
||||
@@ -653,6 +667,9 @@ class InternalCommands:
|
||||
|
||||
if config.has_option("hm", "macSdk"):
|
||||
self.macSdk = config.get("hm", "macSdk")
|
||||
|
||||
if config.has_option("hm", "macDeploy"):
|
||||
self.macDeploy = config.get("hm", "macDeploy")
|
||||
|
||||
if config.has_option("hm", "macIdentity"):
|
||||
self.macIdentity = config.get("hm", "macIdentity")
|
||||
@@ -741,16 +758,6 @@ class InternalCommands:
|
||||
shutil.copy(targetDir + "/synergys", bundleBinDir)
|
||||
shutil.copy(targetDir + "/syntool", bundleBinDir)
|
||||
|
||||
# Copy all generated plugins to the package
|
||||
bundlePluginDir = bundleBinDir + "plugins"
|
||||
pluginDir = targetDir + "/plugins"
|
||||
print "Copying plugins dirtree: " + pluginDir
|
||||
if os.path.isdir(pluginDir):
|
||||
print "Copying to: " + bundlePluginDir
|
||||
shutil.copytree(pluginDir, bundlePluginDir)
|
||||
else:
|
||||
print "pluginDir doesn't exist, skipping"
|
||||
|
||||
self.loadConfig()
|
||||
if not self.macIdentity:
|
||||
raise Exception("run config with --mac-identity")
|
||||
@@ -1151,14 +1158,12 @@ class InternalCommands:
|
||||
controlFile.close()
|
||||
|
||||
targetBin = '%s/%s/usr/bin' % (debDir, package)
|
||||
targetPlugin = '%s/%s/usr/lib/synergy/plugins' % (debDir, package)
|
||||
targetShare = '%s/%s/usr/share' % (debDir, package)
|
||||
targetApplications = "%s/applications" % targetShare
|
||||
targetIcons = "%s/icons" % targetShare
|
||||
targetDocs = "%s/doc/%s" % (targetShare, self.project)
|
||||
|
||||
os.makedirs(targetBin)
|
||||
os.makedirs(targetPlugin)
|
||||
os.makedirs(targetApplications)
|
||||
os.makedirs(targetIcons)
|
||||
os.makedirs(targetDocs)
|
||||
@@ -1176,17 +1181,6 @@ class InternalCommands:
|
||||
if err != 0:
|
||||
raise Exception('strip failed: ' + str(err))
|
||||
|
||||
pluginDir = "%s/plugins" % binDir
|
||||
|
||||
pluginFiles = [ 'libns.so']
|
||||
for f in pluginFiles:
|
||||
shutil.copy("%s/%s" % (pluginDir, f), targetPlugin)
|
||||
target = "%s/%s" % (targetPlugin, f)
|
||||
os.chmod(target, 0o0644)
|
||||
err = os.system("strip " + target)
|
||||
if err != 0:
|
||||
raise Exception('strip failed: ' + str(err))
|
||||
|
||||
shutil.copy("%s/synergy.desktop" % resDir, targetApplications)
|
||||
shutil.copy("%s/synergy.ico" % resDir, targetIcons)
|
||||
|
||||
@@ -1402,13 +1396,6 @@ class InternalCommands:
|
||||
packageTarget = filename
|
||||
ftp.upload(packageSource, packageTarget)
|
||||
|
||||
if type != 'src':
|
||||
pluginsDir = binDir + '/plugins'
|
||||
nsPluginSource = self.findLibraryFile(type, pluginsDir, 'ns')
|
||||
if nsPluginSource:
|
||||
nsPluginTarget = self.getLibraryDistFilename(type, pluginsDir, 'ns')
|
||||
ftp.upload(nsPluginSource, nsPluginTarget, "plugins")
|
||||
|
||||
def getLibraryDistFilename(self, type, dir, name):
|
||||
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
|
||||
firstPart = '%s-%s-%s' % (name, self.getVersionForFilename(), platform)
|
||||
@@ -1870,7 +1857,10 @@ class InternalCommands:
|
||||
# version is major and minor with no dots (e.g. 106)
|
||||
version = str(major) + str(minor)
|
||||
|
||||
return "MacOSX%s-%s" % (version, arch)
|
||||
if (self.macDeploy == self.macSdk):
|
||||
return "MacOSX%s-%s" % (version, arch)
|
||||
else:
|
||||
return "MacOSX-%s" % arch
|
||||
|
||||
def reset(self):
|
||||
if os.path.exists('build'):
|
||||
@@ -1925,6 +1915,8 @@ class CommandHandler:
|
||||
self.qtDir = a
|
||||
elif o == '--mac-sdk':
|
||||
self.ic.macSdk = a
|
||||
elif o == '--mac-deploy':
|
||||
self.ic.macDeploy = a
|
||||
elif o == '--mac-identity':
|
||||
self.ic.macIdentity = a
|
||||
|
||||
|
||||
BIN
res/banner.bmp
BIN
res/banner.bmp
Binary file not shown.
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 112 KiB |
BIN
res/dialog.bmp
BIN
res/dialog.bmp
Binary file not shown.
|
Before Width: | Height: | Size: 451 KiB After Width: | Height: | Size: 601 KiB |
@@ -20,7 +20,6 @@ source=%{_topdir}/../..
|
||||
mkdir -p %{buildroot}/%{_datarootdir}/applications
|
||||
mkdir -p %{buildroot}/%{_datarootdir}/icons
|
||||
mkdir -p %{buildroot}/%{_bindir}
|
||||
mkdir -p %{buildroot}/%{_bindir}/../lib/synergy/plugins
|
||||
|
||||
cp $source/bin/synergy %{buildroot}%{_bindir}
|
||||
cp $source/bin/synergyc %{buildroot}%{_bindir}
|
||||
@@ -29,7 +28,6 @@ cp $source/bin/synergyd %{buildroot}%{_bindir}
|
||||
cp $source/bin/syntool %{buildroot}%{_bindir}
|
||||
cp $source/res/synergy.desktop %{buildroot}%{_datarootdir}/applications
|
||||
cp $source/res/synergy.ico %{buildroot}%{_datarootdir}/icons
|
||||
cp $source/bin/plugins/* %{buildroot}%{_bindir}/../lib/synergy/plugins
|
||||
|
||||
%files
|
||||
%defattr(755,root,root,-)
|
||||
@@ -40,7 +38,6 @@ cp $source/bin/plugins/* %{buildroot}%{_bindir}/../lib/synergy/plugins
|
||||
%{_bindir}/syntool
|
||||
%attr(644,-,-) %{_datarootdir}/applications/synergy.desktop
|
||||
%attr(644,-,-) %{_datarootdir}/icons/synergy.ico
|
||||
%attr(644,-,-) %{_bindir}/../lib/synergy/plugins/*
|
||||
|
||||
%changelog
|
||||
* Thu Mar 20 2014 Nick Bolton <nick@symless.com>
|
||||
|
||||
@@ -14,6 +14,38 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if (WIN32)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(OPENSSL_PLAT_DIR openssl-win64)
|
||||
else()
|
||||
set(OPENSSL_PLAT_DIR openssl-win32)
|
||||
endif()
|
||||
set(OPENSSL_INCLUDE ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/inc32)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
set(OPENSSL_PLAT_DIR openssl-osx)
|
||||
set(OPENSSL_INCLUDE ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/include)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set(OPENSSL_LIBS
|
||||
${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/out32dll/libeay32.lib
|
||||
${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/out32dll/ssleay32.lib
|
||||
)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
if (APPLE)
|
||||
set(OPENSSL_LIBS
|
||||
${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/libssl.a
|
||||
${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/libcrypto.a
|
||||
)
|
||||
else()
|
||||
set(OPENSSL_LIBS ssl crypto)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(cmd)
|
||||
add_subdirectory(micro)
|
||||
|
||||
@@ -58,7 +58,7 @@ endif()
|
||||
|
||||
add_executable(synergyc ${sources})
|
||||
target_link_libraries(synergyc
|
||||
arch base client common io mt net ipc platform server synergy ${libs})
|
||||
arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS})
|
||||
|
||||
if (CONF_CPACK)
|
||||
install(TARGETS
|
||||
|
||||
@@ -221,7 +221,7 @@ MSWindowsClientTaskBarReceiver::primaryAction()
|
||||
const IArchTaskBarReceiver::Icon
|
||||
MSWindowsClientTaskBarReceiver::getIcon() const
|
||||
{
|
||||
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
||||
return static_cast<Icon>(m_icon[getStatus()]);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -263,7 +263,7 @@ MSWindowsClientTaskBarReceiver::loadIcon(UINT id)
|
||||
IMAGE_ICON,
|
||||
0, 0,
|
||||
LR_DEFAULTCOLOR);
|
||||
return reinterpret_cast<HICON>(icon);
|
||||
return static_cast<HICON>(icon);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -288,7 +288,7 @@ MSWindowsClientTaskBarReceiver::createWindow()
|
||||
NULL,
|
||||
(DLGPROC)&MSWindowsClientTaskBarReceiver::staticDlgProc,
|
||||
reinterpret_cast<LPARAM>(
|
||||
reinterpret_cast<void*>(this)));
|
||||
static_cast<void*>(this)));
|
||||
|
||||
// window should appear on top of everything, including (especially)
|
||||
// the task bar.
|
||||
@@ -337,7 +337,7 @@ MSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||
// and put it in the extra window data then forward the call.
|
||||
MSWindowsClientTaskBarReceiver* self = NULL;
|
||||
if (msg == WM_INITDIALOG) {
|
||||
self = reinterpret_cast<MSWindowsClientTaskBarReceiver*>(
|
||||
self = static_cast<MSWindowsClientTaskBarReceiver*>(
|
||||
reinterpret_cast<void*>(lParam));
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) lParam);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# synergy -- mouse and keyboard sharing utility
|
||||
# Copyright (C) 2012-2016 Symless Ltd.
|
||||
# Copyright (C) 2012 Nick Bolton
|
||||
#
|
||||
#
|
||||
# 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
|
||||
@@ -35,7 +35,7 @@ else()
|
||||
endif()
|
||||
|
||||
target_link_libraries(synergyd
|
||||
arch base common io ipc mt net platform synergy ${libs})
|
||||
arch base common io ipc mt net platform synergy shared ${libs} ${OPENSSL_LIBS})
|
||||
|
||||
if (CONF_CPACK)
|
||||
install(TARGETS
|
||||
|
||||
@@ -63,7 +63,7 @@ else()
|
||||
endif()
|
||||
|
||||
target_link_libraries(synergyp
|
||||
arch base client common io mt net ipc platform server synergy client ${libs})
|
||||
arch base client common io mt net ipc platform server synergy client ${libs} ${OPENSSL_LIBS})
|
||||
|
||||
if (CONF_CPACK)
|
||||
install(TARGETS
|
||||
|
||||
@@ -238,7 +238,7 @@ MSWindowsPortableTaskBarReceiver::primaryAction()
|
||||
const IArchTaskBarReceiver::Icon
|
||||
MSWindowsPortableTaskBarReceiver::getIcon() const
|
||||
{
|
||||
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
||||
return static_cast<Icon>(m_icon[getStatus()]);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -280,7 +280,7 @@ MSWindowsPortableTaskBarReceiver::loadIcon(UINT id)
|
||||
IMAGE_ICON,
|
||||
0, 0,
|
||||
LR_DEFAULTCOLOR);
|
||||
return reinterpret_cast<HICON>(icon);
|
||||
return static_cast<HICON>(icon);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -305,7 +305,7 @@ MSWindowsPortableTaskBarReceiver::createWindow()
|
||||
NULL,
|
||||
(DLGPROC)&MSWindowsPortableTaskBarReceiver::staticDlgProc,
|
||||
reinterpret_cast<LPARAM>(
|
||||
reinterpret_cast<void*>(this)));
|
||||
static_cast<void*>(this)));
|
||||
|
||||
// window should appear on top of everything, including (especially)
|
||||
// the task bar.
|
||||
@@ -354,15 +354,15 @@ MSWindowsPortableTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||
// and put it in the extra window data then forward the call.
|
||||
MSWindowsPortableTaskBarReceiver* self = NULL;
|
||||
if (msg == WM_INITDIALOG) {
|
||||
self = reinterpret_cast<MSWindowsPortableTaskBarReceiver*>(
|
||||
self = static_cast<MSWindowsPortableTaskBarReceiver*>(
|
||||
reinterpret_cast<void*>(lParam));
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
||||
}
|
||||
else {
|
||||
// get the extra window data and forward the call
|
||||
LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if (data != 0) {
|
||||
self = reinterpret_cast<MSWindowsPortableTaskBarReceiver*>(
|
||||
self = static_cast<MSWindowsPortableTaskBarReceiver*>(
|
||||
reinterpret_cast<void*>(data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ endif()
|
||||
|
||||
add_executable(synergys ${sources})
|
||||
target_link_libraries(synergys
|
||||
arch base client common io mt net ipc platform server synergy ${libs})
|
||||
arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS})
|
||||
|
||||
if (CONF_CPACK)
|
||||
install(TARGETS
|
||||
|
||||
@@ -252,7 +252,7 @@ MSWindowsServerTaskBarReceiver::primaryAction()
|
||||
const IArchTaskBarReceiver::Icon
|
||||
MSWindowsServerTaskBarReceiver::getIcon() const
|
||||
{
|
||||
return reinterpret_cast<Icon>(m_icon[getStatus()]);
|
||||
return static_cast<Icon>(m_icon[getStatus()]);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -294,7 +294,7 @@ MSWindowsServerTaskBarReceiver::loadIcon(UINT id)
|
||||
IMAGE_ICON,
|
||||
0, 0,
|
||||
LR_DEFAULTCOLOR);
|
||||
return reinterpret_cast<HICON>(icon);
|
||||
return static_cast<HICON>(icon);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -319,7 +319,7 @@ MSWindowsServerTaskBarReceiver::createWindow()
|
||||
NULL,
|
||||
(DLGPROC)&MSWindowsServerTaskBarReceiver::staticDlgProc,
|
||||
reinterpret_cast<LPARAM>(
|
||||
reinterpret_cast<void*>(this)));
|
||||
static_cast<void*>(this)));
|
||||
|
||||
// window should appear on top of everything, including (especially)
|
||||
// the task bar.
|
||||
@@ -368,15 +368,15 @@ MSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd,
|
||||
// and put it in the extra window data then forward the call.
|
||||
MSWindowsServerTaskBarReceiver* self = NULL;
|
||||
if (msg == WM_INITDIALOG) {
|
||||
self = reinterpret_cast<MSWindowsServerTaskBarReceiver*>(
|
||||
self = static_cast<MSWindowsServerTaskBarReceiver*>(
|
||||
reinterpret_cast<void*>(lParam));
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
||||
}
|
||||
else {
|
||||
// get the extra window data and forward the call
|
||||
LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if (data != 0) {
|
||||
self = reinterpret_cast<MSWindowsServerTaskBarReceiver*>(
|
||||
self = static_cast<MSWindowsServerTaskBarReceiver*>(
|
||||
reinterpret_cast<void*>(data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ endif()
|
||||
|
||||
add_executable(syntool ${sources})
|
||||
target_link_libraries(syntool
|
||||
synergy arch base client common io ipc mt net platform server ${libs})
|
||||
synergy arch base client common io ipc mt net platform server ${libs} ${OPENSSL_LIBS})
|
||||
|
||||
if (CONF_CPACK)
|
||||
install(TARGETS
|
||||
|
||||
@@ -7,7 +7,8 @@ DEFINES += VERSION_REVISION=\\\"$$QMAKE_VERSION_REVISION\\\"
|
||||
DEPENDPATH += . \
|
||||
res
|
||||
INCLUDEPATH += . \
|
||||
src
|
||||
src \
|
||||
../lib/shared/
|
||||
FORMS += res/MainWindowBase.ui \
|
||||
res/AboutDialogBase.ui \
|
||||
res/ServerConfigDialogBase.ui \
|
||||
@@ -17,7 +18,9 @@ FORMS += res/MainWindowBase.ui \
|
||||
res/SettingsDialogBase.ui \
|
||||
res/SetupWizardBase.ui \
|
||||
res/AddClientDialogBase.ui \
|
||||
res/PluginWizardPageBase.ui
|
||||
res/ActivationDialog.ui \
|
||||
res/CancelActivationDialog.ui \
|
||||
res/FailedLoginDialog.ui
|
||||
SOURCES += src/main.cpp \
|
||||
src/MainWindow.cpp \
|
||||
src/AboutDialog.cpp \
|
||||
@@ -54,16 +57,16 @@ SOURCES += src/main.cpp \
|
||||
src/DataDownloader.cpp \
|
||||
src/AddClientDialog.cpp \
|
||||
src/CommandProcess.cpp \
|
||||
src/PluginWizardPage.cpp \
|
||||
src/PluginManager.cpp \
|
||||
src/CoreInterface.cpp \
|
||||
src/Fingerprint.cpp \
|
||||
src/SslCertificate.cpp \
|
||||
src/Plugin.cpp \
|
||||
src/WebClient.cpp \
|
||||
../lib/common/PluginVersion.cpp \
|
||||
src/SubscriptionManager.cpp \
|
||||
src/ActivationNotifier.cpp
|
||||
src/ActivationNotifier.cpp \
|
||||
src/ActivationDialog.cpp \
|
||||
src/CancelActivationDialog.cpp \
|
||||
src/FailedLoginDialog.cpp \
|
||||
../lib/shared/SerialKey.cpp \
|
||||
src/LicenseManager.cpp
|
||||
HEADERS += src/MainWindow.h \
|
||||
src/AboutDialog.h \
|
||||
src/ServerConfig.h \
|
||||
@@ -100,19 +103,19 @@ HEADERS += src/MainWindow.h \
|
||||
src/DataDownloader.h \
|
||||
src/AddClientDialog.h \
|
||||
src/CommandProcess.h \
|
||||
src/EditionType.h \
|
||||
src/PluginWizardPage.h \
|
||||
src/ProcessorArch.h \
|
||||
src/PluginManager.h \
|
||||
src/CoreInterface.h \
|
||||
src/Fingerprint.h \
|
||||
src/SslCertificate.h \
|
||||
src/Plugin.h \
|
||||
src/WebClient.h \
|
||||
../lib/common/PluginVersion.h \
|
||||
src/SubscriptionManager.h \
|
||||
src/ActivationNotifier.h \
|
||||
src/ElevateMode.h
|
||||
src/ElevateMode.h \
|
||||
src/ActivationDialog.h \
|
||||
src/CancelActivationDialog.h \
|
||||
src/FailedLoginDialog.h \
|
||||
../lib/shared/EditionType.h \
|
||||
../lib/shared/SerialKey.h \
|
||||
src/LicenseManager.h
|
||||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
macx {
|
||||
|
||||
163
src/gui/res/ActivationDialog.ui
Normal file
163
src/gui/res/ActivationDialog.ui
Normal file
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ActivationDialog</class>
|
||||
<widget class="QDialog" name="ActivationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>410</width>
|
||||
<height>211</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Activate Synergy</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Serial key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>This can be found on your <a href="https://symless.com/account/?source=gui"><span style=" text-decoration: underline; color:#0000ff;">account</span></a> page.</p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_pTextEditSerialKey">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_trialWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Synergy.qrc">:/res/icons/16x16/money.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_trialLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Your trial has expired. <a href="http://symless.com/pricing?src=gui"><span style=" text-decoration: underline; color:#0000ff;">Buy now!</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>m_pTextEditSerialKey</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="Synergy.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ActivationDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ActivationDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
89
src/gui/res/CancelActivationDialog.ui
Normal file
89
src/gui/res/CancelActivationDialog.ui
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CancelActivationDialog</class>
|
||||
<widget class="QDialog" name="CancelActivationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>165</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Cancel Activation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Are you sure?
|
||||
|
||||
If you don't activate Synergy you'll be missing out on some great features.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="https://symless.com/pricing?source=gui"><span style=" text-decoration: underline; color:#0000ff;">Buy now</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CancelActivationDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>CancelActivationDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
108
src/gui/res/FailedLoginDialog.ui
Normal file
108
src/gui/res/FailedLoginDialog.ui
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FailedLoginDialog</class>
|
||||
<widget class="QDialog" name="FailedLoginDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>165</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Activation Error</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>120</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>382</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="https://symless.com/account/reset/?source=gui"><span style=" text-decoration: underline; color:#0000ff;">Forgotten your password?</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="messageLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>382</width>
|
||||
<height>72</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>An error occurred while trying to activate Synergy. The Symless server returned the following error:
|
||||
|
||||
%1</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>label_2</zorder>
|
||||
<zorder>messageLabel</zorder>
|
||||
<zorder>buttonBox</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FailedLoginDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>FailedLoginDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindowBase</class>
|
||||
<widget class="QMainWindow" name="MainWindowBase">
|
||||
@@ -27,6 +27,57 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="m_trialWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Synergy.qrc">:/res/icons/16x16/warning.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_trialLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">%1</span> days of your Synergy Pro trial remain. <a href="http://symless.com/pricing?src=gui"><span style=" text-decoration: underline; color:#0000ff;">Buy now!</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_pWidgetUpdate" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@@ -40,7 +91,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>7</number>
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_pIconUpdate">
|
||||
@@ -128,7 +179,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fingerprint:</string>
|
||||
<string>SSL Fingerprint:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -481,12 +532,12 @@
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_pActionWizard">
|
||||
<action name="m_pActivate">
|
||||
<property name="text">
|
||||
<string>Run Wizard</string>
|
||||
<string>Activate</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true"/>
|
||||
<property name="toolTip">
|
||||
<string>Activate</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PluginWizardPage</class>
|
||||
<widget class="QWizardPage" name="PluginWizardPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Setup Synergy</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<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>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="m_pLabelSpinning">
|
||||
<property name="text">
|
||||
<string> </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="m_pLabelStatus">
|
||||
<property name="text">
|
||||
<string>Please wait...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -17,7 +17,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="m_pTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_pTabScreens">
|
||||
<attribute name="title">
|
||||
|
||||
@@ -176,8 +176,11 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use &SSL encryption (unique certificate)</string>
|
||||
<string>Use &SSL encryption</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -327,11 +330,13 @@
|
||||
<tabstop>m_pLineEditScreenName</tabstop>
|
||||
<tabstop>m_pSpinBoxPort</tabstop>
|
||||
<tabstop>m_pLineEditInterface</tabstop>
|
||||
<tabstop>m_pComboElevate</tabstop>
|
||||
<tabstop>m_pCheckBoxAutoHide</tabstop>
|
||||
<tabstop>m_pCheckBoxEnableCrypto</tabstop>
|
||||
<tabstop>m_pComboLogLevel</tabstop>
|
||||
<tabstop>m_pCheckBoxLogToFile</tabstop>
|
||||
<tabstop>m_pLineEditLogFilename</tabstop>
|
||||
<tabstop>m_pButtonBrowseLog</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
||||
@@ -120,214 +120,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="m_pActivatePage">
|
||||
<property name="title">
|
||||
<string>Activate</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Enable your <a href="http://symless.com/pricing?source=gui">Synergy Pro</a> and Synergy Basic features.</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<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>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_pRadioButtonActivate">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Account login</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_pLabelEmail">
|
||||
<property name="text">
|
||||
<string>Email:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditEmail">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditPassword">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><a href="https://symless.com/account/reset/?source=gui">Forgot password</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_8">
|
||||
<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>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_pRadioButtonSubscription">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Serial key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_pTextEditSerialKey"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<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>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_pRadioButtonSkip">
|
||||
<property name="text">
|
||||
<string>S&kip activation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(100, 100, 100);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>You will see UNREGISTERED in the window title (not recommended).</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>500</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="m_pNodePage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
|
||||
@@ -36,11 +36,11 @@
|
||||
<language ietfCode="ar" name="العربية" />
|
||||
<language ietfCode="pes-IR" name="فارسی" />
|
||||
<language ietfCode="ur" name="اردو" />
|
||||
<language ietfCode="mr" name="मराठी" />
|
||||
<language ietfCode="mr" name="मराठी" />
|
||||
<language ietfCode="si" name="Sඉන්හල" />
|
||||
<language ietfCode="th-TH" name="ภาษาไทย" />
|
||||
<language ietfCode="zh-CN" name="中文 (简体)" />
|
||||
<language ietfCode="zh-TW" name="中文 (繁體)" />
|
||||
<language ietfCode="ja-JP" name="日本語" />
|
||||
<language ietfCode="ko" name="한국의" />
|
||||
<language ietfCode="ko" name="한국어" />
|
||||
</languages>
|
||||
|
||||
@@ -1,20 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>Synergy.icns</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Synergy</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>synergy</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Synergy</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Synergy</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>Synergy.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>synergy</string>
|
||||
<!-- TODO: Fix this in v2.0 //-->
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Synergy</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.8.8</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.8</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>© 2012-2016, Symless Ltd</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -32,7 +32,9 @@ AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) :
|
||||
version = version + '-' + VERSION_STAGE + '-' + VERSION_REVISION;
|
||||
m_pLabelSynergyVersion->setText(version);
|
||||
|
||||
m_pLabelBuildDate->setText(QDate::currentDate().toString());
|
||||
QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified();
|
||||
QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy");
|
||||
m_pLabelBuildDate->setText(buildDate.toString(Qt::SystemLocaleLongDate));
|
||||
|
||||
// change default size based on os
|
||||
#if defined(Q_OS_MAC)
|
||||
|
||||
123
src/gui/src/ActivationDialog.cpp
Normal file
123
src/gui/src/ActivationDialog.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
#include "ActivationDialog.h"
|
||||
#include "ui_ActivationDialog.h"
|
||||
#include "CancelActivationDialog.h"
|
||||
#include "AppConfig.h"
|
||||
#include "WebClient.h"
|
||||
#include "EditionType.h"
|
||||
#include "ActivationNotifier.h"
|
||||
#include "MainWindow.h"
|
||||
#include "QUtility.h"
|
||||
#include "LicenseManager.h"
|
||||
#include "FailedLoginDialog.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
#include <iostream>
|
||||
|
||||
ActivationDialog::ActivationDialog(QWidget* parent, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ActivationDialog),
|
||||
m_appConfig(&appConfig),
|
||||
m_LicenseManager (&licenseManager)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
refreshSerialKey();
|
||||
time_t currentTime = ::time(0);
|
||||
if (!m_LicenseManager->serialKey().isExpired(currentTime)) {
|
||||
ui->m_trialWidget->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void ActivationDialog::refreshSerialKey()
|
||||
{
|
||||
ui->m_pTextEditSerialKey->setText(m_appConfig->serialKey());
|
||||
ui->m_pTextEditSerialKey->setFocus();
|
||||
ui->m_pTextEditSerialKey->moveCursor(QTextCursor::End);
|
||||
ui->m_trialLabel->setText(tr("<html><head/><body><p>Your trial has "
|
||||
"expired. <a href=\"https://symless.com/"
|
||||
"synergy/trial/thanks?id=%1\"><span "
|
||||
"style=\"text-decoration: underline; "
|
||||
"color:#0000ff;\">Buy now!</span></a>"
|
||||
"</p></body></html>")
|
||||
.arg (m_appConfig->serialKey()));
|
||||
}
|
||||
|
||||
ActivationDialog::~ActivationDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ActivationDialog::reject()
|
||||
{
|
||||
if (m_LicenseManager->activeEdition() == kUnregistered) {
|
||||
CancelActivationDialog cancelActivationDialog(this);
|
||||
if (QDialog::Accepted == cancelActivationDialog.exec()) {
|
||||
m_LicenseManager->skipActivation();
|
||||
m_appConfig->activationHasRun(true);
|
||||
m_appConfig->saveSettings();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void ActivationDialog::accept()
|
||||
{
|
||||
QMessageBox message;
|
||||
m_appConfig->activationHasRun(true);
|
||||
m_appConfig->saveSettings();
|
||||
|
||||
std::pair<bool, QString> result;
|
||||
try {
|
||||
SerialKey serialKey (ui->m_pTextEditSerialKey->toPlainText().
|
||||
trimmed().toStdString());
|
||||
result = m_LicenseManager->setSerialKey(serialKey);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
message.critical(this, "Unknown Error",
|
||||
tr("An error occurred while trying to activate Synergy. "
|
||||
"Please contact the helpdesk, and provide the "
|
||||
"following information:\n\n%1").arg(e.what()));
|
||||
refreshSerialKey();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!result.first) {
|
||||
message.critical(this, "Activation failed",
|
||||
tr("%1").arg(result.second));
|
||||
refreshSerialKey();
|
||||
return;
|
||||
}
|
||||
|
||||
m_LicenseManager->notifyActivation("serial:" + m_appConfig->serialKey());
|
||||
Edition edition = m_LicenseManager->activeEdition();
|
||||
time_t daysLeft = m_LicenseManager->serialKey().daysLeft(::time(0));
|
||||
if (edition != kUnregistered) {
|
||||
QString thanksMessage = tr("Thanks for trying %1! %5\n\n%2 day%3 of "
|
||||
"your trial remain%4").
|
||||
arg (m_LicenseManager->getEditionName(edition)).
|
||||
arg (daysLeft).
|
||||
arg ((daysLeft == 1) ? "" : "s").
|
||||
arg ((daysLeft == 1) ? "s" : "");
|
||||
|
||||
if (edition == kPro) {
|
||||
thanksMessage = thanksMessage.arg("If you're using SSL, "
|
||||
"remember to activate all of your devices.");
|
||||
} else {
|
||||
thanksMessage = thanksMessage.arg("");
|
||||
}
|
||||
|
||||
if (m_LicenseManager->serialKey().isTrial()) {
|
||||
message.information(this, "Thanks!", thanksMessage);
|
||||
}
|
||||
else {
|
||||
message.information(this, "Activated!",
|
||||
tr("Thanks for activating %1!").arg
|
||||
(m_LicenseManager->getEditionName(edition)));
|
||||
}
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
35
src/gui/src/ActivationDialog.h
Normal file
35
src/gui/src/ActivationDialog.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef ACTIVATIONDIALOG_H
|
||||
#define ACTIVATIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <LicenseManager.h>
|
||||
|
||||
namespace Ui {
|
||||
class ActivationDialog;
|
||||
}
|
||||
|
||||
class AppConfig;
|
||||
|
||||
class ActivationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActivationDialog(QWidget *parent, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager);
|
||||
~ActivationDialog();
|
||||
|
||||
public slots:
|
||||
void reject();
|
||||
void accept();
|
||||
|
||||
protected:
|
||||
void refreshSerialKey();
|
||||
|
||||
private:
|
||||
Ui::ActivationDialog *ui;
|
||||
AppConfig* m_appConfig;
|
||||
LicenseManager* m_LicenseManager;
|
||||
};
|
||||
|
||||
#endif // ACTIVATIONDIALOG_H
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "CoreInterface.h"
|
||||
|
||||
ActivationNotifier::ActivationNotifier(QObject *parent) :
|
||||
QObject(parent)
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,6 +29,15 @@ void ActivationNotifier::setIdentity(QString identity)
|
||||
m_Identity = identity;
|
||||
}
|
||||
|
||||
void ActivationNotifier::setUpdateInfo(QString const& fromVersion,
|
||||
QString const& toVersion,
|
||||
QString const& serialKey)
|
||||
{
|
||||
m_fromVersion = fromVersion;
|
||||
m_toVersion = toVersion;
|
||||
m_serialKey = serialKey;
|
||||
}
|
||||
|
||||
void ActivationNotifier::notify()
|
||||
{
|
||||
CoreInterface coreInterface;
|
||||
@@ -39,3 +48,13 @@ void ActivationNotifier::notify()
|
||||
// catch all exceptions and fails silently
|
||||
}
|
||||
}
|
||||
|
||||
void ActivationNotifier::notifyUpdate()
|
||||
{
|
||||
try {
|
||||
CoreInterface coreInterface;
|
||||
coreInterface.notifyUpdate(m_fromVersion, m_toVersion,
|
||||
m_serialKey);
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,18 +24,24 @@ class ActivationNotifier : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ActivationNotifier(QObject *parent = 0);
|
||||
explicit ActivationNotifier(QObject *parent = 0);
|
||||
|
||||
void setIdentity(QString identity);
|
||||
void setUpdateInfo(QString const& fromVersion,
|
||||
QString const& toVersion, QString const& serialKey);
|
||||
|
||||
public slots:
|
||||
void notify();
|
||||
void notifyUpdate();
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
QString m_Identity;
|
||||
QString m_fromVersion;
|
||||
QString m_toVersion;
|
||||
QString m_serialKey;
|
||||
};
|
||||
|
||||
#endif // ACTIVATIONNOTIFIER_H
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@@ -73,6 +73,18 @@ AppConfig::~AppConfig()
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
const QString &AppConfig::screenName() const { return m_ScreenName; }
|
||||
|
||||
int AppConfig::port() const { return m_Port; }
|
||||
|
||||
const QString &AppConfig::interface() const { return m_Interface; }
|
||||
|
||||
int AppConfig::logLevel() const { return m_LogLevel; }
|
||||
|
||||
bool AppConfig::logToFile() const { return m_LogToFile; }
|
||||
|
||||
const QString &AppConfig::logFilename() const { return m_LogFilename; }
|
||||
|
||||
QString AppConfig::synergyLogDir() const
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
@@ -116,6 +128,16 @@ QString AppConfig::logLevelText() const
|
||||
return logLevelNames[logLevel()];
|
||||
}
|
||||
|
||||
ProcessMode AppConfig::processMode() const { return m_ProcessMode; }
|
||||
|
||||
bool AppConfig::wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
|
||||
|
||||
const QString &AppConfig::language() const { return m_Language; }
|
||||
|
||||
bool AppConfig::startedBefore() const { return m_StartedBefore; }
|
||||
|
||||
bool AppConfig::autoConfig() const { return m_AutoConfig; }
|
||||
|
||||
void AppConfig::loadSettings()
|
||||
{
|
||||
m_ScreenName = settings().value("screenName", QHostInfo::localHostName()).toString();
|
||||
@@ -131,16 +153,18 @@ void AppConfig::loadSettings()
|
||||
QVariant elevateMode = settings().value("elevateModeEnum");
|
||||
if (!elevateMode.isValid()) {
|
||||
elevateMode = settings().value ("elevateMode",
|
||||
QVariant(static_cast<int>(defaultElevateMode)));
|
||||
QVariant(static_cast<int>(defaultElevateMode)));
|
||||
}
|
||||
m_ElevateMode = static_cast<ElevateMode>(elevateMode.toInt());
|
||||
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
|
||||
m_Edition = settings().value("edition", Unknown).toInt();
|
||||
m_Edition = static_cast<Edition>(settings().value("edition", kUnregistered).toInt());
|
||||
m_ActivateEmail = settings().value("activateEmail", "").toString();
|
||||
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
|
||||
m_CryptoEnabled = settings().value("cryptoEnabled", true).toBool();
|
||||
m_AutoHide = settings().value("autoHide", false).toBool();
|
||||
m_Serialkey = settings().value("serialKey", "").toString();
|
||||
m_Serialkey = settings().value("serialKey", "").toString().trimmed();
|
||||
m_lastVersion = settings().value("lastVersion", "Unknown").toString();
|
||||
m_LastExpiringWarningTime = settings().value("lastExpiringWarningTime", 0).toInt();
|
||||
m_ActivationHasRun = settings().value("activationHasRun", false).toBool();
|
||||
}
|
||||
|
||||
void AppConfig::saveSettings()
|
||||
@@ -155,30 +179,116 @@ void AppConfig::saveSettings()
|
||||
settings().setValue("language", m_Language);
|
||||
settings().setValue("startedBefore", m_StartedBefore);
|
||||
settings().setValue("autoConfig", m_AutoConfig);
|
||||
// Refer to enum ElevateMode declaration for insight in to why this
|
||||
// flag is mapped this way
|
||||
// Refer to enum ElevateMode declaration for insight in to why this
|
||||
// flag is mapped this way
|
||||
settings().setValue("elevateMode", m_ElevateMode == ElevateAlways);
|
||||
settings().setValue("elevateModeEnum", static_cast<int>(m_ElevateMode));
|
||||
settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
|
||||
settings().setValue("edition", m_Edition);
|
||||
settings().setValue("activateEmail", m_ActivateEmail);
|
||||
settings().setValue("cryptoEnabled", m_CryptoEnabled);
|
||||
settings().setValue("autoHide", m_AutoHide);
|
||||
settings().setValue("serialKey", m_Serialkey);
|
||||
settings().setValue("lastVersion", m_lastVersion);
|
||||
settings().setValue("lastExpiringWarningTime", m_LastExpiringWarningTime);
|
||||
settings().setValue("activationHasRun", m_ActivationHasRun);
|
||||
settings().sync();
|
||||
}
|
||||
|
||||
bool AppConfig::activationHasRun() const
|
||||
{
|
||||
return m_ActivationHasRun;
|
||||
}
|
||||
|
||||
AppConfig& AppConfig::activationHasRun(bool value)
|
||||
{
|
||||
m_ActivationHasRun = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
QString AppConfig::lastVersion() const
|
||||
{
|
||||
return m_lastVersion;
|
||||
}
|
||||
|
||||
void AppConfig::setLastVersion(QString version) {
|
||||
m_lastVersion = version;
|
||||
}
|
||||
|
||||
QSettings &AppConfig::settings() { return *m_pSettings; }
|
||||
|
||||
void AppConfig::setScreenName(const QString &s) { m_ScreenName = s; }
|
||||
|
||||
void AppConfig::setPort(int i) { m_Port = i; }
|
||||
|
||||
void AppConfig::setInterface(const QString &s) { m_Interface = s; }
|
||||
|
||||
void AppConfig::setLogLevel(int i) { m_LogLevel = i; }
|
||||
|
||||
void AppConfig::setLogToFile(bool b) { m_LogToFile = b; }
|
||||
|
||||
void AppConfig::setLogFilename(const QString &s) { m_LogFilename = s; }
|
||||
|
||||
void AppConfig::setWizardHasRun() { m_WizardLastRun = kWizardVersion; }
|
||||
|
||||
void AppConfig::setLanguage(const QString language) { m_Language = language; }
|
||||
|
||||
void AppConfig::setStartedBefore(bool b) { m_StartedBefore = b; }
|
||||
|
||||
void AppConfig::setElevateMode(ElevateMode em) { m_ElevateMode = em; }
|
||||
|
||||
void AppConfig::setAutoConfig(bool autoConfig)
|
||||
{
|
||||
m_AutoConfig = autoConfig;
|
||||
}
|
||||
|
||||
bool AppConfig::autoConfigPrompted() { return m_AutoConfigPrompted; }
|
||||
|
||||
void AppConfig::setAutoConfigPrompted(bool prompted)
|
||||
{
|
||||
m_AutoConfigPrompted = prompted;
|
||||
}
|
||||
|
||||
void AppConfig::setEdition(Edition e) {
|
||||
m_Edition = e;
|
||||
}
|
||||
|
||||
Edition AppConfig::edition() const { return m_Edition; }
|
||||
|
||||
QString AppConfig::setSerialKey(QString serial) {
|
||||
using std::swap;
|
||||
swap (serial, m_Serialkey);
|
||||
return serial;
|
||||
}
|
||||
|
||||
void AppConfig::clearSerialKey()
|
||||
{
|
||||
m_Serialkey.clear();
|
||||
}
|
||||
|
||||
QString AppConfig::serialKey() { return m_Serialkey; }
|
||||
|
||||
int AppConfig::lastExpiringWarningTime() const { return m_LastExpiringWarningTime; }
|
||||
|
||||
void AppConfig::setLastExpiringWarningTime(int t) { m_LastExpiringWarningTime = t; }
|
||||
|
||||
QString AppConfig::synergysName() const { return m_SynergysName; }
|
||||
|
||||
QString AppConfig::synergycName() const { return m_SynergycName; }
|
||||
|
||||
ElevateMode AppConfig::elevateMode()
|
||||
{
|
||||
return m_ElevateMode;
|
||||
}
|
||||
|
||||
void AppConfig::setCryptoEnabled(bool e) {
|
||||
m_CryptoEnabled = e;
|
||||
emit sslToggled(e);
|
||||
}
|
||||
|
||||
bool AppConfig::getCryptoEnabled() const {
|
||||
return (edition() == kPro) && m_CryptoEnabled;
|
||||
}
|
||||
|
||||
void AppConfig::setAutoHide(bool b) { m_AutoHide = b; }
|
||||
|
||||
bool AppConfig::getAutoHide() { return m_AutoHide; }
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@@ -20,8 +20,10 @@
|
||||
|
||||
#define APPCONFIG_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include "ElevateMode.h"
|
||||
#include <EditionType.h>
|
||||
|
||||
// this should be incremented each time a new page is added. this is
|
||||
// saved to settings when the user finishes running the wizard. if
|
||||
@@ -47,8 +49,10 @@ enum ProcessMode {
|
||||
Desktop
|
||||
};
|
||||
|
||||
class AppConfig
|
||||
class AppConfig: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class SettingsDialog;
|
||||
friend class MainWindow;
|
||||
friend class SetupWizard;
|
||||
@@ -58,33 +62,32 @@ class AppConfig
|
||||
~AppConfig();
|
||||
|
||||
public:
|
||||
const QString& screenName() const { return m_ScreenName; }
|
||||
int port() const { return m_Port; }
|
||||
const QString& interface() const { return m_Interface; }
|
||||
int logLevel() const { return m_LogLevel; }
|
||||
bool logToFile() const { return m_LogToFile; }
|
||||
const QString& logFilename() const { return m_LogFilename; }
|
||||
const QString& screenName() const;
|
||||
int port() const;
|
||||
const QString& interface() const;
|
||||
int logLevel() const;
|
||||
bool logToFile() const;
|
||||
const QString& logFilename() const;
|
||||
const QString logFilenameCmd() const;
|
||||
QString logLevelText() const;
|
||||
ProcessMode processMode() const { return m_ProcessMode; }
|
||||
bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
|
||||
const QString& language() const { return m_Language; }
|
||||
bool startedBefore() const { return m_StartedBefore; }
|
||||
bool autoConfig() const { return m_AutoConfig; }
|
||||
ProcessMode processMode() const;
|
||||
bool wizardShouldRun() const;
|
||||
const QString& language() const;
|
||||
bool startedBefore() const;
|
||||
bool autoConfig() const;
|
||||
void setAutoConfig(bool autoConfig);
|
||||
bool autoConfigPrompted() { return m_AutoConfigPrompted; }
|
||||
bool autoConfigPrompted();
|
||||
void setAutoConfigPrompted(bool prompted);
|
||||
void setEdition(int e) { m_Edition = e; }
|
||||
int edition() { return m_Edition; }
|
||||
void setActivateEmail(QString e) { m_ActivateEmail = e; }
|
||||
QString activateEmail() { return m_ActivateEmail; }
|
||||
void setSerialKey(QString serial) { m_Serialkey = serial; }
|
||||
QString serialKey() { return m_Serialkey; }
|
||||
int lastExpiringWarningTime() const { return m_LastExpiringWarningTime; }
|
||||
void setLastExpiringWarningTime(int t) { m_LastExpiringWarningTime = t; }
|
||||
void setEdition(Edition);
|
||||
Edition edition() const;
|
||||
QString setSerialKey(QString serial);
|
||||
void clearSerialKey();
|
||||
QString serialKey();
|
||||
int lastExpiringWarningTime() const;
|
||||
void setLastExpiringWarningTime(int t);
|
||||
|
||||
QString synergysName() const { return m_SynergysName; }
|
||||
QString synergycName() const { return m_SynergycName; }
|
||||
QString synergysName() const;
|
||||
QString synergycName() const;
|
||||
QString synergyProgramDir() const;
|
||||
QString synergyLogDir() const;
|
||||
|
||||
@@ -92,26 +95,32 @@ class AppConfig
|
||||
void persistLogDir();
|
||||
ElevateMode elevateMode();
|
||||
|
||||
void setCryptoEnabled(bool e) { m_CryptoEnabled = e; }
|
||||
bool getCryptoEnabled() { return m_CryptoEnabled; }
|
||||
void setAutoHide(bool b) { m_AutoHide = b; }
|
||||
bool getAutoHide() { return m_AutoHide; }
|
||||
void setCryptoEnabled(bool e);
|
||||
bool getCryptoEnabled() const;
|
||||
|
||||
void setAutoHide(bool b);
|
||||
bool getAutoHide();
|
||||
|
||||
bool activationHasRun() const;
|
||||
AppConfig& activationHasRun(bool value);
|
||||
|
||||
QString lastVersion() const;
|
||||
|
||||
void saveSettings();
|
||||
void setLastVersion(QString version);
|
||||
|
||||
protected:
|
||||
QSettings& settings() { return *m_pSettings; }
|
||||
void setScreenName(const QString& s) { m_ScreenName = s; }
|
||||
void setPort(int i) { m_Port = i; }
|
||||
void setInterface(const QString& s) { m_Interface = s; }
|
||||
void setLogLevel(int i) { m_LogLevel = i; }
|
||||
void setLogToFile(bool b) { m_LogToFile = b; }
|
||||
void setLogFilename(const QString& s) { m_LogFilename = s; }
|
||||
void setWizardHasRun() { m_WizardLastRun = kWizardVersion; }
|
||||
void setLanguage(const QString language) { m_Language = language; }
|
||||
void setStartedBefore(bool b) { m_StartedBefore = b; }
|
||||
void setElevateMode(ElevateMode em) { m_ElevateMode = em; }
|
||||
|
||||
protected:
|
||||
QSettings& settings();
|
||||
void setScreenName(const QString& s);
|
||||
void setPort(int i);
|
||||
void setInterface(const QString& s);
|
||||
void setLogLevel(int i);
|
||||
void setLogToFile(bool b);
|
||||
void setLogFilename(const QString& s);
|
||||
void setWizardHasRun();
|
||||
void setLanguage(const QString language);
|
||||
void setStartedBefore(bool b);
|
||||
void setElevateMode(ElevateMode em);
|
||||
void loadSettings();
|
||||
|
||||
private:
|
||||
@@ -129,16 +138,21 @@ class AppConfig
|
||||
bool m_AutoConfig;
|
||||
ElevateMode m_ElevateMode;
|
||||
bool m_AutoConfigPrompted;
|
||||
int m_Edition;
|
||||
Edition m_Edition;
|
||||
QString m_ActivateEmail;
|
||||
bool m_CryptoEnabled;
|
||||
bool m_AutoHide;
|
||||
QString m_Serialkey;
|
||||
QString m_lastVersion;
|
||||
int m_LastExpiringWarningTime;
|
||||
bool m_ActivationHasRun;
|
||||
|
||||
static const char m_SynergysName[];
|
||||
static const char m_SynergycName[];
|
||||
static const char m_SynergyLogDir[];
|
||||
|
||||
signals:
|
||||
void sslToggled(bool enabled);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
14
src/gui/src/CancelActivationDialog.cpp
Normal file
14
src/gui/src/CancelActivationDialog.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "CancelActivationDialog.h"
|
||||
#include "ui_CancelActivationDialog.h"
|
||||
|
||||
CancelActivationDialog::CancelActivationDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CancelActivationDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CancelActivationDialog::~CancelActivationDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
22
src/gui/src/CancelActivationDialog.h
Normal file
22
src/gui/src/CancelActivationDialog.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef CANCELACTIVATIONDIALOG_H
|
||||
#define CANCELACTIVATIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class CancelActivationDialog;
|
||||
}
|
||||
|
||||
class CancelActivationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CancelActivationDialog(QWidget *parent = 0);
|
||||
~CancelActivationDialog();
|
||||
|
||||
private:
|
||||
Ui::CancelActivationDialog *ui;
|
||||
};
|
||||
|
||||
#endif // CANCELACTIVATIONDIALOG_H
|
||||
@@ -22,20 +22,22 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QtGlobal>
|
||||
#include <QDir>
|
||||
#include <stdexcept>
|
||||
|
||||
static const char kCoreBinary[] = "syntool";
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
static const char kSerialKeyFilename[] = "Synergy.subkey";
|
||||
#else
|
||||
static const char kSerialKeyFilename[] = ".synergy.subkey";
|
||||
#endif
|
||||
|
||||
CoreInterface::CoreInterface()
|
||||
{
|
||||
}
|
||||
|
||||
QString CoreInterface::getPluginDir()
|
||||
{
|
||||
QStringList args("--get-plugin-dir");
|
||||
return run(args);
|
||||
}
|
||||
|
||||
QString CoreInterface::getProfileDir()
|
||||
{
|
||||
QStringList args("--get-profile-dir");
|
||||
@@ -54,24 +56,19 @@ QString CoreInterface::getArch()
|
||||
return run(args);
|
||||
}
|
||||
|
||||
QString CoreInterface::getSubscriptionFilename()
|
||||
QString CoreInterface::getSerialKeyFilePath()
|
||||
{
|
||||
QStringList args("--get-subscription-filename");
|
||||
return run(args);
|
||||
QString filename = getProfileDir() + QDir::separator() + kSerialKeyFilename;
|
||||
return filename;
|
||||
}
|
||||
|
||||
QString CoreInterface::activateSerial(const QString& serial)
|
||||
{
|
||||
QStringList args("--subscription-serial");
|
||||
args << serial;
|
||||
|
||||
return run(args);
|
||||
}
|
||||
|
||||
QString CoreInterface::checkSubscription()
|
||||
{
|
||||
QStringList args("--check-subscription");
|
||||
return run(args);
|
||||
QString CoreInterface::notifyUpdate (QString const& fromVersion,
|
||||
QString const& toVersion,
|
||||
QString const& serialKey) {
|
||||
QStringList args("--notify-update");
|
||||
QString input(fromVersion + ":" + toVersion + ":" + serialKey);
|
||||
input.append("\n");
|
||||
return run(args, input);
|
||||
}
|
||||
|
||||
QString CoreInterface::notifyActivation(const QString& identity)
|
||||
|
||||
@@ -24,13 +24,13 @@ class CoreInterface
|
||||
public:
|
||||
CoreInterface();
|
||||
|
||||
QString getPluginDir();
|
||||
QString getProfileDir();
|
||||
QString getInstalledDir();
|
||||
QString getArch();
|
||||
QString getSubscriptionFilename();
|
||||
QString activateSerial(const QString& serial);
|
||||
QString checkSubscription();
|
||||
QString getSerialKeyFilePath();
|
||||
QString notifyActivation(const QString& identity);
|
||||
QString notifyUpdate (QString const& fromVersion,
|
||||
QString const& toVersion,
|
||||
QString const& serialKey);
|
||||
QString run(const QStringList& args, const QString& input = "");
|
||||
};
|
||||
|
||||
15
src/gui/src/FailedLoginDialog.cpp
Normal file
15
src/gui/src/FailedLoginDialog.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "FailedLoginDialog.h"
|
||||
#include "ui_FailedLoginDialog.h"
|
||||
|
||||
FailedLoginDialog::FailedLoginDialog(QWidget *parent, QString message):
|
||||
QDialog(parent),
|
||||
ui(new Ui::FailedLoginDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->messageLabel->setText(ui->messageLabel->text().arg(message));
|
||||
}
|
||||
|
||||
FailedLoginDialog::~FailedLoginDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
23
src/gui/src/FailedLoginDialog.h
Normal file
23
src/gui/src/FailedLoginDialog.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef FAILEDLOGINDIALOG_H
|
||||
#define FAILEDLOGINDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
|
||||
namespace Ui {
|
||||
class FailedLoginDialog;
|
||||
}
|
||||
|
||||
class FailedLoginDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FailedLoginDialog(QWidget *parent = 0, QString message = "");
|
||||
~FailedLoginDialog();
|
||||
|
||||
private:
|
||||
Ui::FailedLoginDialog *ui;
|
||||
};
|
||||
|
||||
#endif // FAILEDLOGINDIALOG_H
|
||||
169
src/gui/src/LicenseManager.cpp
Normal file
169
src/gui/src/LicenseManager.cpp
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Synergy Seamless Inc.
|
||||
*
|
||||
* 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 "LicenseManager.h"
|
||||
#include "EditionType.h"
|
||||
#include "AppConfig.h"
|
||||
#include <ctime>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include <QThread>
|
||||
|
||||
LicenseManager::LicenseManager(AppConfig* appConfig) :
|
||||
m_AppConfig(appConfig),
|
||||
m_serialKey(appConfig->edition()) {
|
||||
}
|
||||
|
||||
std::pair<bool, QString>
|
||||
LicenseManager::setSerialKey(SerialKey serialKey, bool acceptExpired)
|
||||
{
|
||||
std::pair<bool, QString> ret (true, "");
|
||||
time_t currentTime = ::time(0);
|
||||
|
||||
if (!acceptExpired && serialKey.isExpired(currentTime)) {
|
||||
ret.first = false;
|
||||
ret.second = "Serial key expired";
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (serialKey != m_serialKey) {
|
||||
using std::swap;
|
||||
swap (serialKey, m_serialKey);
|
||||
m_AppConfig->setSerialKey(QString::fromStdString
|
||||
(m_serialKey.toString()));
|
||||
emit serialKeyChanged(m_serialKey);
|
||||
|
||||
if (serialKey.isTrial()) {
|
||||
emit endTrial(false);
|
||||
}
|
||||
|
||||
if (m_serialKey.edition() != serialKey.edition()) {
|
||||
m_AppConfig->setEdition(m_serialKey.edition());
|
||||
emit editionChanged(m_serialKey.edition());
|
||||
}
|
||||
|
||||
if (m_serialKey.isTrial()) {
|
||||
if (m_serialKey.isExpired(currentTime)) {
|
||||
emit endTrial(true);
|
||||
} else {
|
||||
emit beginTrial(m_serialKey.isExpiring(currentTime));
|
||||
}
|
||||
}
|
||||
|
||||
m_AppConfig->saveSettings();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
LicenseManager::notifyUpdate(QString fromVersion, QString toVersion) {
|
||||
if ((fromVersion == "Unknown")
|
||||
&& (m_serialKey == SerialKey(kUnregistered))) {
|
||||
return;
|
||||
}
|
||||
|
||||
ActivationNotifier* notifier = new ActivationNotifier();
|
||||
notifier->setUpdateInfo (fromVersion, toVersion,
|
||||
QString::fromStdString(m_serialKey.toString()));
|
||||
|
||||
QThread* thread = new QThread();
|
||||
connect(notifier, SIGNAL(finished()), thread, SLOT(quit()));
|
||||
connect(notifier, SIGNAL(finished()), notifier, SLOT(deleteLater()));
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
notifier->moveToThread(thread);
|
||||
thread->start();
|
||||
|
||||
QMetaObject::invokeMethod(notifier, "notifyUpdate",
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
Edition
|
||||
LicenseManager::activeEdition() const
|
||||
{
|
||||
return m_serialKey.edition();
|
||||
}
|
||||
|
||||
QString
|
||||
LicenseManager::activeEditionName() const
|
||||
{
|
||||
return getEditionName(activeEdition(), m_serialKey.isTrial());
|
||||
}
|
||||
|
||||
SerialKey
|
||||
LicenseManager::serialKey() const
|
||||
{
|
||||
return m_serialKey;
|
||||
}
|
||||
|
||||
void LicenseManager::refresh()
|
||||
{
|
||||
if (!m_AppConfig->serialKey().isEmpty()) {
|
||||
try {
|
||||
SerialKey serialKey (m_AppConfig->serialKey().toStdString());
|
||||
setSerialKey(serialKey, true);
|
||||
} catch (...) {
|
||||
m_AppConfig->clearSerialKey();
|
||||
m_AppConfig->saveSettings();
|
||||
}
|
||||
}
|
||||
if (m_serialKey.isExpired(::time(0))) {
|
||||
emit endTrial(true);
|
||||
}
|
||||
}
|
||||
|
||||
void LicenseManager::skipActivation()
|
||||
{
|
||||
notifyActivation ("skip:unknown");
|
||||
}
|
||||
|
||||
QString
|
||||
LicenseManager::getEditionName(Edition const edition, bool trial)
|
||||
{
|
||||
std::string name ("Synergy");
|
||||
switch (edition) {
|
||||
case kUnregistered:
|
||||
name += " (UNREGISTERED)";
|
||||
return QString::fromUtf8 (name.c_str(), name.size());
|
||||
case kBasic:
|
||||
name += " Basic";
|
||||
break;
|
||||
default:
|
||||
name += " Pro";
|
||||
}
|
||||
if (trial) {
|
||||
name += " (Trial)";
|
||||
}
|
||||
return QString::fromUtf8 (name.c_str(), name.size());
|
||||
}
|
||||
|
||||
void LicenseManager::notifyActivation(QString identity)
|
||||
{
|
||||
ActivationNotifier* notifier = new ActivationNotifier();
|
||||
notifier->setIdentity(identity);
|
||||
|
||||
QThread* thread = new QThread();
|
||||
connect(notifier, SIGNAL(finished()), thread, SLOT(quit()));
|
||||
connect(notifier, SIGNAL(finished()), notifier, SLOT(deleteLater()));
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
notifier->moveToThread(thread);
|
||||
thread->start();
|
||||
|
||||
QMetaObject::invokeMethod(notifier, "notify", Qt::QueuedConnection);
|
||||
}
|
||||
53
src/gui/src/LicenseManager.h
Normal file
53
src/gui/src/LicenseManager.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Synergy Seamless Inc.
|
||||
*
|
||||
* 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>
|
||||
#include <SerialKey.h>
|
||||
#include <ActivationNotifier.h>
|
||||
#include <utility>
|
||||
|
||||
class AppConfig;
|
||||
|
||||
class LicenseManager: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LicenseManager(AppConfig* appConfig);
|
||||
std::pair<bool, QString> setSerialKey(SerialKey serialKey,
|
||||
bool acceptExpired = false);
|
||||
void refresh();
|
||||
Edition activeEdition() const;
|
||||
QString activeEditionName() const;
|
||||
SerialKey serialKey() const;
|
||||
void skipActivation();
|
||||
void notifyUpdate(QString fromVersion, QString toVersion);
|
||||
static QString getEditionName(Edition edition, bool trial = false);
|
||||
void notifyActivation(QString identity);
|
||||
|
||||
private:
|
||||
AppConfig* m_AppConfig;
|
||||
SerialKey m_serialKey;
|
||||
|
||||
signals:
|
||||
void serialKeyChanged (SerialKey) const;
|
||||
void editionChanged (Edition) const;
|
||||
void beginTrial (bool expiring) const;
|
||||
void endTrial (bool expired) const;
|
||||
};
|
||||
@@ -23,18 +23,18 @@
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include "Fingerprint.h"
|
||||
#include "PluginManager.h"
|
||||
#include "AboutDialog.h"
|
||||
#include "ServerConfigDialog.h"
|
||||
#include "SettingsDialog.h"
|
||||
#include "SetupWizard.h"
|
||||
#include "ActivationDialog.h"
|
||||
#include "ZeroconfService.h"
|
||||
#include "DataDownloader.h"
|
||||
#include "CommandProcess.h"
|
||||
#include "SubscriptionManager.h"
|
||||
#include "LicenseManager.h"
|
||||
#include "EditionType.h"
|
||||
#include "QUtility.h"
|
||||
#include "ProcessorArch.h"
|
||||
#include "SslCertificate.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@@ -76,12 +76,14 @@ static const char* synergyIconFiles[] =
|
||||
":/res/icons/16x16/synergy-transfering.png"
|
||||
};
|
||||
|
||||
MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||
MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager) :
|
||||
m_Settings(settings),
|
||||
m_AppConfig(appConfig),
|
||||
m_AppConfig(&appConfig),
|
||||
m_LicenseManager(&licenseManager),
|
||||
m_pSynergy(NULL),
|
||||
m_SynergyState(synergyDisconnected),
|
||||
m_ServerConfig(&m_Settings, 5, 3, m_AppConfig.screenName(), this),
|
||||
m_ServerConfig(&m_Settings, 5, 3, m_AppConfig->screenName(), this),
|
||||
m_pTempConfigFile(NULL),
|
||||
m_pTrayIcon(NULL),
|
||||
m_pTrayIconMenu(NULL),
|
||||
@@ -98,7 +100,9 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||
m_SuppressAutoConfigWarning(false),
|
||||
m_BonjourInstall(NULL),
|
||||
m_SuppressEmptyServerWarning(false),
|
||||
m_ExpectedRunningState(kStopped)
|
||||
m_ExpectedRunningState(kStopped),
|
||||
m_pSslCertificate(NULL),
|
||||
m_ActivationDialogRunning(false)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@@ -133,12 +137,34 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||
m_SuppressAutoConfigWarning = false;
|
||||
|
||||
m_pComboServerList->hide();
|
||||
|
||||
setEdition(m_AppConfig.edition());
|
||||
|
||||
m_pLabelPadlock->hide();
|
||||
m_trialWidget->hide();
|
||||
|
||||
updateLocalFingerprint();
|
||||
connect (this, SIGNAL(windowShown()),
|
||||
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
||||
|
||||
connect (m_LicenseManager, SIGNAL(editionChanged(Edition)),
|
||||
this, SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
||||
|
||||
connect (m_LicenseManager, SIGNAL(beginTrial(bool)),
|
||||
this, SLOT(beginTrial(bool)), Qt::QueuedConnection);
|
||||
|
||||
connect (m_LicenseManager, SIGNAL(endTrial(bool)),
|
||||
this, SLOT(endTrial(bool)), Qt::QueuedConnection);
|
||||
|
||||
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
||||
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
||||
|
||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
m_LicenseManager->refresh();
|
||||
|
||||
QString lastVersion = m_AppConfig->lastVersion();
|
||||
QString currentVersion = m_VersionChecker.getVersion();
|
||||
if (lastVersion != currentVersion) {
|
||||
m_AppConfig->setLastVersion (currentVersion);
|
||||
m_AppConfig->saveSettings();
|
||||
m_LicenseManager->notifyUpdate (lastVersion, currentVersion);
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -159,6 +185,8 @@ MainWindow::~MainWindow()
|
||||
if (m_BonjourInstall != NULL) {
|
||||
delete m_BonjourInstall;
|
||||
}
|
||||
|
||||
delete m_pSslCertificate;
|
||||
}
|
||||
|
||||
void MainWindow::open()
|
||||
@@ -263,7 +291,8 @@ void MainWindow::createMenuBar()
|
||||
m_pMenuFile->addAction(m_pActionStartSynergy);
|
||||
m_pMenuFile->addAction(m_pActionStopSynergy);
|
||||
m_pMenuFile->addSeparator();
|
||||
m_pMenuFile->addAction(m_pActionWizard);
|
||||
m_pMenuFile->addAction(m_pActivate);
|
||||
m_pMenuFile->addSeparator();
|
||||
m_pMenuFile->addAction(m_pActionSave);
|
||||
m_pMenuFile->addSeparator();
|
||||
m_pMenuFile->addAction(m_pActionQuit);
|
||||
@@ -392,15 +421,17 @@ void MainWindow::appendLogRaw(const QString& text)
|
||||
foreach(QString line, text.split(QRegExp("\r|\n|\r\n"))) {
|
||||
if (!line.isEmpty()) {
|
||||
m_pLogOutput->append(line);
|
||||
updateStateFromLogLine(line);
|
||||
updateFromLogLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateStateFromLogLine(const QString &line)
|
||||
void MainWindow::updateFromLogLine(const QString &line)
|
||||
{
|
||||
// TODO: this code makes Andrew cry
|
||||
checkConnected(line);
|
||||
checkFingerprint(line);
|
||||
checkLicense(line);
|
||||
}
|
||||
|
||||
void MainWindow::checkConnected(const QString& line)
|
||||
@@ -425,6 +456,14 @@ void MainWindow::checkConnected(const QString& line)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::checkLicense(const QString &line)
|
||||
{
|
||||
if (line.contains("trial has expired")) {
|
||||
licenseManager().refresh();
|
||||
raiseActivationDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::checkFingerprint(const QString& line)
|
||||
{
|
||||
QRegExp fingerprintRegex(".*server fingerprint: ([A-F0-9:]+)");
|
||||
@@ -493,13 +532,19 @@ void MainWindow::restartSynergy()
|
||||
|
||||
void MainWindow::proofreadInfo()
|
||||
{
|
||||
setEdition(m_AppConfig.edition());
|
||||
setEdition(m_AppConfig->edition()); // Why is this here?
|
||||
|
||||
int oldState = m_SynergyState;
|
||||
m_SynergyState = synergyDisconnected;
|
||||
setSynergyState((qSynergyState)oldState);
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
QMainWindow::showEvent(event);
|
||||
emit windowShown();
|
||||
}
|
||||
|
||||
void MainWindow::clearLog()
|
||||
{
|
||||
m_pLogOutput->clear();
|
||||
@@ -507,6 +552,14 @@ void MainWindow::clearLog()
|
||||
|
||||
void MainWindow::startSynergy()
|
||||
{
|
||||
SerialKey serialKey = m_LicenseManager->serialKey();
|
||||
time_t currentTime = ::time(0);
|
||||
if (serialKey.isExpired(currentTime)) {
|
||||
if (QDialog::Rejected == raiseActivationDialog()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool desktopMode = appConfig().processMode() == Desktop;
|
||||
bool serviceMode = appConfig().processMode() == Service;
|
||||
|
||||
@@ -555,7 +608,7 @@ void MainWindow::startSynergy()
|
||||
|
||||
#endif
|
||||
|
||||
if (m_AppConfig.getCryptoEnabled()) {
|
||||
if (m_AppConfig->getCryptoEnabled()) {
|
||||
args << "--enable-crypto";
|
||||
}
|
||||
|
||||
@@ -618,6 +671,16 @@ void MainWindow::startSynergy()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::sslToggled (bool enabled)
|
||||
{
|
||||
if (enabled) {
|
||||
m_pSslCertificate = new SslCertificate(this);
|
||||
m_pSslCertificate->generateCertificate();
|
||||
}
|
||||
updateLocalFingerprint();
|
||||
}
|
||||
|
||||
bool MainWindow::clientArgs(QStringList& args, QString& app)
|
||||
{
|
||||
app = appPath(appConfig().synergycName());
|
||||
@@ -713,19 +776,6 @@ QString MainWindow::appPath(const QString& name)
|
||||
|
||||
bool MainWindow::serverArgs(QStringList& args, QString& app)
|
||||
{
|
||||
int edition;
|
||||
SubscriptionManager subscriptionManager(this, appConfig(), edition);
|
||||
if (subscriptionManager.fileExists())
|
||||
{
|
||||
if (!subscriptionManager.checkSubscription()) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
setEdition(edition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
app = appPath(appConfig().synergysName());
|
||||
|
||||
if (!QFile::exists(app))
|
||||
@@ -754,25 +804,10 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
|
||||
#endif
|
||||
args << "-c" << configFilename << "--address" << address();
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
// pass in physical resolution and primary screen center
|
||||
// TODO: get this information in the core binary even when
|
||||
// high DPI is used
|
||||
int height = QApplication::desktop()->height();
|
||||
int width = QApplication::desktop()->width();
|
||||
if (!appConfig().serialKey().isEmpty()) {
|
||||
args << "--serial-key" << appConfig().serialKey();
|
||||
}
|
||||
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
int heightCenter = rec.height() / 2;
|
||||
int widthCenter = rec.width() / 2;
|
||||
|
||||
appendLogDebug(tr("screen resolution: %1 %2 primary screen center: %3 %4")
|
||||
.arg(width).arg(height).arg(widthCenter).arg(heightCenter));
|
||||
|
||||
args << "--res-w" << QString::number(width);
|
||||
args << "--res-h" << QString::number(height);
|
||||
args << "--prm-wc" << QString::number(widthCenter);
|
||||
args << "--prm-hc" << QString::number(heightCenter);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -874,7 +909,7 @@ void MainWindow::setSynergyState(qSynergyState state)
|
||||
switch (state)
|
||||
{
|
||||
case synergyConnected: {
|
||||
if (m_AppConfig.getCryptoEnabled()) {
|
||||
if (m_AppConfig->getCryptoEnabled()) {
|
||||
m_pLabelPadlock->show();
|
||||
}
|
||||
else {
|
||||
@@ -989,13 +1024,13 @@ void MainWindow::updateZeroconfService()
|
||||
QMutexLocker locker(&m_UpdateZeroconfMutex);
|
||||
|
||||
if (isBonjourRunning()) {
|
||||
if (!m_AppConfig.wizardShouldRun()) {
|
||||
if (!m_AppConfig->wizardShouldRun()) {
|
||||
if (m_pZeroconfService) {
|
||||
delete m_pZeroconfService;
|
||||
m_pZeroconfService = NULL;
|
||||
}
|
||||
|
||||
if (m_AppConfig.autoConfig() || synergyType() == synergyServer) {
|
||||
if (m_AppConfig->autoConfig() || synergyType() == synergyServer) {
|
||||
m_pZeroconfService = new ZeroconfService(this);
|
||||
}
|
||||
}
|
||||
@@ -1014,28 +1049,71 @@ void MainWindow::serverDetected(const QString name)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setEdition(int type)
|
||||
void MainWindow::setEdition(Edition edition)
|
||||
{
|
||||
QString title;
|
||||
if (type == Basic) {
|
||||
title = "Synergy Basic";
|
||||
}
|
||||
else if (type == Pro) {
|
||||
title = "Synergy Pro";
|
||||
}
|
||||
else if (type == Trial) {
|
||||
title = "Synergy Trial";
|
||||
}
|
||||
else {
|
||||
title = "Synergy (UNREGISTERED)";
|
||||
setWindowTitle(m_LicenseManager->getEditionName (edition));
|
||||
if (m_AppConfig->getCryptoEnabled()) {
|
||||
m_pSslCertificate = new SslCertificate(this);
|
||||
m_pSslCertificate->generateCertificate();
|
||||
}
|
||||
updateLocalFingerprint();
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
setWindowTitle(title);
|
||||
void MainWindow::beginTrial(bool isExpiring)
|
||||
{
|
||||
//Hack
|
||||
//if (isExpiring) {
|
||||
time_t daysLeft = m_LicenseManager->serialKey().daysLeft(::time(0));
|
||||
QString expiringNotice ("<html><head/><body><p><span style=\""
|
||||
"font-weight:600;\">%1</span> day%3 of "
|
||||
"your %2 trial remain%5. <a href="
|
||||
"\"https://symless.com/synergy/trial/thanks?id=%4\">"
|
||||
"<span style=\"text-decoration: underline;"
|
||||
" color:#0000ff;\">Buy now!</span></a>"
|
||||
"</p></body></html>");
|
||||
expiringNotice = expiringNotice
|
||||
.arg (daysLeft)
|
||||
.arg (LicenseManager::getEditionName
|
||||
(m_LicenseManager->activeEdition()))
|
||||
.arg ((daysLeft == 1) ? "" : "s")
|
||||
.arg (QString::fromStdString
|
||||
(m_LicenseManager->serialKey().toString()))
|
||||
.arg ((daysLeft == 1) ? "s" : "");
|
||||
this->m_trialLabel->setText(expiringNotice);
|
||||
this->m_trialWidget->show();
|
||||
//}
|
||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
}
|
||||
|
||||
void MainWindow::endTrial(bool isExpired)
|
||||
{
|
||||
if (isExpired) {
|
||||
QString expiredNotice (
|
||||
"<html><head/><body><p>Your %1 trial has expired. <a href="
|
||||
"\"https://symless.com/synergy/trial/thanks?id=%2\">"
|
||||
"<span style=\"text-decoration: underline;color:#0000ff;\">"
|
||||
"Buy now!</span></a></p></body></html>"
|
||||
);
|
||||
expiredNotice = expiredNotice
|
||||
.arg(LicenseManager::getEditionName
|
||||
(m_LicenseManager->activeEdition()))
|
||||
.arg(QString::fromStdString
|
||||
(m_LicenseManager->serialKey().toString()));
|
||||
|
||||
this->m_trialLabel->setText(expiredNotice);
|
||||
this->m_trialWidget->show();
|
||||
stopSynergy();
|
||||
m_AppConfig->activationHasRun(false);
|
||||
} else {
|
||||
this->m_trialWidget->hide();
|
||||
}
|
||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
}
|
||||
|
||||
void MainWindow::updateLocalFingerprint()
|
||||
{
|
||||
if (Fingerprint::local().fileExists()) {
|
||||
if (m_AppConfig->getCryptoEnabled() && Fingerprint::local().fileExists()) {
|
||||
m_pLabelFingerprint->setVisible(true);
|
||||
m_pLabelLocalFingerprint->setVisible(true);
|
||||
m_pLabelLocalFingerprint->setText(Fingerprint::local().readFirst());
|
||||
@@ -1046,6 +1124,12 @@ void MainWindow::updateLocalFingerprint()
|
||||
}
|
||||
}
|
||||
|
||||
LicenseManager&
|
||||
MainWindow::licenseManager() const
|
||||
{
|
||||
return *m_LicenseManager;
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
||||
{
|
||||
m_pGroupServer->setChecked(!on);
|
||||
@@ -1110,6 +1194,14 @@ void MainWindow::on_m_pActionSettings_triggered()
|
||||
void MainWindow::autoAddScreen(const QString name)
|
||||
{
|
||||
if (!m_ServerConfig.ignoreAutoConfigClient()) {
|
||||
if (m_ActivationDialogRunning) {
|
||||
// TODO: refactor this code
|
||||
// add this screen to the pending list and check this list until
|
||||
// users finish activation dialog
|
||||
m_PendingClientNames.append(name);
|
||||
return;
|
||||
}
|
||||
|
||||
int r = m_ServerConfig.autoAddScreen(name);
|
||||
if (r != kAutoAddScreenOk) {
|
||||
switch (r) {
|
||||
@@ -1145,10 +1237,9 @@ void MainWindow::on_m_pButtonConfigureServer_clicked()
|
||||
showConfigureServer();
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pActionWizard_triggered()
|
||||
void MainWindow::on_m_pActivate_triggered()
|
||||
{
|
||||
SetupWizard wizard(*this, false);
|
||||
wizard.exec();
|
||||
raiseActivationDialog();
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pButtonApply_clicked()
|
||||
@@ -1308,16 +1399,16 @@ void MainWindow::promptAutoConfig()
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (r == QMessageBox::Yes) {
|
||||
m_AppConfig.setAutoConfig(true);
|
||||
m_AppConfig->setAutoConfig(true);
|
||||
downloadBonjour();
|
||||
}
|
||||
else {
|
||||
m_AppConfig.setAutoConfig(false);
|
||||
m_AppConfig->setAutoConfig(false);
|
||||
m_pCheckBoxAutoConfig->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
m_AppConfig.setAutoConfigPrompted(true);
|
||||
m_AppConfig->setAutoConfigPrompted(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pComboServerList_currentIndexChanged(QString )
|
||||
@@ -1363,6 +1454,40 @@ void MainWindow::bonjourInstallFinished()
|
||||
m_pCheckBoxAutoConfig->setChecked(true);
|
||||
}
|
||||
|
||||
int MainWindow::raiseActivationDialog()
|
||||
{
|
||||
if (m_ActivationDialogRunning) {
|
||||
return QDialog::Rejected;
|
||||
}
|
||||
ActivationDialog activationDialog (this, appConfig(), licenseManager());
|
||||
m_ActivationDialogRunning = true;
|
||||
connect (&activationDialog, SIGNAL(finished(int)),
|
||||
this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
|
||||
int result = activationDialog.exec();
|
||||
m_ActivationDialogRunning = false;
|
||||
if (!m_PendingClientNames.empty()) {
|
||||
foreach (const QString& name, m_PendingClientNames) {
|
||||
autoAddScreen(name);
|
||||
}
|
||||
|
||||
m_PendingClientNames.clear();
|
||||
}
|
||||
if (result == QDialog::Accepted) {
|
||||
restartSynergy();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void MainWindow::on_windowShown()
|
||||
{
|
||||
time_t currentTime = ::time(0);
|
||||
if (!m_AppConfig->activationHasRun()
|
||||
&& ((m_AppConfig->edition() == kUnregistered) ||
|
||||
(m_LicenseManager->serialKey().isExpired(currentTime)))) {
|
||||
raiseActivationDialog();
|
||||
}
|
||||
}
|
||||
|
||||
QString MainWindow::getProfileRootForArg()
|
||||
{
|
||||
CoreInterface coreInterface;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "VersionChecker.h"
|
||||
#include "IpcClient.h"
|
||||
#include "Ipc.h"
|
||||
#include "ActivationDialog.h"
|
||||
|
||||
#include <QMutex>
|
||||
|
||||
@@ -56,6 +57,8 @@ class SetupWizard;
|
||||
class ZeroconfService;
|
||||
class DataDownloader;
|
||||
class CommandProcess;
|
||||
class SslCertificate;
|
||||
class LicenseManager;
|
||||
|
||||
class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
{
|
||||
@@ -63,7 +66,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
|
||||
friend class QSynergyApplication;
|
||||
friend class SetupWizard;
|
||||
friend class PluginWizardPage;
|
||||
friend class ActivationDialog;
|
||||
friend class SettingsDialog;
|
||||
|
||||
public:
|
||||
enum qSynergyState
|
||||
@@ -91,7 +95,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
};
|
||||
|
||||
public:
|
||||
MainWindow(QSettings& settings, AppConfig& appConfig);
|
||||
MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager);
|
||||
~MainWindow();
|
||||
|
||||
public:
|
||||
@@ -112,10 +117,15 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
void autoAddScreen(const QString name);
|
||||
void updateZeroconfService();
|
||||
void serverDetected(const QString name);
|
||||
void setEdition(int type);
|
||||
void updateLocalFingerprint();
|
||||
LicenseManager& licenseManager() const;
|
||||
|
||||
public slots:
|
||||
int raiseActivationDialog();
|
||||
|
||||
public slots:
|
||||
void setEdition(Edition edition);
|
||||
void beginTrial(bool isExpiring);
|
||||
void endTrial(bool isExpired);
|
||||
void appendLogRaw(const QString& text);
|
||||
void appendLogInfo(const QString& text);
|
||||
void appendLogDebug(const QString& text);
|
||||
@@ -123,6 +133,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
void startSynergy();
|
||||
|
||||
protected slots:
|
||||
void sslToggled(bool enabled);
|
||||
void on_m_pGroupClient_toggled(bool on);
|
||||
void on_m_pGroupServer_toggled(bool on);
|
||||
bool on_m_pButtonBrowseConfigFile_clicked();
|
||||
@@ -130,7 +141,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
bool on_m_pActionSave_triggered();
|
||||
void on_m_pActionAbout_triggered();
|
||||
void on_m_pActionSettings_triggered();
|
||||
void on_m_pActionWizard_triggered();
|
||||
void on_m_pActivate_triggered();
|
||||
void synergyFinished(int exitCode, QProcess::ExitStatus);
|
||||
void trayActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
void stopSynergy();
|
||||
@@ -141,7 +152,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
|
||||
protected:
|
||||
QSettings& settings() { return m_Settings; }
|
||||
AppConfig& appConfig() { return m_AppConfig; }
|
||||
AppConfig& appConfig() { return *m_AppConfig; }
|
||||
QProcess* synergyProcess() { return m_pSynergy; }
|
||||
void setSynergyProcess(QProcess* p) { m_pSynergy = p; }
|
||||
void initConnections();
|
||||
@@ -158,7 +169,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
void setStatus(const QString& status);
|
||||
void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors);
|
||||
void onModeChanged(bool startDesktop, bool applyService);
|
||||
void updateStateFromLogLine(const QString& line);
|
||||
void updateFromLogLine(const QString& line);
|
||||
QString getIPAddresses();
|
||||
void stopService();
|
||||
void stopDesktop();
|
||||
@@ -174,15 +185,19 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
void promptAutoConfig();
|
||||
QString getProfileRootForArg();
|
||||
void checkConnected(const QString& line);
|
||||
void checkLicense(const QString& line);
|
||||
void checkFingerprint(const QString& line);
|
||||
bool autoHide();
|
||||
QString getTimeStamp();
|
||||
void restartSynergy();
|
||||
void proofreadInfo();
|
||||
|
||||
void showEvent (QShowEvent*);
|
||||
|
||||
private:
|
||||
QSettings& m_Settings;
|
||||
AppConfig& m_AppConfig;
|
||||
AppConfig* m_AppConfig;
|
||||
LicenseManager* m_LicenseManager;
|
||||
QProcess* m_pSynergy;
|
||||
int m_SynergyState;
|
||||
ServerConfig m_ServerConfig;
|
||||
@@ -207,12 +222,19 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
bool m_SuppressEmptyServerWarning;
|
||||
qRuningState m_ExpectedRunningState;
|
||||
QMutex m_StopDesktopMutex;
|
||||
SslCertificate* m_pSslCertificate;
|
||||
bool m_ActivationDialogRunning;
|
||||
QStringList m_PendingClientNames;
|
||||
|
||||
private slots:
|
||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||
void on_m_pComboServerList_currentIndexChanged(QString );
|
||||
void on_m_pButtonApply_clicked();
|
||||
void installBonjour();
|
||||
void on_windowShown();
|
||||
|
||||
signals:
|
||||
void windowShown();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-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 "Plugin.h"
|
||||
|
||||
#include "CoreInterface.h"
|
||||
|
||||
static const char kBaseUrl[] = "http://symless.com/files";
|
||||
static const char kDefaultVersion[] = "1.1";
|
||||
static const char kWinPackagePlatform32[] = "Windows-x86";
|
||||
static const char kWinPackagePlatform64[] = "Windows-x64";
|
||||
static const char kMacPackagePlatform[] = "MacOSX%1-i386";
|
||||
static const char kLinuxPackagePlatformDeb32[] = "Linux-i686-deb";
|
||||
static const char kLinuxPackagePlatformDeb64[] = "Linux-x86_64-deb";
|
||||
static const char kLinuxPackagePlatformRpm32[] = "Linux-i686-rpm";
|
||||
static const char kLinuxPackagePlatformRpm64[] = "Linux-x86_64-rpm";
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
static const char kWinPluginExt[] = ".dll";
|
||||
static const char kInstallerPluginLocation[] = "Plugins";
|
||||
#elif defined(Q_OS_MAC)
|
||||
static const char kMacPluginPrefix[] = "lib";
|
||||
static const char kMacPluginExt[] = ".dylib";
|
||||
static const char kInstallerPluginLocation[] = "plugins"; // TODO: Fix for mac
|
||||
#else
|
||||
static const char kLinuxPluginPrefix[] = "lib";
|
||||
static const char kLinuxPluginExt[] = ".so";
|
||||
// /usr/bin becomes /usr/bin/../lib/syn...
|
||||
static const char kInstallerPluginLocation[] = "../lib/synergy/plugins";
|
||||
#endif
|
||||
|
||||
QString Plugin::getOsSpecificExt()
|
||||
{
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
return kWinPluginExt;
|
||||
#elif defined(Q_OS_MAC)
|
||||
return kMacPluginExt;
|
||||
#else
|
||||
return kLinuxPluginExt;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Plugin::getOsSpecificName(const QString& pluginName)
|
||||
{
|
||||
QString result = pluginName;
|
||||
#if defined(Q_OS_WIN)
|
||||
result.append(getOsSpecificExt());
|
||||
#elif defined(Q_OS_MAC)
|
||||
result = kMacPluginPrefix + pluginName + getOsSpecificExt();
|
||||
#else
|
||||
result = kLinuxPluginPrefix + pluginName + getOsSpecificExt();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
QString Plugin::getOsSpecificInstallerLocation() {
|
||||
return kInstallerPluginLocation;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-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/>.
|
||||
*/
|
||||
#ifndef PLUGIN_H
|
||||
#define PLUGIN_H
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QObject>
|
||||
|
||||
#include "SslCertificate.h"
|
||||
#include "CoreInterface.h"
|
||||
#include "DataDownloader.h"
|
||||
|
||||
class Plugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//Plugin();
|
||||
//~PluginManager();
|
||||
|
||||
static QString getOsSpecificName(const QString& pluginName);
|
||||
static QString getOsSpecificExt();
|
||||
static QString getOsSpecificLocation();
|
||||
static QString getOsSpecificInstallerLocation();
|
||||
static QString getOsSpecificUserLocation();
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
// CoreInterface m_CoreInterface;
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // PLUGIN_H
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-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 "PluginManager.h"
|
||||
|
||||
#include "CoreInterface.h"
|
||||
#include "DataDownloader.h"
|
||||
#include "QUtility.h"
|
||||
#include "ProcessorArch.h"
|
||||
#include "Fingerprint.h"
|
||||
#include "Plugin.h"
|
||||
#include "../lib/common/PluginVersion.h"
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QCoreApplication>
|
||||
|
||||
|
||||
PluginManager::PluginManager() :
|
||||
m_PluginList()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
PluginManager::~PluginManager()
|
||||
{
|
||||
}
|
||||
|
||||
void PluginManager::init()
|
||||
{
|
||||
m_PluginDir = m_CoreInterface.getPluginDir();
|
||||
if (m_PluginDir.isEmpty()) {
|
||||
emit error(tr("Failed to get plugin directory."));
|
||||
}
|
||||
|
||||
m_ProfileDir = m_CoreInterface.getProfileDir();
|
||||
if (m_ProfileDir.isEmpty()) {
|
||||
emit error(tr("Failed to get profile directory."));
|
||||
}
|
||||
|
||||
m_InstalledDir = m_CoreInterface.getInstalledDir();
|
||||
if (m_InstalledDir.isEmpty()) {
|
||||
emit error(tr("Failed to get installed directory."));
|
||||
}
|
||||
}
|
||||
|
||||
bool PluginManager::exist(QString name)
|
||||
{
|
||||
CoreInterface coreInterface;
|
||||
QString PluginDir = coreInterface.getPluginDir();
|
||||
QString pluginName = Plugin::getOsSpecificName(name);
|
||||
QString filename;
|
||||
filename.append(PluginDir);
|
||||
filename.append(QDir::separator()).append(pluginName);
|
||||
QFile file(filename);
|
||||
bool exist = false;
|
||||
if (file.exists()) {
|
||||
exist = true;
|
||||
}
|
||||
|
||||
return exist;
|
||||
}
|
||||
|
||||
void PluginManager::copyPlugins()
|
||||
{
|
||||
try {
|
||||
// Get the Directory where plugins are put on installation
|
||||
// If it doesn't exist, there is nothing to do
|
||||
QString srcDirName(m_InstalledDir.append(QDir::separator())
|
||||
.append(Plugin::getOsSpecificInstallerLocation()));
|
||||
|
||||
QDir srcDir(srcDirName);
|
||||
if (!srcDir.exists()) {
|
||||
emit info(
|
||||
tr("No plugins found to copy from %1")
|
||||
.arg(srcDirName));
|
||||
emit copyFinished();
|
||||
}
|
||||
|
||||
// Get the directory where Plugins are installed into Synergy
|
||||
// If it doesn't exist make it
|
||||
QString destDirName = m_PluginDir;
|
||||
|
||||
QDir destDir(destDirName);
|
||||
if (!destDir.exists()) {
|
||||
destDir.mkpath(".");
|
||||
}
|
||||
// Run through the list of plugins and copy them
|
||||
for ( int i = 0 ; i < m_PluginList.size() ; i++ ) {
|
||||
// Get a file entry for the plugin using the full path
|
||||
QFile file(srcDirName + QDir::separator() + m_PluginList.at(i));
|
||||
|
||||
// construct the destination file name
|
||||
QString newName(destDirName + QDir::separator() + m_PluginList.at(i));
|
||||
|
||||
// Check to see if the plugin already exists
|
||||
QFile newFile(newName);
|
||||
if(newFile.exists()) {
|
||||
// If it does, delete it. TODO: Check to see if same and leave
|
||||
bool result = newFile.remove();
|
||||
if( !result ) {
|
||||
emit error(
|
||||
tr( "Unable to delete plugin:\n%1\n"
|
||||
"Please stop synergy and run the wizard again.")
|
||||
.arg(newName));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// make a copy of the plugin in the new location
|
||||
#if defined(Q_OS_WIN)
|
||||
bool result = file.copy(newName);
|
||||
#else
|
||||
bool result = file.link(newName);
|
||||
#endif
|
||||
if ( !result ) {
|
||||
emit error(
|
||||
tr("Failed to copy plugin '%1' to: %2\n%3\n"
|
||||
"Please stop synergy and run the wizard again.")
|
||||
.arg(m_PluginList.at(i))
|
||||
.arg(newName)
|
||||
.arg(file.errorString()));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
emit info(
|
||||
tr("Copying '%1' plugin (%2/%3)...")
|
||||
.arg(m_PluginList.at(i))
|
||||
.arg(i+1)
|
||||
.arg(m_PluginList.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
emit error(tr( "An error occurred while trying to copy the "
|
||||
"plugin list. Please contact the help desk, and "
|
||||
"provide the following details.\n\n%1").arg(e.what()));
|
||||
}
|
||||
|
||||
emit copyFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
void PluginManager::queryPluginList()
|
||||
{
|
||||
try {
|
||||
setDone(false);
|
||||
QString extension = "*" + Plugin::getOsSpecificExt();
|
||||
QStringList nameFilter(extension);
|
||||
|
||||
QString installDir(m_CoreInterface.getInstalledDir()
|
||||
.append(QDir::separator())
|
||||
.append(Plugin::getOsSpecificInstallerLocation()));
|
||||
|
||||
QString searchDirectory(installDir);
|
||||
QDir directory(searchDirectory);
|
||||
m_PluginList = directory.entryList(nameFilter);
|
||||
setDone(true);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
setDone(true);
|
||||
emit error(tr( "An error occurred while trying to load the "
|
||||
"plugin list. Please contact the help desk, and "
|
||||
"provide the following details.\n\n%1").arg(e.what()));
|
||||
}
|
||||
emit queryPluginDone();
|
||||
return;
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-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/>.
|
||||
*/
|
||||
|
||||
#ifndef PLUGINMANAGER_H
|
||||
#define PLUGINMANAGER_H
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QObject>
|
||||
|
||||
#include "SslCertificate.h"
|
||||
#include "CoreInterface.h"
|
||||
#include "DataDownloader.h"
|
||||
#include "Plugin.h"
|
||||
|
||||
class PluginManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PluginManager();
|
||||
~PluginManager();
|
||||
|
||||
void init();
|
||||
|
||||
int pluginCount() { return m_PluginList.count(); }
|
||||
QStringList& getPluginList() { return m_PluginList; }
|
||||
|
||||
bool isDone() { return done; }
|
||||
void setDone(bool b) { done = b; }
|
||||
static bool exist(QString name);
|
||||
|
||||
public slots:
|
||||
void copyPlugins();
|
||||
void queryPluginList();
|
||||
|
||||
private:
|
||||
QString getPluginUrl(const QString& pluginName);
|
||||
bool runProgram(
|
||||
const QString& program,
|
||||
const QStringList& args,
|
||||
const QStringList& env);
|
||||
|
||||
signals:
|
||||
void error(QString e);
|
||||
void info(QString i);
|
||||
void updateCopyStatus(int);
|
||||
void copyFinished();
|
||||
void queryPluginDone();
|
||||
|
||||
private:
|
||||
QStringList m_PluginList;
|
||||
QString m_PluginDir;
|
||||
QString m_ProfileDir;
|
||||
QString m_InstalledDir;
|
||||
CoreInterface m_CoreInterface;
|
||||
SslCertificate m_SslCertificate;
|
||||
bool done;
|
||||
};
|
||||
|
||||
#endif // PLUGINMANAGER_H
|
||||
@@ -1,206 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-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 "PluginWizardPage.h"
|
||||
#include "ui_PluginWizardPageBase.h"
|
||||
|
||||
#include "SslCertificate.h"
|
||||
#include "PluginManager.h"
|
||||
#include "MainWindow.h"
|
||||
#include "EditionType.h"
|
||||
|
||||
#include <QMovie>
|
||||
#include <QThread>
|
||||
#include <QTime>
|
||||
|
||||
PluginWizardPage::PluginWizardPage(MainWindow& mainWindow, QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
m_Finished(false),
|
||||
m_Edition(Unknown),
|
||||
m_pSslCertificate(NULL),
|
||||
m_mainWindow(mainWindow)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
QMovie *movie = new QMovie(":/res/image/spinning-wheel.gif");
|
||||
m_pLabelSpinning->setMovie(movie);
|
||||
movie->start();
|
||||
|
||||
m_pSslCertificate = new SslCertificate(this);
|
||||
}
|
||||
|
||||
PluginWizardPage::~PluginWizardPage()
|
||||
{
|
||||
delete m_pSslCertificate;
|
||||
}
|
||||
|
||||
void PluginWizardPage::changeEvent(QEvent *e)
|
||||
{
|
||||
QWizardPage::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PluginWizardPage::initializePage()
|
||||
{
|
||||
QWizardPage::initializePage();
|
||||
|
||||
if (m_Edition != Pro) {
|
||||
updateStatus(tr("Setup complete."));
|
||||
showFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
m_pLabelSpinning->show();
|
||||
|
||||
QThread* thread = new QThread;
|
||||
|
||||
connect(&m_PluginManager,
|
||||
SIGNAL(error(QString)),
|
||||
this,
|
||||
SLOT(showError(QString)));
|
||||
|
||||
connect(&m_PluginManager,
|
||||
SIGNAL(info(QString)),
|
||||
this,
|
||||
SLOT(updateStatus(QString)));
|
||||
|
||||
connect(&m_PluginManager,
|
||||
SIGNAL(queryPluginDone()),
|
||||
this,
|
||||
SLOT(queryPluginDone()));
|
||||
|
||||
connect(&m_PluginManager,
|
||||
SIGNAL(queryPluginDone()),
|
||||
thread,
|
||||
SLOT(quit()));
|
||||
|
||||
connect(&m_PluginManager,
|
||||
SIGNAL(error(QString)),
|
||||
thread,
|
||||
SLOT(quit()));
|
||||
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
m_PluginManager.moveToThread(thread);
|
||||
thread->start();
|
||||
|
||||
QMetaObject::invokeMethod(&m_PluginManager, "queryPluginList", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void PluginWizardPage::queryPluginDone()
|
||||
{
|
||||
QStringList pluginList = m_PluginManager.getPluginList();
|
||||
if (pluginList.isEmpty()) {
|
||||
updateStatus(tr("Setup complete."));
|
||||
showFinished();
|
||||
}
|
||||
else {
|
||||
m_mainWindow.stopSynergy();
|
||||
copyPlugins();
|
||||
m_mainWindow.startSynergy();
|
||||
}
|
||||
}
|
||||
|
||||
void PluginWizardPage::copyPlugins()
|
||||
{
|
||||
m_pThread = new QThread;
|
||||
|
||||
connect(&m_PluginManager,
|
||||
SIGNAL(copyFinished()),
|
||||
this,
|
||||
SLOT(generateCertificate()));
|
||||
|
||||
connect(&m_PluginManager,
|
||||
SIGNAL(error(QString)),
|
||||
m_pThread,
|
||||
SLOT(quit()));
|
||||
|
||||
connect(m_pThread,
|
||||
SIGNAL(finished()),
|
||||
m_pThread,
|
||||
SLOT(deleteLater()));
|
||||
|
||||
updateStatus(
|
||||
tr("Copying plugins..."));
|
||||
|
||||
m_PluginManager.moveToThread(m_pThread);
|
||||
m_pThread->start();
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
&m_PluginManager,
|
||||
"copyPlugins",
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void PluginWizardPage::generateCertificate()
|
||||
{
|
||||
connect(m_pSslCertificate,
|
||||
SIGNAL(generateFinished()),
|
||||
this,
|
||||
SLOT(finished()));
|
||||
|
||||
connect(m_pSslCertificate,
|
||||
SIGNAL(generateFinished()),
|
||||
m_pThread,
|
||||
SLOT(quit()));
|
||||
|
||||
updateStatus(tr("Generating SSL certificate..."));
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
m_pSslCertificate,
|
||||
"generateCertificate",
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void PluginWizardPage::showError(QString error)
|
||||
{
|
||||
updateStatus(tr("Error: %1").arg(error));
|
||||
showFinished();
|
||||
}
|
||||
|
||||
|
||||
void PluginWizardPage::updateStatus(QString info)
|
||||
{
|
||||
m_pLabelStatus->setText(info);
|
||||
}
|
||||
|
||||
void PluginWizardPage::finished()
|
||||
{
|
||||
// TODO: we should check if ns plugin exists
|
||||
m_mainWindow.appConfig().setCryptoEnabled(true);
|
||||
|
||||
updateStatus(tr("Plugins installed successfully."));
|
||||
showFinished();
|
||||
}
|
||||
|
||||
void PluginWizardPage::showFinished()
|
||||
{
|
||||
m_pLabelSpinning->hide();
|
||||
m_Finished = true;
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
bool PluginWizardPage::isComplete() const
|
||||
{
|
||||
return m_Finished;
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-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/>.
|
||||
*/
|
||||
|
||||
#ifndef PLUGINWIZARDPAGE_H
|
||||
#define PLUGINWIZARDPAGE_H
|
||||
|
||||
#include "AppConfig.h"
|
||||
|
||||
#include "ui_PluginWizardPageBase.h"
|
||||
#include "PluginManager.h"
|
||||
#include <QWizardPage>
|
||||
|
||||
class SslCertificate;
|
||||
class MainWindow;
|
||||
|
||||
class PluginWizardPage : public QWizardPage, public Ui::PluginWizardPage {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PluginWizardPage(MainWindow& mainWindow, QWidget *parent = 0);
|
||||
~PluginWizardPage();
|
||||
|
||||
void setFinished(bool b) { m_Finished = b; }
|
||||
void setEdition(int edition) { m_Edition = edition; }
|
||||
|
||||
bool isComplete() const;
|
||||
void initializePage();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
protected slots:
|
||||
void showError(QString error);
|
||||
void updateStatus(QString info);
|
||||
void queryPluginDone();
|
||||
void generateCertificate();
|
||||
void finished();
|
||||
|
||||
private:
|
||||
void copyPlugins();
|
||||
void showFinished();
|
||||
|
||||
private:
|
||||
bool m_Finished;
|
||||
int m_Edition;
|
||||
PluginManager m_PluginManager;
|
||||
SslCertificate* m_pSslCertificate;
|
||||
QThread* m_pThread;
|
||||
MainWindow& m_mainWindow;
|
||||
};
|
||||
#endif // PLUGINWIZARDPAGE_H
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "ProcessorArch.h"
|
||||
#include "CommandProcess.h"
|
||||
#include "EditionType.h"
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
#include <QProcess>
|
||||
@@ -97,15 +98,18 @@ QString getOSInformation()
|
||||
QString result;
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
QStringList arguments;
|
||||
arguments.append("/etc/os-release");
|
||||
CommandProcess cp("/bin/cat", arguments);
|
||||
QString output = cp.run();
|
||||
result = "Linux";
|
||||
try {
|
||||
QStringList arguments;
|
||||
arguments.append("/etc/os-release");
|
||||
CommandProcess cp("/bin/cat", arguments);
|
||||
QString output = cp.run();
|
||||
|
||||
QRegExp resultRegex(".*PRETTY_NAME=\"([^\"]+)\".*");
|
||||
if (resultRegex.exactMatch(output)) {
|
||||
QString OSInfo = resultRegex.cap(1);
|
||||
result = OSInfo;
|
||||
QRegExp resultRegex(".*PRETTY_NAME=\"([^\"]+)\".*");
|
||||
if (resultRegex.exactMatch(output)) {
|
||||
result = resultRegex.cap(1);
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,12 +18,14 @@
|
||||
|
||||
#include "SettingsDialog.h"
|
||||
|
||||
#include "PluginManager.h"
|
||||
#include "CoreInterface.h"
|
||||
#include "SynergyLocale.h"
|
||||
#include "QSynergyApplication.h"
|
||||
#include "QUtility.h"
|
||||
#include "AppConfig.h"
|
||||
#include "EditionType.h"
|
||||
#include "SslCertificate.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@@ -36,7 +38,7 @@ static const char networkSecurity[] = "ns";
|
||||
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
Ui::SettingsDialogBase(),
|
||||
m_AppConfig(config)
|
||||
m_appConfig(config)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@@ -61,13 +63,8 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||
m_pComboElevate->hide();
|
||||
#endif
|
||||
|
||||
if (!PluginManager::exist(networkSecurity)) {
|
||||
m_pGroupNetworkSecurity->setEnabled(false);
|
||||
m_pCheckBoxEnableCrypto->setChecked(false);
|
||||
}
|
||||
else {
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_AppConfig.getCryptoEnabled());
|
||||
}
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
m_pCheckBoxEnableCrypto->setEnabled(m_appConfig.edition() == kPro);
|
||||
}
|
||||
|
||||
void SettingsDialog::accept()
|
||||
@@ -147,5 +144,12 @@ void SettingsDialog::on_m_pComboLanguage_currentIndexChanged(int index)
|
||||
|
||||
void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked)
|
||||
{
|
||||
m_AppConfig.setCryptoEnabled(checked);
|
||||
m_appConfig.setCryptoEnabled(checked);
|
||||
m_appConfig.saveSettings();
|
||||
if (checked) {
|
||||
SslCertificate sslCertificate;
|
||||
sslCertificate.generateCertificate();
|
||||
MainWindow& mainWindow = dynamic_cast<MainWindow&> (*this->parent());
|
||||
mainWindow.updateLocalFingerprint();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
|
||||
void accept();
|
||||
void reject();
|
||||
void changeEvent(QEvent* event);
|
||||
AppConfig& appConfig() { return m_AppConfig; }
|
||||
AppConfig& appConfig() { return m_appConfig; }
|
||||
|
||||
private:
|
||||
AppConfig& m_AppConfig;
|
||||
AppConfig& m_appConfig;
|
||||
SynergyLocale m_Locale;
|
||||
CoreInterface m_CoreInterface;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "WebClient.h"
|
||||
#include "ActivationNotifier.h"
|
||||
#include "SubscriptionManager.h"
|
||||
#include "LicenseManager.h"
|
||||
#include "EditionType.h"
|
||||
#include "QSynergyApplication.h"
|
||||
#include "QUtility.h"
|
||||
@@ -28,13 +28,9 @@
|
||||
|
||||
SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
|
||||
m_MainWindow(mainWindow),
|
||||
m_StartMain(startMain),
|
||||
m_Edition(Unknown),
|
||||
m_LoginAttemps(0)
|
||||
m_StartMain(startMain)
|
||||
{
|
||||
setupUi(this);
|
||||
m_pPluginPage = new PluginWizardPage(mainWindow);
|
||||
addPage(m_pPluginPage);
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
|
||||
@@ -59,13 +55,6 @@ SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
|
||||
|
||||
m_Locale.fillLanguageComboBox(m_pComboLanguage);
|
||||
setIndexFromItemData(m_pComboLanguage, m_MainWindow.appConfig().language());
|
||||
AppConfig& appConfig = m_MainWindow.appConfig();
|
||||
|
||||
m_pLineEditEmail->setText(appConfig.activateEmail());
|
||||
m_pTextEditSerialKey->setText(appConfig.serialKey());
|
||||
|
||||
m_pTextEditSerialKey->setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
SetupWizard::~SetupWizard()
|
||||
@@ -78,70 +67,7 @@ bool SetupWizard::validateCurrentPage()
|
||||
message.setWindowTitle(tr("Setup Synergy"));
|
||||
message.setIcon(QMessageBox::Information);
|
||||
|
||||
if (currentPage() == m_pActivatePage)
|
||||
{
|
||||
if (m_pRadioButtonActivate->isChecked()) {
|
||||
if (m_pLineEditEmail->text().isEmpty() ||
|
||||
m_pLineEditPassword->text().isEmpty()) {
|
||||
message.setText(tr("Please enter your email address and password."));
|
||||
message.exec();
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
WebClient webClient;
|
||||
m_Edition = webClient.getEdition(
|
||||
m_pLineEditEmail->text(),
|
||||
m_pLineEditPassword->text(),
|
||||
message,
|
||||
this);
|
||||
|
||||
if (m_Edition == Unknown) {
|
||||
m_LoginAttemps++;
|
||||
if (m_LoginAttemps == kMaximiumLoginAttemps) {
|
||||
m_LoginAttemps = 0;
|
||||
|
||||
QMessageBox::StandardButton reply =
|
||||
QMessageBox::information(
|
||||
this, tr("Setup Synergy"),
|
||||
tr("Would you like to use your serial key instead?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (reply == QMessageBox::Yes) {
|
||||
m_pRadioButtonSubscription->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
m_pPluginPage->setEdition(m_Edition);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_pRadioButtonSubscription->isChecked()) {
|
||||
if (m_pTextEditSerialKey->toPlainText().isEmpty()) {
|
||||
message.setText(tr("Please enter your subscription serial key."));
|
||||
message.exec();
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// create subscription file in profile directory
|
||||
SubscriptionManager subscriptionManager(this, m_MainWindow.appConfig(), m_Edition);
|
||||
if (!subscriptionManager.activateSerial(m_pTextEditSerialKey->toPlainText())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_pPluginPage->setEdition(m_Edition);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (currentPage() == m_pNodePage)
|
||||
if (currentPage() == m_pNodePage)
|
||||
{
|
||||
bool result = m_pClientRadioButton->isChecked() ||
|
||||
m_pServerRadioButton->isChecked();
|
||||
@@ -198,31 +124,6 @@ void SetupWizard::accept()
|
||||
settings.setValue("groupServerChecked", false);
|
||||
}
|
||||
|
||||
if (m_pRadioButtonActivate->isChecked()) {
|
||||
appConfig.setActivateEmail(m_pLineEditEmail->text());
|
||||
|
||||
notifyActivation("login:" + m_pLineEditEmail->text());
|
||||
}
|
||||
|
||||
if (m_pRadioButtonSubscription->isChecked())
|
||||
{
|
||||
appConfig.setSerialKey(m_pTextEditSerialKey->toPlainText());
|
||||
|
||||
notifyActivation("serial:" + m_pTextEditSerialKey->toPlainText());
|
||||
}
|
||||
|
||||
if (m_pRadioButtonSkip->isChecked())
|
||||
{
|
||||
notifyActivation("skip:unknown");
|
||||
}
|
||||
|
||||
appConfig.setEdition(m_Edition);
|
||||
m_MainWindow.setEdition(m_Edition);
|
||||
m_MainWindow.updateLocalFingerprint();
|
||||
|
||||
appConfig.saveSettings();
|
||||
settings.sync();
|
||||
|
||||
QWizard::accept();
|
||||
|
||||
if (m_StartMain)
|
||||
@@ -238,60 +139,14 @@ void SetupWizard::reject()
|
||||
|
||||
if (m_StartMain)
|
||||
{
|
||||
m_MainWindow.setEdition(m_Edition);
|
||||
m_MainWindow.open();
|
||||
}
|
||||
|
||||
// treat cancel as skip
|
||||
notifyActivation("skip:unknown");
|
||||
|
||||
QWizard::reject();
|
||||
}
|
||||
|
||||
void SetupWizard::notifyActivation(QString identity)
|
||||
{
|
||||
ActivationNotifier* notifier = new ActivationNotifier();
|
||||
notifier->setIdentity(identity);
|
||||
QThread* thread = new QThread;
|
||||
connect(notifier, SIGNAL(finished()), thread, SLOT(quit()));
|
||||
connect(notifier, SIGNAL(finished()), notifier, SLOT(deleteLater()));
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
notifier->moveToThread(thread);
|
||||
thread->start();
|
||||
|
||||
QMetaObject::invokeMethod(notifier, "notify", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void SetupWizard::on_m_pComboLanguage_currentIndexChanged(int index)
|
||||
{
|
||||
QString ietfCode = m_pComboLanguage->itemData(index).toString();
|
||||
QSynergyApplication::getInstance()->switchTranslator(ietfCode);
|
||||
}
|
||||
|
||||
void SetupWizard::on_m_pRadioButtonSkip_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
m_pLineEditEmail->setEnabled(false);
|
||||
m_pLineEditPassword->setEnabled(false);
|
||||
m_pTextEditSerialKey->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupWizard::on_m_pRadioButtonActivate_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
m_pLineEditEmail->setEnabled(true);
|
||||
m_pLineEditPassword->setEnabled(true);
|
||||
m_pTextEditSerialKey->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupWizard::on_m_pRadioButtonSubscription_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
m_pLineEditEmail->setEnabled(false);
|
||||
m_pLineEditPassword->setEnabled(false);
|
||||
m_pTextEditSerialKey->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "ui_SetupWizardBase.h"
|
||||
#include "SynergyLocale.h"
|
||||
#include "PluginWizardPage.h"
|
||||
|
||||
#include <QWizard>
|
||||
#include <QNetworkAccessManager>
|
||||
@@ -43,19 +42,12 @@ protected:
|
||||
void changeEvent(QEvent* event);
|
||||
void accept();
|
||||
void reject();
|
||||
void notifyActivation(QString identity);
|
||||
|
||||
private:
|
||||
MainWindow& m_MainWindow;
|
||||
bool m_StartMain;
|
||||
SynergyLocale m_Locale;
|
||||
int m_Edition;
|
||||
PluginWizardPage* m_pPluginPage;
|
||||
int m_LoginAttemps;
|
||||
|
||||
private slots:
|
||||
void on_m_pRadioButtonSubscription_toggled(bool checked);
|
||||
void on_m_pRadioButtonActivate_toggled(bool checked);
|
||||
void on_m_pRadioButtonSkip_toggled(bool checked);
|
||||
void on_m_pComboLanguage_currentIndexChanged(int index);
|
||||
};
|
||||
|
||||
@@ -90,56 +90,59 @@ bool SslCertificate::runTool(const QStringList& args)
|
||||
|
||||
void SslCertificate::generateCertificate()
|
||||
{
|
||||
QStringList arguments;
|
||||
|
||||
// self signed certificate
|
||||
arguments.append("req");
|
||||
arguments.append("-x509");
|
||||
arguments.append("-nodes");
|
||||
|
||||
// valide duration
|
||||
arguments.append("-days");
|
||||
arguments.append(kCertificateLifetime);
|
||||
|
||||
// subject information
|
||||
arguments.append("-subj");
|
||||
|
||||
QString subInfo(kCertificateSubjectInfo);
|
||||
arguments.append(subInfo);
|
||||
|
||||
// private key
|
||||
arguments.append("-newkey");
|
||||
arguments.append("rsa:1024");
|
||||
|
||||
QString sslDirPath = QString("%1%2%3")
|
||||
.arg(m_ProfileDir)
|
||||
.arg(QDir::separator())
|
||||
.arg(kSslDir);
|
||||
|
||||
QDir sslDir(sslDirPath);
|
||||
if (!sslDir.exists()) {
|
||||
sslDir.mkpath(".");
|
||||
}
|
||||
|
||||
QString filename = QString("%1%2%3")
|
||||
.arg(sslDirPath)
|
||||
.arg(QDir::separator())
|
||||
.arg(kCertificateFilename);
|
||||
|
||||
// key output filename
|
||||
arguments.append("-keyout");
|
||||
arguments.append(filename);
|
||||
QFile file(filename);
|
||||
if (!file.exists()) {
|
||||
QStringList arguments;
|
||||
|
||||
// certificate output filename
|
||||
arguments.append("-out");
|
||||
arguments.append(filename);
|
||||
// self signed certificate
|
||||
arguments.append("req");
|
||||
arguments.append("-x509");
|
||||
arguments.append("-nodes");
|
||||
|
||||
if (!runTool(arguments)) {
|
||||
return;
|
||||
// valide duration
|
||||
arguments.append("-days");
|
||||
arguments.append(kCertificateLifetime);
|
||||
|
||||
// subject information
|
||||
arguments.append("-subj");
|
||||
|
||||
QString subInfo(kCertificateSubjectInfo);
|
||||
arguments.append(subInfo);
|
||||
|
||||
// private key
|
||||
arguments.append("-newkey");
|
||||
arguments.append("rsa:1024");
|
||||
|
||||
QDir sslDir(sslDirPath);
|
||||
if (!sslDir.exists()) {
|
||||
sslDir.mkpath(".");
|
||||
}
|
||||
|
||||
// key output filename
|
||||
arguments.append("-keyout");
|
||||
arguments.append(filename);
|
||||
|
||||
// certificate output filename
|
||||
arguments.append("-out");
|
||||
arguments.append(filename);
|
||||
|
||||
if (!runTool(arguments)) {
|
||||
return;
|
||||
}
|
||||
|
||||
emit info(tr("SSL certificate generated."));
|
||||
}
|
||||
|
||||
emit info(tr("SSL certificate generated."));
|
||||
|
||||
generateFingerprint(filename);
|
||||
|
||||
emit generateFinished();
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Synergy Seamless Inc.
|
||||
*
|
||||
* 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 "SubscriptionManager.h"
|
||||
|
||||
|
||||
#include "CoreInterface.h"
|
||||
#include "EditionType.h"
|
||||
#include "AppConfig.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QDateTime>
|
||||
#include <QDate>
|
||||
|
||||
static const char purchaseURL[] = "https://symless.com/account/";
|
||||
|
||||
SubscriptionManager::SubscriptionManager(QWidget* parent, AppConfig& appConfig, int& edition) :
|
||||
m_pParent(parent),
|
||||
m_AppConfig(appConfig),
|
||||
m_Edition(edition)
|
||||
{
|
||||
}
|
||||
|
||||
bool SubscriptionManager::activateSerial(const QString& serial)
|
||||
{
|
||||
m_Edition = Unknown;
|
||||
persistDirectory();
|
||||
CoreInterface coreInterface;
|
||||
QString output;
|
||||
|
||||
try
|
||||
{
|
||||
output = coreInterface.activateSerial(serial);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
m_ErrorMessage = e.what();
|
||||
checkError(m_ErrorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
checkOutput(output);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SubscriptionManager::checkSubscription()
|
||||
{
|
||||
m_Edition = Unknown;
|
||||
persistDirectory();
|
||||
CoreInterface coreInterface;
|
||||
QString output;
|
||||
try
|
||||
{
|
||||
output = coreInterface.checkSubscription();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
m_ErrorMessage = e.what();
|
||||
checkError(m_ErrorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
checkOutput(output);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SubscriptionManager::fileExists()
|
||||
{
|
||||
CoreInterface coreInterface;
|
||||
QString subscriptionFilename = coreInterface.getSubscriptionFilename();
|
||||
|
||||
return QFile::exists(subscriptionFilename);
|
||||
}
|
||||
|
||||
void SubscriptionManager::checkError(QString& error)
|
||||
{
|
||||
if (error.contains("trial has expired")) {
|
||||
QMessageBox::warning(m_pParent, tr("Subscription warning"),
|
||||
tr("Your trial has expired. Click <a href='%1'>here</a> to purchase").arg(purchaseURL));
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(m_pParent, tr("Subscription error"),
|
||||
tr("An error occurred while trying to activate using a serial key. "
|
||||
"Please contact the helpdesk, and provide the "
|
||||
"following details.\n\n%1").arg(error));
|
||||
}
|
||||
}
|
||||
|
||||
void SubscriptionManager::checkOutput(QString& output)
|
||||
{
|
||||
getEditionType(output);
|
||||
checkExpiring(output);
|
||||
}
|
||||
|
||||
void SubscriptionManager::getEditionType(QString& output)
|
||||
{
|
||||
if (output.contains("pro subscription valid")) {
|
||||
m_Edition = Pro;
|
||||
}
|
||||
else if (output.contains("basic subscription valid")) {
|
||||
m_Edition = Basic;
|
||||
}
|
||||
else if (output.contains("trial subscription valid")) {
|
||||
m_Edition = Trial;
|
||||
}
|
||||
}
|
||||
|
||||
void SubscriptionManager::checkExpiring(QString& output)
|
||||
{
|
||||
if (output.contains("trial will end in") && shouldWarnExpiring()) {
|
||||
QRegExp dayLeftRegex(".*trial will end in ([0-9]+) day.*");
|
||||
if (dayLeftRegex.exactMatch(output)) {
|
||||
QString dayLeft = dayLeftRegex.cap(1);
|
||||
|
||||
QMessageBox::warning(m_pParent, tr("Subscription warning"),
|
||||
tr("Your trial will end in %1 %2. Click <a href='%3'>here</a> to purchase")
|
||||
.arg(dayLeft)
|
||||
.arg(dayLeft == "1" ? "day" : "days")
|
||||
.arg(purchaseURL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SubscriptionManager::shouldWarnExpiring()
|
||||
{
|
||||
// warn users about expiring subscription once a day
|
||||
int lastExpiringWarningTime = m_AppConfig.lastExpiringWarningTime();
|
||||
QDateTime currentDateTime = QDateTime::currentDateTime();
|
||||
int currentTime = currentDateTime.toTime_t();
|
||||
const int secondPerDay = 60 * 60 * 24;
|
||||
bool result = false;
|
||||
if ((currentTime - lastExpiringWarningTime) > secondPerDay) {
|
||||
result = true;
|
||||
m_AppConfig.setLastExpiringWarningTime(currentTime);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void SubscriptionManager::persistDirectory()
|
||||
{
|
||||
CoreInterface coreInterface;
|
||||
QString profileDir = coreInterface.getProfileDir();
|
||||
|
||||
QDir dir(profileDir);
|
||||
if (!dir.exists()) {
|
||||
dir.mkpath(".");
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Synergy Seamless Inc.
|
||||
*
|
||||
* 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 <QWidget>
|
||||
|
||||
class AppConfig;
|
||||
|
||||
class SubscriptionManager : public QWidget
|
||||
{
|
||||
public:
|
||||
SubscriptionManager(QWidget* parent, AppConfig& appConfig, int& edition);
|
||||
|
||||
bool activateSerial(const QString& serial);
|
||||
bool checkSubscription();
|
||||
bool fileExists();
|
||||
QString getLastError(){ return m_ErrorMessage; }
|
||||
|
||||
private:
|
||||
void checkError(QString& error);
|
||||
void checkOutput(QString& output);
|
||||
void getEditionType(QString& output);
|
||||
void checkExpiring(QString& output);
|
||||
bool shouldWarnExpiring();
|
||||
void persistDirectory();
|
||||
|
||||
private:
|
||||
QString m_ErrorMessage;
|
||||
QWidget* m_pParent;
|
||||
AppConfig& m_AppConfig;
|
||||
int& m_Edition;
|
||||
};
|
||||
@@ -51,8 +51,10 @@ void VersionChecker::replyFinished(QNetworkReply* reply)
|
||||
if (!newestVersion.isEmpty())
|
||||
{
|
||||
QString currentVersion = getVersion();
|
||||
if (compareVersions(currentVersion, newestVersion) > 0)
|
||||
emit updateFound(newestVersion);
|
||||
if (currentVersion != "Unknown") {
|
||||
if (compareVersions(currentVersion, newestVersion) > 0)
|
||||
emit updateFound(newestVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,76 +25,60 @@
|
||||
#include <QCoreApplication>
|
||||
#include <stdexcept>
|
||||
|
||||
int WebClient::getEdition(
|
||||
const QString& email,
|
||||
const QString& password,
|
||||
QMessageBox& message,
|
||||
QWidget* w)
|
||||
{
|
||||
QString responseJson;
|
||||
int edition = Unknown;
|
||||
try {
|
||||
responseJson = request(email, password);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
message.critical(
|
||||
w, "Error",
|
||||
tr("An error occurred while trying to sign in. "
|
||||
"Please contact the helpdesk, and provide the "
|
||||
"following details.\n\n%1").arg(e.what()));
|
||||
return edition;
|
||||
}
|
||||
bool
|
||||
WebClient::getEdition (int& edition, QString& errorOut) {
|
||||
QString responseJson = request();
|
||||
|
||||
/* TODO: This is horrible and should be ripped out as soon as we move
|
||||
* to Qt 5. See issue #5630
|
||||
*/
|
||||
|
||||
QRegExp resultRegex(".*\"result\".*:.*(true|false).*");
|
||||
if (resultRegex.exactMatch(responseJson)) {
|
||||
if (resultRegex.exactMatch (responseJson)) {
|
||||
QString boolString = resultRegex.cap(1);
|
||||
if (boolString == "true") {
|
||||
QRegExp editionRegex(".*\"edition\".*:.*\"([^\"]+)\".*");
|
||||
if (editionRegex.exactMatch(responseJson)) {
|
||||
QString e = editionRegex.cap(1);
|
||||
edition = e.toInt();
|
||||
return true;
|
||||
} else {
|
||||
throw std::runtime_error ("Unrecognised server response.");
|
||||
}
|
||||
|
||||
return edition;
|
||||
} else {
|
||||
errorOut = tr("Login failed. Invalid email address or password.");
|
||||
return false;
|
||||
}
|
||||
else if (boolString == "false") {
|
||||
message.critical(
|
||||
w, "Error",
|
||||
tr("Login failed, invalid email or password."));
|
||||
|
||||
return edition;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
QRegExp errorRegex(".*\"error\".*:.*\"([^\"]+)\".*");
|
||||
if (errorRegex.exactMatch(responseJson)) {
|
||||
|
||||
// replace "\n" with real new lines.
|
||||
QString error = errorRegex.cap(1).replace("\\n", "\n");
|
||||
message.critical(
|
||||
w, "Error",
|
||||
tr("Login failed, an error occurred.\n\n%1").arg(error));
|
||||
|
||||
return edition;
|
||||
if (errorRegex.exactMatch (responseJson)) {
|
||||
errorOut = errorRegex.cap(1).replace("\\n", "\n");
|
||||
return false;
|
||||
} else {
|
||||
throw std::runtime_error ("Unrecognised server response.");
|
||||
}
|
||||
}
|
||||
|
||||
message.critical(
|
||||
w, "Error",
|
||||
tr("Login failed, an error occurred.\n\nServer response:\n\n%1")
|
||||
.arg(responseJson));
|
||||
|
||||
return edition;
|
||||
}
|
||||
|
||||
QString WebClient::request(
|
||||
const QString& email,
|
||||
const QString& password)
|
||||
{
|
||||
bool
|
||||
WebClient::setEmail (QString email, QString& errorOut) {
|
||||
if (email.isEmpty()) {
|
||||
errorOut = tr("Your email address cannot be left blank.");
|
||||
return false;
|
||||
}
|
||||
m_Email = email;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
WebClient::setPassword (QString password, QString&) {
|
||||
m_Password = password;
|
||||
return true;
|
||||
}
|
||||
|
||||
QString
|
||||
WebClient::request() {
|
||||
QStringList args("--login-auth");
|
||||
// hash password in case it contains interesting chars.
|
||||
QString credentials(email + ":" + hash(password) + "\n");
|
||||
|
||||
return m_CoreInterface.run(args, credentials);
|
||||
QString credentials (m_Email + ":" + hash(m_Password) + "\n");
|
||||
return m_CoreInterface.run (args, credentials);
|
||||
}
|
||||
|
||||
@@ -32,21 +32,15 @@ class WebClient : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
int getEdition(const QString& email,
|
||||
const QString& password,
|
||||
QMessageBox& message,
|
||||
QWidget* w);
|
||||
void setEmail(QString& e) { m_Email = e; }
|
||||
void setPassword(QString& p) { m_Password = p; }
|
||||
|
||||
bool getEdition (int& edition, QString& errorOut);
|
||||
bool setEmail (QString email, QString& errorOut);
|
||||
bool setPassword (QString password, QString& errorOut);
|
||||
signals:
|
||||
void error(QString e);
|
||||
|
||||
private:
|
||||
QString request(const QString& email,
|
||||
const QString& password);
|
||||
|
||||
private:
|
||||
QString request();
|
||||
|
||||
QString m_Email;
|
||||
QString m_Password;
|
||||
CoreInterface m_CoreInterface;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@@ -20,6 +20,7 @@
|
||||
#define TRAY_RETRY_WAIT 2000
|
||||
|
||||
#include "QSynergyApplication.h"
|
||||
#include "LicenseManager.h"
|
||||
#include "MainWindow.h"
|
||||
#include "AppConfig.h"
|
||||
#include "SetupWizard.h"
|
||||
@@ -65,7 +66,7 @@ int main(int argc, char* argv[])
|
||||
"Please drag Synergy to the Applications folder, and open it from there.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (!checkMacAssistiveDevices())
|
||||
{
|
||||
return 1;
|
||||
@@ -82,11 +83,13 @@ int main(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
QSettings settings;
|
||||
AppConfig appConfig(&settings);
|
||||
AppConfig appConfig (&settings);
|
||||
qRegisterMetaType<Edition>("Edition");
|
||||
LicenseManager licenseManager (&appConfig);
|
||||
|
||||
app.switchTranslator(appConfig.language());
|
||||
|
||||
MainWindow mainWindow(settings, appConfig);
|
||||
MainWindow mainWindow(settings, appConfig, licenseManager);
|
||||
SetupWizard setupWizard(mainWindow, true);
|
||||
|
||||
if (appConfig.wizardShouldRun())
|
||||
@@ -116,8 +119,8 @@ int waitForTray()
|
||||
if (++trayAttempts > TRAY_RETRY_COUNT)
|
||||
{
|
||||
QMessageBox::critical(NULL, "Synergy",
|
||||
QObject::tr("System tray is unavailable, quitting."));
|
||||
return false;
|
||||
QObject::tr("System tray is unavailable, don't close your window."));
|
||||
return true;
|
||||
}
|
||||
|
||||
QThreadImpl::msleep(TRAY_RETRY_WAIT);
|
||||
@@ -156,7 +159,8 @@ bool checkMacAssistiveDevices()
|
||||
QMessageBox::information(
|
||||
NULL, "Synergy",
|
||||
"Please enable access to assistive devices "
|
||||
"(System Preferences), then re-open Synergy.");
|
||||
"System Preferences -> Security & Privacy -> "
|
||||
"Privacy -> Accessibility, then re-open Synergy.");
|
||||
}
|
||||
return result;
|
||||
|
||||
|
||||
@@ -23,10 +23,9 @@ add_subdirectory(ipc)
|
||||
add_subdirectory(mt)
|
||||
add_subdirectory(net)
|
||||
add_subdirectory(platform)
|
||||
add_subdirectory(plugin)
|
||||
add_subdirectory(server)
|
||||
add_subdirectory(synergy)
|
||||
|
||||
add_subdirectory(shared)
|
||||
|
||||
if (WIN32)
|
||||
add_subdirectory(synwinhk)
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
# include "arch/win32/ArchSystemWindows.h"
|
||||
# include "arch/win32/ArchTaskBarWindows.h"
|
||||
# include "arch/win32/ArchTimeWindows.h"
|
||||
# include "arch/win32/ArchPluginWindows.h"
|
||||
# include "arch/win32/ArchInternetWindows.h"
|
||||
#elif SYSAPI_UNIX
|
||||
# include "arch/unix/ArchConsoleUnix.h"
|
||||
@@ -66,7 +65,6 @@
|
||||
# include "arch/unix/ArchSystemUnix.h"
|
||||
# include "arch/unix/ArchTaskBarXWindows.h"
|
||||
# include "arch/unix/ArchTimeUnix.h"
|
||||
# include "arch/unix/ArchPluginUnix.h"
|
||||
# include "arch/unix/ArchInternetUnix.h"
|
||||
#endif
|
||||
|
||||
@@ -122,12 +120,10 @@ public:
|
||||
|
||||
static void setInstance(Arch* s) { s_instance = s; }
|
||||
|
||||
ARCH_PLUGIN& plugin() const { return (ARCH_PLUGIN&)m_plugin; }
|
||||
ARCH_INTERNET& internet() const { return (ARCH_INTERNET&)m_internet; }
|
||||
|
||||
private:
|
||||
static Arch* s_instance;
|
||||
ARCH_PLUGIN m_plugin;
|
||||
ARCH_INTERNET m_internet;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* 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 "common/IInterface.h"
|
||||
#include "common/stdmap.h"
|
||||
#include "base/String.h"
|
||||
|
||||
class IEventQueue;
|
||||
|
||||
//! Interface for plugin manager.
|
||||
/*!
|
||||
A plugin manager should load all 3rd party plugins from the plugins dir,
|
||||
and then look for common function names in the plugins.
|
||||
*/
|
||||
class IArchPlugin : public IInterface {
|
||||
public:
|
||||
//! @name manipulators
|
||||
//@{
|
||||
|
||||
//!Load plugins
|
||||
/*!
|
||||
Scan the plugins dir and load plugins.
|
||||
*/
|
||||
virtual void load() = 0;
|
||||
|
||||
//!Unload plugins
|
||||
/*!
|
||||
Look through the loaded plugins and unload them.
|
||||
*/
|
||||
virtual void unload() = 0;
|
||||
|
||||
//! Init the common parts
|
||||
/*!
|
||||
Initializes common parts like log and arch.
|
||||
*/
|
||||
virtual void init(void* log, void* arch) = 0;
|
||||
|
||||
//! Init the event part
|
||||
/*!
|
||||
Initializes event parts.
|
||||
*/
|
||||
virtual void initEvent(void* eventTarget, IEventQueue* events) = 0;
|
||||
|
||||
//! Check if exists
|
||||
/*!
|
||||
Returns true if the plugin exists and is loaded.
|
||||
*/
|
||||
virtual bool exists(const char* name) = 0;
|
||||
|
||||
//! Invoke function
|
||||
/*!
|
||||
Invokes a function from the plugin.
|
||||
*/
|
||||
virtual void* invoke(const char* plugin,
|
||||
const char* command,
|
||||
void** args,
|
||||
void* library = NULL) = 0;
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
typedef std::map<String, void*> PluginTable;
|
||||
};
|
||||
@@ -117,9 +117,11 @@ ArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
|
||||
open("/dev/null", O_RDWR);
|
||||
|
||||
int dupErr = dup(1);
|
||||
if (dupErr)
|
||||
|
||||
if (dupErr < 0) {
|
||||
// NB: file logging actually isn't working at this point!
|
||||
LOG((CLOG_ERR "dup error: %i", dupErr));
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
return execSelfNonDaemonized();
|
||||
|
||||
@@ -116,7 +116,6 @@ CurlFacade::urlEncode(const String& url)
|
||||
char* resultCStr = curl_easy_escape(m_curl, url.c_str(), 0);
|
||||
|
||||
if (resultCStr == NULL) {
|
||||
curl_free(resultCStr);
|
||||
throw XArch("CURL escape failed.");
|
||||
}
|
||||
|
||||
|
||||
@@ -697,7 +697,7 @@ void*
|
||||
ArchMultithreadPosix::threadFunc(void* vrep)
|
||||
{
|
||||
// get the thread
|
||||
ArchThreadImpl* thread = reinterpret_cast<ArchThreadImpl*>(vrep);
|
||||
ArchThreadImpl* thread = static_cast<ArchThreadImpl*>(vrep);
|
||||
|
||||
// setup pthreads
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
||||
|
||||
@@ -646,7 +646,7 @@ ArchNetworkBSD::newAnyAddr(EAddressFamily family)
|
||||
switch (family) {
|
||||
case kINET: {
|
||||
struct sockaddr_in* ipAddr =
|
||||
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr);
|
||||
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr);
|
||||
ipAddr->sin_family = AF_INET;
|
||||
ipAddr->sin_port = 0;
|
||||
ipAddr->sin_addr.s_addr = INADDR_ANY;
|
||||
@@ -737,8 +737,7 @@ ArchNetworkBSD::addrToName(ArchNetAddress addr)
|
||||
|
||||
// mutexed name lookup (ugh)
|
||||
ARCH->lockMutex(m_mutex);
|
||||
struct hostent* info = gethostbyaddr(
|
||||
reinterpret_cast<const char*>(&addr->m_addr),
|
||||
struct hostent* info = gethostbyaddr(&addr->m_addr,
|
||||
addr->m_len, addr->m_addr.sa_family);
|
||||
if (info == NULL) {
|
||||
ARCH->unlockMutex(m_mutex);
|
||||
@@ -834,7 +833,7 @@ ArchNetworkBSD::isAnyAddr(ArchNetAddress addr)
|
||||
switch (getAddrFamily(addr)) {
|
||||
case kINET: {
|
||||
struct sockaddr_in* ipAddr =
|
||||
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr);
|
||||
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr);
|
||||
return (ipAddr->sin_addr.s_addr == INADDR_ANY &&
|
||||
addr->m_len == (socklen_t)sizeof(struct sockaddr_in));
|
||||
}
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* 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 "arch/unix/ArchPluginUnix.h"
|
||||
|
||||
#include "arch/unix/XArchUnix.h"
|
||||
#include "common/PluginVersion.h"
|
||||
#include "base/IEventQueue.h"
|
||||
#include "base/Event.h"
|
||||
#include "base/Log.h"
|
||||
|
||||
#include <vector>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
typedef void (*initFunc)(void*, void*);
|
||||
typedef int (*initEventFunc)(void (*sendEvent)(const char*, void*));
|
||||
typedef void* (*invokeFunc)(const char*, void*);
|
||||
typedef void (*cleanupFunc)();
|
||||
|
||||
void* g_eventTarget = NULL;
|
||||
IEventQueue* g_events = NULL;
|
||||
|
||||
ArchPluginUnix::ArchPluginUnix()
|
||||
{
|
||||
}
|
||||
|
||||
ArchPluginUnix::~ArchPluginUnix()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginUnix::load()
|
||||
{
|
||||
String pluginsDir = getPluginsDir();
|
||||
LOG((CLOG_DEBUG "plugins dir: %s", pluginsDir.c_str()));
|
||||
|
||||
struct dirent* de = NULL;
|
||||
DIR* dir = NULL;
|
||||
|
||||
dir = opendir(pluginsDir.c_str());
|
||||
if (dir == NULL) {
|
||||
LOG((CLOG_DEBUG "can't open plugins dir: %s",
|
||||
pluginsDir.c_str()));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<String> plugins;
|
||||
while ((de = readdir(dir)) != NULL) {
|
||||
// ignore hidden files and diretories like .. and .
|
||||
if (de->d_name[0] != '.') {
|
||||
plugins.push_back(de->d_name);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
std::vector<String>::iterator it;
|
||||
for (it = plugins.begin(); it != plugins.end(); ++it) {
|
||||
String filename = *it;
|
||||
String path = synergy::string::sprintf(
|
||||
"%s/%s", pluginsDir.c_str(), filename.c_str());
|
||||
String name = synergy::string::removeFileExt(filename.substr(3));
|
||||
|
||||
LOG((CLOG_DEBUG "loading plugin: %s", filename.c_str()));
|
||||
void* handle = dlopen(path.c_str(), RTLD_LAZY);
|
||||
|
||||
if (handle == NULL) {
|
||||
LOG((CLOG_ERR "failed to load plugin '%s', error: %s",
|
||||
filename.c_str(), dlerror()));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
String expectedVersion = getExpectedPluginVersion(name.c_str());
|
||||
String currentVersion = getCurrentVersion(name, handle);
|
||||
|
||||
if (currentVersion.empty() || (expectedVersion != currentVersion)) {
|
||||
LOG((CLOG_ERR
|
||||
"failed to load plugin '%s', "
|
||||
"expected version %s but was %s",
|
||||
filename.c_str(),
|
||||
expectedVersion.c_str(),
|
||||
currentVersion.empty() ? "unknown" : currentVersion.c_str()));
|
||||
|
||||
dlclose(handle);
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG((CLOG_DEBUG "plugin loaded: %s (version %s)",
|
||||
filename.c_str(),
|
||||
currentVersion.c_str()));
|
||||
|
||||
m_pluginTable.insert(std::make_pair(name, handle));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginUnix::unload()
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
cleanupFunc cleanup = (cleanupFunc)dlsym(it->second, "cleanup");
|
||||
if (cleanup != NULL) {
|
||||
cleanup();
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no cleanup function in %s", it->first.c_str()));
|
||||
}
|
||||
|
||||
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
||||
dlclose(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginUnix::init(void* log, void* arch)
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
initFunc initPlugin = (initFunc)dlsym(it->second, "init");
|
||||
if (initPlugin != NULL) {
|
||||
initPlugin(log, arch);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginUnix::initEvent(void* eventTarget, IEventQueue* events)
|
||||
{
|
||||
g_eventTarget = eventTarget;
|
||||
g_events = events;
|
||||
|
||||
PluginTable::iterator it;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
initEventFunc initEventPlugin = (initEventFunc)dlsym(it->second, "initEvent");
|
||||
if (initEventPlugin != NULL) {
|
||||
initEventPlugin(&sendEvent);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init event function in %s", it->first.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ArchPluginUnix::exists(const char* name)
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
it = m_pluginTable.find(name);
|
||||
return it != m_pluginTable.end() ? true : false;
|
||||
}
|
||||
|
||||
void*
|
||||
ArchPluginUnix::invoke(
|
||||
const char* plugin,
|
||||
const char* command,
|
||||
void** args,
|
||||
void* library)
|
||||
{
|
||||
void* lib = NULL;
|
||||
|
||||
if (library == NULL) {
|
||||
PluginTable::iterator it;
|
||||
it = m_pluginTable.find(plugin);
|
||||
if (it != m_pluginTable.end()) {
|
||||
lib = it->second;
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "invoke command failed, plugin: %s command: %s",
|
||||
plugin, command));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lib = library;
|
||||
}
|
||||
|
||||
invokeFunc invokePlugin = (invokeFunc)dlsym(lib, "invoke");
|
||||
void* result = NULL;
|
||||
if (invokePlugin != NULL) {
|
||||
result = invokePlugin(command, args);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no invoke function in %s", plugin));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
String
|
||||
ArchPluginUnix::getPluginsDir()
|
||||
{
|
||||
return ARCH->getPluginDirectory();
|
||||
}
|
||||
|
||||
String
|
||||
ArchPluginUnix::getCurrentVersion(const String& name, void* handle)
|
||||
{
|
||||
char* version = (char*)invoke(name.c_str(), "version", NULL, handle);
|
||||
if (version == NULL) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
void
|
||||
sendEvent(const char* eventName, void* data)
|
||||
{
|
||||
LOG((CLOG_DEBUG5 "plugin sending event"));
|
||||
Event::Type type = g_events->getRegisteredType(eventName);
|
||||
g_events->addEvent(Event(type, g_eventTarget, data));
|
||||
}
|
||||
|
||||
void
|
||||
log(const char* text)
|
||||
{
|
||||
LOG((CLOG_DEBUG "plugin: %s", text));
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* 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 "arch/IArchPlugin.h"
|
||||
|
||||
#define ARCH_PLUGIN ArchPluginUnix
|
||||
|
||||
class IEventQueue;
|
||||
|
||||
//! Unix implementation of IArchPlugin
|
||||
class ArchPluginUnix : public IArchPlugin {
|
||||
public:
|
||||
ArchPluginUnix();
|
||||
virtual ~ArchPluginUnix();
|
||||
|
||||
// IArchPlugin overrides
|
||||
void load();
|
||||
void unload();
|
||||
void init(void* log, void* arch);
|
||||
void initEvent(void* eventTarget, IEventQueue* events);
|
||||
bool exists(const char* name);
|
||||
virtual void* invoke(const char* pluginName,
|
||||
const char* functionName,
|
||||
void** args,
|
||||
void* library = NULL);
|
||||
|
||||
private:
|
||||
String getPluginsDir();
|
||||
String getCurrentVersion(const String& name, void* handle);
|
||||
|
||||
private:
|
||||
PluginTable m_pluginTable;
|
||||
};
|
||||
|
||||
void sendEvent(const char* text, void* data);
|
||||
void log(const char* text);
|
||||
@@ -76,5 +76,5 @@ ArchSystemUnix::setting(const std::string&, const std::string&) const
|
||||
std::string
|
||||
ArchSystemUnix::getLibsUsed(void) const
|
||||
{
|
||||
return "not implmented.\nuse lsof on shell";
|
||||
return "not implemented.\nuse lsof on shell";
|
||||
}
|
||||
|
||||
@@ -661,7 +661,7 @@ unsigned int __stdcall
|
||||
ArchMultithreadWindows::threadFunc(void* vrep)
|
||||
{
|
||||
// get the thread
|
||||
ArchThreadImpl* thread = reinterpret_cast<ArchThreadImpl*>(vrep);
|
||||
ArchThreadImpl* thread = static_cast<ArchThreadImpl*>(vrep);
|
||||
|
||||
// run thread
|
||||
s_instance->doThreadFunc(thread);
|
||||
|
||||
@@ -805,7 +805,7 @@ ArchNetworkWinsock::setAddrPort(ArchNetAddress addr, int port)
|
||||
case kINET: {
|
||||
struct sockaddr_in* ipAddr =
|
||||
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr);
|
||||
ipAddr->sin_port = htons_winsock(static_cast<u_short>(port));
|
||||
ipAddr->sin_port = htons_winsock(port);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* 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 "arch/win32/ArchPluginWindows.h"
|
||||
#include "arch/win32/XArchWindows.h"
|
||||
#include "common/PluginVersion.h"
|
||||
#include "base/Log.h"
|
||||
#include "base/IEventQueue.h"
|
||||
#include "base/Event.h"
|
||||
#include "synergy/Screen.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <iostream>
|
||||
|
||||
typedef void (*initFunc)(void*, void*);
|
||||
typedef int (*initEventFunc)(void (*sendEvent)(const char*, void*));
|
||||
typedef void* (*invokeFunc)(const char*, void**);
|
||||
typedef void (*cleanupFunc)();
|
||||
|
||||
void* g_eventTarget = NULL;
|
||||
IEventQueue* g_events = NULL;
|
||||
static const char * kPre174Plugin = "Pre-1.7.v";
|
||||
|
||||
ArchPluginWindows::ArchPluginWindows()
|
||||
{
|
||||
}
|
||||
|
||||
ArchPluginWindows::~ArchPluginWindows()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginWindows::load()
|
||||
{
|
||||
String dir = getPluginsDir();
|
||||
LOG((CLOG_DEBUG "plugins dir: %s", dir.c_str()));
|
||||
|
||||
String pattern = String(dir).append("\\*.dll");
|
||||
std::vector<String> plugins;
|
||||
getFilenames(pattern, plugins);
|
||||
|
||||
std::vector<String>::iterator it;
|
||||
for (it = plugins.begin(); it != plugins.end(); ++it) {
|
||||
String filename = *it;
|
||||
String name = synergy::string::removeFileExt(filename);
|
||||
String path = synergy::string::sprintf(
|
||||
"%s\\%s", dir.c_str(), filename.c_str());
|
||||
|
||||
LOG((CLOG_DEBUG "loading plugin: %s", filename.c_str()));
|
||||
HINSTANCE handle = LoadLibrary(path.c_str());
|
||||
void* voidHandle = reinterpret_cast<void*>(handle);
|
||||
|
||||
if (handle == NULL) {
|
||||
String error = XArchEvalWindows().eval();
|
||||
LOG((CLOG_ERR "failed to load plugin '%s', error: %s",
|
||||
filename.c_str(), error.c_str()));
|
||||
continue;
|
||||
}
|
||||
|
||||
String expectedVersion = getExpectedPluginVersion(name.c_str());
|
||||
String currentVersion = getCurrentVersion(name.c_str(), voidHandle);
|
||||
|
||||
if (currentVersion.empty() || (expectedVersion != currentVersion)) {
|
||||
LOG((CLOG_ERR
|
||||
"failed to load plugin '%s', "
|
||||
"expected version %s but was %s",
|
||||
filename.c_str(),
|
||||
expectedVersion.c_str(),
|
||||
currentVersion.empty() ? "unknown" : currentVersion.c_str()));
|
||||
|
||||
FreeLibrary(handle);
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG((CLOG_DEBUG "plugin loaded: %s (version %s)",
|
||||
filename.c_str(),
|
||||
currentVersion.c_str()));
|
||||
|
||||
m_pluginTable.insert(std::make_pair(name, voidHandle));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginWindows::unload()
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
HINSTANCE lib;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
cleanupFunc cleanup = (cleanupFunc)GetProcAddress(lib, "cleanup");
|
||||
if (cleanup != NULL) {
|
||||
cleanup();
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no cleanup function in %s", it->first.c_str()));
|
||||
}
|
||||
|
||||
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
||||
FreeLibrary(lib);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginWindows::init(void* log, void* arch)
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
HINSTANCE lib;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
initFunc initPlugin = (initFunc)GetProcAddress(lib, "init");
|
||||
if (initPlugin != NULL) {
|
||||
initPlugin(log, arch);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginWindows::initEvent(void* eventTarget, IEventQueue* events)
|
||||
{
|
||||
g_eventTarget = eventTarget;
|
||||
g_events = events;
|
||||
|
||||
PluginTable::iterator it;
|
||||
HINSTANCE lib;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
initEventFunc initEventPlugin = (initEventFunc)GetProcAddress(lib, "initEvent");
|
||||
if (initEventPlugin != NULL) {
|
||||
initEventPlugin(&sendEvent);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init event function in %s", it->first.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ArchPluginWindows::exists(const char* name)
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
it = m_pluginTable.find(name);
|
||||
return it != m_pluginTable.end() ? true : false;
|
||||
}
|
||||
|
||||
void*
|
||||
ArchPluginWindows::invoke(
|
||||
const char* plugin,
|
||||
const char* command,
|
||||
void** args,
|
||||
void* library)
|
||||
{
|
||||
HINSTANCE lib = NULL;
|
||||
|
||||
if (library == NULL) {
|
||||
PluginTable::iterator it;
|
||||
it = m_pluginTable.find(plugin);
|
||||
if (it != m_pluginTable.end()) {
|
||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "invoke command failed, plugin: %s command: %s",
|
||||
plugin, command));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lib = reinterpret_cast<HINSTANCE>(library);
|
||||
}
|
||||
|
||||
invokeFunc invokePlugin = (invokeFunc)GetProcAddress(lib, "invoke");
|
||||
void* result = NULL;
|
||||
if (invokePlugin != NULL) {
|
||||
result = invokePlugin(command, args);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no invoke function in %s", plugin));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginWindows::getFilenames(const String& pattern, std::vector<String>& filenames)
|
||||
{
|
||||
WIN32_FIND_DATA data;
|
||||
HANDLE find = FindFirstFile(pattern.c_str(), &data);
|
||||
if (find == INVALID_HANDLE_VALUE) {
|
||||
FindClose(find);
|
||||
LOG((CLOG_DEBUG "plugins dir is empty: %s", pattern.c_str()));
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
filenames.push_back(data.cFileName);
|
||||
} while (FindNextFile(find, &data));
|
||||
|
||||
FindClose(find);
|
||||
}
|
||||
|
||||
String
|
||||
ArchPluginWindows::getPluginsDir()
|
||||
{
|
||||
return ARCH->getPluginDirectory();
|
||||
}
|
||||
|
||||
String
|
||||
ArchPluginWindows::getCurrentVersion(const String& name, void* handle)
|
||||
{
|
||||
char* version = (char*)invoke(name.c_str(), "version", NULL, handle);
|
||||
if (version == NULL) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sendEvent(const char* eventName, void* data)
|
||||
{
|
||||
LOG((CLOG_DEBUG5 "plugin sending event"));
|
||||
Event::Type type = g_events->getRegisteredType(eventName);
|
||||
g_events->addEvent(Event(type, g_eventTarget, data));
|
||||
}
|
||||
|
||||
void
|
||||
log(const char* text)
|
||||
{
|
||||
LOG((CLOG_DEBUG "plugin: %s", text));
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* 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 "arch/IArchPlugin.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define ARCH_PLUGIN ArchPluginWindows
|
||||
|
||||
class Screen;
|
||||
class IEventQueue;
|
||||
|
||||
//! Windows implementation of IArchPlugin
|
||||
class ArchPluginWindows : public IArchPlugin {
|
||||
public:
|
||||
ArchPluginWindows();
|
||||
virtual ~ArchPluginWindows();
|
||||
|
||||
// IArchPlugin overrides
|
||||
void load();
|
||||
void unload();
|
||||
void init(void* log, void* arch);
|
||||
void initEvent(void* eventTarget, IEventQueue* events);
|
||||
bool exists(const char* name);
|
||||
void* invoke(const char* pluginName,
|
||||
const char* functionName,
|
||||
void** args,
|
||||
void* library = NULL);
|
||||
|
||||
private:
|
||||
void getFilenames(const String& pattern, std::vector<String>& filenames);
|
||||
String getPluginsDir();
|
||||
String getCurrentVersion(const String& name, void* handle);
|
||||
|
||||
private:
|
||||
PluginTable m_pluginTable;
|
||||
};
|
||||
|
||||
void sendEvent(const char* text, void* data);
|
||||
void log(const char* text);
|
||||
@@ -245,7 +245,7 @@ ArchTaskBarWindows::modifyIconNoLock(
|
||||
receiver->lock();
|
||||
|
||||
// get icon data
|
||||
HICON icon = reinterpret_cast<HICON>(
|
||||
HICON icon = static_cast<HICON>(
|
||||
const_cast<IArchTaskBarReceiver::Icon>(receiver->getIcon()));
|
||||
|
||||
// get tool tip
|
||||
@@ -415,16 +415,15 @@ ArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg,
|
||||
if (msg == WM_NCCREATE) {
|
||||
CREATESTRUCT* createInfo;
|
||||
createInfo = reinterpret_cast<CREATESTRUCT*>(lParam);
|
||||
self = reinterpret_cast<ArchTaskBarWindows*>(
|
||||
self = static_cast<ArchTaskBarWindows*>(
|
||||
createInfo->lpCreateParams);
|
||||
SetWindowLong(hwnd, 0, reinterpret_cast<LONG>(self));
|
||||
SetWindowLongPtr(hwnd, 0, reinterpret_cast<LONG_PTR>(createInfo->lpCreateParams));
|
||||
}
|
||||
else {
|
||||
// get the extra window data and forward the call
|
||||
LONG data = GetWindowLong(hwnd, 0);
|
||||
LONG_PTR data = GetWindowLongPtr(hwnd, 0);
|
||||
if (data != 0) {
|
||||
self = reinterpret_cast<ArchTaskBarWindows*>(
|
||||
reinterpret_cast<void*>(data));
|
||||
self = static_cast<ArchTaskBarWindows*>(reinterpret_cast<void*>(data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,6 +443,7 @@ ArchTaskBarWindows::threadMainLoop()
|
||||
m_taskBarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
|
||||
|
||||
// register a window class
|
||||
LPCTSTR className = TEXT("SynergyTaskBar");
|
||||
WNDCLASSEX classInfo;
|
||||
classInfo.cbSize = sizeof(classInfo);
|
||||
classInfo.style = CS_NOCLOSE;
|
||||
@@ -455,20 +455,20 @@ ArchTaskBarWindows::threadMainLoop()
|
||||
classInfo.hCursor = NULL;
|
||||
classInfo.hbrBackground = NULL;
|
||||
classInfo.lpszMenuName = NULL;
|
||||
classInfo.lpszClassName = TEXT("SynergyTaskBar");
|
||||
classInfo.lpszClassName = className;
|
||||
classInfo.hIconSm = NULL;
|
||||
ATOM windowClass = RegisterClassEx(&classInfo);
|
||||
|
||||
// create window
|
||||
m_hwnd = CreateWindowEx(WS_EX_TOOLWINDOW,
|
||||
reinterpret_cast<LPCTSTR>(windowClass),
|
||||
className,
|
||||
TEXT("Synergy Task Bar"),
|
||||
WS_POPUP,
|
||||
0, 0, 1, 1,
|
||||
NULL,
|
||||
NULL,
|
||||
instanceWin32(),
|
||||
reinterpret_cast<void*>(this));
|
||||
static_cast<void*>(this));
|
||||
|
||||
// signal ready
|
||||
ARCH->lockMutex(m_mutex);
|
||||
@@ -478,7 +478,7 @@ ArchTaskBarWindows::threadMainLoop()
|
||||
|
||||
// handle failure
|
||||
if (m_hwnd == NULL) {
|
||||
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), instanceWin32());
|
||||
UnregisterClass(className, instanceWin32());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -494,13 +494,13 @@ ArchTaskBarWindows::threadMainLoop()
|
||||
// clean up
|
||||
removeAllIcons();
|
||||
DestroyWindow(m_hwnd);
|
||||
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), instanceWin32());
|
||||
UnregisterClass(className, instanceWin32());
|
||||
}
|
||||
|
||||
void*
|
||||
ArchTaskBarWindows::threadEntry(void* self)
|
||||
{
|
||||
reinterpret_cast<ArchTaskBarWindows*>(self)->threadMainLoop();
|
||||
static_cast<ArchTaskBarWindows*>(self)->threadMainLoop();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ ArchTimeWindows::~ArchTimeWindows()
|
||||
{
|
||||
s_freq = 0.0;
|
||||
if (s_mmInstance == NULL) {
|
||||
FreeLibrary(reinterpret_cast<HMODULE>(s_mmInstance));
|
||||
FreeLibrary(static_cast<HMODULE>(s_mmInstance));
|
||||
s_tgt = NULL;
|
||||
s_mmInstance = NULL;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ static
|
||||
void
|
||||
interrupt(Arch::ESignal, void* data)
|
||||
{
|
||||
EventQueue* events = reinterpret_cast<EventQueue*>(data);
|
||||
EventQueue* events = static_cast<EventQueue*>(data);
|
||||
events->addEvent(Event(Event::kQuit));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "client/Client.h"
|
||||
|
||||
#include "../plugin/ns/SecureSocket.h"
|
||||
#include "client/ServerProxy.h"
|
||||
#include "synergy/Screen.h"
|
||||
#include "synergy/FileChunk.h"
|
||||
@@ -33,12 +32,12 @@
|
||||
#include "net/TCPSocket.h"
|
||||
#include "net/IDataSocket.h"
|
||||
#include "net/ISocketFactory.h"
|
||||
#include "net/SecureSocket.h"
|
||||
#include "arch/Arch.h"
|
||||
#include "base/Log.h"
|
||||
#include "base/IEventQueue.h"
|
||||
#include "base/TMethodEventJob.h"
|
||||
#include "base/TMethodJob.h"
|
||||
#include "common/PluginVersion.h"
|
||||
#include "common/stdexcept.h"
|
||||
|
||||
#include <cstring>
|
||||
@@ -72,7 +71,7 @@ Client::Client(
|
||||
m_sendFileThread(NULL),
|
||||
m_writeToDropDirThread(NULL),
|
||||
m_socket(NULL),
|
||||
m_useSecureNetwork(false),
|
||||
m_useSecureNetwork(args.m_enableCrypto),
|
||||
m_args(args),
|
||||
m_enableClipboard(true)
|
||||
{
|
||||
@@ -99,13 +98,6 @@ Client::Client(
|
||||
new TMethodEventJob<Client>(this,
|
||||
&Client::handleFileRecieveCompleted));
|
||||
}
|
||||
|
||||
if (m_args.m_enableCrypto) {
|
||||
m_useSecureNetwork = ARCH->plugin().exists(s_pluginNames[kSecureSocket]);
|
||||
if (m_useSecureNetwork == false) {
|
||||
LOG((CLOG_NOTE "crypto disabled because of ns plugin not available"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Client::~Client()
|
||||
@@ -160,8 +152,7 @@ Client::connect()
|
||||
|
||||
// filter socket messages, including a packetizing filter
|
||||
m_stream = socket;
|
||||
bool adopt = !m_useSecureNetwork;
|
||||
m_stream = new PacketStreamFilter(m_events, m_stream, adopt);
|
||||
m_stream = new PacketStreamFilter(m_events, m_stream, true);
|
||||
|
||||
// connect
|
||||
LOG((CLOG_DEBUG1 "connecting to server"));
|
||||
@@ -439,7 +430,7 @@ Client::sendConnectionFailedEvent(const char* msg)
|
||||
void
|
||||
Client::sendFileChunk(const void* data)
|
||||
{
|
||||
FileChunk* chunk = reinterpret_cast<FileChunk*>(const_cast<void*>(data));
|
||||
FileChunk* chunk = static_cast<FileChunk*>(const_cast<void*>(data));
|
||||
LOG((CLOG_DEBUG1 "send file chunk"));
|
||||
assert(m_server != NULL);
|
||||
|
||||
@@ -593,13 +584,6 @@ Client::cleanupStream()
|
||||
{
|
||||
delete m_stream;
|
||||
m_stream = NULL;
|
||||
|
||||
// PacketStreamFilter doen't adopt secure socket, because
|
||||
// we need to tell the dynamic lib that allocated this object
|
||||
// to do the deletion.
|
||||
if (m_useSecureNetwork) {
|
||||
ARCH->plugin().invoke(s_pluginNames[kSecureSocket], "deleteSocket", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -621,7 +605,7 @@ void
|
||||
Client::handleConnectionFailed(const Event& event, void*)
|
||||
{
|
||||
IDataSocket::ConnectionFailedInfo* info =
|
||||
reinterpret_cast<IDataSocket::ConnectionFailedInfo*>(event.getData());
|
||||
static_cast<IDataSocket::ConnectionFailedInfo*>(event.getData());
|
||||
|
||||
cleanupTimer();
|
||||
cleanupConnecting();
|
||||
@@ -677,7 +661,7 @@ Client::handleClipboardGrabbed(const Event& event, void*)
|
||||
}
|
||||
|
||||
const IScreen::ClipboardInfo* info =
|
||||
reinterpret_cast<const IScreen::ClipboardInfo*>(event.getData());
|
||||
static_cast<const IScreen::ClipboardInfo*>(event.getData());
|
||||
|
||||
// grab ownership
|
||||
m_server->onGrabClipboard(info->m_id);
|
||||
@@ -826,14 +810,14 @@ Client::sendFileToServer(const char* filename)
|
||||
m_sendFileThread = new Thread(
|
||||
new TMethodJob<Client>(
|
||||
this, &Client::sendFileThread,
|
||||
reinterpret_cast<void*>(const_cast<char*>(filename))));
|
||||
static_cast<void*>(const_cast<char*>(filename))));
|
||||
}
|
||||
|
||||
void
|
||||
Client::sendFileThread(void* filename)
|
||||
{
|
||||
try {
|
||||
char* name = reinterpret_cast<char*>(filename);
|
||||
char* name = static_cast<char*>(filename);
|
||||
StreamChunker::sendFile(name, m_events, this);
|
||||
}
|
||||
catch (std::runtime_error error) {
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-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 "PluginVersion.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static const char kUnknownVersion[] = "unknown";
|
||||
const char* s_pluginNames[] = { "ns" };
|
||||
static const char* s_pluginVersions[] = { "1.3" };
|
||||
|
||||
const char* getExpectedPluginVersion(const char* name)
|
||||
{
|
||||
for (int i = 0; i < kPluginCount; i++) {
|
||||
if (strcmp(name, s_pluginNames[i]) == 0) {
|
||||
return s_pluginVersions[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return kUnknownVersion;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-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
|
||||
|
||||
enum EPluginType {
|
||||
kSecureSocket,
|
||||
kPluginCount
|
||||
};
|
||||
|
||||
extern const char* s_pluginNames[];
|
||||
|
||||
//! Get expected plugin version
|
||||
/*!
|
||||
Returns the plugin version expected by the plugin loader.
|
||||
*/
|
||||
const char* getExpectedPluginVersion(const char* name);
|
||||
@@ -59,7 +59,7 @@ StreamBuffer::peek(UInt32 n)
|
||||
scan = m_chunks.erase(scan);
|
||||
}
|
||||
|
||||
return reinterpret_cast<const void*>(&(head->begin()[m_headUsed]));
|
||||
return static_cast<const void*>(&(head->begin()[m_headUsed]));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -104,7 +104,7 @@ StreamBuffer::write(const void* vdata, UInt32 n)
|
||||
m_size += n;
|
||||
|
||||
// cast data to bytes
|
||||
const UInt8* data = reinterpret_cast<const UInt8*>(vdata);
|
||||
const UInt8* data = static_cast<const UInt8*>(vdata);
|
||||
|
||||
// point to last chunk if it has space, otherwise append an empty chunk
|
||||
ChunkList::iterator scan = m_chunks.end();
|
||||
|
||||
@@ -83,7 +83,7 @@ StreamFilter::shutdownOutput()
|
||||
void*
|
||||
StreamFilter::getEventTarget() const
|
||||
{
|
||||
return const_cast<void*>(reinterpret_cast<const void*>(this));
|
||||
return const_cast<void*>(static_cast<const void*>(this));
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -146,7 +146,7 @@ IpcClientProxy::send(const IpcMessage& message)
|
||||
switch (message.type()) {
|
||||
case kIpcLogLine: {
|
||||
const IpcLogLineMessage& llm = static_cast<const IpcLogLineMessage&>(message);
|
||||
String logLine = llm.logLine();
|
||||
const String logLine = llm.logLine();
|
||||
ProtocolUtil::writef(&m_stream, kIpcMsgLogLine, &logLine);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ IpcServerProxy::send(const IpcMessage& message)
|
||||
|
||||
case kIpcCommand: {
|
||||
const IpcCommandMessage& cm = static_cast<const IpcCommandMessage&>(message);
|
||||
String command = cm.command();
|
||||
const String command = cm.command();
|
||||
ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ Thread::threadFunc(void* vjob)
|
||||
}
|
||||
|
||||
// get job
|
||||
IJob* job = reinterpret_cast<IJob*>(vjob);
|
||||
IJob* job = static_cast<IJob*>(vjob);
|
||||
|
||||
// run job
|
||||
void* result = NULL;
|
||||
|
||||
@@ -23,6 +23,7 @@ endif()
|
||||
|
||||
include_directories(
|
||||
../
|
||||
${OPENSSL_INCLUDE}
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
@@ -33,6 +34,23 @@ endif()
|
||||
|
||||
add_library(net STATIC ${sources})
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(net mt io)
|
||||
if (WIN32)
|
||||
add_custom_command(
|
||||
TARGET net
|
||||
POST_BUILD
|
||||
COMMAND xcopy /Y /Q
|
||||
..\\..\\..\\..\\ext\\${OPENSSL_PLAT_DIR}\\out32dll\\libeay32.*
|
||||
..\\..\\..\\..\\bin\\${CMAKE_CFG_INTDIR}
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET net
|
||||
POST_BUILD
|
||||
COMMAND xcopy /Y /Q
|
||||
..\\..\\..\\..\\ext\\${OPENSSL_PLAT_DIR}\\out32dll\\ssleay32.*
|
||||
..\\..\\..\\..\\bin\\${CMAKE_CFG_INTDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(net mt io ${OPENSSL_LIBS})
|
||||
endif()
|
||||
|
||||
@@ -41,14 +41,7 @@ public:
|
||||
*/
|
||||
virtual IDataSocket*
|
||||
accept() = 0;
|
||||
|
||||
//! Delete connection socket
|
||||
/*!
|
||||
This is used when the socket was created but not adopted by a client
|
||||
proxy.
|
||||
*/
|
||||
virtual void deleteSocket(void*) = 0;
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
// ISocket overrides
|
||||
|
||||
@@ -93,14 +93,3 @@ SecureListenSocket::accept()
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SecureListenSocket::deleteSocket(void* socket)
|
||||
{
|
||||
SecureSocketSet::iterator it;
|
||||
it = m_secureSocketSet.find((IDataSocket*)socket);
|
||||
if (it != m_secureSocketSet.end()) {
|
||||
delete *it;
|
||||
m_secureSocketSet.erase(it);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ public:
|
||||
// IListenSocket overrides
|
||||
virtual IDataSocket*
|
||||
accept();
|
||||
void deleteSocket(void*);
|
||||
|
||||
private:
|
||||
typedef std::set<IDataSocket*> SecureSocketSet;
|
||||
@@ -46,6 +46,7 @@ SocketMultiplexer::SocketMultiplexer() :
|
||||
// this pointer just has to be unique and not NULL. it will
|
||||
// never be dereferenced. it's used to identify cursor nodes
|
||||
// in the jobs list.
|
||||
// TODO: Remove this evilness
|
||||
m_cursorMark = reinterpret_cast<ISocketMultiplexerJob*>(this);
|
||||
|
||||
// start thread
|
||||
|
||||
@@ -102,7 +102,7 @@ TCPListenSocket::close()
|
||||
void*
|
||||
TCPListenSocket::getEventTarget() const
|
||||
{
|
||||
return const_cast<void*>(reinterpret_cast<const void*>(this));
|
||||
return const_cast<void*>(static_cast<const void*>(this));
|
||||
}
|
||||
|
||||
IDataSocket*
|
||||
|
||||
@@ -43,7 +43,6 @@ public:
|
||||
// IListenSocket overrides
|
||||
virtual IDataSocket*
|
||||
accept();
|
||||
virtual void deleteSocket(void*) { }
|
||||
|
||||
protected:
|
||||
void setListeningJob();
|
||||
|
||||
@@ -125,7 +125,7 @@ TCPSocket::close()
|
||||
void*
|
||||
TCPSocket::getEventTarget() const
|
||||
{
|
||||
return const_cast<void*>(reinterpret_cast<const void*>(this));
|
||||
return const_cast<void*>(static_cast<const void*>(this));
|
||||
}
|
||||
|
||||
UInt32
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
*/
|
||||
|
||||
#include "net/TCPSocketFactory.h"
|
||||
|
||||
#include "net/TCPSocket.h"
|
||||
#include "net/TCPListenSocket.h"
|
||||
#include "net/SecureSocket.h"
|
||||
#include "net/SecureListenSocket.h"
|
||||
#include "arch/Arch.h"
|
||||
#include "common/PluginVersion.h"
|
||||
#include "base/Log.h"
|
||||
|
||||
//
|
||||
@@ -43,20 +43,14 @@ TCPSocketFactory::~TCPSocketFactory()
|
||||
IDataSocket*
|
||||
TCPSocketFactory::create(bool secure) const
|
||||
{
|
||||
IDataSocket* socket = NULL;
|
||||
if (secure) {
|
||||
void* args[2] = {
|
||||
m_events,
|
||||
m_socketMultiplexer
|
||||
};
|
||||
socket = static_cast<IDataSocket*>(
|
||||
ARCH->plugin().invoke(s_pluginNames[kSecureSocket], "getSocket", args));
|
||||
SecureSocket* secureSocket = new SecureSocket(m_events, m_socketMultiplexer);
|
||||
secureSocket->initSsl (false);
|
||||
return secureSocket;
|
||||
}
|
||||
else {
|
||||
socket = new TCPSocket(m_events, m_socketMultiplexer);
|
||||
return new TCPSocket(m_events, m_socketMultiplexer);
|
||||
}
|
||||
|
||||
return socket;
|
||||
}
|
||||
|
||||
IListenSocket*
|
||||
@@ -64,12 +58,7 @@ TCPSocketFactory::createListen(bool secure) const
|
||||
{
|
||||
IListenSocket* socket = NULL;
|
||||
if (secure) {
|
||||
void* args[2] = {
|
||||
m_events,
|
||||
m_socketMultiplexer
|
||||
};
|
||||
socket = static_cast<IListenSocket*>(
|
||||
ARCH->plugin().invoke(s_pluginNames[kSecureSocket], "getListenSocket", args));
|
||||
socket = new SecureListenSocket(m_events, m_socketMultiplexer);
|
||||
}
|
||||
else {
|
||||
socket = new TCPListenSocket(m_events, m_socketMultiplexer);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user