added --enable-drag-drop arg and supporting gui changes.

This commit is contained in:
Nick Bolton 2013-09-18 08:34:32 +00:00
parent ba78e4b67f
commit 2935c6671e
13 changed files with 156 additions and 166 deletions

View File

@ -208,7 +208,7 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditCryptoPass"> <widget class="QLineEdit" name="m_pLineEditCryptoPass">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="echoMode"> <property name="echoMode">
<enum>QLineEdit::Password</enum> <enum>QLineEdit::Password</enum>

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>500</width> <width>556</width>
<height>390</height> <height>489</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -134,7 +134,11 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Synergy Premium users have access to extra features. The latest feature is encryption, which keeps sensitive information (e.g. passwords) safer when typed. These features are funded by Synergy Premium users. You can create an account for as little as $1.</string> <string>&lt;p&gt;&lt;b&gt;Latest feature:&lt;/b&gt; Drag and drop files between computers.&lt;/p&gt;
&lt;p&gt;Thanks to donations from our Synergy Premium users, we've been able to add new features. The latest feature is drag and drop, where you can drag and drop files from one computer to another (supported on Windows and Mac OS X).&lt;/p&gt;
&lt;p&gt;To access the latest feature, donate $1 or more to our project, and in return we give you a Synergy Premium account. A help desk with &lt;b&gt;phone and email support&lt;/b&gt; is also provided to our Synergy Premium users free of charge!&lt;/p&gt;</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -160,74 +164,12 @@
<item> <item>
<widget class="QRadioButton" name="m_pRadioButtonPremiumLogin"> <widget class="QRadioButton" name="m_pRadioButtonPremiumLogin">
<property name="text"> <property name="text">
<string>Yes, I have an account</string> <string>Yes, I am a Synergy Premium user, and proud of it! :)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QFormLayout" name="formLayout_5"> <layout class="QFormLayout" name="formLayout_5">
<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="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>&amp;Password:</string>
</property>
<property name="indent">
<number>10</number>
</property>
<property name="buddy">
<cstring>m_pLineEditPremiumPassword</cstring>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="m_pLabel_28"> <widget class="QLabel" name="m_pLabel_28">
<property name="sizePolicy"> <property name="sizePolicy">
@ -293,6 +235,68 @@
</property> </property>
</widget> </widget>
</item> </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>&amp;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"> <item row="2" column="1">
<widget class="QLabel" name="m_pLabelForgotPassword"> <widget class="QLabel" name="m_pLabelForgotPassword">
<property name="text"> <property name="text">
@ -324,7 +328,7 @@
<item> <item>
<widget class="QRadioButton" name="m_pRadioButtonPremiumRegister"> <widget class="QRadioButton" name="m_pRadioButtonPremiumRegister">
<property name="text"> <property name="text">
<string>I want to sign up now</string> <string>I want to donate $1 and get Synergy Premium</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -347,7 +351,7 @@
<item> <item>
<widget class="QRadioButton" name="m_pRadioButtonPremiumLater"> <widget class="QRadioButton" name="m_pRadioButtonPremiumLater">
<property name="text"> <property name="text">
<string>Maybe later</string> <string>Maybe later :(</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -356,6 +360,9 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
@ -483,36 +490,10 @@
<string>Encryption</string> <string>Encryption</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Only available to Synergy Premium users.</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::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Network traffic can be easily monitored. Using encryption can reduce the risk that sensitive information will be revealed to others (for example, passwords).</string> <string>Network traffic can be easily monitored on public networks (e.g. schools and corporate networks) or WiFi networks. Using encryption can reduce the risk that sensitive information (e.g. passwords) will be revealed to others.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -536,19 +517,18 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto"> <widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>Enable encryption</string> <string>Enable encryption</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<spacer name="verticalSpacer_5"> <spacer name="verticalSpacer_5">
<property name="orientation"> <property name="orientation">
@ -611,7 +591,7 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditCryptoPassword1"> <widget class="QLineEdit" name="m_pLineEditCryptoPassword1">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@ -670,7 +650,7 @@
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="m_pLineEditCryptoPassword2"> <widget class="QLineEdit" name="m_pLineEditCryptoPassword2">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">

View File

@ -150,7 +150,7 @@ void AppConfig::loadSettings()
m_ScreenName = settings().value("screenName", QHostInfo::localHostName()).toString(); m_ScreenName = settings().value("screenName", QHostInfo::localHostName()).toString();
m_Port = settings().value("port", 24800).toInt(); m_Port = settings().value("port", 24800).toInt();
m_Interface = settings().value("interface").toString(); m_Interface = settings().value("interface").toString();
m_LogLevel = settings().value("logLevel", 2).toInt(); m_LogLevel = settings().value("logLevel", 3).toInt(); // level 3: INFO
m_LogToFile = settings().value("logToFile", false).toBool(); m_LogToFile = settings().value("logToFile", false).toBool();
m_LogFilename = settings().value("logFilename", synergyLogDir() + "synergy.log").toString(); m_LogFilename = settings().value("logFilename", synergyLogDir() + "synergy.log").toString();
m_AutoStart = settings().value("autoStart", false).toBool(); m_AutoStart = settings().value("autoStart", false).toBool();
@ -161,7 +161,7 @@ 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_PremiumEmail = settings().value("premiumEmail", "").toString();
m_PremiumToken = settings().value("premiumToken", "").toString(); m_PremiumToken = settings().value("premiumToken", "").toString();
} }

View File

@ -415,6 +415,11 @@ void MainWindow::startSynergy()
#endif #endif
} }
if (appConfig().isPremium())
{
args << "--enable-drag-drop";
}
if ((synergyType() == synergyClient && !clientArgs(args, app)) if ((synergyType() == synergyClient && !clientArgs(args, app))
|| (synergyType() == synergyServer && !serverArgs(args, app))) || (synergyType() == synergyServer && !serverArgs(args, app)))
{ {

View File

@ -46,21 +46,10 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
m_pCheckBoxAutoHide->setChecked(appConfig().autoHide()); m_pCheckBoxAutoHide->setChecked(appConfig().autoHide());
m_pCheckBoxEnableCrypto->setChecked(appConfig().cryptoEnabled()); m_pCheckBoxEnableCrypto->setChecked(appConfig().cryptoEnabled());
setIndexFromItemData(m_pComboLanguage, appConfig().language()); setIndexFromItemData(m_pComboLanguage, appConfig().language());
if (appConfig().isPremium())
{
if (appConfig().cryptoEnabled()) if (appConfig().cryptoEnabled())
{ {
m_pLineEditCryptoPass->setText(appConfig().cryptoPass()); m_pLineEditCryptoPass->setText(appConfig().cryptoPass());
} }
}
else
{
m_pCheckBoxEnableCrypto->setChecked(false);
m_pCheckBoxEnableCrypto->setEnabled(false);
m_pLineEditCryptoPass->clear();
m_pLineEditCryptoPass->setEnabled(false);
}
} }
void SettingsDialog::accept() void SettingsDialog::accept()

View File

@ -105,11 +105,6 @@ bool SetupWizard::validateCurrentPage()
{ {
return false; return false;
} }
else
{
m_pCheckBoxEnableCrypto->setEnabled(true);
m_pCheckBoxEnableCrypto->setChecked(true);
}
} }
else if (m_pRadioButtonPremiumRegister->isChecked()) else if (m_pRadioButtonPremiumRegister->isChecked())
{ {
@ -120,9 +115,7 @@ bool SetupWizard::validateCurrentPage()
} }
else if (m_pRadioButtonPremiumLater->isChecked()) else if (m_pRadioButtonPremiumLater->isChecked())
{ {
m_pCheckBoxEnableCrypto->setEnabled(false); return true;
m_pLineEditCryptoPassword1->setEnabled(false);
m_pLineEditCryptoPassword2->setEnabled(false);
} }
else { else {
message.setText(tr("Please select an option.")); message.setText(tr("Please select an option."));
@ -257,6 +250,9 @@ void SetupWizard::on_m_pRadioButtonPremiumLogin_toggled(bool checked)
bool SetupWizard::isPremiumLoginValid(QMessageBox& message) bool SetupWizard::isPremiumLoginValid(QMessageBox& message)
{ {
// hash the email and password and send it over plain-text,
// it would be nice to use SSL, but unfortunately the Qt
// implementation is unreliable.
QString email = hash(m_pLineEditPremiumEmail->text()); QString email = hash(m_pLineEditPremiumEmail->text());
QString password = hash(m_pLineEditPremiumPassword->text()); QString password = hash(m_pLineEditPremiumPassword->text());

View File

@ -36,6 +36,8 @@
#include "TMethodJob.h" #include "TMethodJob.h"
#include "CArch.h" #include "CArch.h"
#include "CArchMiscWindows.h" #include "CArchMiscWindows.h"
#include "CApp.h"
#include "CArgsBase.h"
#include <string.h> #include <string.h>
#include <pbt.h> #include <pbt.h>
#include <Shlobj.h> #include <Shlobj.h>
@ -1279,14 +1281,14 @@ CMSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
if (button >= kButtonLeft && button <= kButtonExtra0 + 1) { if (button >= kButtonLeft && button <= kButtonExtra0 + 1) {
if (pressed) { if (pressed) {
m_buttons[button] = true; m_buttons[button] = true;
if (button == kButtonLeft) { if (CApp::instance().argsBase().m_enableDragDrop && button == kButtonLeft) {
m_draggingFileDir.clear(); m_draggingFileDir.clear();
LOG((CLOG_DEBUG2 "dragging file directory is cleared")); LOG((CLOG_DEBUG2 "dragging file directory is cleared"));
} }
} }
else { else {
m_buttons[button] = false; m_buttons[button] = false;
if (m_draggingStarted && button == kButtonLeft) { if (CApp::instance().argsBase().m_enableDragDrop && m_draggingStarted && button == kButtonLeft) {
m_draggingStarted = false; m_draggingStarted = false;
} }
} }

View File

@ -640,6 +640,7 @@ COSXScreen::getDropTargetThread(void*)
void void
COSXScreen::fakeMouseMove(SInt32 x, SInt32 y) COSXScreen::fakeMouseMove(SInt32 x, SInt32 y)
{ {
if (CApp::instance().argsBase().m_enableDragDrop) {
if (m_fakeDraggingStarted) { if (m_fakeDraggingStarted) {
// HACK: for some reason the drag icon // HACK: for some reason the drag icon
// does not follow the cursor unless a key // does not follow the cursor unless a key
@ -652,6 +653,7 @@ COSXScreen::fakeMouseMove(SInt32 x, SInt32 y)
if (m_buttonState.test(0)) { if (m_buttonState.test(0)) {
m_draggingStarted = true; m_draggingStarted = true;
} }
}
// synthesize event // synthesize event
CGPoint pos; CGPoint pos;
@ -908,8 +910,7 @@ COSXScreen::leave()
{ {
hideCursor(); hideCursor();
if (m_draggingStarted) { if (m_draggingStarted && !m_isPrimary) {
if (!m_isPrimary) {
// fake ctrl key up // fake ctrl key up
fakeKeyUp(29); fakeKeyUp(29);
// fake esc key down and up // fake esc key down and up
@ -929,7 +930,6 @@ COSXScreen::leave()
client->sendFileToServer(dragInfoCStr); client->sendFileToServer(dragInfoCStr);
m_draggingStarted = false; m_draggingStarted = false;
} }
}
if (m_isPrimary) { if (m_isPrimary) {
// warp to center // warp to center

View File

@ -168,6 +168,14 @@ CApp::parseArg(const int& argc, const char* const* argv, int& i)
argsBase().m_crypto.setMode("cfb"); argsBase().m_crypto.setMode("cfb");
} }
else if (isArg(i, argc, argv, NULL, "--enable-drag-drop")) {
#ifdef WINAPI_XWINDOWS
std::cerr << "Option not supported on Linux: " << argv[i] << std::endl;
m_bye(kExitArgs);
#endif
argsBase().m_enableDragDrop = true;
}
else { else {
// option not supported here // option not supported here
return false; return false;

View File

@ -38,7 +38,8 @@ m_pname(NULL),
m_logFilter(NULL), m_logFilter(NULL),
m_logFile(NULL), m_logFile(NULL),
m_display(NULL), m_display(NULL),
m_enableIpc(false) m_enableIpc(false),
m_enableDragDrop(false)
{ {
} }

View File

@ -37,6 +37,7 @@ public:
bool m_disableTray; bool m_disableTray;
bool m_enableIpc; bool m_enableIpc;
CCryptoOptions m_crypto; CCryptoOptions m_crypto;
bool m_enableDragDrop;
#if SYSAPI_WIN32 #if SYSAPI_WIN32
bool m_debugServiceWait; bool m_debugServiceWait;
bool m_pauseOnExit; bool m_pauseOnExit;

View File

@ -156,6 +156,10 @@ CClientApp::parseArgs(int argc, const char* const* argv)
// identify system // identify system
LOG((CLOG_INFO "%s Client on %s %s", kAppVersion, ARCH->getOSName().c_str(), ARCH->getPlatformName().c_str())); LOG((CLOG_INFO "%s Client on %s %s", kAppVersion, ARCH->getOSName().c_str(), ARCH->getPlatformName().c_str()));
if (args().m_enableDragDrop) {
LOG((CLOG_INFO "drag and drop enabled"));
}
loggingFilterWarning(); loggingFilterWarning();
} }

View File

@ -147,6 +147,10 @@ CServerApp::parseArgs(int argc, const char* const* argv)
// identify system // identify system
LOG((CLOG_INFO "%s Server on %s %s", kAppVersion, ARCH->getOSName().c_str(), ARCH->getPlatformName().c_str())); LOG((CLOG_INFO "%s Server on %s %s", kAppVersion, ARCH->getOSName().c_str(), ARCH->getPlatformName().c_str()));
if (args().m_enableDragDrop) {
LOG((CLOG_INFO "drag and drop enabled"));
}
loggingFilterWarning(); loggingFilterWarning();
} }