diff --git a/.gitignore b/.gitignore index 4ede8306..f807b819 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,22 @@ #doxygen /doc/doxygen /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 diff --git a/src/gui/gui.pro b/src/gui/gui.pro index a585a232..d5613988 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -1,115 +1,113 @@ -QT += widgets network +QT += widgets \ + network TEMPLATE = app TARGET = synergy DEPENDPATH += . \ - res + res INCLUDEPATH += . \ - src + src FORMS += res/MainWindowBase.ui \ - res/AboutDialogBase.ui \ - res/ServerConfigDialogBase.ui \ - res/ScreenSettingsDialogBase.ui \ - res/ActionDialogBase.ui \ - res/HotkeyDialogBase.ui \ - res/SettingsDialogBase.ui \ - res/SetupWizardBase.ui + res/AboutDialogBase.ui \ + res/ServerConfigDialogBase.ui \ + res/ScreenSettingsDialogBase.ui \ + res/ActionDialogBase.ui \ + res/HotkeyDialogBase.ui \ + res/SettingsDialogBase.ui \ + res/SetupWizardBase.ui SOURCES += src/main.cpp \ - src/MainWindow.cpp \ - src/AboutDialog.cpp \ - src/ServerConfig.cpp \ - src/ServerConfigDialog.cpp \ - src/ScreenSetupView.cpp \ - src/Screen.cpp \ - src/ScreenSetupModel.cpp \ - src/NewScreenWidget.cpp \ - src/TrashScreenWidget.cpp \ - src/ScreenSettingsDialog.cpp \ - src/BaseConfig.cpp \ - src/HotkeyDialog.cpp \ - src/ActionDialog.cpp \ - src/Hotkey.cpp \ - src/Action.cpp \ - src/KeySequence.cpp \ - src/KeySequenceWidget.cpp \ - src/SettingsDialog.cpp \ - src/AppConfig.cpp \ - src/QSynergyApplication.cpp \ - src/VersionChecker.cpp \ - src/SetupWizard.cpp \ - src/IpcClient.cpp \ - src/IpcReader.cpp \ - src/Ipc.cpp \ - src/SynergyLocale.cpp \ - src/QUtility.cpp \ - src/PremiumAuth.cpp \ - src/ZeroconfServer.cpp \ - src/ZeroconfThread.cpp \ - src/ZeroconfRegister.cpp \ - src/ZeroconfBrowser.cpp \ - src/ZeroconfService.cpp + src/MainWindow.cpp \ + src/AboutDialog.cpp \ + src/ServerConfig.cpp \ + src/ServerConfigDialog.cpp \ + src/ScreenSetupView.cpp \ + src/Screen.cpp \ + src/ScreenSetupModel.cpp \ + src/NewScreenWidget.cpp \ + src/TrashScreenWidget.cpp \ + src/ScreenSettingsDialog.cpp \ + src/BaseConfig.cpp \ + src/HotkeyDialog.cpp \ + src/ActionDialog.cpp \ + src/Hotkey.cpp \ + src/Action.cpp \ + src/KeySequence.cpp \ + src/KeySequenceWidget.cpp \ + src/SettingsDialog.cpp \ + src/AppConfig.cpp \ + src/QSynergyApplication.cpp \ + src/VersionChecker.cpp \ + src/SetupWizard.cpp \ + src/IpcClient.cpp \ + src/IpcReader.cpp \ + src/Ipc.cpp \ + src/SynergyLocale.cpp \ + src/QUtility.cpp \ + src/ZeroconfServer.cpp \ + src/ZeroconfThread.cpp \ + src/ZeroconfRegister.cpp \ + src/ZeroconfBrowser.cpp \ + src/ZeroconfService.cpp HEADERS += src/MainWindow.h \ - src/AboutDialog.h \ - src/ServerConfig.h \ - src/ServerConfigDialog.h \ - src/ScreenSetupView.h \ - src/Screen.h \ - src/ScreenSetupModel.h \ - src/NewScreenWidget.h \ - src/TrashScreenWidget.h \ - src/ScreenSettingsDialog.h \ - src/BaseConfig.h \ - src/HotkeyDialog.h \ - src/ActionDialog.h \ - src/Hotkey.h \ - src/Action.h \ - src/KeySequence.h \ - src/KeySequenceWidget.h \ - src/SettingsDialog.h \ - src/AppConfig.h \ - src/QSynergyApplication.h \ - src/VersionChecker.h \ - src/SetupWizard.h \ - src/IpcClient.h \ - src/IpcReader.h \ - src/Ipc.h \ - src/SynergyLocale.h \ - src/QUtility.h \ - src/PremiumAuth.h \ - src/ZeroconfServer.h \ - src/ZeroconfThread.h \ - src/ZeroconfRegister.h \ - src/ZeroconfRecord.h \ - src/ZeroconfBrowser.h \ - src/ZeroconfService.h + src/AboutDialog.h \ + src/ServerConfig.h \ + src/ServerConfigDialog.h \ + src/ScreenSetupView.h \ + src/Screen.h \ + src/ScreenSetupModel.h \ + src/NewScreenWidget.h \ + src/TrashScreenWidget.h \ + src/ScreenSettingsDialog.h \ + src/BaseConfig.h \ + src/HotkeyDialog.h \ + src/ActionDialog.h \ + src/Hotkey.h \ + src/Action.h \ + src/KeySequence.h \ + src/KeySequenceWidget.h \ + src/SettingsDialog.h \ + src/AppConfig.h \ + src/QSynergyApplication.h \ + src/VersionChecker.h \ + src/SetupWizard.h \ + src/IpcClient.h \ + src/IpcReader.h \ + src/Ipc.h \ + src/SynergyLocale.h \ + src/QUtility.h \ + src/ZeroconfServer.h \ + src/ZeroconfThread.h \ + src/ZeroconfRegister.h \ + src/ZeroconfRecord.h \ + src/ZeroconfBrowser.h \ + src/ZeroconfService.h RESOURCES += res/Synergy.qrc RC_FILE = res/win/Synergy.rc -macx { - HEADERS += src/AXDatabaseCleaner.h - OBJECTIVE_SOURCES += src/AXDatabaseCleaner.mm - QMAKE_INFO_PLIST = res/mac/Info.plist - TARGET = Synergy - QSYNERGY_ICON.files = res/mac/Synergy.icns - QSYNERGY_ICON.path = Contents/Resources - QMAKE_BUNDLE_DATA += QSYNERGY_ICON - LIBS += $$MACX_LIBS -} -unix:!macx { - LIBS += -ldns_sd +macx { + HEADERS += src/AXDatabaseCleaner.h + OBJECTIVE_SOURCES += src/AXDatabaseCleaner.mm + QMAKE_INFO_PLIST = res/mac/Info.plist + TARGET = Synergy + QSYNERGY_ICON.files = res/mac/Synergy.icns + QSYNERGY_ICON.path = Contents/Resources + QMAKE_BUNDLE_DATA += QSYNERGY_ICON + LIBS += $$MACX_LIBS } +unix:!macx:LIBS += -ldns_sd debug { - OBJECTS_DIR = tmp/debug - MOC_DIR = tmp/debug - RCC_DIR = tmp/debug + OBJECTS_DIR = tmp/debug + MOC_DIR = tmp/debug + RCC_DIR = tmp/debug } release { - OBJECTS_DIR = tmp/release - MOC_DIR = tmp/release - RCC_DIR = tmp/release + OBJECTS_DIR = tmp/release + MOC_DIR = tmp/release + RCC_DIR = tmp/release } win32 { - Debug:DESTDIR = ../../bin/Debug - Release:DESTDIR = ../../bin/Release - LIBS += -L"../../ext/bonjour/x64" -ldnssd - INCLUDEPATH += "$(BONJOUR_SDK_HOME)/Include" + Debug:DESTDIR = ../../bin/Debug + Release:DESTDIR = ../../bin/Release + LIBS += -L"../../ext/bonjour/x64" \ + -ldnssd + INCLUDEPATH += "$(BONJOUR_SDK_HOME)/Include" } else:DESTDIR = ../../bin diff --git a/src/gui/res/MainWindowBase.ui b/src/gui/res/MainWindowBase.ui index 02fdc723..1706b293 100644 --- a/src/gui/res/MainWindowBase.ui +++ b/src/gui/res/MainWindowBase.ui @@ -1,567 +1,516 @@ - - - MainWindowBase - - - - 0 - 0 - 600 - 500 - - - - - 0 - 0 - - - - - 500 - 400 - - - - Synergy - - - - - - - - 2 - - - 0 - - - 0 - - - 7 - - - - - - - - :/res/icons/16x16/warning.png - - - - - - - m_pLabelUpdate - - - true - - - - - - - Qt::Horizontal - - - - 469 - 20 - - - - - - - - - - - - 2 - - - 0 - - - 0 - - - 7 - - - - - - - - :/res/icons/16x16/money.png - - - - - - - Please help us <a href="http://synergy-project.org/donate/?source=gui-notice">fund this project</a> if you like Synergy. - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - 0 - - - - &Server (share this computer's mouse and keyboard): - - - true - - - true - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - IP addresses: - - - - - - - - - - - - - - - - Configure interactively: - - - true - - - - - - - - - &Configure Server... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Use existing configuration: - - - - - - - - - &Configuration file: - - - m_pLineEditConfigFile - - - - - - - false - - - - - - - false - - - &Browse... - - - - - - - - - - - - - 0 - 0 - - - - &Client (use another computer's mouse and keyboard): - - - true - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Screen name: - - - - - - - &Server IP: - - - m_pLineEditHostname - - - - - - - - - - - - - - - - - Auto connect - - - - - - - - - - Log - - - - - - - 0 - 0 - - - - - Courier - - - - false - - - false - - - QTextEdit::NoWrap - - - true - - - - - - - - - - QLayout::SetDefaultConstraint - - - - - Ready - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - &Elevate - - - - - - - false - - - &Apply - - - - - - - &Start - - - - - - - - - - &About Synergy... - - - - - - - - &Quit - - - Quit - - - Ctrl+Q - - - - - &Start - - - Run - - - Ctrl+S - - - - - false - - - S&top - - - Stop - - - Ctrl+T - - - - - S&how Status - - - Ctrl+H - - - - - &Hide - - - Hide - - - - - - - - &Show - - - Show - - - - - - - - Save configuration &as... - - - Save the interactively generated server configuration to a file. - - - Ctrl+Alt+S - - - - - Settings - - - Edit settings - - - - - - - - Run Wizard - - - - - - - - - - - - m_pRadioExternalConfig - toggled(bool) - m_pLineEditConfigFile - setEnabled(bool) - - - 156 - 179 - - - 169 - 209 - - - - - m_pRadioExternalConfig - toggled(bool) - m_pButtonBrowseConfigFile - setEnabled(bool) - - - 353 - 182 - - - 356 - 211 - - - - - m_pRadioInternalConfig - toggled(bool) - m_pButtonConfigureServer - setEnabled(bool) - - - 204 - 244 - - - 212 - 274 - - - - - m_pButtonToggleStart - clicked() - m_pActionStartSynergy - trigger() - - - 361 - 404 - - - -1 - -1 - - - - - + + + MainWindowBase + + + + 0 + 0 + 600 + 500 + + + + + 0 + 0 + + + + + 500 + 400 + + + + Synergy + + + + + + + + 2 + + + 0 + + + 0 + + + 7 + + + + + + + + :/res/icons/16x16/warning.png + + + + + + + m_pLabelUpdate + + + true + + + + + + + Qt::Horizontal + + + + 469 + 20 + + + + + + + + + + + + 0 + 0 + + + + &Server (share this computer's mouse and keyboard): + + + true + + + true + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + IP addresses: + + + + + + + + + + + + + + + + Configure interactively: + + + true + + + + + + + + + &Configure Server... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Use existing configuration: + + + + + + + + + &Configuration file: + + + m_pLineEditConfigFile + + + + + + + false + + + + + + + false + + + &Browse... + + + + + + + + + + + + + 0 + 0 + + + + &Client (use another computer's mouse and keyboard): + + + true + + + true + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Screen name: + + + + + + + &Server IP: + + + m_pLineEditHostname + + + + + + + + + + + + + + + + + Auto connect + + + + + + + + + + Log + + + + + + + 0 + 0 + + + + + Courier + + + + false + + + false + + + QTextEdit::NoWrap + + + true + + + + + + + + + + QLayout::SetDefaultConstraint + + + + + Ready + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Elevate + + + + + + + false + + + &Apply + + + + + + + &Start + + + + + + + + + + &About Synergy... + + + + + + + + &Quit + + + Quit + + + Ctrl+Q + + + + + &Start + + + Run + + + Ctrl+S + + + + + false + + + S&top + + + Stop + + + Ctrl+T + + + + + S&how Status + + + Ctrl+H + + + + + &Hide + + + Hide + + + + + + + + &Show + + + Show + + + + + + + + Save configuration &as... + + + Save the interactively generated server configuration to a file. + + + Ctrl+Alt+S + + + + + Settings + + + Edit settings + + + + + + + + Run Wizard + + + + + + + + + + + + m_pRadioExternalConfig + toggled(bool) + m_pLineEditConfigFile + setEnabled(bool) + + + 156 + 179 + + + 169 + 209 + + + + + m_pRadioExternalConfig + toggled(bool) + m_pButtonBrowseConfigFile + setEnabled(bool) + + + 353 + 182 + + + 356 + 211 + + + + + m_pRadioInternalConfig + toggled(bool) + m_pButtonConfigureServer + setEnabled(bool) + + + 204 + 244 + + + 212 + 274 + + + + + m_pButtonToggleStart + clicked() + m_pActionStartSynergy + trigger() + + + 361 + 404 + + + -1 + -1 + + + + + diff --git a/src/gui/res/SetupWizardBase.ui b/src/gui/res/SetupWizardBase.ui index b6f25474..8c089886 100644 --- a/src/gui/res/SetupWizardBase.ui +++ b/src/gui/res/SetupWizardBase.ui @@ -1,443 +1,245 @@ - - - SetupWizardBase - - - - 0 - 0 - 556 - 464 - - - - - 0 - 0 - - - - - 500 - 390 - - - - Setup Synergy - - - - Welcome - - - - - - - - - Thanks for installing Synergy! - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - - - - 100 - 0 - - - - &Language: - - - m_pComboLanguage - - - - - - - - 200 - 16777215 - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - - - - Synergy lets you easily share your mouse and keyboard between multiple computers on your desk, and it's Free and Open Source. Just move your mouse off the edge of one computer's screen on to another. You can even share all of your clipboards. All you need is a network connection. Synergy is cross-platform (works on Windows, Mac OS X and Linux). - - - true - - - - - - - - Synergy Premium - - - - - - I donated to Synergy and have a premium login... - - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 75 - true - - - - &Email: - - - 10 - - - m_pLineEditPremiumEmail - - - - - - - true - - - - 0 - 0 - - - - - 200 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - QLineEdit::Normal - - - - - - - - 100 - 0 - - - - - 75 - true - - - - &Password: - - - 10 - - - m_pLineEditPremiumPassword - - - - - - - true - - - - 0 - 0 - - - - - 200 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - QLineEdit::Password - - - - - - - <a href="http://synergy-project.org/premium/reset/?source=gui">Forgot password</a> - - - true - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 5 - - - - - - - - No, I have not donated to Synergy, skip this step - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 100 - - - - - - - - - - 0 - 0 - - - - Server or Client? - - - - - - - - - - 75 - true - - - - &Server (share this computer's mouse and keyboard) - - - - - - - - 0 - 0 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">My main mouse and keyboard are connected to this computer. This will allow you to move your mouse over to another computer's screen. There can only be one server in your setup.</span></p></body></html> - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 75 - true - - - - &Client (use another computer's mouse and keyboard) - - - - - - - - 0 - 0 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You have already set up a server. This computer will be controlled using the server's mouse and keyboard. There can be many clients in your setup.</span></p></body></html> - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - - m_pComboLanguage - m_pRadioButtonPremiumLogin - m_pLineEditPremiumEmail - m_pLineEditPremiumPassword - m_pRadioButtonPremiumLater - m_pServerRadioButton - m_pClientRadioButton - - - - + + + SetupWizardBase + + + + 0 + 0 + 556 + 464 + + + + + 0 + 0 + + + + + 500 + 390 + + + + Setup Synergy + + + + Welcome + + + + + + + + + Thanks for installing Synergy! + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + + + 100 + 0 + + + + &Language: + + + m_pComboLanguage + + + + + + + + 200 + 16777215 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + + + Synergy lets you easily share your mouse and keyboard between multiple computers on your desk, and it's Free and Open Source. Just move your mouse off the edge of one computer's screen on to another. You can even share all of your clipboards. All you need is a network connection. Synergy is cross-platform (works on Windows, Mac OS X and Linux). + + + true + + + + + + + + + 0 + 0 + + + + Server or Client? + + + + + + + + + + 75 + true + + + + &Server (share this computer's mouse and keyboard) + + + + + + + + 0 + 0 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">My main mouse and keyboard are connected to this computer. This will allow you to move your mouse over to another computer's screen. There can only be one server in your setup.</span></p></body></html> + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 75 + true + + + + &Client (use another computer's mouse and keyboard) + + + + + + + + 0 + 0 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You have already set up a server. This computer will be controlled using the server's mouse and keyboard. There can be many clients in your setup.</span></p></body></html> + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 0 + 0 + + + + + + + + + m_pComboLanguage + m_pServerRadioButton + m_pClientRadioButton + + + + diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index 15ed3c03..d5db337a 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -121,8 +121,6 @@ void AppConfig::loadSettings() m_CryptoPass = settings().value("cryptoPass", "").toString(); m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool(); 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_AutoConnect = settings().value("autoConnect", true).toBool(); } @@ -139,8 +137,6 @@ void AppConfig::saveSettings() settings().setValue("cryptoPass", m_CryptoPass); settings().setValue("cryptoEnabled", m_CryptoEnabled); settings().setValue("language", m_Language); - settings().setValue("premiumEmail", m_PremiumEmail); - settings().setValue("premiumToken", m_PremiumToken); settings().setValue("startedBefore", m_StartedBefore); 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) { m_AutoConnect = autoConnect; diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index 03f8044d..2e716cfb 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -30,7 +30,7 @@ // // 1: first version // 2: added language page -// 3: added premium page +// 3: added premium page and removed // const int kWizardVersion = 3; @@ -67,8 +67,6 @@ class AppConfig ProcessMode processMode() const { return m_ProcessMode; } bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; } 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 autoConnect() const { return m_AutoConnect; } void setAutoConnect(bool autoConnect); @@ -80,7 +78,6 @@ class AppConfig bool detectPath(const QString& name, QString& path); void persistLogDir(); - bool isPremium(); protected: QSettings& settings() { return *m_pSettings; } @@ -93,8 +90,6 @@ class AppConfig void setCryptoEnabled(bool b) { m_CryptoEnabled = b; } void setWizardHasRun() { m_WizardLastRun = kWizardVersion; } 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 loadSettings(); @@ -115,8 +110,6 @@ class AppConfig QString m_CryptoPass; ProcessMode m_ProcessMode; QString m_Language; - QString m_PremiumEmail; - QString m_PremiumToken; bool m_StartedBefore; bool m_AutoConnect; diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 5f515145..f728c578 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -128,8 +128,6 @@ MainWindow::~MainWindow() void MainWindow::open() { - updatePremiumInfo(); - createTrayIcon(); showNormal(); @@ -416,10 +414,9 @@ void MainWindow::startSynergy() } #ifndef Q_OS_LINUX - if (appConfig().isPremium()) - { - args << "--enable-drag-drop"; - } + + args << "--enable-drag-drop"; + #endif if ((synergyType() == synergyClient && !clientArgs(args, app)) @@ -781,7 +778,6 @@ void MainWindow::changeEvent(QEvent* event) case QEvent::LanguageChange: retranslateUi(this); retranslateMenuBar(); - updatePremiumInfo(); break; 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() { if (!m_AppConfig.wizardShouldRun()) { @@ -912,7 +894,6 @@ void MainWindow::on_m_pActionWizard_triggered() { SetupWizard wizard(*this, false); wizard.exec(); - updatePremiumInfo(); } void MainWindow::on_m_pElevateCheckBox_toggled(bool checked) diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 86381a02..560a81cd 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -147,7 +147,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void stopDesktop(); void changeEvent(QEvent* event); void retranslateMenuBar(); - void updatePremiumInfo(); private: QSettings& m_Settings; diff --git a/src/gui/src/PremiumAuth.cpp b/src/gui/src/PremiumAuth.cpp index 624684a0..e69de29b 100644 --- a/src/gui/src/PremiumAuth.cpp +++ b/src/gui/src/PremiumAuth.cpp @@ -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 . - */ - -#include "PremiumAuth.h" -#include "QUtility.h" - -#include -#include -#include - -// 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; -} diff --git a/src/gui/src/PremiumAuth.h b/src/gui/src/PremiumAuth.h index 29362d4d..e69de29b 100644 --- a/src/gui/src/PremiumAuth.h +++ b/src/gui/src/PremiumAuth.h @@ -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 . - */ - -#pragma once - -#include - -class PremiumAuth -{ -public: - QString request(const QString& email, const QString& password); -}; diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index 924e677a..edbdad8d 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -19,15 +19,8 @@ #include "MainWindow.h" #include "QSynergyApplication.h" #include "QUtility.h" -#include "PremiumAuth.h" #include -#include -#include -#include -#include - -#define PREMIUM_REGISTER_URL "http://synergy-project.org/donate/?source=gui-wizard" SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) : m_MainWindow(mainWindow), @@ -58,13 +51,7 @@ SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) : m_Locale.fillLanguageComboBox(m_pComboLanguage); 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() @@ -89,32 +76,6 @@ bool SetupWizard::validateCurrentPage() 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; } @@ -144,19 +105,6 @@ void SetupWizard::accept() AppConfig& appConfig = m_MainWindow.appConfig(); 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.saveSettings(); @@ -205,65 +153,3 @@ void SetupWizard::on_m_pComboLanguage_currentIndexChanged(int index) QString ietfCode = m_pComboLanguage->itemData(index).toString(); 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; -} diff --git a/src/gui/src/SetupWizard.h b/src/gui/src/SetupWizard.h index e6112b19..d7e66794 100644 --- a/src/gui/src/SetupWizard.h +++ b/src/gui/src/SetupWizard.h @@ -39,9 +39,6 @@ protected: void accept(); void reject(); -private: - bool isPremiumLoginValid(QMessageBox& message); - private: MainWindow& m_MainWindow; bool m_StartMain; @@ -50,5 +47,4 @@ private: private slots: void on_m_pCheckBoxEnableCrypto_stateChanged(int ); void on_m_pComboLanguage_currentIndexChanged(int index); - void on_m_pRadioButtonPremiumLogin_toggled(bool checked); };