Merge changes made in v1.8.4

This commit is contained in:
Andrew Nelless
2016-10-12 10:41:44 +01:00
117 changed files with 1414 additions and 3018 deletions

View File

@@ -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 {

View File

@@ -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>&lt;p&gt;
Keyboard and mouse sharing application. Cross platform and open source.&lt;br /&gt;&lt;br /&gt;
Copyright © 2012-2016 Symless Ltd.&lt;br /&gt;
Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.&lt;br /&gt;&lt;br /&gt;
Synergy is released under the GNU General Public License (GPLv2).&lt;br /&gt;&lt;br /&gt;
Synergy is based on CosmoSynergy by Richard Lee and Adam Feder.&lt;br /&gt;
The Synergy GUI is based on QSynergy by Volker Lanz.&lt;br /&gt;&lt;br /&gt;
Visit our website for help and info (symless.com).
&lt;/p&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Keyboard and mouse sharing application. &lt;br/&gt;&lt;br/&gt;Copyright © 2012-2016 Symless Ltd.&lt;br/&gt;Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.&lt;/p&gt;&lt;p&gt;Synergy is based on CosmoSynergy by Richard Lee and Adam Feder.&lt;br/&gt;The Synergy GUI is based on QSynergy by Volker Lanz. &lt;/p&gt;&lt;p&gt;Synergy is released under the GNU General Public License (GPLv2).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

@@ -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>&amp;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>&amp;Serial key</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Found on your &lt;a href=&quot;https://symless.com/account/?source=gui&quot;&gt;account&lt;/a&gt; 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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CancelActivationDialog</class>
<widget class="QDialog" name="CancelActivationDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>165</height>
</rect>
</property>
<property name="windowTitle">
<string>Cancel Activation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Are you sure?
If you don't activate Synergy you'll be missing out on some great features</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://symless.com/pricing?source=gui&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Buy now&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FailedLoginDialog</class>
<widget class="QDialog" name="FailedLoginDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>165</height>
</rect>
</property>
<property name="windowTitle">
<string>Activation Error</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>50</x>
<y>120</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>382</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://symless.com/account/reset/?source=gui&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Forgotten your password?&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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 &amp;SSL encryption (unique certificate)</string>
<string>Use &amp;SSL encryption</string>
</property>
</widget>
</item>

View File

@@ -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 &lt;a href=&quot;http://symless.com/pricing?source=gui&quot;&gt;Synergy Pro&lt;/a&gt; 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>&amp;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>&lt;a href=&quot;https://symless.com/account/reset/?source=gui&quot;&gt;Forgot password&lt;/a&gt;</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>&amp;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&amp;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">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -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)

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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; }

View File

@@ -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

View File

@@ -0,0 +1,14 @@
#include "CancelActivationDialog.h"
#include "ui_CancelActivationDialog.h"
CancelActivationDialog::CancelActivationDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CancelActivationDialog)
{
ui->setupUi(this);
}
CancelActivationDialog::~CancelActivationDialog()
{
delete ui;
}

View File

@@ -0,0 +1,22 @@
#ifndef CANCELACTIVATIONDIALOG_H
#define CANCELACTIVATIONDIALOG_H
#include <QDialog>
namespace Ui {
class CancelActivationDialog;
}
class CancelActivationDialog : public QDialog
{
Q_OBJECT
public:
explicit CancelActivationDialog(QWidget *parent = 0);
~CancelActivationDialog();
private:
Ui::CancelActivationDialog *ui;
};
#endif // CANCELACTIVATIONDIALOG_H

View File

@@ -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

View File

@@ -0,0 +1,15 @@
#include "FailedLoginDialog.h"
#include "ui_FailedLoginDialog.h"
FailedLoginDialog::FailedLoginDialog(QWidget *parent, QString message):
QDialog(parent),
ui(new Ui::FailedLoginDialog)
{
ui->setupUi(this);
ui->messageLabel->setText(ui->messageLabel->text().arg(message));
}
FailedLoginDialog::~FailedLoginDialog()
{
delete ui;
}

View File

@@ -0,0 +1,23 @@
#ifndef FAILEDLOGINDIALOG_H
#define FAILEDLOGINDIALOG_H
#include <QDialog>
#include <QString>
namespace Ui {
class FailedLoginDialog;
}
class FailedLoginDialog : public QDialog
{
Q_OBJECT
public:
explicit FailedLoginDialog(QWidget *parent = 0, QString message = "");
~FailedLoginDialog();
private:
Ui::FailedLoginDialog *ui;
};
#endif // FAILEDLOGINDIALOG_H

View File

@@ -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;

View File

@@ -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,8 +65,9 @@ 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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -29,3 +29,4 @@ QString hash(const QString& string);
QString getFirstMacAddress();
qProcessorArch getProcessorArch();
QString getOSInformation();
QString getEditionName (int edition);

View File

@@ -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();
}
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);
};

View File

@@ -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();

View File

@@ -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));
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}

View File

@@ -32,21 +32,15 @@ class WebClient : public QObject
Q_OBJECT
public:
int getEdition(const QString& email,
const QString& password,
QMessageBox& message,
QWidget* w);
void setEmail(QString& e) { m_Email = e; }
void setPassword(QString& p) { m_Password = p; }
bool getEdition (int& edition, QString& errorOut);
bool setEmail (QString email, QString& errorOut);
bool setPassword (QString password, QString& errorOut);
signals:
void error(QString e);
private:
QString request(const QString& email,
const QString& password);
private:
QString request();
QString m_Email;
QString m_Password;
CoreInterface m_CoreInterface;