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">
<widget class="QLineEdit" name="m_pLineEditCryptoPass">
<property name="enabled">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>390</height>
<width>556</width>
<height>489</height>
</rect>
</property>
<property name="sizePolicy">
@ -134,7 +134,11 @@
</sizepolicy>
</property>
<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 name="wordWrap">
<bool>true</bool>
@ -160,74 +164,12 @@
<item>
<widget class="QRadioButton" name="m_pRadioButtonPremiumLogin">
<property name="text">
<string>Yes, I have an account</string>
<string>Yes, I am a Synergy Premium user, and proud of it! :)</string>
</property>
</widget>
</item>
<item>
<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">
<widget class="QLabel" name="m_pLabel_28">
<property name="sizePolicy">
@ -293,6 +235,68 @@
</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="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">
@ -324,7 +328,7 @@
<item>
<widget class="QRadioButton" name="m_pRadioButtonPremiumRegister">
<property name="text">
<string>I want to sign up now</string>
<string>I want to donate $1 and get Synergy Premium</string>
</property>
</widget>
</item>
@ -347,7 +351,7 @@
<item>
<widget class="QRadioButton" name="m_pRadioButtonPremiumLater">
<property name="text">
<string>Maybe later</string>
<string>Maybe later :(</string>
</property>
</widget>
</item>
@ -356,6 +360,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>
@ -483,36 +490,10 @@
<string>Encryption</string>
</property>
<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>
<widget class="QLabel" name="label_6">
<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 name="wordWrap">
<bool>true</bool>
@ -536,18 +517,17 @@
</spacer>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item row="1" column="0">
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
<property name="text">
<string>Enable encryption</string>
</property>
</widget>
</item>
</layout>
<property name="text">
<string>Enable encryption</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
@ -611,7 +591,7 @@
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditCryptoPassword1">
<property name="enabled">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@ -670,7 +650,7 @@
<item row="2" column="1">
<widget class="QLineEdit" name="m_pLineEditCryptoPassword2">
<property name="enabled">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">

View File

@ -150,7 +150,7 @@ void AppConfig::loadSettings()
m_ScreenName = settings().value("screenName", QHostInfo::localHostName()).toString();
m_Port = settings().value("port", 24800).toInt();
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_LogFilename = settings().value("logFilename", synergyLogDir() + "synergy.log").toString();
m_AutoStart = settings().value("autoStart", false).toBool();
@ -161,7 +161,7 @@ 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_PremiumEmail = settings().value("premiumEmail", "").toString();
m_PremiumToken = settings().value("premiumToken", "").toString();
}

View File

@ -415,6 +415,11 @@ void MainWindow::startSynergy()
#endif
}
if (appConfig().isPremium())
{
args << "--enable-drag-drop";
}
if ((synergyType() == synergyClient && !clientArgs(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_pCheckBoxEnableCrypto->setChecked(appConfig().cryptoEnabled());
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()

View File

@ -105,11 +105,6 @@ bool SetupWizard::validateCurrentPage()
{
return false;
}
else
{
m_pCheckBoxEnableCrypto->setEnabled(true);
m_pCheckBoxEnableCrypto->setChecked(true);
}
}
else if (m_pRadioButtonPremiumRegister->isChecked())
{
@ -120,9 +115,7 @@ bool SetupWizard::validateCurrentPage()
}
else if (m_pRadioButtonPremiumLater->isChecked())
{
m_pCheckBoxEnableCrypto->setEnabled(false);
m_pLineEditCryptoPassword1->setEnabled(false);
m_pLineEditCryptoPassword2->setEnabled(false);
return true;
}
else {
message.setText(tr("Please select an option."));
@ -257,6 +250,9 @@ void SetupWizard::on_m_pRadioButtonPremiumLogin_toggled(bool checked)
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 password = hash(m_pLineEditPremiumPassword->text());

View File

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

View File

@ -640,17 +640,19 @@ COSXScreen::getDropTargetThread(void*)
void
COSXScreen::fakeMouseMove(SInt32 x, SInt32 y)
{
if (m_fakeDraggingStarted) {
// HACK: for some reason the drag icon
// does not follow the cursor unless a key
// is pressed (except esc key)
// TODO: fake this key down properly
fakeKeyDown(kKeyControl_L, 8194, 29);
}
if (CApp::instance().argsBase().m_enableDragDrop) {
if (m_fakeDraggingStarted) {
// HACK: for some reason the drag icon
// does not follow the cursor unless a key
// is pressed (except esc key)
// TODO: fake this key down properly
fakeKeyDown(kKeyControl_L, 8194, 29);
}
// index 0 means left mouse button
if (m_buttonState.test(0)) {
m_draggingStarted = true;
// index 0 means left mouse button
if (m_buttonState.test(0)) {
m_draggingStarted = true;
}
}
// synthesize event
@ -908,27 +910,25 @@ COSXScreen::leave()
{
hideCursor();
if (m_draggingStarted) {
if (!m_isPrimary) {
// fake ctrl key up
fakeKeyUp(29);
// fake esc key down and up
fakeKeyDown(kKeyEscape, 8192, 1);
fakeKeyUp(1);
CFStringRef dragInfo = getDraggedFileURL();
char* dragInfoCStr = CFStringRefToUTF8String(dragInfo);
LOG((CLOG_DEBUG "drag info: %s", dragInfoCStr));
CFRelease(dragInfo);
CString fileList(dragInfoCStr);
size_t size = fileList.size();
CClientApp& app = CClientApp::instance();
CClient* client = app.getClientPtr();
UInt32 fileCount = 1;
client->draggingInfoSending(fileCount, fileList, size);
LOG((CLOG_DEBUG "send dragging file to server"));
client->sendFileToServer(dragInfoCStr);
m_draggingStarted = false;
}
if (m_draggingStarted && !m_isPrimary) {
// fake ctrl key up
fakeKeyUp(29);
// fake esc key down and up
fakeKeyDown(kKeyEscape, 8192, 1);
fakeKeyUp(1);
CFStringRef dragInfo = getDraggedFileURL();
char* dragInfoCStr = CFStringRefToUTF8String(dragInfo);
LOG((CLOG_DEBUG "drag info: %s", dragInfoCStr));
CFRelease(dragInfo);
CString fileList(dragInfoCStr);
size_t size = fileList.size();
CClientApp& app = CClientApp::instance();
CClient* client = app.getClientPtr();
UInt32 fileCount = 1;
client->draggingInfoSending(fileCount, fileList, size);
LOG((CLOG_DEBUG "send dragging file to server"));
client->sendFileToServer(dragInfoCStr);
m_draggingStarted = false;
}
if (m_isPrimary) {

View File

@ -168,6 +168,14 @@ CApp::parseArg(const int& argc, const char* const* argv, int& i)
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 {
// option not supported here
return false;

View File

@ -38,7 +38,8 @@ m_pname(NULL),
m_logFilter(NULL),
m_logFile(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_enableIpc;
CCryptoOptions m_crypto;
bool m_enableDragDrop;
#if SYSAPI_WIN32
bool m_debugServiceWait;
bool m_pauseOnExit;

View File

@ -155,6 +155,10 @@ CClientApp::parseArgs(int argc, const char* const* argv)
// identify system
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();
}

View File

@ -146,6 +146,10 @@ CServerApp::parseArgs(int argc, const char* const* argv)
// identify system
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();
}