parent
70c8f98615
commit
38718a362f
|
@ -17,3 +17,22 @@
|
||||||
#doxygen
|
#doxygen
|
||||||
/doc/doxygen
|
/doc/doxygen
|
||||||
/doc/doxygen.cfg
|
/doc/doxygen.cfg
|
||||||
|
build
|
||||||
|
cryptopp562
|
||||||
|
gmock-1.6.0
|
||||||
|
gtest-1.6.0
|
||||||
|
lib
|
||||||
|
/src/gui/Makefile.Debug
|
||||||
|
/src/gui/Makefile.Release
|
||||||
|
/src/gui/object_script.synergy.Debug
|
||||||
|
/src/gui/object_script.synergy.Release
|
||||||
|
/src/gui/Makefile
|
||||||
|
tmp
|
||||||
|
/src/gui/ui_ScreenSettingsDialogBase.h
|
||||||
|
/src/gui/ui_ServerConfigDialogBase.h
|
||||||
|
/src/gui/ui_SettingsDialogBase.h
|
||||||
|
/src/gui/ui_SetupWizardBase.h
|
||||||
|
/src/gui/ui_AboutDialogBase.h
|
||||||
|
/src/gui/ui_ActionDialogBase.h
|
||||||
|
/src/gui/ui_HotkeyDialogBase.h
|
||||||
|
/src/gui/ui_MainWindowBase.h
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
QT += widgets network
|
QT += widgets \
|
||||||
|
network
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET = synergy
|
TARGET = synergy
|
||||||
DEPENDPATH += . \
|
DEPENDPATH += . \
|
||||||
|
@ -41,7 +42,6 @@ SOURCES += src/main.cpp \
|
||||||
src/Ipc.cpp \
|
src/Ipc.cpp \
|
||||||
src/SynergyLocale.cpp \
|
src/SynergyLocale.cpp \
|
||||||
src/QUtility.cpp \
|
src/QUtility.cpp \
|
||||||
src/PremiumAuth.cpp \
|
|
||||||
src/ZeroconfServer.cpp \
|
src/ZeroconfServer.cpp \
|
||||||
src/ZeroconfThread.cpp \
|
src/ZeroconfThread.cpp \
|
||||||
src/ZeroconfRegister.cpp \
|
src/ZeroconfRegister.cpp \
|
||||||
|
@ -74,7 +74,6 @@ HEADERS += src/MainWindow.h \
|
||||||
src/Ipc.h \
|
src/Ipc.h \
|
||||||
src/SynergyLocale.h \
|
src/SynergyLocale.h \
|
||||||
src/QUtility.h \
|
src/QUtility.h \
|
||||||
src/PremiumAuth.h \
|
|
||||||
src/ZeroconfServer.h \
|
src/ZeroconfServer.h \
|
||||||
src/ZeroconfThread.h \
|
src/ZeroconfThread.h \
|
||||||
src/ZeroconfRegister.h \
|
src/ZeroconfRegister.h \
|
||||||
|
@ -93,9 +92,7 @@ macx {
|
||||||
QMAKE_BUNDLE_DATA += QSYNERGY_ICON
|
QMAKE_BUNDLE_DATA += QSYNERGY_ICON
|
||||||
LIBS += $$MACX_LIBS
|
LIBS += $$MACX_LIBS
|
||||||
}
|
}
|
||||||
unix:!macx {
|
unix:!macx:LIBS += -ldns_sd
|
||||||
LIBS += -ldns_sd
|
|
||||||
}
|
|
||||||
debug {
|
debug {
|
||||||
OBJECTS_DIR = tmp/debug
|
OBJECTS_DIR = tmp/debug
|
||||||
MOC_DIR = tmp/debug
|
MOC_DIR = tmp/debug
|
||||||
|
@ -109,7 +106,8 @@ release {
|
||||||
win32 {
|
win32 {
|
||||||
Debug:DESTDIR = ../../bin/Debug
|
Debug:DESTDIR = ../../bin/Debug
|
||||||
Release:DESTDIR = ../../bin/Release
|
Release:DESTDIR = ../../bin/Release
|
||||||
LIBS += -L"../../ext/bonjour/x64" -ldnssd
|
LIBS += -L"../../ext/bonjour/x64" \
|
||||||
|
-ldnssd
|
||||||
INCLUDEPATH += "$(BONJOUR_SDK_HOME)/Include"
|
INCLUDEPATH += "$(BONJOUR_SDK_HOME)/Include"
|
||||||
}
|
}
|
||||||
else:DESTDIR = ../../bin
|
else:DESTDIR = ../../bin
|
||||||
|
|
|
@ -78,57 +78,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="m_pWidgetPremium" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>7</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="m_pIconPremium">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap resource="Synergy.qrc">:/res/icons/16x16/money.png</pixmap>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="m_pLabelPremium">
|
|
||||||
<property name="text">
|
|
||||||
<string>Please help us <a href="http://synergy-project.org/donate/?source=gui-notice">fund this project</a> if you like Synergy.</string>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="m_pSpacerPremium">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="m_pGroupServer">
|
<widget class="QGroupBox" name="m_pGroupServer">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
|
@ -120,200 +120,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWizardPage" name="m_pPremiumUserPage">
|
|
||||||
<property name="title">
|
|
||||||
<string>Synergy Premium</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="m_pRadioButtonPremiumLogin">
|
|
||||||
<property name="text">
|
|
||||||
<string>I donated to Synergy and have a premium login...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout_5">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="m_pLabel_28">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Email:</string>
|
|
||||||
</property>
|
|
||||||
<property name="indent">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>m_pLineEditPremiumEmail</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="m_pLineEditPremiumEmail">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="baseSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="echoMode">
|
|
||||||
<enum>QLineEdit::Normal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="m_pLabel_29">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Password:</string>
|
|
||||||
</property>
|
|
||||||
<property name="indent">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>m_pLineEditPremiumPassword</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="m_pLineEditPremiumPassword">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="baseSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="echoMode">
|
|
||||||
<enum>QLineEdit::Password</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="m_pLabelForgotPassword">
|
|
||||||
<property name="text">
|
|
||||||
<string><a href="http://synergy-project.org/premium/reset/?source=gui">Forgot password</a></string>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_12">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>5</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="m_pRadioButtonPremiumLater">
|
|
||||||
<property name="text">
|
|
||||||
<string>No, I have not donated to Synergy, skip this step</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_9">
|
|
||||||
<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>100</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWizardPage" name="m_pNodePage">
|
<widget class="QWizardPage" name="m_pNodePage">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
@ -431,10 +237,6 @@ p, li { white-space: pre-wrap; }
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>m_pComboLanguage</tabstop>
|
<tabstop>m_pComboLanguage</tabstop>
|
||||||
<tabstop>m_pRadioButtonPremiumLogin</tabstop>
|
|
||||||
<tabstop>m_pLineEditPremiumEmail</tabstop>
|
|
||||||
<tabstop>m_pLineEditPremiumPassword</tabstop>
|
|
||||||
<tabstop>m_pRadioButtonPremiumLater</tabstop>
|
|
||||||
<tabstop>m_pServerRadioButton</tabstop>
|
<tabstop>m_pServerRadioButton</tabstop>
|
||||||
<tabstop>m_pClientRadioButton</tabstop>
|
<tabstop>m_pClientRadioButton</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
|
|
@ -121,8 +121,6 @@ void AppConfig::loadSettings()
|
||||||
m_CryptoPass = settings().value("cryptoPass", "").toString();
|
m_CryptoPass = settings().value("cryptoPass", "").toString();
|
||||||
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
|
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
|
||||||
m_Language = settings().value("language", QLocale::system().name()).toString();
|
m_Language = settings().value("language", QLocale::system().name()).toString();
|
||||||
m_PremiumEmail = settings().value("premiumEmail", "").toString();
|
|
||||||
m_PremiumToken = settings().value("premiumToken", "").toString();
|
|
||||||
m_StartedBefore = settings().value("startedBefore", false).toBool();
|
m_StartedBefore = settings().value("startedBefore", false).toBool();
|
||||||
m_AutoConnect = settings().value("autoConnect", true).toBool();
|
m_AutoConnect = settings().value("autoConnect", true).toBool();
|
||||||
}
|
}
|
||||||
|
@ -139,8 +137,6 @@ void AppConfig::saveSettings()
|
||||||
settings().setValue("cryptoPass", m_CryptoPass);
|
settings().setValue("cryptoPass", m_CryptoPass);
|
||||||
settings().setValue("cryptoEnabled", m_CryptoEnabled);
|
settings().setValue("cryptoEnabled", m_CryptoEnabled);
|
||||||
settings().setValue("language", m_Language);
|
settings().setValue("language", m_Language);
|
||||||
settings().setValue("premiumEmail", m_PremiumEmail);
|
|
||||||
settings().setValue("premiumToken", m_PremiumToken);
|
|
||||||
settings().setValue("startedBefore", m_StartedBefore);
|
settings().setValue("startedBefore", m_StartedBefore);
|
||||||
settings().setValue("autoConnect", m_AutoConnect);
|
settings().setValue("autoConnect", m_AutoConnect);
|
||||||
}
|
}
|
||||||
|
@ -161,13 +157,6 @@ void AppConfig::setCryptoPass(const QString &s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppConfig::isPremium()
|
|
||||||
{
|
|
||||||
QString hashSrc = m_PremiumEmail + getFirstMacAddress();
|
|
||||||
QString hashResult = hash(hashSrc);
|
|
||||||
return hashResult == m_PremiumToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AppConfig::setAutoConnect(bool autoConnect)
|
void AppConfig::setAutoConnect(bool autoConnect)
|
||||||
{
|
{
|
||||||
m_AutoConnect = autoConnect;
|
m_AutoConnect = autoConnect;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
//
|
//
|
||||||
// 1: first version
|
// 1: first version
|
||||||
// 2: added language page
|
// 2: added language page
|
||||||
// 3: added premium page
|
// 3: added premium page and removed
|
||||||
//
|
//
|
||||||
const int kWizardVersion = 3;
|
const int kWizardVersion = 3;
|
||||||
|
|
||||||
|
@ -67,8 +67,6 @@ class AppConfig
|
||||||
ProcessMode processMode() const { return m_ProcessMode; }
|
ProcessMode processMode() const { return m_ProcessMode; }
|
||||||
bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
|
bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
|
||||||
const QString& language() const { return m_Language; }
|
const QString& language() const { return m_Language; }
|
||||||
const QString& premiumEmail() const { return m_PremiumEmail; }
|
|
||||||
const QString& premiumToken() const { return m_PremiumToken; }
|
|
||||||
bool startedBefore() const { return m_StartedBefore; }
|
bool startedBefore() const { return m_StartedBefore; }
|
||||||
bool autoConnect() const { return m_AutoConnect; }
|
bool autoConnect() const { return m_AutoConnect; }
|
||||||
void setAutoConnect(bool autoConnect);
|
void setAutoConnect(bool autoConnect);
|
||||||
|
@ -80,7 +78,6 @@ class AppConfig
|
||||||
|
|
||||||
bool detectPath(const QString& name, QString& path);
|
bool detectPath(const QString& name, QString& path);
|
||||||
void persistLogDir();
|
void persistLogDir();
|
||||||
bool isPremium();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSettings& settings() { return *m_pSettings; }
|
QSettings& settings() { return *m_pSettings; }
|
||||||
|
@ -93,8 +90,6 @@ class AppConfig
|
||||||
void setCryptoEnabled(bool b) { m_CryptoEnabled = b; }
|
void setCryptoEnabled(bool b) { m_CryptoEnabled = b; }
|
||||||
void setWizardHasRun() { m_WizardLastRun = kWizardVersion; }
|
void setWizardHasRun() { m_WizardLastRun = kWizardVersion; }
|
||||||
void setLanguage(const QString language) { m_Language = language; }
|
void setLanguage(const QString language) { m_Language = language; }
|
||||||
void setPremiumEmail(const QString premiumEmail) { m_PremiumEmail = premiumEmail; }
|
|
||||||
void setPremiumToken(const QString premiumToken) { m_PremiumToken = premiumToken; }
|
|
||||||
void setStartedBefore(bool b) { m_StartedBefore = b; }
|
void setStartedBefore(bool b) { m_StartedBefore = b; }
|
||||||
|
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
@ -115,8 +110,6 @@ class AppConfig
|
||||||
QString m_CryptoPass;
|
QString m_CryptoPass;
|
||||||
ProcessMode m_ProcessMode;
|
ProcessMode m_ProcessMode;
|
||||||
QString m_Language;
|
QString m_Language;
|
||||||
QString m_PremiumEmail;
|
|
||||||
QString m_PremiumToken;
|
|
||||||
bool m_StartedBefore;
|
bool m_StartedBefore;
|
||||||
bool m_AutoConnect;
|
bool m_AutoConnect;
|
||||||
|
|
||||||
|
|
|
@ -128,8 +128,6 @@ MainWindow::~MainWindow()
|
||||||
|
|
||||||
void MainWindow::open()
|
void MainWindow::open()
|
||||||
{
|
{
|
||||||
updatePremiumInfo();
|
|
||||||
|
|
||||||
createTrayIcon();
|
createTrayIcon();
|
||||||
|
|
||||||
showNormal();
|
showNormal();
|
||||||
|
@ -416,10 +414,9 @@ void MainWindow::startSynergy()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_LINUX
|
#ifndef Q_OS_LINUX
|
||||||
if (appConfig().isPremium())
|
|
||||||
{
|
|
||||||
args << "--enable-drag-drop";
|
args << "--enable-drag-drop";
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((synergyType() == synergyClient && !clientArgs(args, app))
|
if ((synergyType() == synergyClient && !clientArgs(args, app))
|
||||||
|
@ -781,7 +778,6 @@ void MainWindow::changeEvent(QEvent* event)
|
||||||
case QEvent::LanguageChange:
|
case QEvent::LanguageChange:
|
||||||
retranslateUi(this);
|
retranslateUi(this);
|
||||||
retranslateMenuBar();
|
retranslateMenuBar();
|
||||||
updatePremiumInfo();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -790,20 +786,6 @@ void MainWindow::changeEvent(QEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updatePremiumInfo()
|
|
||||||
{
|
|
||||||
if (m_AppConfig.isPremium())
|
|
||||||
{
|
|
||||||
m_pWidgetPremium->hide();
|
|
||||||
setWindowTitle(tr("Synergy Premium"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_pWidgetPremium->show();
|
|
||||||
setWindowTitle(tr("Synergy"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateZeroconfService()
|
void MainWindow::updateZeroconfService()
|
||||||
{
|
{
|
||||||
if (!m_AppConfig.wizardShouldRun()) {
|
if (!m_AppConfig.wizardShouldRun()) {
|
||||||
|
@ -912,7 +894,6 @@ void MainWindow::on_m_pActionWizard_triggered()
|
||||||
{
|
{
|
||||||
SetupWizard wizard(*this, false);
|
SetupWizard wizard(*this, false);
|
||||||
wizard.exec();
|
wizard.exec();
|
||||||
updatePremiumInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_m_pElevateCheckBox_toggled(bool checked)
|
void MainWindow::on_m_pElevateCheckBox_toggled(bool checked)
|
||||||
|
|
|
@ -147,7 +147,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
void stopDesktop();
|
void stopDesktop();
|
||||||
void changeEvent(QEvent* event);
|
void changeEvent(QEvent* event);
|
||||||
void retranslateMenuBar();
|
void retranslateMenuBar();
|
||||||
void updatePremiumInfo();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings& m_Settings;
|
QSettings& m_Settings;
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
* synergy -- mouse and keyboard sharing utility
|
|
||||||
* Copyright (C) 2014 Bolton Software 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 COPYING 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 "PremiumAuth.h"
|
|
||||||
#include "QUtility.h"
|
|
||||||
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
// we use syntool to authenticate because Qt's http library is very
|
|
||||||
// unreliable, and since we're writing platform specific code, use the
|
|
||||||
// synergy code since there we can use integ tests.
|
|
||||||
QString PremiumAuth::request(const QString& email, const QString& password)
|
|
||||||
{
|
|
||||||
QString program(QCoreApplication::applicationDirPath() + "/syntool");
|
|
||||||
QStringList args("--premium-auth");
|
|
||||||
|
|
||||||
QProcess process;
|
|
||||||
process.setReadChannel(QProcess::StandardOutput);
|
|
||||||
process.start(program, args);
|
|
||||||
bool success = process.waitForStarted();
|
|
||||||
|
|
||||||
QString out, error;
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
// hash password in case it contains interesting chars.
|
|
||||||
QString credentials(email + ":" + hash(password) + "\n");
|
|
||||||
process.write(credentials.toStdString().c_str());
|
|
||||||
|
|
||||||
if (process.waitForFinished()) {
|
|
||||||
out = process.readAllStandardOutput();
|
|
||||||
error = process.readAllStandardError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
out = out.trimmed();
|
|
||||||
error = error.trimmed();
|
|
||||||
|
|
||||||
if (out.isEmpty() ||
|
|
||||||
!error.isEmpty() ||
|
|
||||||
!success ||
|
|
||||||
process.exitCode() != 0)
|
|
||||||
{
|
|
||||||
throw std::runtime_error(
|
|
||||||
QString("Code: %1\nError: %2")
|
|
||||||
.arg(process.exitCode())
|
|
||||||
.arg(error.isEmpty() ? "Unknown" : error)
|
|
||||||
.toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
* synergy -- mouse and keyboard sharing utility
|
|
||||||
* Copyright (C) 2014 Bolton Software 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 COPYING 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 <QString>
|
|
||||||
|
|
||||||
class PremiumAuth
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QString request(const QString& email, const QString& password);
|
|
||||||
};
|
|
|
@ -19,15 +19,8 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "QSynergyApplication.h"
|
#include "QSynergyApplication.h"
|
||||||
#include "QUtility.h"
|
#include "QUtility.h"
|
||||||
#include "PremiumAuth.h"
|
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QUrl>
|
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
|
|
||||||
#define PREMIUM_REGISTER_URL "http://synergy-project.org/donate/?source=gui-wizard"
|
|
||||||
|
|
||||||
SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
|
SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
|
||||||
m_MainWindow(mainWindow),
|
m_MainWindow(mainWindow),
|
||||||
|
@ -58,13 +51,7 @@ SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
|
||||||
|
|
||||||
m_Locale.fillLanguageComboBox(m_pComboLanguage);
|
m_Locale.fillLanguageComboBox(m_pComboLanguage);
|
||||||
setIndexFromItemData(m_pComboLanguage, m_MainWindow.appConfig().language());
|
setIndexFromItemData(m_pComboLanguage, m_MainWindow.appConfig().language());
|
||||||
AppConfig& appConfig = m_MainWindow.appConfig();
|
|
||||||
QString premiumEmail = appConfig.premiumEmail();
|
|
||||||
if (!premiumEmail.isEmpty())
|
|
||||||
{
|
|
||||||
m_pRadioButtonPremiumLogin->setChecked(true);
|
|
||||||
m_pLineEditPremiumEmail->setText(premiumEmail);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupWizard::~SetupWizard()
|
SetupWizard::~SetupWizard()
|
||||||
|
@ -89,32 +76,6 @@ bool SetupWizard::validateCurrentPage()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (currentPage() == m_pPremiumUserPage)
|
|
||||||
{
|
|
||||||
if (m_pRadioButtonPremiumLogin->isChecked())
|
|
||||||
{
|
|
||||||
if (m_pLineEditPremiumEmail->text().isEmpty() ||
|
|
||||||
m_pLineEditPremiumPassword->text().isEmpty())
|
|
||||||
{
|
|
||||||
message.setText(tr("Please enter your email address and password."));
|
|
||||||
message.exec();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (!isPremiumLoginValid(message))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (m_pRadioButtonPremiumLater->isChecked())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
message.setText(tr("Please select an option."));
|
|
||||||
message.exec();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -144,19 +105,6 @@ void SetupWizard::accept()
|
||||||
AppConfig& appConfig = m_MainWindow.appConfig();
|
AppConfig& appConfig = m_MainWindow.appConfig();
|
||||||
|
|
||||||
appConfig.setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
|
appConfig.setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
|
||||||
appConfig.setPremiumEmail(m_pLineEditPremiumEmail->text());
|
|
||||||
|
|
||||||
if (!m_pRadioButtonPremiumLogin->isChecked())
|
|
||||||
{
|
|
||||||
appConfig.setPremiumToken("");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QString mac = getFirstMacAddress();
|
|
||||||
QString hashSrc = m_pLineEditPremiumEmail->text() + mac;
|
|
||||||
QString hashResult = hash(hashSrc);
|
|
||||||
appConfig.setPremiumToken(hashResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
appConfig.setWizardHasRun();
|
appConfig.setWizardHasRun();
|
||||||
appConfig.saveSettings();
|
appConfig.saveSettings();
|
||||||
|
@ -205,65 +153,3 @@ void SetupWizard::on_m_pComboLanguage_currentIndexChanged(int index)
|
||||||
QString ietfCode = m_pComboLanguage->itemData(index).toString();
|
QString ietfCode = m_pComboLanguage->itemData(index).toString();
|
||||||
QSynergyApplication::getInstance()->switchTranslator(ietfCode);
|
QSynergyApplication::getInstance()->switchTranslator(ietfCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupWizard::on_m_pRadioButtonPremiumLogin_toggled(bool checked)
|
|
||||||
{
|
|
||||||
m_pLineEditPremiumEmail->setEnabled(checked);
|
|
||||||
m_pLineEditPremiumPassword->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SetupWizard::isPremiumLoginValid(QMessageBox& message)
|
|
||||||
{
|
|
||||||
QString email = m_pLineEditPremiumEmail->text();
|
|
||||||
QString password = m_pLineEditPremiumPassword->text();
|
|
||||||
|
|
||||||
QString responseJson;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
PremiumAuth auth;
|
|
||||||
responseJson = auth.request(email, password);
|
|
||||||
}
|
|
||||||
catch (std::exception& e)
|
|
||||||
{
|
|
||||||
message.critical(
|
|
||||||
this, "Error",
|
|
||||||
tr("Sorry, an error occured while trying to sign in. "
|
|
||||||
"Please contact the help desk, and provide the "
|
|
||||||
"following details.\n\n%1")
|
|
||||||
.arg(e.what()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRegExp resultRegex(".*\"result\".*:.*(true|false).*");
|
|
||||||
if (resultRegex.exactMatch(responseJson)) {
|
|
||||||
QString boolString = resultRegex.cap(1);
|
|
||||||
if (boolString == "true") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (boolString == "false") {
|
|
||||||
message.critical(
|
|
||||||
this, "Error",
|
|
||||||
tr("Login failed, invalid email or password."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QRegExp errorRegex(".*\"error\".*:.*\"(.+)\".*");
|
|
||||||
if (errorRegex.exactMatch(responseJson)) {
|
|
||||||
|
|
||||||
// replace "\n" with real new lines.
|
|
||||||
QString error = errorRegex.cap(1).replace("\\n", "\n");
|
|
||||||
|
|
||||||
message.critical(
|
|
||||||
this, "Error",
|
|
||||||
tr("Login failed, an error occurred.\n\n%1").arg(error));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message.critical(
|
|
||||||
this, "Error",
|
|
||||||
tr("Login failed, an error occurred.\n\nServer response:\n\n%1")
|
|
||||||
.arg(responseJson));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
|
@ -39,9 +39,6 @@ protected:
|
||||||
void accept();
|
void accept();
|
||||||
void reject();
|
void reject();
|
||||||
|
|
||||||
private:
|
|
||||||
bool isPremiumLoginValid(QMessageBox& message);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow& m_MainWindow;
|
MainWindow& m_MainWindow;
|
||||||
bool m_StartMain;
|
bool m_StartMain;
|
||||||
|
@ -50,5 +47,4 @@ private:
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_pCheckBoxEnableCrypto_stateChanged(int );
|
void on_m_pCheckBoxEnableCrypto_stateChanged(int );
|
||||||
void on_m_pComboLanguage_currentIndexChanged(int index);
|
void on_m_pComboLanguage_currentIndexChanged(int index);
|
||||||
void on_m_pRadioButtonPremiumLogin_toggled(bool checked);
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue