Merge changes made in v1.8.4
|
@ -205,7 +205,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)
|
||||
|
|
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
v1.8.4-stable
|
||||
=============
|
||||
|
||||
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
|
||||
Bug #5640 Synergy branding is inconsistent across platforms
|
||||
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
|
||||
|
|
|
@ -747,16 +747,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")
|
||||
|
@ -1152,14 +1142,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)
|
||||
|
@ -1177,17 +1165,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)
|
||||
|
||||
|
@ -1403,13 +1380,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)
|
||||
|
|
BIN
res/banner.bmp
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 112 KiB |
BIN
res/dialog.bmp
Before Width: | Height: | Size: 451 KiB After Width: | Height: | Size: 601 KiB |
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
|
BIN
res/synergy.ico
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 24 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,16 @@ 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 (WIN32)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET synergyc
|
||||
POST_BUILD
|
||||
COMMAND "mt.exe" -manifest \"${CMAKE_SOURCE_DIR}\\res\\dpiaware.manifest\" -inputresource:\"$<TARGET_FILE:synergyc>\"\;\#1 -outputresource:\"$<TARGET_FILE:synergyc>\"\;\#1
|
||||
COMMENT "Adding display aware manifest..."
|
||||
)
|
||||
endif()
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,16 @@ 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 ${libs} ${OPENSSL_LIBS})
|
||||
|
||||
if (WIN32)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET synergyd
|
||||
POST_BUILD
|
||||
COMMAND "mt.exe" -manifest \"${CMAKE_SOURCE_DIR}\\res\\dpiaware.manifest\" -inputresource:\"$<TARGET_FILE:synergyd>\"\;\#1 -outputresource:\"$<TARGET_FILE:synergyd>\"\;\#1
|
||||
COMMENT "Adding display aware manifest..."
|
||||
)
|
||||
endif()
|
||||
|
||||
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,7 +354,7 @@ 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);
|
||||
}
|
||||
|
@ -362,7 +362,8 @@ MSWindowsPortableTaskBarReceiver::staticDlgProc(HWND hwnd,
|
|||
// get the extra window data and forward the call
|
||||
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if (data != 0) {
|
||||
self = reinterpret_cast<MSWindowsPortableTaskBarReceiver*>(data);
|
||||
self = static_cast<MSWindowsPortableTaskBarReceiver*>(
|
||||
reinterpret_cast<void*>(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,16 @@ 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 (WIN32)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET synergys
|
||||
POST_BUILD
|
||||
COMMAND "mt.exe" -manifest \"${CMAKE_SOURCE_DIR}\\res\\dpiaware.manifest\" -inputresource:\"$<TARGET_FILE:synergys>\"\;\#1 -outputresource:\"$<TARGET_FILE:synergys>\"\;\#1
|
||||
COMMENT "Adding display aware manifest..."
|
||||
)
|
||||
endif()
|
||||
|
||||
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,14 +368,16 @@ 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*>(lParam);
|
||||
self = static_cast<MSWindowsServerTaskBarReceiver*>(
|
||||
reinterpret_cast<void*>(lParam));
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
||||
}
|
||||
else {
|
||||
// get the extra window data and forward the call
|
||||
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if (data != 0) {
|
||||
self = reinterpret_cast<MSWindowsServerTaskBarReceiver*>(data);
|
||||
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
|
||||
|
|
|
@ -17,7 +17,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 +56,15 @@ 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
|
||||
HEADERS += src/MainWindow.h \
|
||||
src/AboutDialog.h \
|
||||
src/ServerConfig.h \
|
||||
|
@ -101,18 +102,17 @@ HEADERS += src/MainWindow.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
|
||||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
macx {
|
||||
|
|
|
@ -13,25 +13,19 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>300</height>
|
||||
<height>378</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>450</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>450</width>
|
||||
<height>300</height>
|
||||
<height>378</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -41,48 +35,20 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><p>
|
||||
Keyboard and mouse sharing application. Cross platform and open source.<br /><br />
|
||||
Copyright © 2012-2016 Symless Ltd.<br />
|
||||
Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br />
|
||||
Synergy is released under the GNU General Public License (GPLv2).<br /><br />
|
||||
Synergy is based on CosmoSynergy by Richard Lee and Adam Feder.<br />
|
||||
The Synergy GUI is based on QSynergy by Volker Lanz.<br /><br />
|
||||
Visit our website for help and info (symless.com).
|
||||
</p></string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>100</height>
|
||||
<width>450</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -197,6 +163,41 @@ Visit our website for help and info (symless.com).
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Keyboard and mouse sharing application. <br/><br/>Copyright © 2012-2016 Symless Ltd.<br/>Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.</p><p>Synergy is based on CosmoSynergy by Richard Lee and Adam Feder.<br/>The Synergy GUI is based on QSynergy by Volker Lanz. </p><p>Synergy is released under the GNU General Public License (GPLv2).</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
<?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>440</width>
|
||||
<height>314</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Activate Synergy</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<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_2">
|
||||
<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="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<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="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Found on your <a href="https://symless.com/account/?source=gui">account</a> page.</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_pTextEditSerialKey">
|
||||
<property name="enabled">
|
||||
<bool>false</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="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>
|
||||
<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>
|
|
@ -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>
|
|
@ -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">
|
||||
|
@ -128,7 +128,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fingerprint:</string>
|
||||
<string>SSL Fingerprint:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -481,12 +481,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>
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 5.6 KiB |
|
@ -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)
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
#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 "SubscriptionManager.h"
|
||||
#include "FailedLoginDialog.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
#include <iostream>
|
||||
|
||||
ActivationDialog::ActivationDialog(QWidget* parent, AppConfig& appConfig) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ActivationDialog),
|
||||
m_appConfig (&appConfig)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->m_pLineEditEmail->setText(appConfig.activateEmail());
|
||||
ui->m_pTextEditSerialKey->setText(appConfig.serialKey());
|
||||
|
||||
if (!appConfig.serialKey().isEmpty()) {
|
||||
ui->m_pRadioButtonActivate->setAutoExclusive(false);
|
||||
ui->m_pRadioButtonSubscription->setAutoExclusive(false);
|
||||
ui->m_pRadioButtonActivate->setChecked(false);
|
||||
ui->m_pRadioButtonSubscription->setChecked(true);
|
||||
ui->m_pRadioButtonActivate->setAutoExclusive(true);
|
||||
ui->m_pRadioButtonSubscription->setAutoExclusive(true);
|
||||
ui->m_pTextEditSerialKey->setFocus();
|
||||
ui->m_pTextEditSerialKey->moveCursor(QTextCursor::End);
|
||||
} else {
|
||||
if (ui->m_pLineEditEmail->text().isEmpty()) {
|
||||
ui->m_pLineEditEmail->setFocus();
|
||||
} else {
|
||||
ui->m_pLineEditPassword->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ActivationDialog::~ActivationDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ActivationDialog::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 ActivationDialog::reject()
|
||||
{
|
||||
CancelActivationDialog cancelActivationDialog(this);
|
||||
if (QDialog::Accepted == cancelActivationDialog.exec()) {
|
||||
notifyActivation("skip:unknown");
|
||||
m_appConfig->activationHasRun(true);
|
||||
m_appConfig->saveSettings();
|
||||
QDialog::reject();
|
||||
}
|
||||
}
|
||||
|
||||
void ActivationDialog::on_m_pRadioButtonSubscription_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->m_pLineEditEmail->setEnabled(false);
|
||||
ui->m_pLineEditPassword->setEnabled(false);
|
||||
ui->m_pTextEditSerialKey->setEnabled(true);
|
||||
ui->m_pTextEditSerialKey->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void ActivationDialog::on_m_pRadioButtonActivate_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->m_pLineEditEmail->setEnabled(true);
|
||||
ui->m_pLineEditPassword->setEnabled(true);
|
||||
ui->m_pTextEditSerialKey->setEnabled(false);
|
||||
if (ui->m_pLineEditEmail->text().isEmpty()) {
|
||||
ui->m_pLineEditEmail->setFocus();
|
||||
} else {
|
||||
ui->m_pLineEditPassword->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActivationDialog::accept()
|
||||
{
|
||||
QMessageBox message;
|
||||
QString error;
|
||||
int edition = Unregistered;
|
||||
|
||||
m_appConfig->activationHasRun(true);
|
||||
m_appConfig->saveSettings();
|
||||
|
||||
try {
|
||||
if (ui->m_pRadioButtonActivate->isChecked()) {
|
||||
WebClient webClient;
|
||||
QString email = ui->m_pLineEditEmail->text();
|
||||
QString password = ui->m_pLineEditPassword->text();
|
||||
|
||||
if (!webClient.setEmail (email, error)) {
|
||||
message.critical (this, "Invalid Email Address", tr("%1").arg(error));
|
||||
return;
|
||||
}
|
||||
else if (!webClient.setPassword (password, error)) {
|
||||
message.critical (this, "Invalid Password", tr("%1").arg(error));
|
||||
return;
|
||||
}
|
||||
else if (!webClient.getEdition (edition, error)) {
|
||||
FailedLoginDialog failedLoginDialog (this, error);
|
||||
failedLoginDialog.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
m_appConfig->setActivateEmail (email);
|
||||
m_appConfig->clearSerialKey();
|
||||
ui->m_pTextEditSerialKey->clear();
|
||||
notifyActivation ("login:" + m_appConfig->activateEmail());
|
||||
}
|
||||
else {
|
||||
QString serialKey = ui->m_pTextEditSerialKey->toPlainText();
|
||||
|
||||
if (!m_appConfig->setSerialKey (serialKey, error)) {
|
||||
message.critical (this, "Invalid Serial Key", tr("%1").arg(error));
|
||||
return;
|
||||
}
|
||||
|
||||
SubscriptionManager subscriptionManager (this, *m_appConfig, edition);
|
||||
if (!subscriptionManager.activateSerial (serialKey)) {
|
||||
return;
|
||||
}
|
||||
m_appConfig->setActivateEmail("");
|
||||
notifyActivation ("serial:" + m_appConfig->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 details.\n\n%1").arg(e.what()));
|
||||
return;
|
||||
}
|
||||
|
||||
m_appConfig->setEdition(edition);
|
||||
m_appConfig->saveSettings();
|
||||
|
||||
message.information (this, "Activated!",
|
||||
tr("Thanks for activating %1!").arg (getEditionName (edition)));
|
||||
QDialog::accept();
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef ACTIVATIONDIALOG_H
|
||||
#define ACTIVATIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class ActivationDialog;
|
||||
}
|
||||
|
||||
class AppConfig;
|
||||
|
||||
class ActivationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ActivationDialog(QWidget *parent, AppConfig& appConfig);
|
||||
~ActivationDialog();
|
||||
|
||||
public slots:
|
||||
void reject();
|
||||
void accept();
|
||||
|
||||
protected:
|
||||
void notifyActivation (QString identity);
|
||||
|
||||
private:
|
||||
Ui::ActivationDialog *ui;
|
||||
AppConfig* m_appConfig;
|
||||
|
||||
private slots:
|
||||
void on_m_pRadioButtonSubscription_toggled(bool checked);
|
||||
void on_m_pRadioButtonActivate_toggled(bool checked);
|
||||
};
|
||||
|
||||
#endif // ACTIVATIONDIALOG_H
|
|
@ -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::networkInterface() 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();
|
||||
|
@ -135,12 +157,13 @@ void AppConfig::loadSettings()
|
|||
}
|
||||
m_ElevateMode = static_cast<ElevateMode>(elevateMode.toInt());
|
||||
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
|
||||
m_Edition = settings().value("edition", UnknownEdition).toInt();
|
||||
m_Edition = settings().value("edition", Unregistered).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_LastExpiringWarningTime = settings().value("lastExpiringWarningTime", 0).toInt();
|
||||
m_ActivationHasRun = settings().value("activationHasRun", false).toBool();
|
||||
}
|
||||
|
||||
void AppConfig::saveSettings()
|
||||
|
@ -166,19 +189,107 @@ void AppConfig::saveSettings()
|
|||
settings().setValue("autoHide", m_AutoHide);
|
||||
settings().setValue("serialKey", m_Serialkey);
|
||||
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;
|
||||
}
|
||||
|
||||
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::setNetworkInterface(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(int e) {
|
||||
m_Edition = e;
|
||||
emit editionSet (e);
|
||||
}
|
||||
|
||||
int AppConfig::edition() const { return m_Edition; }
|
||||
|
||||
bool AppConfig::setActivateEmail(QString e) {
|
||||
m_ActivateEmail = e;
|
||||
return true;
|
||||
}
|
||||
|
||||
QString AppConfig::activateEmail() { return m_ActivateEmail; }
|
||||
|
||||
bool AppConfig::setSerialKey(QString serial, QString& errorOut) {
|
||||
if (serial.isEmpty()) {
|
||||
errorOut = "Your serial key cannot be blank.";
|
||||
return false;
|
||||
}
|
||||
m_Serialkey = serial;
|
||||
return true;
|
||||
}
|
||||
|
||||
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() == Pro) && m_CryptoEnabled;
|
||||
}
|
||||
|
||||
void AppConfig::setAutoHide(bool b) { m_AutoHide = b; }
|
||||
|
||||
bool AppConfig::getAutoHide() { return m_AutoHide; }
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#define APPCONFIG_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include "ElevateMode.h"
|
||||
|
||||
|
@ -48,8 +49,10 @@ enum ProcessMode {
|
|||
Desktop
|
||||
};
|
||||
|
||||
class AppConfig
|
||||
class AppConfig: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class SettingsDialog;
|
||||
friend class MainWindow;
|
||||
friend class SetupWizard;
|
||||
|
@ -59,33 +62,34 @@ class AppConfig
|
|||
~AppConfig();
|
||||
|
||||
public:
|
||||
const QString& screenName() const { return m_ScreenName; }
|
||||
int port() const { return m_Port; }
|
||||
const QString& networkInterface() 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& networkInterface() 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(int e);
|
||||
int edition() const;
|
||||
bool setActivateEmail(QString e);
|
||||
QString activateEmail();
|
||||
bool setSerialKey(QString serial, QString& error);
|
||||
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;
|
||||
|
||||
|
@ -93,26 +97,29 @@ 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);
|
||||
|
||||
void saveSettings();
|
||||
|
||||
protected:
|
||||
QSettings& settings() { return *m_pSettings; }
|
||||
void setScreenName(const QString& s) { m_ScreenName = s; }
|
||||
void setPort(int i) { m_Port = i; }
|
||||
void setNetworkInterface(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; }
|
||||
|
||||
QSettings& settings();
|
||||
void setScreenName(const QString& s);
|
||||
void setPort(int i);
|
||||
void setNetworkInterface(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:
|
||||
|
@ -136,10 +143,15 @@ class AppConfig
|
|||
bool m_AutoHide;
|
||||
QString m_Serialkey;
|
||||
int m_LastExpiringWarningTime;
|
||||
bool m_ActivationHasRun;
|
||||
|
||||
static const char m_SynergysName[];
|
||||
static const char m_SynergycName[];
|
||||
static const char m_SynergyLogDir[];
|
||||
|
||||
signals:
|
||||
void editionSet(int);
|
||||
void sslToggled(bool enabled);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -18,11 +18,13 @@
|
|||
#ifndef EDITIONTYPE_H
|
||||
#define EDITIONTYPE_H
|
||||
|
||||
enum qEditionType {
|
||||
/* Do not reorder these! */
|
||||
|
||||
enum EditionType {
|
||||
Basic,
|
||||
Pro,
|
||||
Trial,
|
||||
UnknownEdition
|
||||
Unregistered
|
||||
};
|
||||
|
||||
#endif // EDITIONTYPE_H
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -23,11 +23,10 @@
|
|||
#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"
|
||||
|
@ -35,6 +34,7 @@
|
|||
#include "EditionType.h"
|
||||
#include "QUtility.h"
|
||||
#include "ProcessorArch.h"
|
||||
#include "SslCertificate.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
@ -98,7 +98,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
|||
m_SuppressAutoConfigWarning(false),
|
||||
m_BonjourInstall(NULL),
|
||||
m_SuppressEmptyServerWarning(false),
|
||||
m_ExpectedRunningState(kStopped)
|
||||
m_ExpectedRunningState(kStopped),
|
||||
m_pSslCertificate(NULL)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
|
@ -137,8 +138,9 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
|||
setEdition(m_AppConfig.edition());
|
||||
|
||||
m_pLabelPadlock->hide();
|
||||
|
||||
updateLocalFingerprint();
|
||||
connect (this, SIGNAL(windowShown()), this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
||||
connect (&m_AppConfig, SIGNAL(editionSet(int)), this, SLOT(setEdition(int)), Qt::QueuedConnection);
|
||||
connect (&m_AppConfig, SIGNAL(sslToggled(bool)), this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -159,6 +161,8 @@ MainWindow::~MainWindow()
|
|||
if (m_BonjourInstall != NULL) {
|
||||
delete m_BonjourInstall;
|
||||
}
|
||||
|
||||
delete m_pSslCertificate;
|
||||
}
|
||||
|
||||
void MainWindow::open()
|
||||
|
@ -263,7 +267,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);
|
||||
|
@ -493,13 +498,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();
|
||||
|
@ -618,6 +629,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());
|
||||
|
@ -1014,28 +1035,20 @@ void MainWindow::serverDetected(const QString name)
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::setEdition(int type)
|
||||
void MainWindow::setEdition(int edition)
|
||||
{
|
||||
QString title;
|
||||
if (type == Basic) {
|
||||
title = "Synergy Basic";
|
||||
setWindowTitle(getEditionName(edition));
|
||||
if (m_AppConfig.getCryptoEnabled()) {
|
||||
m_pSslCertificate = new SslCertificate(this);
|
||||
m_pSslCertificate->generateCertificate();
|
||||
}
|
||||
else if (type == Pro) {
|
||||
title = "Synergy Pro";
|
||||
}
|
||||
else if (type == Trial) {
|
||||
title = "Synergy Trial";
|
||||
}
|
||||
else {
|
||||
title = "Synergy (UNREGISTERED)";
|
||||
}
|
||||
|
||||
setWindowTitle(title);
|
||||
updateLocalFingerprint();
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
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());
|
||||
|
@ -1145,10 +1158,10 @@ 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();
|
||||
ActivationDialog activationDialog (this, this->appConfig());
|
||||
activationDialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pButtonApply_clicked()
|
||||
|
@ -1367,6 +1380,14 @@ void MainWindow::bonjourInstallFinished()
|
|||
m_pCheckBoxAutoConfig->setChecked(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_windowShown()
|
||||
{
|
||||
if (!m_AppConfig.activationHasRun() && (m_AppConfig.edition() == Unregistered)) {
|
||||
ActivationDialog activationDialog (this, m_AppConfig);
|
||||
activationDialog.exec();
|
||||
}
|
||||
}
|
||||
|
||||
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,7 @@ class SetupWizard;
|
|||
class ZeroconfService;
|
||||
class DataDownloader;
|
||||
class CommandProcess;
|
||||
class SslCertificate;
|
||||
|
||||
class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
{
|
||||
|
@ -63,7 +65,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
|
||||
|
@ -112,10 +115,10 @@ 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();
|
||||
|
||||
public slots:
|
||||
void setEdition(int edition);
|
||||
void appendLogRaw(const QString& text);
|
||||
void appendLogInfo(const QString& text);
|
||||
void appendLogDebug(const QString& text);
|
||||
|
@ -123,6 +126,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 +134,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();
|
||||
|
@ -180,6 +184,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
void restartSynergy();
|
||||
void proofreadInfo();
|
||||
|
||||
void showEvent (QShowEvent*);
|
||||
|
||||
private:
|
||||
QSettings& m_Settings;
|
||||
AppConfig& m_AppConfig;
|
||||
|
@ -207,12 +213,17 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
bool m_SuppressEmptyServerWarning;
|
||||
qRuningState m_ExpectedRunningState;
|
||||
QMutex m_StopDesktopMutex;
|
||||
SslCertificate* m_pSslCertificate;
|
||||
|
||||
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(UnknownEdition),
|
||||
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>
|
||||
|
@ -41,6 +42,22 @@ void setIndexFromItemData(QComboBox* comboBox, const QVariant& itemData)
|
|||
}
|
||||
}
|
||||
|
||||
QString
|
||||
getEditionName (int edition) {
|
||||
if (edition == Basic) {
|
||||
return "Synergy Basic";
|
||||
}
|
||||
else if (edition == Pro) {
|
||||
return "Synergy Pro";
|
||||
}
|
||||
else if (edition == Trial) {
|
||||
return "Synergy Trial";
|
||||
}
|
||||
else {
|
||||
return "Synergy (UNREGISTERED)";
|
||||
}
|
||||
}
|
||||
|
||||
QString hash(const QString& string)
|
||||
{
|
||||
QByteArray data = string.toUtf8();
|
||||
|
@ -96,15 +113,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
|
||||
|
||||
|
|
|
@ -29,3 +29,4 @@ QString hash(const QString& string);
|
|||
QString getFirstMacAddress();
|
||||
qProcessorArch getProcessorArch();
|
||||
QString getOSInformation();
|
||||
QString getEditionName (int edition);
|
||||
|
|
|
@ -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() == Pro);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -28,13 +28,9 @@
|
|||
|
||||
SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
|
||||
m_MainWindow(mainWindow),
|
||||
m_StartMain(startMain),
|
||||
m_Edition(UnknownEdition),
|
||||
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 == UnknownEdition) {
|
||||
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();
|
||||
|
|
|
@ -39,7 +39,7 @@ SubscriptionManager::SubscriptionManager(QWidget* parent, AppConfig& appConfig,
|
|||
|
||||
bool SubscriptionManager::activateSerial(const QString& serial)
|
||||
{
|
||||
m_Edition = UnknownEdition;
|
||||
m_Edition = Unregistered;
|
||||
persistDirectory();
|
||||
CoreInterface coreInterface;
|
||||
QString output;
|
||||
|
@ -62,7 +62,7 @@ bool SubscriptionManager::activateSerial(const QString& serial)
|
|||
|
||||
bool SubscriptionManager::checkSubscription()
|
||||
{
|
||||
m_Edition = UnknownEdition;
|
||||
m_Edition = Unregistered;
|
||||
persistDirectory();
|
||||
CoreInterface coreInterface;
|
||||
QString output;
|
||||
|
@ -98,7 +98,7 @@ void SubscriptionManager::checkError(QString& error)
|
|||
}
|
||||
else {
|
||||
QMessageBox::warning(m_pParent, tr("Subscription error"),
|
||||
tr("An error occurred while trying to activate using a serial key. "
|
||||
tr("An error occurred while trying to activate Synergy using your serial key. "
|
||||
"Please contact the helpdesk, and provide the "
|
||||
"following details.\n\n%1").arg(error));
|
||||
}
|
||||
|
|
|
@ -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 = UnknownEdition;
|
||||
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);
|
||||
QString request();
|
||||
|
||||
private:
|
||||
QString m_Email;
|
||||
QString m_Password;
|
||||
CoreInterface m_CoreInterface;
|
||||
|
|
|
@ -23,7 +23,6 @@ add_subdirectory(ipc)
|
|||
add_subdirectory(mt)
|
||||
add_subdirectory(net)
|
||||
add_subdirectory(platform)
|
||||
add_subdirectory(plugin)
|
||||
add_subdirectory(server)
|
||||
add_subdirectory(synergy)
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
|
@ -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);
|
|
@ -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);
|
||||
SetWindowLongPtr(hwnd, 0, reinterpret_cast<LONG_PTR>(self));
|
||||
SetWindowLongPtr(hwnd, 0, reinterpret_cast<LONG_PTR>(createInfo->lpCreateParams));
|
||||
}
|
||||
else {
|
||||
// get the extra window data and forward the call
|
||||
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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -71,21 +71,21 @@ String
|
|||
MSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
|
||||
{
|
||||
// get datator
|
||||
const char* src = (const char*)GlobalLock(data);
|
||||
LPVOID src = GlobalLock(data);
|
||||
if (src == NULL) {
|
||||
return String();
|
||||
}
|
||||
UInt32 srcSize = (UInt32)GlobalSize(data);
|
||||
|
||||
// check image type
|
||||
const BITMAPINFO* bitmap = reinterpret_cast<const BITMAPINFO*>(src);
|
||||
const BITMAPINFO* bitmap = static_cast<const BITMAPINFO*>(src);
|
||||
LOG((CLOG_INFO "bitmap: %dx%d %d", bitmap->bmiHeader.biWidth, bitmap->bmiHeader.biHeight, (int)bitmap->bmiHeader.biBitCount));
|
||||
if (bitmap->bmiHeader.biPlanes == 1 &&
|
||||
(bitmap->bmiHeader.biBitCount == 24 ||
|
||||
bitmap->bmiHeader.biBitCount == 32) &&
|
||||
bitmap->bmiHeader.biCompression == BI_RGB) {
|
||||
// already in canonical form
|
||||
String image(src, srcSize);
|
||||
String image(static_cast<char const*>(src), srcSize);
|
||||
GlobalUnlock(data);
|
||||
return image;
|
||||
}
|
||||
|
|
|
@ -656,7 +656,7 @@ MSWindowsDesks::deskThread(void* vdesk)
|
|||
MSG msg;
|
||||
|
||||
// use given desktop for this thread
|
||||
Desk* desk = reinterpret_cast<Desk*>(vdesk);
|
||||
Desk* desk = static_cast<Desk*>(vdesk);
|
||||
desk->m_threadID = GetCurrentThreadId();
|
||||
desk->m_window = NULL;
|
||||
desk->m_foregroundWindow = NULL;
|
||||
|
|
|
@ -105,6 +105,7 @@ MSWindowsScreen::MSWindowsScreen(
|
|||
m_xCenter(0), m_yCenter(0),
|
||||
m_multimon(false),
|
||||
m_xCursor(0), m_yCursor(0),
|
||||
m_xFractionalMove(0.0f), m_yFractionalMove(0.0f),
|
||||
m_sequenceNumber(0),
|
||||
m_mark(0),
|
||||
m_markReceived(0),
|
||||
|
@ -575,6 +576,21 @@ void MSWindowsScreen::saveMousePosition(SInt32 x, SInt32 y) {
|
|||
LOG((CLOG_DEBUG5 "saved mouse position for next delta: %+d,%+d", x,y));
|
||||
}
|
||||
|
||||
void MSWindowsScreen::accumulateFractionalMove(float x, float y, SInt32& intX, SInt32& intY)
|
||||
{
|
||||
// Accumulate together the move into the running total
|
||||
m_xFractionalMove += x;
|
||||
m_yFractionalMove += y;
|
||||
|
||||
// Return the integer part
|
||||
intX = (SInt32)m_xFractionalMove;
|
||||
intY = (SInt32)m_yFractionalMove;
|
||||
|
||||
// And keep only the fractional part
|
||||
m_xFractionalMove -= intX;
|
||||
m_yFractionalMove -= intY;
|
||||
}
|
||||
|
||||
UInt32
|
||||
MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
||||
{
|
||||
|
@ -941,7 +957,7 @@ MSWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
|
|||
void
|
||||
MSWindowsScreen::handleSystemEvent(const Event& event, void*)
|
||||
{
|
||||
MSG* msg = reinterpret_cast<MSG*>(event.getData());
|
||||
MSG* msg = static_cast<MSG*>(event.getData());
|
||||
assert(msg != NULL);
|
||||
|
||||
if (ArchMiscWindows::processDialog(msg)) {
|
||||
|
@ -1355,16 +1371,18 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
|||
{
|
||||
SInt32 originalMX = mx;
|
||||
SInt32 originalMY = my;
|
||||
float scaledMX = (float)mx;
|
||||
float scaledMY = (float)my;
|
||||
|
||||
if (DpiHelper::s_dpiScaled) {
|
||||
mx = (SInt32)(mx / DpiHelper::getDpi());
|
||||
my = (SInt32)(my / DpiHelper::getDpi());
|
||||
scaledMX /= DpiHelper::getDpi();
|
||||
scaledMY /= DpiHelper::getDpi();
|
||||
}
|
||||
|
||||
// compute motion delta (relative to the last known
|
||||
// mouse position)
|
||||
SInt32 x = mx - m_xCursor;
|
||||
SInt32 y = my - m_yCursor;
|
||||
float x = scaledMX - m_xCursor;
|
||||
float y = scaledMY - m_yCursor;
|
||||
|
||||
LOG((CLOG_DEBUG3
|
||||
"mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)",
|
||||
|
@ -1377,7 +1395,7 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
|||
}
|
||||
|
||||
// save position to compute delta of next motion
|
||||
saveMousePosition(mx, my);
|
||||
saveMousePosition((SInt32)scaledMX, (SInt32)scaledMY);
|
||||
|
||||
if (m_isOnScreen) {
|
||||
|
||||
|
@ -1415,7 +1433,9 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
|||
}
|
||||
else {
|
||||
// send motion
|
||||
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y));
|
||||
SInt32 ix, iy;
|
||||
accumulateFractionalMove(x, y, ix, iy);
|
||||
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(ix, iy));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -216,6 +216,10 @@ private: // HACK
|
|||
// save last position of mouse to compute next delta movement
|
||||
void saveMousePosition(SInt32 x, SInt32 y);
|
||||
|
||||
// accumulates together a series of fractional pixel moves, each time
|
||||
// taking away and returning just the integer part of the running total.
|
||||
void accumulateFractionalMove(float x, float y, SInt32& intX, SInt32& intY);
|
||||
|
||||
// check if it is a modifier key repeating message
|
||||
bool isModifierRepeat(KeyModifierMask oldState,
|
||||
KeyModifierMask state, WPARAM wParam) const;
|
||||
|
@ -266,6 +270,9 @@ private:
|
|||
// last mouse position
|
||||
SInt32 m_xCursor, m_yCursor;
|
||||
|
||||
// accumulated fractional pixel moves
|
||||
float m_xFractionalMove, m_yFractionalMove;
|
||||
|
||||
// last clipboard
|
||||
UInt32 m_sequenceNumber;
|
||||
|
||||
|
|
|
@ -975,7 +975,7 @@ OSXScreen::sendClipboardEvent(Event::Type type, ClipboardID id) const
|
|||
void
|
||||
OSXScreen::handleSystemEvent(const Event& event, void*)
|
||||
{
|
||||
EventRef* carbonEvent = reinterpret_cast<EventRef*>(event.getData());
|
||||
EventRef* carbonEvent = static_cast<EventRef*>(event.getData());
|
||||
assert(carbonEvent != NULL);
|
||||
|
||||
UInt32 eventClass = GetEventClass(*carbonEvent);
|
||||
|
|
|
@ -31,7 +31,7 @@ OSXUchrKeyResource::OSXUchrKeyResource(const void* resource,
|
|||
m_sri(NULL),
|
||||
m_st(NULL)
|
||||
{
|
||||
m_resource = reinterpret_cast<const UCKeyboardLayout*>(resource);
|
||||
m_resource = static_cast<const UCKeyboardLayout*>(resource);
|
||||
if (m_resource == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ OSXUchrKeyResource::OSXUchrKeyResource(const void* resource,
|
|||
}
|
||||
|
||||
// get tables for keyboard type
|
||||
const UInt8* base = reinterpret_cast<const UInt8*>(m_resource);
|
||||
const UInt8* const base = reinterpret_cast<const UInt8*>(m_resource);
|
||||
m_m = reinterpret_cast<const UCKeyModifiersToTableNum*>(base +
|
||||
th->keyModifiersToTableNumOffset);
|
||||
m_cti = reinterpret_cast<const UCKeyToCharTableIndex*>(base +
|
||||
|
@ -134,7 +134,7 @@ OSXUchrKeyResource::getKey(UInt32 table, UInt32 button) const
|
|||
assert(table < getNumTables());
|
||||
assert(button < getNumButtons());
|
||||
|
||||
const UInt8* base = reinterpret_cast<const UInt8*>(m_resource);
|
||||
const UInt8* const base = reinterpret_cast<const UInt8*>(m_resource);
|
||||
const UCKeyOutput* cPtr = reinterpret_cast<const UCKeyOutput*>(base +
|
||||
m_cti->keyToCharTableOffsets[table]);
|
||||
|
||||
|
@ -211,7 +211,7 @@ bool
|
|||
OSXUchrKeyResource::getKeyRecord(
|
||||
KeySequence& keys, UInt16 index, UInt16& state) const
|
||||
{
|
||||
const UInt8* base = reinterpret_cast<const UInt8*>(m_resource);
|
||||
const UInt8* const base = reinterpret_cast<const UInt8*>(m_resource);
|
||||
const UCKeyStateRecord* sr =
|
||||
reinterpret_cast<const UCKeyStateRecord*>(base +
|
||||
m_sri->keyStateRecordOffsets[index]);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "common/stdvector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
//
|
||||
|
@ -516,7 +517,7 @@ XWindowsClipboard::icccmFillCache()
|
|||
}
|
||||
|
||||
XWindowsUtil::convertAtomProperty(data);
|
||||
const Atom* targets = reinterpret_cast<const Atom*>(data.data());
|
||||
const Atom* targets = reinterpret_cast<const Atom*>(data.data()); // TODO: Safe?
|
||||
const UInt32 numTargets = data.size() / sizeof(Atom);
|
||||
LOG((CLOG_DEBUG " available targets: %s", XWindowsUtil::atomsToString(m_display, targets, numTargets).c_str()));
|
||||
|
||||
|
@ -671,11 +672,11 @@ XWindowsClipboard::motifOwnsClipboard() const
|
|||
}
|
||||
|
||||
// check the owner window against the current clipboard owner
|
||||
const MotifClipHeader* header =
|
||||
reinterpret_cast<const MotifClipHeader*>(data.data());
|
||||
if (data.size() >= sizeof(MotifClipHeader) &&
|
||||
header->m_id == kMotifClipHeader) {
|
||||
if (static_cast<Window>(header->m_selectionOwner) == owner) {
|
||||
if (data.size() >= sizeof(MotifClipHeader)) {
|
||||
MotifClipHeader header;
|
||||
std::memcpy (&header, data.data(), sizeof(header));
|
||||
if ((header.m_id == kMotifClipHeader) &&
|
||||
(static_cast<Window>(header.m_selectionOwner) == owner)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -699,18 +700,18 @@ XWindowsClipboard::motifFillCache()
|
|||
return;
|
||||
}
|
||||
|
||||
// check that the header is okay
|
||||
const MotifClipHeader* header =
|
||||
reinterpret_cast<const MotifClipHeader*>(data.data());
|
||||
if (data.size() < sizeof(MotifClipHeader) ||
|
||||
header->m_id != kMotifClipHeader ||
|
||||
header->m_numItems < 1) {
|
||||
MotifClipHeader header;
|
||||
if (data.size() < sizeof(header)) { // check that the header is okay
|
||||
return;
|
||||
}
|
||||
std::memcpy (&header, data.data(), sizeof(header));
|
||||
if (header.m_id != kMotifClipHeader || header.m_numItems < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get the Motif item property from the root window
|
||||
char name[18 + 20];
|
||||
sprintf(name, "_MOTIF_CLIP_ITEM_%d", header->m_item);
|
||||
sprintf(name, "_MOTIF_CLIP_ITEM_%d", header.m_item);
|
||||
Atom atomItem = XInternAtom(m_display, name, False);
|
||||
data = "";
|
||||
if (!XWindowsUtil::getWindowProperty(m_display, root,
|
||||
|
@ -719,19 +720,20 @@ XWindowsClipboard::motifFillCache()
|
|||
return;
|
||||
}
|
||||
|
||||
// check that the item is okay
|
||||
const MotifClipItem* item =
|
||||
reinterpret_cast<const MotifClipItem*>(data.data());
|
||||
if (data.size() < sizeof(MotifClipItem) ||
|
||||
item->m_id != kMotifClipItem ||
|
||||
item->m_numFormats - item->m_numDeletedFormats < 1) {
|
||||
MotifClipItem item;
|
||||
if (data.size() < sizeof(item)) { // check that the item is okay
|
||||
return;
|
||||
}
|
||||
std::memcpy (&item, data.data(), sizeof(item));
|
||||
if (item.m_id != kMotifClipItem ||
|
||||
item.m_numFormats - item.m_numDeletedFormats < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// format list is after static item structure elements
|
||||
const SInt32 numFormats = item->m_numFormats - item->m_numDeletedFormats;
|
||||
const SInt32* formats = reinterpret_cast<const SInt32*>(item->m_size +
|
||||
reinterpret_cast<const char*>(data.data()));
|
||||
const SInt32 numFormats = item.m_numFormats - item.m_numDeletedFormats;
|
||||
const SInt32* formats = reinterpret_cast<const SInt32*>(item.m_size +
|
||||
static_cast<const char*>(data.data()));
|
||||
|
||||
// get the available formats
|
||||
typedef std::map<Atom, String> MotifFormatMap;
|
||||
|
@ -748,18 +750,20 @@ XWindowsClipboard::motifFillCache()
|
|||
}
|
||||
|
||||
// check that the format is okay
|
||||
const MotifClipFormat* motifFormat =
|
||||
reinterpret_cast<const MotifClipFormat*>(data.data());
|
||||
if (data.size() < sizeof(MotifClipFormat) ||
|
||||
motifFormat->m_id != kMotifClipFormat ||
|
||||
motifFormat->m_length < 0 ||
|
||||
motifFormat->m_type == None ||
|
||||
motifFormat->m_deleted != 0) {
|
||||
MotifClipFormat motifFormat;
|
||||
if (data.size() < sizeof(motifFormat)) {
|
||||
continue;
|
||||
}
|
||||
std::memcpy (&motifFormat, data.data(), sizeof(motifFormat));
|
||||
if (motifFormat.m_id != kMotifClipFormat ||
|
||||
motifFormat.m_length < 0 ||
|
||||
motifFormat.m_type == None ||
|
||||
motifFormat.m_deleted != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// save it
|
||||
motifFormats.insert(std::make_pair(motifFormat->m_type, data));
|
||||
motifFormats.insert(std::make_pair(motifFormat.m_type, data));
|
||||
}
|
||||
//const UInt32 numMotifFormats = motifFormats.size();
|
||||
|
||||
|
@ -782,15 +786,14 @@ XWindowsClipboard::motifFillCache()
|
|||
}
|
||||
|
||||
// get format
|
||||
const MotifClipFormat* motifFormat =
|
||||
reinterpret_cast<const MotifClipFormat*>(
|
||||
index2->second.data());
|
||||
const Atom target = motifFormat->m_type;
|
||||
MotifClipFormat motifFormat;
|
||||
std::memcpy (&motifFormat, index2->second.data(), sizeof(motifFormat));
|
||||
const Atom target = motifFormat.m_type;
|
||||
|
||||
// get the data (finally)
|
||||
Atom actualTarget;
|
||||
String targetData;
|
||||
if (!motifGetSelection(motifFormat, &actualTarget, &targetData)) {
|
||||
if (!motifGetSelection(&motifFormat, &actualTarget, &targetData)) {
|
||||
LOG((CLOG_DEBUG1 " no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -785,7 +785,7 @@ void
|
|||
XWindowsKeyState::remapKeyModifiers(KeyID id, SInt32 group,
|
||||
synergy::KeyMap::KeyItem& item, void* vself)
|
||||
{
|
||||
XWindowsKeyState* self = reinterpret_cast<XWindowsKeyState*>(vself);
|
||||
XWindowsKeyState* self = static_cast<XWindowsKeyState*>(vself);
|
||||
item.m_required =
|
||||
self->mapModifiersFromX(XkbBuildCoreState(item.m_required, group));
|
||||
item.m_sensitive =
|
||||
|
|
|
@ -1179,7 +1179,7 @@ XWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
|
|||
void
|
||||
XWindowsScreen::handleSystemEvent(const Event& event, void*)
|
||||
{
|
||||
XEvent* xevent = reinterpret_cast<XEvent*>(event.getData());
|
||||
XEvent* xevent = static_cast<XEvent*>(event.getData());
|
||||
assert(xevent != NULL);
|
||||
|
||||
// update key state
|
||||
|
@ -1442,6 +1442,8 @@ XWindowsScreen::handleSystemEvent(const Event& event, void*)
|
|||
XMoveWindow(m_display, m_window, m_x, m_y);
|
||||
XResizeWindow(m_display, m_window, m_w, m_h);
|
||||
}
|
||||
|
||||
sendEvent(m_events->forIScreen().shapeChanged());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1386,7 +1386,7 @@ XWindowsUtil::setWindowProperty(Display* display, Window window,
|
|||
Atom type, SInt32 format)
|
||||
{
|
||||
const UInt32 length = 4 * XMaxRequestSize(display);
|
||||
const unsigned char* data = reinterpret_cast<const unsigned char*>(vdata);
|
||||
const unsigned char* data = static_cast<const unsigned char*>(vdata);
|
||||
UInt32 datumSize = static_cast<UInt32>(format / 8);
|
||||
// format 32 on 64bit systems is 8 bytes not 4.
|
||||
if (format == 32) {
|
||||
|
@ -1784,5 +1784,5 @@ void
|
|||
XWindowsUtil::ErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "flagging X error: %d", e->error_code));
|
||||
*reinterpret_cast<bool*>(flag) = true;
|
||||
*static_cast<bool*>(flag) = true;
|
||||
}
|
||||
|
|
|
@ -1,28 +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/>.
|
||||
|
||||
if (WIN32)
|
||||
add_subdirectory(winmmjoy)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# 10.7 should be supported, but gives is a _NXArgv linker error
|
||||
if (OSX_TARGET_MINOR GREATER 7)
|
||||
add_subdirectory(ns)
|
||||
endif()
|
||||
else()
|
||||
add_subdirectory(ns)
|
||||
endif()
|
|
@ -1,128 +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/>.
|
||||
|
||||
file(GLOB headers "*.h")
|
||||
file(GLOB sources "*.cpp")
|
||||
|
||||
if (SYNERGY_ADD_HEADERS)
|
||||
list(APPEND sources ${headers})
|
||||
endif()
|
||||
|
||||
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 ../../../../ext/${OPENSSL_PLAT_DIR}/inc32)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
set(OPENSSL_PLAT_DIR openssl-osx)
|
||||
set(OPENSSL_INCLUDE ../../../../ext/${OPENSSL_PLAT_DIR}/include)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
../../../lib/
|
||||
../../../..
|
||||
${OPENSSL_INCLUDE}
|
||||
)
|
||||
|
||||
add_library(ns SHARED ${sources})
|
||||
|
||||
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()
|
||||
|
||||
target_link_libraries(ns
|
||||
arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS})
|
||||
|
||||
if (WIN32)
|
||||
add_custom_command(
|
||||
TARGET ns
|
||||
POST_BUILD
|
||||
COMMAND xcopy /Y /Q
|
||||
..\\..\\..\\..\\..\\lib\\${CMAKE_CFG_INTDIR}\\ns.*
|
||||
..\\..\\..\\..\\..\\bin\\${CMAKE_CFG_INTDIR}\\plugins\\
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ns
|
||||
POST_BUILD
|
||||
COMMAND xcopy /Y /Q
|
||||
..\\..\\..\\..\\..\\ext\\${OPENSSL_PLAT_DIR}\\out32dll\\libeay32.*
|
||||
..\\..\\..\\..\\..\\bin\\${CMAKE_CFG_INTDIR}
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ns
|
||||
POST_BUILD
|
||||
COMMAND xcopy /Y /Q
|
||||
..\\..\\..\\..\\..\\ext\\${OPENSSL_PLAT_DIR}\\out32dll\\ssleay32.*
|
||||
..\\..\\..\\..\\..\\bin\\${CMAKE_CFG_INTDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
if (APPLE)
|
||||
add_custom_command(
|
||||
TARGET ns
|
||||
POST_BUILD
|
||||
COMMAND
|
||||
mkdir -p
|
||||
${CMAKE_SOURCE_DIR}/bin/${CMAKE_CFG_INTDIR}/plugins
|
||||
&&
|
||||
cp
|
||||
${CMAKE_SOURCE_DIR}/lib/${CMAKE_CFG_INTDIR}/libns.*
|
||||
${CMAKE_SOURCE_DIR}/bin/${CMAKE_CFG_INTDIR}/plugins/
|
||||
)
|
||||
else()
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
add_custom_command(
|
||||
TARGET ns
|
||||
POST_BUILD
|
||||
COMMAND mkdir -p
|
||||
${CMAKE_SOURCE_DIR}/bin/debug/plugins
|
||||
&&
|
||||
cp
|
||||
${CMAKE_SOURCE_DIR}/lib/debug/libns.*
|
||||
${CMAKE_SOURCE_DIR}/bin/debug/plugins/
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
TARGET ns
|
||||
POST_BUILD
|
||||
COMMAND mkdir -p
|
||||
${CMAKE_SOURCE_DIR}/bin/plugins
|
||||
&&
|
||||
cp
|
||||
${CMAKE_SOURCE_DIR}/lib/libns.*
|
||||
${CMAKE_SOURCE_DIR}/bin/plugins/
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
|
@ -1,127 +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 "ns.h"
|
||||
|
||||
#include "SecureSocket.h"
|
||||
#include "SecureListenSocket.h"
|
||||
#include "arch/Arch.h"
|
||||
#include "common/PluginVersion.h"
|
||||
#include "base/Log.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
SecureSocket* g_secureSocket = NULL;
|
||||
SecureListenSocket* g_secureListenSocket = NULL;
|
||||
Arch* g_arch = NULL;
|
||||
Log* g_log = NULL;
|
||||
|
||||
std::string
|
||||
helperGetLibsUsed(void)
|
||||
{
|
||||
std::stringstream libs(ARCH->getLibsUsed());
|
||||
std::string msg;
|
||||
std::string pid;
|
||||
std::getline(libs,pid);
|
||||
|
||||
while( std::getline(libs,msg) ) {
|
||||
LOG(( CLOG_DEBUG "libs:%s",msg.c_str()));
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void
|
||||
init(void* log, void* arch)
|
||||
{
|
||||
if (g_log == NULL) {
|
||||
g_log = new Log(reinterpret_cast<Log*>(log));
|
||||
}
|
||||
|
||||
if (g_arch == NULL) {
|
||||
Arch::setInstance(reinterpret_cast<Arch*>(arch));
|
||||
}
|
||||
|
||||
LOG(( CLOG_DEBUG "library use: %s", helperGetLibsUsed().c_str()));
|
||||
}
|
||||
|
||||
int
|
||||
initEvent(void (*sendEvent)(const char*, void*))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void*
|
||||
invoke(const char* command, void** args)
|
||||
{
|
||||
IEventQueue* arg1 = NULL;
|
||||
SocketMultiplexer* arg2 = NULL;
|
||||
if (args != NULL) {
|
||||
arg1 = reinterpret_cast<IEventQueue*>(args[0]);
|
||||
arg2 = reinterpret_cast<SocketMultiplexer*>(args[1]);
|
||||
}
|
||||
|
||||
if (strcmp(command, "getSocket") == 0) {
|
||||
if (g_secureSocket != NULL) {
|
||||
delete g_secureSocket;
|
||||
}
|
||||
g_secureSocket = new SecureSocket(arg1, arg2);
|
||||
g_secureSocket->initSsl(false);
|
||||
return g_secureSocket;
|
||||
}
|
||||
else if (strcmp(command, "getListenSocket") == 0) {
|
||||
if (g_secureListenSocket != NULL) {
|
||||
delete g_secureListenSocket;
|
||||
}
|
||||
g_secureListenSocket = new SecureListenSocket(arg1, arg2);
|
||||
return g_secureListenSocket;
|
||||
}
|
||||
else if (strcmp(command, "deleteSocket") == 0) {
|
||||
if (g_secureSocket != NULL) {
|
||||
delete g_secureSocket;
|
||||
g_secureSocket = NULL;
|
||||
}
|
||||
}
|
||||
else if (strcmp(command, "deleteListenSocket") == 0) {
|
||||
if (g_secureListenSocket != NULL) {
|
||||
delete g_secureListenSocket;
|
||||
g_secureListenSocket = NULL;
|
||||
}
|
||||
}
|
||||
else if (strcmp(command, "version") == 0) {
|
||||
return (void*)getExpectedPluginVersion(s_pluginNames[kSecureSocket]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
cleanup()
|
||||
{
|
||||
if (g_secureSocket != NULL) {
|
||||
delete g_secureSocket;
|
||||
}
|
||||
|
||||
if (g_secureListenSocket != NULL) {
|
||||
delete g_secureListenSocket;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +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
|
||||
|
||||
#if defined _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
|
||||
#if defined(ns_EXPORTS)
|
||||
#define NS_API __declspec(dllexport)
|
||||
#else
|
||||
#define NS_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define NS_API
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
|
||||
NS_API void init(void* log, void* arch);
|
||||
NS_API int initEvent(void (*sendEvent)(const char*, void*));
|
||||
NS_API void* invoke(const char* command, void** args);
|
||||
NS_API void cleanup();
|
||||
|
||||
}
|