moving 1.4 to trunk

This commit is contained in:
Nick Bolton
2012-06-10 16:50:54 +00:00
parent cdeb3a7824
commit 488241850c
1291 changed files with 425650 additions and 12 deletions

90
src/gui/gui.pro Normal file
View File

@@ -0,0 +1,90 @@
QT += network
TEMPLATE = app
TARGET = synergy
DEPENDPATH += . \
res
INCLUDEPATH += . \
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
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/IpcLogReader.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/IpcLogReader.h
RESOURCES += res/Synergy.qrc
RC_FILE = res/win/Synergy.rc
TRANSLATIONS = res/lang/nl_NL.ts
macx {
QMAKE_INFO_PLIST = res/mac/Synergy.plist
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
TARGET = Synergy
QSYNERGY_ICON.files = res/mac/Synergy.icns
QSYNERGY_ICON.path = Contents/Resources
QMAKE_BUNDLE_DATA += QSYNERGY_ICON
LIBS += -framework \
ApplicationServices
}
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
}
win32 {
Debug:DESTDIR = ../../bin/Debug
Release:DESTDIR = ../../bin/Release
}
else:DESTDIR = ../../bin

1062
src/gui/gui.ts Normal file

File diff suppressed because it is too large Load Diff

1
src/gui/lang.cmd Normal file
View File

@@ -0,0 +1 @@
lupdate gui.pro -ts gui.ts

View File

@@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialogBase</class>
<widget class="QDialog" name="AboutDialogBase">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>255</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>450</width>
<height>250</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>450</width>
<height>255</height>
</size>
</property>
<property name="windowTitle">
<string>About Synergy</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;&quot;&gt;&lt;span style=&quot; font-size:x-large;&quot;&gt;Synergy&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Version:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelSynergyVersion">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hostname:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="m_pLabelHostname">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>IP-Address:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="m_pLabelIPAddress">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>78</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>131</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>&amp;Ok</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;p&gt;The Synergy GUI is based on QSynergy by Volker Lanz&lt;br/&gt;
&lt;br/&gt;
Copyright © 2008 Volker Lanz (vl@fidra.de)&lt;br/&gt;
Copyright © 2010 Chris Schoeneman, Nick Bolton, Sorin Sbarnea&lt;/p&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonOk</sender>
<signal>clicked()</signal>
<receiver>AboutDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>315</x>
<y>374</y>
</hint>
<hint type="destinationlabel">
<x>301</x>
<y>3</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,581 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ActionDialogBase</class>
<widget class="QDialog" name="ActionDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>484</height>
</rect>
</property>
<property name="windowTitle">
<string>Configure Action</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="m_pGroupType">
<property name="title">
<string>Choose the action to perform</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QRadioButton" name="m_pRadioPress">
<property name="text">
<string>Press a hotkey</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioRelease">
<property name="text">
<string>Release a hotkey</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioPressAndRelease">
<property name="text">
<string>Press and release a hotkey</string>
</property>
</widget>
</item>
<item>
<widget class="KeySequenceWidget" name="m_pKeySequenceWidgetHotkey">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_pGroupBoxScreens">
<property name="title">
<string>only on these screens</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QHBoxLayout">
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QListWidget" name="m_pListScreens">
<property name="minimumSize">
<size>
<width>128</width>
<height>64</height>
</size>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QRadioButton" name="m_pRadioSwitchToScreen">
<property name="text">
<string>Switch to screen</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="m_pComboSwitchToScreen">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QRadioButton" name="m_pRadioSwitchInDirection">
<property name="text">
<string>Switch in direction</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="m_pComboSwitchInDirection">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>left</string>
</property>
</item>
<item>
<property name="text">
<string>right</string>
</property>
</item>
<item>
<property name="text">
<string>up</string>
</property>
</item>
<item>
<property name="text">
<string>down</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QRadioButton" name="m_pRadioLockCursorToScreen">
<property name="text">
<string>Lock cursor to screen</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="m_pComboLockCursorToScreen">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>toggle</string>
</property>
</item>
<item>
<property name="text">
<string>on</string>
</property>
</item>
<item>
<property name="text">
<string>off</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>This action is performed when</string>
</property>
<layout class="QHBoxLayout">
<item>
<widget class="QRadioButton" name="m_pRadioHotkeyPressed">
<property name="text">
<string>the hotkey is pressed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioHotkeyReleased">
<property name="text">
<string>the hotkey is released</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KeySequenceWidget</class>
<extends>QLineEdit</extends>
<header>KeySequenceWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ActionDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>245</x>
<y>474</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ActionDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>313</x>
<y>474</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pGroupType</sender>
<signal>toggled(bool)</signal>
<receiver>m_pKeySequenceWidgetHotkey</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>104</x>
<y>194</y>
</hint>
<hint type="destinationlabel">
<x>110</x>
<y>132</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchInDirection</sender>
<signal>toggled(bool)</signal>
<receiver>m_pKeySequenceWidgetHotkey</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>118</x>
<y>322</y>
</hint>
<hint type="destinationlabel">
<x>81</x>
<y>129</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioLockCursorToScreen</sender>
<signal>toggled(bool)</signal>
<receiver>m_pKeySequenceWidgetHotkey</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>101</x>
<y>353</y>
</hint>
<hint type="destinationlabel">
<x>68</x>
<y>126</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioPress</sender>
<signal>toggled(bool)</signal>
<receiver>m_pKeySequenceWidgetHotkey</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>48</y>
</hint>
<hint type="destinationlabel">
<x>45</x>
<y>129</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioRelease</sender>
<signal>toggled(bool)</signal>
<receiver>m_pKeySequenceWidgetHotkey</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>135</x>
<y>70</y>
</hint>
<hint type="destinationlabel">
<x>148</x>
<y>125</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioPressAndRelease</sender>
<signal>toggled(bool)</signal>
<receiver>m_pKeySequenceWidgetHotkey</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>194</x>
<y>100</y>
</hint>
<hint type="destinationlabel">
<x>201</x>
<y>125</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchToScreen</sender>
<signal>toggled(bool)</signal>
<receiver>m_pComboSwitchToScreen</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>148</x>
<y>291</y>
</hint>
<hint type="destinationlabel">
<x>350</x>
<y>290</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchInDirection</sender>
<signal>toggled(bool)</signal>
<receiver>m_pComboSwitchInDirection</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>158</x>
<y>322</y>
</hint>
<hint type="destinationlabel">
<x>350</x>
<y>321</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioLockCursorToScreen</sender>
<signal>toggled(bool)</signal>
<receiver>m_pComboLockCursorToScreen</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>180</x>
<y>353</y>
</hint>
<hint type="destinationlabel">
<x>350</x>
<y>352</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioPress</sender>
<signal>toggled(bool)</signal>
<receiver>m_pGroupBoxScreens</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>25</x>
<y>47</y>
</hint>
<hint type="destinationlabel">
<x>33</x>
<y>155</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchToScreen</sender>
<signal>toggled(bool)</signal>
<receiver>m_pGroupBoxScreens</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>278</y>
</hint>
<hint type="destinationlabel">
<x>98</x>
<y>153</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioRelease</sender>
<signal>toggled(bool)</signal>
<receiver>m_pGroupBoxScreens</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>264</x>
<y>67</y>
</hint>
<hint type="destinationlabel">
<x>241</x>
<y>158</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioPressAndRelease</sender>
<signal>toggled(bool)</signal>
<receiver>m_pGroupBoxScreens</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>286</x>
<y>98</y>
</hint>
<hint type="destinationlabel">
<x>290</x>
<y>156</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchInDirection</sender>
<signal>toggled(bool)</signal>
<receiver>m_pGroupBoxScreens</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>38</x>
<y>313</y>
</hint>
<hint type="destinationlabel">
<x>64</x>
<y>195</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioLockCursorToScreen</sender>
<signal>toggled(bool)</signal>
<receiver>m_pGroupBoxScreens</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>339</y>
</hint>
<hint type="destinationlabel">
<x>79</x>
<y>234</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchToScreen</sender>
<signal>toggled(bool)</signal>
<receiver>m_pKeySequenceWidgetHotkey</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>84</x>
<y>280</y>
</hint>
<hint type="destinationlabel">
<x>185</x>
<y>123</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HotkeyDialogBase</class>
<widget class="QDialog" name="HotkeyDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>344</width>
<height>86</height>
</rect>
</property>
<property name="windowTitle">
<string>Hotkey</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Enter the specification for the hotkey:</string>
</property>
</widget>
</item>
<item>
<widget class="KeySequenceWidget" name="m_pKeySequenceWidgetHotkey"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KeySequenceWidget</class>
<extends>QLineEdit</extends>
<header>KeySequenceWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>HotkeyDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>HotkeyDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,395 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindowBase</class>
<widget class="QMainWindow" name="MainWindowBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>500</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>400</height>
</size>
</property>
<property name="windowTitle">
<string>Synergy</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout">
<item row="6" column="6">
<widget class="QPushButton" name="m_pButtonToggleStart">
<property name="text">
<string>&amp;Start</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="7">
<widget class="QGroupBox" name="m_pGroupServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>&amp;Server (share this computer's mouse and keyboard):</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QRadioButton" name="m_pRadioExternalConfig">
<property name="text">
<string>Use existing configuration:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="m_pLabelConfigurationFile">
<property name="text">
<string>&amp;Configuration file:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditConfigFile</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_pLineEditConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_pButtonBrowseConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Browse...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioInternalConfig">
<property name="text">
<string>Configure interactively:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QPushButton" name="m_pButtonConfigureServer">
<property name="text">
<string>&amp;Configure Server...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="7">
<widget class="QGroupBox" name="m_pGroupClient">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>&amp;Client (use another computer's keyboard and mouse):</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="m_pLabelServerName">
<property name="text">
<string>&amp;Name of the server:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditHostname</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="m_pLineEditHostname"/>
</item>
</layout>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="m_pStatusLabel">
<property name="text">
<string>Ready</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="7">
<widget class="QGroupBox" name="m_pGroupLog">
<property name="title">
<string>Log</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="m_pLogOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Courier</family>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="5">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="2">
<widget class="QLabel" name="m_pUpdateIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="Synergy.qrc">:/res/icons/16x16/warning.png</pixmap>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="m_pUpdateLabel">
<property name="text">
<string/>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<action name="m_pActionAbout">
<property name="text">
<string>&amp;About Synergy...</string>
</property>
</action>
<action name="m_pActionQuit">
<property name="text">
<string>&amp;Quit</string>
</property>
<property name="statusTip">
<string>Quit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="m_pActionStartSynergy">
<property name="text">
<string>&amp;Start</string>
</property>
<property name="statusTip">
<string>Run</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="m_pActionStopSynergy">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>S&amp;top</string>
</property>
<property name="statusTip">
<string>Stop</string>
</property>
<property name="shortcut">
<string>Ctrl+T</string>
</property>
</action>
<action name="actionShowStatus">
<property name="text">
<string>S&amp;how Status</string>
</property>
<property name="shortcut">
<string>Ctrl+H</string>
</property>
</action>
<action name="m_pActionMinimize">
<property name="text">
<string>&amp;Minimize</string>
</property>
</action>
<action name="m_pActionRestore">
<property name="text">
<string>&amp;Restore</string>
</property>
</action>
<action name="m_pActionSave">
<property name="text">
<string>Save configuration &amp;as...</string>
</property>
<property name="statusTip">
<string>Save the interactively generated server configuration to a file.</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+S</string>
</property>
</action>
<action name="m_pActionSettings">
<property name="text">
<string>Settings</string>
</property>
<property name="statusTip">
<string>Edit settings</string>
</property>
</action>
<action name="m_pActionWizard">
<property name="text">
<string>Run Wizard</string>
</property>
</action>
</widget>
<resources>
<include location="Synergy.qrc"/>
</resources>
<connections>
<connection>
<sender>m_pButtonToggleStart</sender>
<signal>clicked()</signal>
<receiver>m_pActionStartSynergy</receiver>
<slot>trigger()</slot>
<hints>
<hint type="sourcelabel">
<x>361</x>
<y>404</y>
</hint>
<hint type="destinationlabel">
<x>-1</x>
<y>-1</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioExternalConfig</sender>
<signal>toggled(bool)</signal>
<receiver>m_pLineEditConfigFile</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>156</x>
<y>179</y>
</hint>
<hint type="destinationlabel">
<x>169</x>
<y>209</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioExternalConfig</sender>
<signal>toggled(bool)</signal>
<receiver>m_pButtonBrowseConfigFile</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>353</x>
<y>182</y>
</hint>
<hint type="destinationlabel">
<x>356</x>
<y>211</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioInternalConfig</sender>
<signal>toggled(bool)</signal>
<receiver>m_pButtonConfigureServer</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>204</x>
<y>244</y>
</hint>
<hint type="destinationlabel">
<x>212</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,543 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ScreenSettingsDialogBase</class>
<widget class="QDialog" name="ScreenSettingsDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>434</width>
<height>437</height>
</rect>
</property>
<property name="windowTitle">
<string>Screen Settings</string>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Screen &amp;name:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditName</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_pLineEditName"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QGroupBox" name="m_pGroupAliases">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>A&amp;liases</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="m_pLineEditAlias"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="m_pButtonAddAlias">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2">
<widget class="QListWidget" name="m_pListAliases">
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="m_pButtonRemoveAlias">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Remove</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>126</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_pGroupModifiers">
<property name="title">
<string>&amp;Modifier keys</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Shift:</string>
</property>
<property name="buddy">
<cstring>m_pComboBoxShift</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_pComboBoxShift">
<item>
<property name="text">
<string>Shift</string>
</property>
</item>
<item>
<property name="text">
<string>Ctrl</string>
</property>
</item>
<item>
<property name="text">
<string>Alt</string>
</property>
</item>
<item>
<property name="text">
<string>Meta</string>
</property>
</item>
<item>
<property name="text">
<string>Super</string>
</property>
</item>
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&amp;Ctrl:</string>
</property>
<property name="buddy">
<cstring>m_pComboBoxCtrl</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="m_pComboBoxCtrl">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Shift</string>
</property>
</item>
<item>
<property name="text">
<string>Ctrl</string>
</property>
</item>
<item>
<property name="text">
<string>Alt</string>
</property>
</item>
<item>
<property name="text">
<string>Meta</string>
</property>
</item>
<item>
<property name="text">
<string>Super</string>
</property>
</item>
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Al&amp;t:</string>
</property>
<property name="buddy">
<cstring>m_pComboBoxAlt</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="m_pComboBoxAlt">
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>Shift</string>
</property>
</item>
<item>
<property name="text">
<string>Ctrl</string>
</property>
</item>
<item>
<property name="text">
<string>Alt</string>
</property>
</item>
<item>
<property name="text">
<string>Meta</string>
</property>
</item>
<item>
<property name="text">
<string>Super</string>
</property>
</item>
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>M&amp;eta:</string>
</property>
<property name="buddy">
<cstring>m_pComboBoxMeta</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="m_pComboBoxMeta">
<property name="currentIndex">
<number>3</number>
</property>
<item>
<property name="text">
<string>Shift</string>
</property>
</item>
<item>
<property name="text">
<string>Ctrl</string>
</property>
</item>
<item>
<property name="text">
<string>Alt</string>
</property>
</item>
<item>
<property name="text">
<string>Meta</string>
</property>
</item>
<item>
<property name="text">
<string>Super</string>
</property>
</item>
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>S&amp;uper:</string>
</property>
<property name="buddy">
<cstring>m_pComboBoxSuper</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="m_pComboBoxSuper">
<property name="currentIndex">
<number>4</number>
</property>
<item>
<property name="text">
<string>Shift</string>
</property>
</item>
<item>
<property name="text">
<string>Ctrl</string>
</property>
</item>
<item>
<property name="text">
<string>Alt</string>
</property>
</item>
<item>
<property name="text">
<string>Meta</string>
</property>
</item>
<item>
<property name="text">
<string>Super</string>
</property>
</item>
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QGroupBox" name="m_pGroupSwitchCorners">
<property name="title">
<string>&amp;Dead corners</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="m_pCheckBoxCornerTopLeft">
<property name="text">
<string>Top-left</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="m_pCheckBoxCornerTopRight">
<property name="text">
<string>Top-right</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_pCheckBoxCornerBottomLeft">
<property name="text">
<string>Bottom-left</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="m_pCheckBoxCornerBottomRight">
<property name="text">
<string>Bottom-right</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Corner Si&amp;ze:</string>
</property>
<property name="buddy">
<cstring>m_pSpinBoxSwitchCornerSize</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="m_pSpinBoxSwitchCornerSize"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_pGroupFixes">
<property name="title">
<string>&amp;Fixes</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="m_pCheckBoxCapsLock">
<property name="text">
<string>Fix CAPS LOCK key</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_pCheckBoxNumLock">
<property name="text">
<string>Fix NUM LOCK key</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_pCheckBoxScrollLock">
<property name="text">
<string>Fix SCROLL LOCK key</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="m_pCheckBoxXTest">
<property name="text">
<string>Fix XTest for Xinerama</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="m_pButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>m_pButtonBox</sender>
<signal>accepted()</signal>
<receiver>ScreenSettingsDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>222</x>
<y>502</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pButtonBox</sender>
<signal>rejected()</signal>
<receiver>ScreenSettingsDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>290</x>
<y>508</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,756 @@
<ui version="4.0" >
<class>ServerConfigDialogBase</class>
<widget class="QDialog" name="ServerConfigDialogBase" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>740</width>
<height>514</height>
</rect>
</property>
<property name="windowTitle" >
<string>Server Configuration</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QTabWidget" name="m_pTabWidget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="m_pTabScreens" >
<attribute name="title" >
<string>Screens and links</string>
</attribute>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="TrashScreenWidget" name="m_pTrashScreenWidget" >
<property name="acceptDrops" >
<bool>true</bool>
</property>
<property name="toolTip" >
<string>Drag a screen from the grid to the trashcan to remove it.</string>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="QSynergy.qrc" >:/res/icons/64x64/user-trash.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Configure the layout of your synergy server configuration.</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="NewScreenWidget" name="m_pLabelNewScreenWidget" >
<property name="toolTip" >
<string>Drag this button to the grid to add a new screen.</string>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="QSynergy.qrc" >:/res/icons/64x64/video-display.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="ScreenSetupView" name="m_pScreenSetupView" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>273</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>273</height>
</size>
</property>
<property name="acceptDrops" >
<bool>true</bool>
</property>
<property name="autoFillBackground" >
<bool>false</bool>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Drag new screens to the grid or move existing ones around.
Drag a screen to the trashcan to delete it.
Double click on a screen to edit its settings.</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_pTabHotkeys" >
<attribute name="title" >
<string>Hotkeys</string>
</attribute>
<layout class="QHBoxLayout" >
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>&amp;Hotkeys</string>
</property>
<layout class="QGridLayout" >
<item rowspan="4" row="0" column="0" >
<widget class="QListWidget" name="m_pListHotkeys" />
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="m_pButtonNewHotkey" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>&amp;New</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="m_pButtonEditHotkey" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>&amp;Edit</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="m_pButtonRemoveHotkey" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>&amp;Remove</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>75</width>
<height>161</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>A&amp;ctions</string>
</property>
<layout class="QGridLayout" >
<item rowspan="4" row="0" column="0" >
<widget class="QListWidget" name="m_pListActions" />
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="m_pButtonNewAction" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Ne&amp;w</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="m_pButtonEditAction" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>E&amp;dit</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="m_pButtonRemoveAction" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Re&amp;move</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_pTabAdvanced" >
<attribute name="title" >
<string>Advanced server settings</string>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QGroupBox" name="m_pGroupSwitch" >
<property name="title" >
<string>&amp;Switch</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QCheckBox" name="m_pCheckBoxSwitchDelay" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Switch &amp;after waiting</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="m_pSpinBoxSwitchDelay" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>10000</number>
</property>
<property name="singleStep" >
<number>10</number>
</property>
<property name="value" >
<number>250</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabel_14" >
<property name="text" >
<string>ms</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QCheckBox" name="m_pCheckBoxSwitchDoubleTap" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Switch on double &amp;tap within</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="m_pSpinBoxSwitchDoubleTap" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>10000</number>
</property>
<property name="singleStep" >
<number>10</number>
</property>
<property name="value" >
<number>250</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabel_15" >
<property name="text" >
<string>ms</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" >
<widget class="QGroupBox" name="m_pGroupOptions" >
<property name="title" >
<string>&amp;Options</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QCheckBox" name="m_pCheckBoxHeartbeat" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>&amp;Check clients every</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="m_pSpinBoxHeartbeat" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="minimum" >
<number>1000</number>
</property>
<property name="maximum" >
<number>30000</number>
</property>
<property name="singleStep" >
<number>1000</number>
</property>
<property name="value" >
<number>5000</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabel_16" >
<property name="text" >
<string>ms</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="m_pCheckBoxRelativeMouseMoves" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Use &amp;relative mouse moves</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="m_pCheckBoxScreenSaverSync" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>S&amp;ynchronize screen savers</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="m_pCheckBoxWin32KeepForeground" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Don't take &amp;foreground window on Windows servers</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QGroupBox" name="m_pGroupSwitchCorners" >
<property name="title" >
<string>&amp;Dead corners</string>
</property>
<property name="checked" >
<bool>false</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="m_pCheckBoxCornerTopLeft" >
<property name="text" >
<string>To&amp;p-left</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2" >
<widget class="QCheckBox" name="m_pCheckBoxCornerTopRight" >
<property name="text" >
<string>Top-rig&amp;ht</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="m_pCheckBoxCornerBottomLeft" >
<property name="text" >
<string>&amp;Bottom-left</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2" >
<widget class="QCheckBox" name="m_pCheckBoxCornerBottomRight" >
<property name="text" >
<string>Bottom-ri&amp;ght</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" colspan="2" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Cor&amp;ner Size:</string>
</property>
<property name="buddy" >
<cstring>m_pSpinBoxSwitchCornerSize</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_pSpinBoxSwitchCornerSize" />
</item>
</layout>
</item>
<item row="2" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="m_pButtonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ScreenSetupView</class>
<extends>QTableView</extends>
<header>ScreenSetupView.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>NewScreenWidget</class>
<extends>QLabel</extends>
<header>NewScreenWidget.h</header>
</customwidget>
<customwidget>
<class>TrashScreenWidget</class>
<extends>QLabel</extends>
<header>TrashScreenWidget.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="QSynergy.qrc" />
</resources>
<connections>
<connection>
<sender>m_pButtonBox</sender>
<signal>accepted()</signal>
<receiver>ServerConfigDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>572</x>
<y>424</y>
</hint>
<hint type="destinationlabel" >
<x>377</x>
<y>-8</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pButtonBox</sender>
<signal>rejected()</signal>
<receiver>ServerConfigDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>641</x>
<y>424</y>
</hint>
<hint type="destinationlabel" >
<x>595</x>
<y>1</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pCheckBoxSwitchDelay</sender>
<signal>toggled(bool)</signal>
<receiver>m_pSpinBoxSwitchDelay</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>110</x>
<y>63</y>
</hint>
<hint type="destinationlabel" >
<x>110</x>
<y>63</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pCheckBoxSwitchDoubleTap</sender>
<signal>toggled(bool)</signal>
<receiver>m_pSpinBoxSwitchDoubleTap</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>110</x>
<y>63</y>
</hint>
<hint type="destinationlabel" >
<x>110</x>
<y>63</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pCheckBoxHeartbeat</sender>
<signal>toggled(bool)</signal>
<receiver>m_pSpinBoxHeartbeat</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>110</x>
<y>63</y>
</hint>
<hint type="destinationlabel" >
<x>110</x>
<y>63</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pListHotkeys</sender>
<signal>itemDoubleClicked(QListWidgetItem*)</signal>
<receiver>m_pButtonEditHotkey</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel" >
<x>197</x>
<y>115</y>
</hint>
<hint type="destinationlabel" >
<x>304</x>
<y>115</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pListActions</sender>
<signal>itemDoubleClicked(QListWidgetItem*)</signal>
<receiver>m_pButtonEditAction</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel" >
<x>505</x>
<y>120</y>
</hint>
<hint type="destinationlabel" >
<x>677</x>
<y>118</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,355 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsDialogBase</class>
<widget class="QDialog" name="SettingsDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>383</width>
<height>470</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<layout class="QGridLayout">
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="m_pGroupAdvanced">
<property name="title">
<string>&amp;Advanced</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="m_pLabel_19">
<property name="text">
<string>Sc&amp;reen name:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditScreenName</cstring>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="m_pLineEditScreenName">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_pLabel_20">
<property name="text">
<string>P&amp;ort:</string>
</property>
<property name="buddy">
<cstring>m_pSpinBoxGamePoll</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_pLabel_21">
<property name="text">
<string>&amp;Interface:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="m_pLineEditInterface">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="m_pSpinBoxPort">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>24800</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="4" column="0" rowspan="2" colspan="2">
<widget class="QGroupBox" name="m_pGroupLog">
<property name="title">
<string>Logging</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="m_pLabel_3">
<property name="text">
<string>&amp;Logging level:</string>
</property>
<property name="buddy">
<cstring>m_pComboLogLevel</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_pCheckBoxLogToFile">
<property name="text">
<string>Log to file:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditLogFilename">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="m_pButtonBrowseLog">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_pComboLogLevel">
<item>
<property name="text">
<string>Error</string>
</property>
</item>
<item>
<property name="text">
<string>Warning</string>
</property>
</item>
<item>
<property name="text">
<string>Note</string>
</property>
</item>
<item>
<property name="text">
<string>Info</string>
</property>
</item>
<item>
<property name="text">
<string>Debug</string>
</property>
</item>
<item>
<property name="text">
<string>Debug1</string>
</property>
</item>
<item>
<property name="text">
<string>Debug2</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="m_pGroupGameDevices">
<property name="title">
<string>&amp;Game device support</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="m_pLabel_22">
<property name="text">
<string>&amp;Mode:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="m_pComboBoxGameDevice">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Next Generation (XInput) - 32-bit only</string>
</property>
</item>
<item>
<property name="text">
<string>Legacy (JOYINFOEX)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="m_pLabel_23">
<property name="text">
<string>&amp;Polling:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QRadioButton" name="m_pRadioButtonGamePollDynamic">
<property name="text">
<string>Dynamic (align with client polling)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="m_pRadioButtonGamePollStatic">
<property name="text">
<string>Static frequency:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_pSpinBoxGamePoll">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="m_pGroupStart">
<property name="title">
<string>&amp;Startup</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QCheckBox" name="m_pCheckBoxAutoStart">
<property name="text">
<string>&amp;Start Synergy after logging in</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="m_pCheckBoxAutoConnect">
<property name="text">
<string>&amp;Automatically start server/client</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="m_pCheckBoxAutoHide">
<property name="text">
<string>&amp;Hide when server/client starts</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_pLineEditScreenName</tabstop>
<tabstop>m_pLineEditInterface</tabstop>
<tabstop>m_pCheckBoxAutoConnect</tabstop>
<tabstop>m_pComboLogLevel</tabstop>
<tabstop>m_pCheckBoxLogToFile</tabstop>
<tabstop>m_pLineEditLogFilename</tabstop>
<tabstop>m_pButtonBrowseLog</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SettingsDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>266</x>
<y>340</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SettingsDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>334</x>
<y>340</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,276 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SetupWizardBase</class>
<widget class="QWizard" name="SetupWizardBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>390</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>390</height>
</size>
</property>
<property name="windowTitle">
<string>Setup Synergy</string>
</property>
<widget class="QWizardPage" name="m_pNodePage">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Server or Client?</string>
</property>
<property name="subTitle">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="m_pServerRadioButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&amp;Server (new setup)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pClientLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>This is the first computer you are configuring. Your keyboard and mouse 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.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<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>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="m_pClientRadioButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&amp;Client (add to setup)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pServerLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>You have already set up a server. This is a computer you wish to control using the server's keyboard and mouse. There can be many clients in your setup.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="m_pStartupPage">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Startup Mode</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="m_pServiceRadioButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&amp;Service</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pServiceLabel">
<property name="text">
<string>Always run Synergy in the background automatically at startup. This allows you to use Synergy at the login prompt. If you experience problems while using this mode, you can run this wizard again and select the &quot;Desktop&quot; option.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="m_pDesktopRadioButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&amp;Desktop</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pDesktopLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Synergy will start when your desktop loads (after you login). This mode can help if you experience problems with the &quot;Service&quot; option.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="m_pNoneRadioButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&amp;None</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pNoneLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Do not start Synergy when your comptuer starts.</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::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

10
src/gui/res/Synergy.qrc Normal file
View File

@@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/res">
<file>icons/16x16/synergy-connected.png</file>
<file>icons/16x16/synergy-disconnected.png</file>
<file>icons/64x64/video-display.png</file>
<file>icons/64x64/user-trash.png</file>
<file>icons/16x16/warning.png</file>
<file>icons/256x256/synergy.ico</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
src/gui/res/lang/nl_NL.qm Normal file

Binary file not shown.

1061
src/gui/res/lang/nl_NL.ts Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleIconFile</key>
<string>Synergy.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>0.9.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>Synergy</string>
</dict>
</plist>

View File

@@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "../icons/256x256/synergy.ico"

View File

@@ -0,0 +1,46 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "AboutDialog.h"
#include <QtCore>
#include <QtGui>
#include <QtNetwork>
static QString getIPAddress()
{
QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
for (int i = 0; i < addresses.size(); i++)
if (addresses[i].protocol() == QAbstractSocket::IPv4Protocol && addresses[i] != QHostAddress(QHostAddress::LocalHost))
return addresses[i].toString();
return "Unknown";
}
AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AboutDialogBase()
{
setupUi(this);
m_versionChecker.setApp(synergyApp);
m_pLabelSynergyVersion->setText(m_versionChecker.getVersion());
m_pLabelHostname->setText(QHostInfo::localHostName());
m_pLabelIPAddress->setText(getIPAddress());
}

42
src/gui/src/AboutDialog.h Normal file
View File

@@ -0,0 +1,42 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(ABOUTDIALOG__H)
#define ABOUTDIALOG__H
#include <QDialog>
#include "VersionChecker.h"
#include "ui_AboutDialogBase.h"
class QWidget;
class QString;
class AboutDialog : public QDialog, public Ui::AboutDialogBase
{
Q_OBJECT
public:
AboutDialog(QWidget* parent, const QString& synergyApp = QString());
private:
VersionChecker m_versionChecker;
};
#endif

149
src/gui/src/Action.cpp Normal file
View File

@@ -0,0 +1,149 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "Action.h"
#include <QSettings>
#include <QTextStream>
const char* Action::m_ActionTypeNames[] =
{
"keyDown", "keyUp", "keystroke",
"switchToScreen", "switchInDirection", "lockCursorToScreen",
"mouseDown", "mouseUp", "mousebutton"
};
const char* Action::m_SwitchDirectionNames[] = { "left", "right", "up", "down" };
const char* Action::m_LockCursorModeNames[] = { "toggle", "on", "off" };
Action::Action() :
m_KeySequence(),
m_Type(keystroke),
m_TypeScreenNames(),
m_SwitchScreenName(),
m_SwitchDirection(switchLeft),
m_LockCursorMode(lockCursorToggle),
m_ActiveOnRelease(false),
m_HasScreens(false)
{
}
QString Action::text() const
{
QString text = QString(m_ActionTypeNames[keySequence().isMouseButton() ? type() + 6 : type() ]) + "(";
switch (type())
{
case keyDown:
case keyUp:
case keystroke:
{
text += keySequence().toString();
if (!keySequence().isMouseButton())
{
const QStringList& screens = typeScreenNames();
if (haveScreens() && !screens.isEmpty())
{
text += ",";
for (int i = 0; i < screens.size(); i++)
{
text += screens[i];
if (i != screens.size() - 1)
text += ":";
}
}
else
text += ",*";
}
}
break;
case switchToScreen:
text += switchScreenName();
break;
case switchInDirection:
text += m_SwitchDirectionNames[m_SwitchDirection];
break;
case lockCursorToScreen:
text += m_LockCursorModeNames[m_LockCursorMode];
break;
default:
Q_ASSERT(0);
break;
}
text += ")";
return text;
}
void Action::loadSettings(QSettings& settings)
{
keySequence().loadSettings(settings);
setType(settings.value("type", keyDown).toInt());
typeScreenNames().clear();
int numTypeScreens = settings.beginReadArray("typeScreenNames");
for (int i = 0; i < numTypeScreens; i++)
{
settings.setArrayIndex(i);
typeScreenNames().append(settings.value("typeScreenName").toString());
}
settings.endArray();
setSwitchScreenName(settings.value("switchScreenName").toString());
setSwitchDirection(settings.value("switchInDirection", switchLeft).toInt());
setLockCursorMode(settings.value("lockCursorToScreen", lockCursorToggle).toInt());
setActiveOnRelease(settings.value("activeOnRelease", false).toBool());
setHaveScreens(settings.value("hasScreens", false).toBool());
}
void Action::saveSettings(QSettings& settings) const
{
keySequence().saveSettings(settings);
settings.setValue("type", type());
settings.beginWriteArray("typeScreenNames");
for (int i = 0; i < typeScreenNames().size(); i++)
{
settings.setArrayIndex(i);
settings.setValue("typeScreenName", typeScreenNames()[i]);
}
settings.endArray();
settings.setValue("switchScreenName", switchScreenName());
settings.setValue("switchInDirection", switchDirection());
settings.setValue("lockCursorToScreen", lockCursorMode());
settings.setValue("activeOnRelease", activeOnRelease());
settings.setValue("hasScreens", haveScreens());
}
QTextStream& operator<<(QTextStream& outStream, const Action& action)
{
if (action.activeOnRelease())
outStream << ";";
outStream << action.text();
return outStream;
}

88
src/gui/src/Action.h Normal file
View File

@@ -0,0 +1,88 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(ACTION_H)
#define ACTION_H
#include "KeySequence.h"
#include <QString>
#include <QStringList>
#include <QList>
class ActionDialog;
class QSettings;
class QTextStream;
class Action
{
friend class ActionDialog;
friend QTextStream& operator<<(QTextStream& outStream, const Action& action);
public:
enum ActionType { keyDown, keyUp, keystroke, switchToScreen, switchInDirection, lockCursorToScreen, mouseDown, mouseUp, mousebutton };
enum SwitchDirection { switchLeft, switchRight, switchUp, switchDown };
enum LockCursorMode { lockCursorToggle, lockCursonOn, lockCursorOff };
public:
Action();
public:
QString text() const;
const KeySequence& keySequence() const { return m_KeySequence; }
void loadSettings(QSettings& settings);
void saveSettings(QSettings& settings) const;
int type() const { return m_Type; }
const QStringList& typeScreenNames() const { return m_TypeScreenNames; }
const QString& switchScreenName() const { return m_SwitchScreenName; }
int switchDirection() const { return m_SwitchDirection; }
int lockCursorMode() const { return m_LockCursorMode; }
bool activeOnRelease() const { return m_ActiveOnRelease; }
bool haveScreens() const { return m_HasScreens; }
protected:
KeySequence& keySequence() { return m_KeySequence; }
void setKeySequence(const KeySequence& seq) { m_KeySequence = seq; }
void setType(int t) { m_Type = t; }
QStringList& typeScreenNames() { return m_TypeScreenNames; }
void setSwitchScreenName(const QString& n) { m_SwitchScreenName = n; }
void setSwitchDirection(int d) { m_SwitchDirection = d; }
void setLockCursorMode(int m) { m_LockCursorMode = m; }
void setActiveOnRelease(bool b) { m_ActiveOnRelease = b; }
void setHaveScreens(bool b) { m_HasScreens = b; }
private:
KeySequence m_KeySequence;
int m_Type;
QStringList m_TypeScreenNames;
QString m_SwitchScreenName;
int m_SwitchDirection;
int m_LockCursorMode;
bool m_ActiveOnRelease;
bool m_HasScreens;
static const char* m_ActionTypeNames[];
static const char* m_SwitchDirectionNames[];
static const char* m_LockCursorModeNames[];
};
typedef QList<Action> ActionList;
QTextStream& operator<<(QTextStream& outStream, const Action& action);
#endif

View File

@@ -0,0 +1,108 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "ActionDialog.h"
#include "Hotkey.h"
#include "Action.h"
#include "ServerConfig.h"
#include "KeySequence.h"
#include <QtCore>
#include <QtGui>
ActionDialog::ActionDialog(QWidget* parent, ServerConfig& config, Hotkey& hotkey, Action& action) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::ActionDialogBase(),
m_ServerConfig(config),
m_Hotkey(hotkey),
m_Action(action),
m_pButtonGroupType(new QButtonGroup(this))
{
setupUi(this);
// work around Qt Designer's lack of a QButtonGroup; we need it to get
// at the button id of the checked radio button
QRadioButton* const typeButtons[] = { m_pRadioPress, m_pRadioRelease, m_pRadioPressAndRelease, m_pRadioSwitchToScreen, m_pRadioSwitchInDirection, m_pRadioLockCursorToScreen };
for (unsigned int i = 0; i < sizeof(typeButtons) / sizeof(typeButtons[0]); i++)
m_pButtonGroupType->addButton(typeButtons[i], i);
m_pKeySequenceWidgetHotkey->setText(m_Action.keySequence().toString());
m_pKeySequenceWidgetHotkey->setKeySequence(m_Action.keySequence());
m_pButtonGroupType->button(m_Action.type())->setChecked(true);
m_pComboSwitchInDirection->setCurrentIndex(m_Action.switchDirection());
m_pComboLockCursorToScreen->setCurrentIndex(m_Action.lockCursorMode());
if (m_Action.activeOnRelease())
m_pRadioHotkeyReleased->setChecked(true);
else
m_pRadioHotkeyPressed->setChecked(true);
m_pGroupBoxScreens->setChecked(m_Action.haveScreens());
int idx = 0;
foreach(const Screen& screen, serverConfig().screens())
if (!screen.isNull())
{
QListWidgetItem *pListItem = new QListWidgetItem(screen.name());
m_pListScreens->addItem(pListItem);
if (m_Action.typeScreenNames().indexOf(screen.name()) != -1)
m_pListScreens->setCurrentItem(pListItem);
m_pComboSwitchToScreen->addItem(screen.name());
if (screen.name() == m_Action.switchScreenName())
m_pComboSwitchToScreen->setCurrentIndex(idx);
idx++;
}
}
void ActionDialog::accept()
{
if (!sequenceWidget()->valid() && m_pButtonGroupType->checkedId() >= 0 && m_pButtonGroupType->checkedId() < 3)
return;
m_Action.setKeySequence(sequenceWidget()->keySequence());
m_Action.setType(m_pButtonGroupType->checkedId());
m_Action.setHaveScreens(m_pGroupBoxScreens->isChecked());
m_Action.typeScreenNames().clear();
foreach(const QListWidgetItem* pItem, m_pListScreens->selectedItems())
m_Action.typeScreenNames().append(pItem->text());
m_Action.setSwitchScreenName(m_pComboSwitchToScreen->currentText());
m_Action.setSwitchDirection(m_pComboSwitchInDirection->currentIndex());
m_Action.setLockCursorMode(m_pComboLockCursorToScreen->currentIndex());
m_Action.setActiveOnRelease(m_pRadioHotkeyReleased->isChecked());
QDialog::accept();
}
void ActionDialog::on_m_pKeySequenceWidgetHotkey_keySequenceChanged()
{
if (sequenceWidget()->keySequence().isMouseButton())
{
m_pGroupBoxScreens->setEnabled(false);
m_pListScreens->setEnabled(false);
}
else
{
m_pGroupBoxScreens->setEnabled(true);
m_pListScreens->setEnabled(true);
}
}

View File

@@ -0,0 +1,55 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(ACTIONDIALOG_H)
#define ACTIONDIALOG_H
#include <QDialog>
#include "ui_ActionDialogBase.h"
class Hotkey;
class Action;
class QRadioButton;
class QButtonGroup;
class ServerConfig;
class ActionDialog : public QDialog, public Ui::ActionDialogBase
{
Q_OBJECT
public:
ActionDialog(QWidget* parent, ServerConfig& config, Hotkey& hotkey, Action& action);
protected slots:
void accept();
void on_m_pKeySequenceWidgetHotkey_keySequenceChanged();
protected:
const KeySequenceWidget* sequenceWidget() const { return m_pKeySequenceWidgetHotkey; }
const ServerConfig& serverConfig() const { return m_ServerConfig; }
private:
const ServerConfig& m_ServerConfig;
Hotkey& m_Hotkey;
Action& m_Action;
QButtonGroup* m_pButtonGroupType;
};
#endif

180
src/gui/src/AppConfig.cpp Normal file
View File

@@ -0,0 +1,180 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "AppConfig.h"
#include <QtCore>
#include <QtNetwork>
#if defined(Q_OS_WIN)
const char AppConfig::m_SynergysName[] = "synergys.exe";
const char AppConfig::m_SynergycName[] = "synergyc.exe";
const char AppConfig::m_SynergyLogDir[] = "log/";
#else
const char AppConfig::m_SynergysName[] = "synergys";
const char AppConfig::m_SynergycName[] = "synergyc";
const char AppConfig::m_SynergyLogDir[] = "/var/log/";
#endif
static const char* logLevelNames[] =
{
"ERROR",
"WARNING",
"NOTE",
"INFO",
"DEBUG",
"DEBUG1",
"DEBUG2"
};
AppConfig::AppConfig(QSettings* settings) :
m_pSettings(settings),
m_AutoConnect(false),
m_ScreenName(),
m_Port(24800),
m_Interface(),
m_LogLevel(0),
m_AutoStart(false),
m_AutoHide(false),
m_AutoStartPrompt(false),
m_WizardHasRun(false),
m_GameModeIndex(0),
m_GamePollingDynamic(true),
m_GamePollingFrequency(60)
{
Q_ASSERT(m_pSettings);
loadSettings();
}
AppConfig::~AppConfig()
{
saveSettings();
}
QString AppConfig::synergyLogDir() const
{
#if defined(Q_OS_WIN)
// on windows, we want to log to program files
return synergyProgramDir() + "log/";
#else
// on unix, we'll log to the standard log dir
return "/var/log/";
#endif
}
QString AppConfig::synergyProgramDir() const
{
// synergy binaries should be in the same dir.
return QCoreApplication::applicationDirPath() + "/";
}
void AppConfig::persistLogDir()
{
QDir dir = synergyLogDir();
// persist the log directory
if (!dir.exists())
{
dir.mkpath(dir.path());
}
}
QString AppConfig::logLevelText() const
{
return logLevelNames[logLevel()];
}
void AppConfig::setAutoStart(bool b)
{
m_AutoStart = b;
// always create or delete the links/files/entries even if they exist already,
// in case it was broken.
#if defined(Q_OS_LINUX)
QString desktopFileName("synergy.desktop");
QString desktopFilePath("/usr/share/applications/" + desktopFileName);
QString autoStartPath(QDir::homePath() + "/.config/autostart/" + desktopFileName);
if (b)
{
QFile::link(desktopFilePath, autoStartPath);
}
else
{
QFile::remove(autoStartPath);
}
#elif defined(Q_OS_WIN)
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
QString path("Synergy");
if (b)
{
settings.setValue(path, QCoreApplication::applicationFilePath());
}
else
{
settings.remove(path);
}
settings.sync();
#endif
// TODO: mac os x auto start
}
void AppConfig::loadSettings()
{
m_AutoConnect = settings().value("autoConnect", false).toBool();
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_LogToFile = settings().value("logToFile", false).toBool();
m_LogFilename = settings().value("logFilename", synergyLogDir() + "synergy.log").toString();
m_AutoStart = settings().value("autoStart", false).toBool();
m_AutoHide = settings().value("autoHide", true).toBool();
m_AutoStartPrompt = settings().value("autoStartPrompt", true).toBool();
m_WizardHasRun = settings().value("wizardHasRun", false).toBool();
m_ProcessMode = (ProcessMode)settings().value("processMode", Desktop).toInt();
m_GameModeIndex = settings().value("gameModeIndex", 0).toInt();
m_GamePollingDynamic = settings().value("gamePollingDynamic", true).toBool();
m_GamePollingFrequency = settings().value("gamePollingFrequency", 60).toInt();
}
void AppConfig::saveSettings()
{
settings().setValue("autoConnect", m_AutoConnect);
settings().setValue("screenName", m_ScreenName);
settings().setValue("port", m_Port);
settings().setValue("interface", m_Interface);
settings().setValue("logLevel", m_LogLevel);
settings().setValue("logToFile", m_LogToFile);
settings().setValue("logFilename", m_LogFilename);
settings().setValue("autoStart", m_AutoStart);
settings().setValue("autoHide", m_AutoHide);
settings().setValue("autoStartPrompt", m_AutoStartPrompt);
settings().setValue("wizardHasRun", m_WizardHasRun);
settings().setValue("processMode", m_ProcessMode);
settings().setValue("gameModeIndex", m_GameModeIndex);
settings().setValue("gamePollingDynamic", m_GamePollingDynamic);
settings().setValue("gamePollingFrequency", m_GamePollingFrequency);
}

112
src/gui/src/AppConfig.h Normal file
View File

@@ -0,0 +1,112 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(APPCONFIG_H)
#define APPCONFIG_H
#include <QString>
class QSettings;
class SettingsDialog;
enum ProcessMode {
Service,
Desktop
};
class AppConfig
{
friend class SettingsDialog;
friend class MainWindow;
friend class SetupWizard;
public:
AppConfig(QSettings* settings);
~AppConfig();
public:
bool autoConnect() const { return m_AutoConnect; }
const QString& screenName() const { return m_ScreenName; }
int port() const { return m_Port; }
const QString& interface() const { return m_Interface; }
int logLevel() const { return m_LogLevel; }
bool logToFile() const { return m_LogToFile; }
const QString& logFilename() const { return m_LogFilename; }
QString logLevelText() const;
bool autoStart() const { return m_AutoStart; }
bool autoHide() const { return m_AutoHide; }
bool autoStartPrompt() const { return m_AutoStartPrompt; }
bool wizardHasRun() const { return m_WizardHasRun; }
ProcessMode processMode() const { return m_ProcessMode; }
int gameModeIndex() const { return m_GameModeIndex; }
bool gamePollingDynamic() const { return m_GamePollingDynamic; }
int gamePollingFrequency() const { return m_GamePollingFrequency; }
QString synergysName() const { return m_SynergysName; }
QString synergycName() const { return m_SynergycName; }
QString synergyProgramDir() const;
QString synergyLogDir() const;
bool detectPath(const QString& name, QString& path);
void persistLogDir();
protected:
QSettings& settings() { return *m_pSettings; }
void setAutoConnect(bool b) { m_AutoConnect = b; }
void setScreenName(const QString& s) { m_ScreenName = s; }
void setPort(int i) { m_Port = i; }
void setInterface(const QString& s) { m_Interface = s; }
void setLogLevel(int i) { m_LogLevel = i; }
void setLogToFile(bool b) { m_LogToFile = b; }
void setLogFilename(const QString& s) { m_LogFilename = s; }
void setAutoStart(bool b);
void setAutoHide(bool b) { m_AutoHide = b; }
void setAutoStartPrompt(bool b) { m_AutoStartPrompt = b; }
void setWizardHasRun(bool b) { m_WizardHasRun = b; }
void setProcessMode(ProcessMode p) { m_ProcessMode = p; }
void setGameModeIndex(int i) { m_GameModeIndex = i; }
void setGamePollingDynamic(bool b) { m_GamePollingDynamic = b; }
void setGamePollingFrequency(int i) { m_GamePollingFrequency = i; }
void loadSettings();
void saveSettings();
private:
QSettings* m_pSettings;
bool m_AutoConnect;
QString m_ScreenName;
int m_Port;
QString m_Interface;
int m_LogLevel;
bool m_LogToFile;
QString m_LogFilename;
bool m_AutoStart;
bool m_AutoHide;
bool m_AutoStartPrompt;
bool m_WizardHasRun;
ProcessMode m_ProcessMode;
int m_GameModeIndex;
bool m_GamePollingDynamic;
int m_GamePollingFrequency;
static const char m_SynergysName[];
static const char m_SynergycName[];
static const char m_SynergyLogDir[];
};
#endif

View File

@@ -0,0 +1,45 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "BaseConfig.h"
const char* BaseConfig::m_ModifierNames[] =
{
"shift",
"ctrl",
"alt",
"meta",
"super",
"none"
};
const char* BaseConfig::m_FixNames[] =
{
"halfDuplexCapsLock",
"halfDuplexNumLock",
"halfDuplexScrollLock",
"xtestIsXineramaUnaware"
};
const char* BaseConfig::m_SwitchCornerNames[] =
{
"top-left",
"top-right",
"bottom-left",
"bottom-right"
};

90
src/gui/src/BaseConfig.h Normal file
View File

@@ -0,0 +1,90 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(BASECONFIG_H)
#define BASECONFIG_H
#include <QSettings>
#include <QString>
#include <QVariant>
class BaseConfig
{
public:
enum Modifier { DefaultMod = -1, Shift, Ctrl, Alt, Meta, Super, None, NumModifiers };
enum SwitchCorner { TopLeft, TopRight, BottomLeft, BottomRight, NumSwitchCorners };
enum Fix { CapsLock, NumLock, ScrollLock, XTest, NumFixes };
protected:
BaseConfig() {}
virtual ~BaseConfig() {}
protected:
template<typename T1, typename T2>
void readSettings(QSettings& settings, T1& array, const QString& arrayName, const T2& deflt)
{
int entries = settings.beginReadArray(arrayName + "Array");
array.clear();
for (int i = 0; i < entries; i++)
{
settings.setArrayIndex(i);
QVariant v = settings.value(arrayName, deflt);
array.append(v.value<T2>());
}
settings.endArray();
}
template<typename T1, typename T2>
void readSettings(QSettings& settings, T1& array, const QString& arrayName, const T2& deflt, int entries)
{
Q_ASSERT(array.size() >= entries);
settings.beginReadArray(arrayName + "Array");
for (int i = 0; i < entries; i++)
{
settings.setArrayIndex(i);
QVariant v = settings.value(arrayName, deflt);
array[i] = v.value<T2>();
}
settings.endArray();
}
template<typename T>
void writeSettings(QSettings& settings, const T& array, const QString& arrayName) const
{
settings.beginWriteArray(arrayName + "Array");
for (int i = 0; i < array.size(); i++)
{
settings.setArrayIndex(i);
settings.setValue(arrayName, array[i]);
}
settings.endArray();
}
public:
static const char* modifierName(int idx) { return m_ModifierNames[idx]; }
static const char* fixName(int idx) { return m_FixNames[idx]; }
static const char* switchCornerName(int idx) { return m_SwitchCornerNames[idx]; }
private:
static const char* m_ModifierNames[];
static const char* m_FixNames[];
static const char* m_SwitchCornerNames[];
};
#endif

74
src/gui/src/Hotkey.cpp Normal file
View File

@@ -0,0 +1,74 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "Hotkey.h"
#include <QSettings>
Hotkey::Hotkey() :
m_KeySequence(),
m_Actions()
{
}
QString Hotkey::text() const
{
QString text = keySequence().toString();
if (keySequence().isMouseButton())
return "mousebutton(" + text + ")";
return "keystroke(" + text + ")";
}
void Hotkey::loadSettings(QSettings& settings)
{
keySequence().loadSettings(settings);
actions().clear();
int num = settings.beginReadArray("actions");
for (int i = 0; i < num; i++)
{
settings.setArrayIndex(i);
Action a;
a.loadSettings(settings);
actions().append(a);
}
settings.endArray();
}
void Hotkey::saveSettings(QSettings& settings) const
{
keySequence().saveSettings(settings);
settings.beginWriteArray("actions");
for (int i = 0; i < actions().size(); i++)
{
settings.setArrayIndex(i);
actions()[i].saveSettings(settings);
}
settings.endArray();
}
QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey)
{
for (int i = 0; i < hotkey.actions().size(); i++)
outStream << "\t" << hotkey.text() << " = " << hotkey.actions()[i] << endl;
return outStream;
}

65
src/gui/src/Hotkey.h Normal file
View File

@@ -0,0 +1,65 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(HOTKEY_H)
#define HOTKEY_H
#include <QString>
#include <QList>
#include <QTextStream>
#include "Action.h"
#include "KeySequence.h"
class HotkeyDialog;
class ServerConfigDialog;
class QSettings;
class Hotkey
{
friend class HotkeyDialog;
friend class ServerConfigDialog;
friend QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey);
public:
Hotkey();
public:
QString text() const;
const KeySequence& keySequence() const { return m_KeySequence; }
const ActionList& actions() const { return m_Actions; }
void loadSettings(QSettings& settings);
void saveSettings(QSettings& settings) const;
protected:
KeySequence& keySequence() { return m_KeySequence; }
void setKeySequence(const KeySequence& seq) { m_KeySequence = seq; }
ActionList& actions() { return m_Actions; }
private:
KeySequence m_KeySequence;
ActionList m_Actions;
};
typedef QList<Hotkey> HotkeyList;
QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey);
#endif

View File

@@ -0,0 +1,40 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "HotkeyDialog.h"
#include <QtCore>
#include <QtGui>
HotkeyDialog::HotkeyDialog (QWidget* parent, Hotkey& hotkey) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::HotkeyDialogBase(),
m_Hotkey(hotkey)
{
setupUi(this);
m_pKeySequenceWidgetHotkey->setText(m_Hotkey.text());
}
void HotkeyDialog::accept()
{
if (!sequenceWidget()->valid())
return;
hotkey().setKeySequence(sequenceWidget()->keySequence());
QDialog::accept();
}

View File

@@ -0,0 +1,48 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(HOTKEYDIALOG_H)
#define HOTKEYDIALOG_H
#include "ui_HotkeyDialogBase.h"
#include "Hotkey.h"
#include <QDialog>
class HotkeyDialog : public QDialog, public Ui::HotkeyDialogBase
{
Q_OBJECT
public:
HotkeyDialog(QWidget* parent, Hotkey& hotkey);
public:
const Hotkey& hotkey() const { return m_Hotkey; }
protected slots:
void accept();
protected:
const KeySequenceWidget* sequenceWidget() const { return m_pKeySequenceWidgetHotkey; }
Hotkey& hotkey() { return m_Hotkey; }
private:
Hotkey& m_Hotkey;
};
#endif

View File

@@ -0,0 +1,67 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Nick Bolton
*
* 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 "IpcLogReader.h"
#if defined(Q_OS_WIN)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#endif
IpcLogReader::IpcLogReader()
{
}
IpcLogReader::~IpcLogReader()
{
}
void
IpcLogReader::run()
{
#if defined(Q_OS_WIN)
const WCHAR* name = L"\\\\.\\pipe\\SynergyLog";
HANDLE pipe = CreateFile(
name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
if (pipe == INVALID_HANDLE_VALUE)
{
receivedLine(
QString("ERROR: could not connect to service log, error: ") +
QString::number(GetLastError()));
return;
}
char buffer[1024];
DWORD bytesRead;
while (true)
{
if (!ReadFile(pipe, buffer, sizeof(buffer), &bytesRead, NULL)) {
break;
}
buffer[bytesRead] = '\0';
QString text = QString::fromAscii(buffer, bytesRead);
text = text.trimmed().append("\n");
receivedLine(text);
}
#endif
}

View File

@@ -0,0 +1,32 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Nick Bolton
*
* 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 <QThread>
#include <string>
class IpcLogReader : public QThread
{
Q_OBJECT
public:
IpcLogReader();
virtual ~IpcLogReader();
void run();
signals:
void receivedLine(const QString& text);
};

236
src/gui/src/KeySequence.cpp Normal file
View File

@@ -0,0 +1,236 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "KeySequence.h"
#include <QtCore>
#include <QtGui>
// this table originally comes from Qt sources (gui/kernel/qkeysequence.cpp)
// and is heavily modified for QSynergy
static const struct
{
int key;
const char* name;
} keyname[] =
{
{ Qt::Key_Space, "Space" },
{ Qt::Key_Escape, "Escape" },
{ Qt::Key_Tab, "Tab" },
{ Qt::Key_Backtab, "LeftTab" },
{ Qt::Key_Backspace, "BackSpace" },
{ Qt::Key_Return, "Return" },
{ Qt::Key_Insert, "Insert" },
{ Qt::Key_Delete, "Delete" },
{ Qt::Key_Pause, "Pause" },
{ Qt::Key_Print, "Print" },
{ Qt::Key_SysReq, "SysReq" },
{ Qt::Key_Home, "Home" },
{ Qt::Key_End, "End" },
{ Qt::Key_Left, "Left" },
{ Qt::Key_Up, "Up" },
{ Qt::Key_Right, "Right" },
{ Qt::Key_Down, "Down" },
{ Qt::Key_PageUp, "PageUp" },
{ Qt::Key_PageDown, "PageDown" },
{ Qt::Key_CapsLock, "CapsLock" },
{ Qt::Key_NumLock, "NumLock" },
{ Qt::Key_ScrollLock, "ScrollLock" },
{ Qt::Key_Menu, "Menu" },
{ Qt::Key_Help, "Help" },
{ Qt::Key_Enter, "KP_Enter" },
{ Qt::Key_Clear, "Clear" },
{ Qt::Key_Back, "WWWBack" },
{ Qt::Key_Forward, "WWWForward" },
{ Qt::Key_Stop, "WWWStop" },
{ Qt::Key_Refresh, "WWWRefresh" },
{ Qt::Key_VolumeDown, "AudioDown" },
{ Qt::Key_VolumeMute, "AudioMute" },
{ Qt::Key_VolumeUp, "AudioUp" },
{ Qt::Key_MediaPlay, "AudioPlay" },
{ Qt::Key_MediaStop, "AudioStop" },
{ Qt::Key_MediaPrevious,"AudioPrev" },
{ Qt::Key_MediaNext, "AudioNext" },
{ Qt::Key_HomePage, "WWWHome" },
{ Qt::Key_Favorites, "WWWFavorites" },
{ Qt::Key_Search, "WWWSearch" },
{ Qt::Key_Standby, "Sleep" },
{ Qt::Key_LaunchMail, "AppMail" },
{ Qt::Key_LaunchMedia, "AppMedia" },
{ Qt::Key_Launch0, "AppUser1" },
{ Qt::Key_Launch1, "AppUser2" },
{ Qt::Key_Select, "Select" },
{ 0, 0 }
};
KeySequence::KeySequence() :
m_Sequence(),
m_Modifiers(0),
m_IsValid(false)
{
}
bool KeySequence::isMouseButton() const
{
return !m_Sequence.isEmpty() && m_Sequence.last() < Qt::Key_Space;
}
QString KeySequence::toString() const
{
QString result;
for (int i = 0; i < m_Sequence.size(); i++)
{
result += keyToString(m_Sequence[i]);
if (i != m_Sequence.size() - 1)
result += "+";
}
return result;
}
bool KeySequence::appendMouseButton(int button)
{
return appendKey(button, 0);
}
bool KeySequence::appendKey(int key, int modifiers)
{
if (m_Sequence.size() == 4)
return true;
switch(key)
{
case Qt::Key_AltGr:
return false;
case Qt::Key_Control:
case Qt::Key_Alt:
case Qt::Key_Shift:
case Qt::Key_Meta:
case Qt::Key_Menu:
{
int mod = modifiers & (~m_Modifiers);
if (mod)
{
m_Sequence.append(mod);
m_Modifiers |= mod;
}
}
break;
default:
// see if we can handle this key, if not, don't accept it
if (keyToString(key).isEmpty())
break;
m_Sequence.append(key);
setValid(true);
return true;
}
return false;
}
void KeySequence::loadSettings(QSettings& settings)
{
sequence().clear();
int num = settings.beginReadArray("keys");
for (int i = 0; i < num; i++)
{
settings.setArrayIndex(i);
sequence().append(settings.value("key", 0).toInt());
}
settings.endArray();
setModifiers(0);
setValid(true);
}
void KeySequence::saveSettings(QSettings& settings) const
{
settings.beginWriteArray("keys");
for (int i = 0; i < sequence().size(); i++)
{
settings.setArrayIndex(i);
settings.setValue("key", sequence()[i]);
}
settings.endArray();
}
QString KeySequence::keyToString(int key)
{
// nothing there?
if (key == 0)
return "";
// a hack to handle mouse buttons as if they were keys
if (key < Qt::Key_Space)
{
switch(key)
{
case Qt::LeftButton: return "1";
case Qt::RightButton: return "2";
case Qt::MidButton: return "3";
}
return "4"; // qt only knows three mouse buttons, so assume it's an unknown fourth one
}
// modifiers?
if (key & Qt::ShiftModifier)
return "Shift";
if (key & Qt::ControlModifier)
return "Control";
if (key & Qt::AltModifier)
return "Alt";
if (key & Qt::MetaModifier)
return "Meta";
// treat key pad like normal keys (FIXME: we should have another lookup table for keypad keys instead)
key &= ~Qt::KeypadModifier;
// a printable 7 bit character?
if (key < 0x80 && key != Qt::Key_Space)
return QChar(key & 0x7f).toLower();
// a function key?
if (key >= Qt::Key_F1 && key <= Qt::Key_F35)
return QString::fromUtf8("F%1").arg(key - Qt::Key_F1 + 1);
// a special key?
int i=0;
while (keyname[i].name)
{
if (key == keyname[i].key)
return QString::fromUtf8(keyname[i].name);
i++;
}
// representable in ucs2?
if (key < 0x10000)
return QString("\\u%1").arg(QChar(key).toLower().unicode(), 4, 16, QChar('0'));
// give up, synergy probably won't handle this
return "";
}

57
src/gui/src/KeySequence.h Normal file
View File

@@ -0,0 +1,57 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(KEYSEQUENCE_H)
#define KEYSEQUENCE_H
#include <QList>
#include <QString>
class QSettings;
class KeySequence
{
public:
KeySequence();
public:
QString toString() const;
bool appendKey(int modifiers, int key);
bool appendMouseButton(int button);
bool isMouseButton() const;
bool valid() const { return m_IsValid; }
int modifiers() const { return m_Modifiers; }
void saveSettings(QSettings& settings) const;
void loadSettings(QSettings& settings);
const QList<int>& sequence() const { return m_Sequence; }
private:
void setValid(bool b) { m_IsValid = b; }
void setModifiers(int i) { m_Modifiers = i; }
QList<int>& sequence() { return m_Sequence; }
private:
QList<int> m_Sequence;
int m_Modifiers;
bool m_IsValid;
static QString keyToString(int key);
};
#endif

View File

@@ -0,0 +1,143 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "KeySequenceWidget.h"
#include <iostream>
KeySequenceWidget::KeySequenceWidget(QWidget* parent, const KeySequence& seq) :
QPushButton(parent),
m_KeySequence(seq),
m_BackupSequence(seq),
m_Status(Stopped),
m_MousePrefix("mousebutton("),
m_MousePostfix(")"),
m_KeyPrefix("keystroke("),
m_KeyPostfix(")")
{
setFocusPolicy(Qt::NoFocus);
updateOutput();
}
void KeySequenceWidget::setKeySequence(const KeySequence& seq)
{
keySequence() = seq;
backupSequence() = seq;
setStatus(Stopped);
updateOutput();
}
void KeySequenceWidget::mousePressEvent(QMouseEvent* event)
{
event->accept();
if (status() == Stopped)
{
startRecording();
return;
}
if (m_KeySequence.appendMouseButton(event->button()))
stopRecording();
updateOutput();
}
void KeySequenceWidget::startRecording()
{
keySequence() = KeySequence();
setDown(true);
setFocus();
grabKeyboard();
setStatus(Recording);
}
void KeySequenceWidget::stopRecording()
{
if (!keySequence().valid())
{
keySequence() = backupSequence();
updateOutput();
}
setDown(false);
focusNextChild();
releaseKeyboard();
setStatus(Stopped);
emit keySequenceChanged();
}
bool KeySequenceWidget::event(QEvent* event)
{
if (status() == Recording)
{
switch(event->type())
{
case QEvent::KeyPress:
keyPressEvent(static_cast<QKeyEvent*>(event));
return true;
case QEvent::MouseButtonRelease:
event->accept();
return true;
case QEvent::ShortcutOverride:
event->accept();
return true;
case QEvent::FocusOut:
stopRecording();
if (!valid())
{
keySequence() = backupSequence();
updateOutput();
}
break;
default:
break;
}
}
return QPushButton::event(event);
}
void KeySequenceWidget::keyPressEvent(QKeyEvent* event)
{
event->accept();
if (status() == Stopped)
return;
if (m_KeySequence.appendKey(event->key(), event->modifiers()))
stopRecording();
updateOutput();
}
void KeySequenceWidget::updateOutput()
{
QString s;
if (m_KeySequence.isMouseButton())
s = mousePrefix() + m_KeySequence.toString() + mousePostfix();
else
s = keyPrefix() + m_KeySequence.toString() + keyPostfix();
setText(s);
}

View File

@@ -0,0 +1,80 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(KEYSEQUENCEWIDGET__H)
#define KEYSEQUENCEWIDGET__H
#include <QtGui>
#include "KeySequence.h"
class KeySequenceWidget : public QPushButton
{
Q_OBJECT
public:
KeySequenceWidget(QWidget* parent, const KeySequence& seq = KeySequence());
signals:
void keySequenceChanged();
public:
const QString& mousePrefix() const { return m_MousePrefix; }
const QString& mousePostfix() const { return m_MousePostfix; }
const QString& keyPrefix() const { return m_KeyPrefix; }
const QString& keyPostfix() const { return m_KeyPostfix; }
void setMousePrefix(const QString& s) { m_MousePrefix = s; }
void setMousePostfix(const QString& s) { m_MousePostfix = s; }
void setKeyPrefix(const QString& s) { m_KeyPrefix = s; }
void setKeyPostfix(const QString& s) { m_KeyPostfix = s; }
const KeySequence& keySequence() const { return m_KeySequence; }
const KeySequence& backupSequence() const { return m_BackupSequence; }
void setKeySequence(const KeySequence& seq);
bool valid() const { return keySequence().valid(); }
protected:
void mousePressEvent(QMouseEvent*);
void keyPressEvent(QKeyEvent*);
bool event(QEvent* event);
void appendToSequence(int key);
void updateOutput();
void startRecording();
void stopRecording();
KeySequence& keySequence() { return m_KeySequence; }
KeySequence& backupSequence() { return m_BackupSequence; }
private:
enum Status { Stopped, Recording };
void setStatus(Status s) { m_Status = s; }
Status status() const { return m_Status; }
private:
KeySequence m_KeySequence;
KeySequence m_BackupSequence;
Status m_Status;
QString m_MousePrefix;
QString m_MousePostfix;
QString m_KeyPrefix;
QString m_KeyPostfix;
};
#endif

722
src/gui/src/MainWindow.cpp Normal file
View File

@@ -0,0 +1,722 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#define WEBSITE_ADDRESS "synergy-foss.org"
#include "MainWindow.h"
#include "AboutDialog.h"
#include "ServerConfigDialog.h"
#include "SettingsDialog.h"
#include "SetupWizard.h"
#include <QtCore>
#include <QtGui>
#include <QtNetwork>
#include <QNetworkAccessManager>
#if defined(Q_OS_MAC)
#include <ApplicationServices/ApplicationServices.h>
#endif
#if defined(Q_OS_WIN)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#endif
#if defined(Q_OS_WIN)
static const char synergyConfigName[] = "synergy.sgc";
static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.sgc);;All files (*.*)"));
#else
static const char synergyConfigName[] = "synergy.conf";
static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.conf);;All files (*.*)"));
#endif
static const char* synergyIconFiles[] =
{
":/res/icons/16x16/synergy-disconnected.png",
":/res/icons/16x16/synergy-disconnected.png",
":/res/icons/16x16/synergy-connected.png"
};
class QThreadImpl : public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_Settings(settings),
m_AppConfig(appConfig),
m_pSynergy(NULL),
m_SynergyState(synergyDisconnected),
m_ServerConfig(&m_Settings, 5, 3),
m_pTempConfigFile(NULL),
m_pTrayIcon(NULL),
m_pTrayIconMenu(NULL),
m_alreadyHidden(false),
m_SetupWizard(NULL)
{
setupUi(this);
createMenuBar();
loadSettings();
initConnections();
m_pUpdateIcon->hide();
m_pUpdateLabel->hide();
m_versionChecker.setApp(appPath(appConfig.synergycName()));
m_SetupWizard = new SetupWizard(*this, false);
connect(m_SetupWizard, SIGNAL(finished(int)), this, SLOT(refreshStartButton()));
if (appConfig.processMode() == Service)
{
connect(&m_IpcLogReader, SIGNAL(receivedLine(const QString&)), this, SLOT(appendLog(const QString&)));
m_IpcLogReader.start();
}
}
MainWindow::~MainWindow()
{
stopSynergy();
saveSettings();
delete m_SetupWizard;
}
void MainWindow::start(bool firstRun)
{
refreshStartButton();
if (!firstRun && appConfig().autoConnect() && appConfig().processMode() == Desktop)
startSynergy();
createTrayIcon();
// always show. auto-hide only happens when we have a connection.
show();
m_versionChecker.checkLatest();
}
void MainWindow::refreshStartButton()
{
if (appConfig().processMode() == Service)
{
m_pButtonToggleStart->setText(tr("&Apply"));
}
else
{
m_pButtonToggleStart->setText(tr("&Start"));
}
}
void MainWindow::setStatus(const QString &status)
{
m_pStatusLabel->setText(status);
}
void MainWindow::createTrayIcon()
{
m_pTrayIconMenu = new QMenu(this);
m_pTrayIconMenu->addAction(m_pActionStartSynergy);
m_pTrayIconMenu->addAction(m_pActionStopSynergy);
m_pTrayIconMenu->addSeparator();
m_pTrayIconMenu->addAction(m_pActionMinimize);
m_pTrayIconMenu->addAction(m_pActionRestore);
m_pTrayIconMenu->addSeparator();
m_pTrayIconMenu->addAction(m_pActionQuit);
m_pTrayIcon = new QSystemTrayIcon(this);
m_pTrayIcon->setContextMenu(m_pTrayIconMenu);
setIcon(synergyDisconnected);
m_pTrayIcon->show();
}
void MainWindow::createMenuBar()
{
QMenuBar* menubar = new QMenuBar(this);
QMenu* pMenuFile = new QMenu(tr("&File"), menubar);
QMenu* pMenuEdit = new QMenu(tr("&Edit"), menubar);
QMenu* pMenuWindow = new QMenu(tr("&Window"), menubar);
QMenu* pMenuHelp = new QMenu(tr("&Help"), menubar);
menubar->addAction(pMenuFile->menuAction());
menubar->addAction(pMenuEdit->menuAction());
#if !defined(Q_OS_MAC)
menubar->addAction(pMenuWindow->menuAction());
#endif
menubar->addAction(pMenuHelp->menuAction());
pMenuFile->addAction(m_pActionStartSynergy);
pMenuFile->addAction(m_pActionStopSynergy);
pMenuFile->addSeparator();
pMenuFile->addAction(m_pActionWizard);
pMenuFile->addAction(m_pActionSave);
pMenuFile->addSeparator();
pMenuFile->addAction(m_pActionQuit);
pMenuEdit->addAction(m_pActionSettings);
pMenuWindow->addAction(m_pActionMinimize);
pMenuWindow->addAction(m_pActionRestore);
pMenuHelp->addAction(m_pActionAbout);
setMenuBar(menubar);
}
void MainWindow::loadSettings()
{
// the next two must come BEFORE loading groupServerChecked and groupClientChecked or
// disabling and/or enabling the right widgets won't automatically work
m_pRadioExternalConfig->setChecked(settings().value("externalConfig", false).toBool());
m_pRadioInternalConfig->setChecked(settings().value("internalConfig", true).toBool());
m_pGroupServer->setChecked(settings().value("groupServerChecked", false).toBool());
m_pLineEditConfigFile->setText(settings().value("configFile", QDir::homePath() + "/" + synergyConfigName).toString());
m_pGroupClient->setChecked(settings().value("groupClientChecked", true).toBool());
m_pLineEditHostname->setText(settings().value("serverHostname").toString());
}
void MainWindow::initConnections()
{
connect(m_pActionMinimize, SIGNAL(triggered()), this, SLOT(hide()));
connect(m_pActionRestore, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(m_pActionStartSynergy, SIGNAL(triggered()), this, SLOT(startSynergy()));
connect(m_pActionStopSynergy, SIGNAL(triggered()), this, SLOT(stopSynergy()));
connect(m_pActionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(&m_versionChecker, SIGNAL(updateFound(const QString&)), this, SLOT(updateFound(const QString&)));
if (m_pTrayIcon)
connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
}
void MainWindow::saveSettings()
{
// program settings
settings().setValue("groupServerChecked", m_pGroupServer->isChecked());
settings().setValue("externalConfig", m_pRadioExternalConfig->isChecked());
settings().setValue("configFile", m_pLineEditConfigFile->text());
settings().setValue("internalConfig", m_pRadioInternalConfig->isChecked());
settings().setValue("groupClientChecked", m_pGroupClient->isChecked());
settings().setValue("serverHostname", m_pLineEditHostname->text());
settings().sync();
}
void MainWindow::setIcon(qSynergyState state)
{
QIcon icon;
icon.addFile(synergyIconFiles[state]);
if (m_pTrayIcon)
m_pTrayIcon->setIcon(icon);
}
void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
{
if (reason == QSystemTrayIcon::DoubleClick)
{
if (isVisible())
{
hide();
}
else
{
showNormal();
activateWindow();
}
}
}
void MainWindow::logOutput()
{
if (m_pSynergy)
{
QString text(m_pSynergy->readAllStandardOutput());
foreach(QString line, text.split(QRegExp("\r|\n|\r\n")))
{
if (!line.isEmpty())
{
appendLog(line);
if (line.contains("has connected") ||
line.contains("connected to server"))
{
// only set connected state and hide, if we get
// "has connected" message. this is a little bit
// hacky, but it works for now (until we have IPC).
setSynergyState(synergyConnected);
// only hide once after each new connection.
if (!m_alreadyHidden && appConfig().autoHide())
{
hide();
m_alreadyHidden = true;
}
}
}
}
}
}
void MainWindow::logError()
{
if (m_pSynergy)
{
appendLog(m_pSynergy->readAllStandardError());
}
}
void MainWindow::updateFound(const QString &version)
{
m_pUpdateIcon->show();
m_pUpdateLabel->show();
m_pUpdateLabel->setText(
tr("<p>Version %1 is now available, <a href=\"%2\">visit website</a>.</p>")
.arg(version).arg("http://synergy-foss.org"));
}
void MainWindow::appendLog(const QString& text)
{
foreach(QString line, text.split(QRegExp("\r|\n|\r\n")))
if (!line.isEmpty())
m_pLogOutput->append(line);
}
void MainWindow::clearLog()
{
m_pLogOutput->clear();
}
void MainWindow::startSynergy()
{
// TODO: refactor this out into 2 methods.
bool desktopMode = appConfig().processMode() == Desktop;
bool serviceMode = appConfig().processMode() == Service;
if (desktopMode)
{
// cause the service to stop creating processes.
sendDaemonCommand("", false);
stopSynergy();
setSynergyState(synergyConnecting);
}
QString app;
QStringList args;
args << "-f" << "--no-tray" << "--debug" << appConfig().logLevelText();
if (!appConfig().screenName().isEmpty())
args << "--name" << appConfig().screenName();
if (appConfig().gameModeIndex() != 0)
{
if (appConfig().gameModeIndex() == 1)
{
args << "--game-mode" << "xinput";
}
else if (appConfig().gameModeIndex() == 2)
{
args << "--game-mode" << "joyinfoex";
}
if (appConfig().gamePollingDynamic())
{
args << "--game-poll" << "dynamic";
}
else
{
args << "--game-poll" << "static";
args << "--game-poll-freq" << QString::number(appConfig().gamePollingFrequency());
}
}
if (desktopMode)
{
setSynergyProcess(new QProcess(this));
}
if ((synergyType() == synergyClient && !clientArgs(args, app))
|| (synergyType() == synergyServer && !serverArgs(args, app)))
{
if (desktopMode)
{
stopSynergy();
return;
}
}
if (desktopMode)
{
connect(synergyProcess(), SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(synergyFinished(int, QProcess::ExitStatus)));
connect(synergyProcess(), SIGNAL(readyReadStandardOutput()), this, SLOT(logOutput()));
connect(synergyProcess(), SIGNAL(readyReadStandardError()), this, SLOT(logError()));
}
// put a space between last log output and new instance.
if (!m_pLogOutput->toPlainText().isEmpty())
appendLog("");
if (desktopMode)
{
appendLog("starting " + QString(synergyType() == synergyServer ? "server" : "client"));
}
if (serviceMode)
{
appendLog("applying service mode: " + QString(synergyType() == synergyServer ? "server" : "client"));
}
// show command if debug log level...
if (appConfig().logLevel() >= 4) {
appendLog(QString("command: %1 %2").arg(app, args.join(" ")));
}
appendLog("config file: " + configFilename());
appendLog("log level: " + appConfig().logLevelText());
if (appConfig().logToFile())
appendLog("log file: " + appConfig().logFilename());
if (desktopMode)
{
synergyProcess()->start(app, args);
if (!synergyProcess()->waitForStarted())
{
stopSynergy();
show();
QMessageBox::warning(this, tr("Program can not be started"), QString(tr("The executable<br><br>%1<br><br>could not be successfully started, although it does exist. Please check if you have sufficient permissions to run this program.").arg(app)));
return;
}
}
if (serviceMode)
{
QString command(app + " " + args.join(" "));
sendDaemonCommand(command, true);
}
}
bool MainWindow::clientArgs(QStringList& args, QString& app)
{
app = appPath(appConfig().synergycName());
if (!QFile::exists(app))
{
show();
QMessageBox::warning(this, tr("Synergy client not found"),
tr("The executable for the synergy client does not exist."));
return false;
}
if (m_pLineEditHostname->text().isEmpty())
{
show();
QMessageBox::warning(this, tr("Hostname is empty"),
tr("Please fill in a hostname for the synergy client to connect to."));
return false;
}
if (appConfig().logToFile())
{
appConfig().persistLogDir();
args << "--log" << appConfig().logFilename();
}
args << m_pLineEditHostname->text() + ":" + QString::number(appConfig().port());
return true;
}
QString MainWindow::configFilename()
{
QString filename;
if (m_pRadioInternalConfig->isChecked())
{
// TODO: no need to use a temporary file, since we need it to
// be permenant (since it'll be used for Windows services, etc).
m_pTempConfigFile = new QTemporaryFile();
if (!m_pTempConfigFile->open())
{
QMessageBox::critical(this, tr("Cannot write configuration file"), tr("The temporary configuration file required to start synergy can not be written."));
return false;
}
serverConfig().save(*m_pTempConfigFile);
filename = m_pTempConfigFile->fileName();
m_pTempConfigFile->close();
}
else
{
if (!QFile::exists(m_pLineEditConfigFile->text()))
{
if (QMessageBox::warning(this, tr("Configuration filename invalid"),
tr("You have not filled in a valid configuration file for the synergy server. "
"Do you want to browse for the configuration file now?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes
|| !on_m_pButtonBrowseConfigFile_clicked())
return false;
}
filename = m_pLineEditConfigFile->text();
}
return filename;
}
QString MainWindow::address()
{
return (!appConfig().interface().isEmpty() ? appConfig().interface() : "") + ":" + QString::number(appConfig().port());
}
QString MainWindow::appPath(const QString& name)
{
return appConfig().synergyProgramDir() + name;
}
bool MainWindow::serverArgs(QStringList& args, QString& app)
{
app = appPath(appConfig().synergysName());
if (!QFile::exists(app))
{
QMessageBox::warning(this, tr("Synergy server not found"),
tr("The executable for the synergy server does not exist."));
return false;
}
if (appConfig().logToFile())
{
appConfig().persistLogDir();
args << "--log" << appConfig().logFilename();
}
args << "-c" << configFilename() << "--address" << address();
return true;
}
void MainWindow::stopSynergy()
{
if (synergyProcess())
{
appendLog("stopping synergy");
if (synergyProcess()->isOpen())
synergyProcess()->close();
delete synergyProcess();
setSynergyProcess(NULL);
setSynergyState(synergyDisconnected);
}
// HACK: deleting the object deletes the physical file, which is
// bad, since it could be in use by the Windows service!
//delete m_pTempConfigFile;
m_pTempConfigFile = NULL;
// reset so that new connects cause auto-hide.
m_alreadyHidden = false;
}
void MainWindow::synergyFinished(int exitCode, QProcess::ExitStatus)
{
// on Windows, we always seem to have an exit code != 0.
#if !defined(Q_OS_WIN)
if (exitCode != 0)
{
QMessageBox::critical(this, tr("Synergy terminated with an error"), QString(tr("Synergy terminated unexpectedly with an exit code of %1.<br><br>Please see the log output for details.")).arg(exitCode));
stopSynergy();
}
#else
Q_UNUSED(exitCode);
#endif
setSynergyState(synergyDisconnected);
// do not call stopSynergy() in case of clean synergy shutdown, because this must have (well, should have...)
// come from our own delete synergyProcess() in stopSynergy(), so we would do a double-delete...
}
void MainWindow::setSynergyState(qSynergyState state)
{
// ignore state stuff when in service mode (for now anyway).
if (appConfig().processMode() == Service)
return;
if (synergyState() == state)
return;
if (state == synergyConnected || state == synergyConnecting)
{
disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger()));
m_pButtonToggleStart->setText(tr("&Stop"));
}
else
{
disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger()));
connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
m_pButtonToggleStart->setText(tr("&Start"));
}
m_pGroupClient->setEnabled(state == synergyDisconnected);
m_pGroupServer->setEnabled(state == synergyDisconnected);
m_pActionStartSynergy->setEnabled(state == synergyDisconnected);
m_pActionStopSynergy->setEnabled(state == synergyConnected);
switch (state)
{
case synergyConnected:
setStatus(tr("Synergy is running."));
break;
case synergyConnecting:
setStatus(tr("Synergy is starting."));
break;
case synergyDisconnected:
setStatus(tr("Synergy is not running."));
break;
}
setIcon(state);
m_SynergyState = state;
}
void MainWindow::setVisible(bool visible)
{
m_pActionMinimize->setEnabled(visible);
m_pActionRestore->setEnabled(!visible);
QMainWindow::setVisible(visible);
#if MAC_OS_X_VERSION_10_7
// dock hide only supported on lion :(
ProcessSerialNumber psn = { 0, kCurrentProcess };
GetCurrentProcess(&psn);
if (visible)
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
else
TransformProcessType(&psn, kProcessTransformToBackgroundApplication);
#endif
}
bool MainWindow::on_m_pButtonBrowseConfigFile_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter);
if (!fileName.isEmpty())
{
m_pLineEditConfigFile->setText(fileName);
return true;
}
return false;
}
bool MainWindow::on_m_pActionSave_triggered()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Save configuration as..."));
if (!fileName.isEmpty() && !serverConfig().save(fileName))
{
QMessageBox::warning(this, tr("Save failed"), tr("Could not save configuration to file."));
return true;
}
return false;
}
void MainWindow::on_m_pActionAbout_triggered()
{
AboutDialog dlg(this, appPath(appConfig().synergycName()));
dlg.exec();
}
void MainWindow::on_m_pActionSettings_triggered()
{
SettingsDialog dlg(this, appConfig());
dlg.exec();
}
void MainWindow::on_m_pButtonConfigureServer_clicked()
{
ServerConfigDialog dlg(this, serverConfig(), appConfig().screenName());
dlg.exec();
}
void MainWindow::sendDaemonCommand(const QString& command, bool showErrors)
{
sendIpcMessage(Command, command.toStdString().c_str(), showErrors);
}
// TODO: put this in an IPC client class.
void MainWindow::sendIpcMessage(qIpcMessage type, const char* data, bool showErrors)
{
#if defined(Q_OS_WIN)
const WCHAR* name = L"\\\\.\\pipe\\Synergy";
char message[1024];
message[0] = type;
char* messagePtr = message;
messagePtr++;
strcpy(messagePtr, data);
HANDLE pipe = CreateFile(
name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (showErrors && pipe == INVALID_HANDLE_VALUE)
{
appendLog(QString("ERROR: could not connect to service, error: ") +
QString::number(GetLastError()));
return;
}
DWORD dwMode = PIPE_READMODE_MESSAGE;
BOOL stateSuccess = SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
if (showErrors && !stateSuccess)
{
appendLog(QString("ERROR: could not set service pipe state, error: ") +
QString::number(GetLastError()));
return;
}
DWORD written;
BOOL writeSuccess = WriteFile(
pipe, message, strlen(message), &written, NULL);
if (showErrors && !writeSuccess)
{
appendLog(QString("ERROR: could not write to service pipe, error: ") +
QString::number(GetLastError()));
return;
}
CloseHandle(pipe);
#endif
}
void MainWindow::on_m_pActionWizard_triggered()
{
m_SetupWizard->show();
}

149
src/gui/src/MainWindow.h Normal file
View File

@@ -0,0 +1,149 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(MAINWINDOW__H)
#define MAINWINDOW__H
#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QSettings>
#include <QProcess>
#include <QThread>
#include "ui_MainWindowBase.h"
#include "ServerConfig.h"
#include "AppConfig.h"
#include "VersionChecker.h"
#include "IpcLogReader.h"
class QAction;
class QMenu;
class QLineEdit;
class QGroupBox;
class QPushButton;
class QTextEdit;
class QComboBox;
class QTabWidget;
class QCheckBox;
class QRadioButton;
class QTemporaryFile;
class LogDialog;
class QSynergyApplication;
class SetupWizard;
class MainWindow : public QMainWindow, public Ui::MainWindowBase
{
Q_OBJECT
friend class QSynergyApplication;
friend class SetupWizard;
public:
enum qSynergyState
{
synergyDisconnected,
synergyConnecting,
synergyConnected
};
enum qSynergyType
{
synergyClient,
synergyServer
};
enum qIpcMessage {
Command = 1
};
public:
MainWindow(QSettings& settings, AppConfig& appConfig);
~MainWindow();
public:
void setVisible(bool visible);
int synergyType() const { return m_pGroupClient->isChecked() ? synergyClient : synergyServer; }
int synergyState() const { return m_SynergyState; }
QString hostname() const { return m_pLineEditHostname->text(); }
QString configFilename();
QString address();
QString appPath(const QString& name);
void start(bool firstRun);
void clearLog();
public slots:
void appendLog(const QString& text);
protected slots:
void on_m_pGroupClient_toggled(bool on) { m_pGroupServer->setChecked(!on); }
void on_m_pGroupServer_toggled(bool on) { m_pGroupClient->setChecked(!on); }
bool on_m_pButtonBrowseConfigFile_clicked();
void on_m_pButtonConfigureServer_clicked();
bool on_m_pActionSave_triggered();
void on_m_pActionAbout_triggered();
void on_m_pActionSettings_triggered();
void on_m_pActionWizard_triggered();
void synergyFinished(int exitCode, QProcess::ExitStatus);
void iconActivated(QSystemTrayIcon::ActivationReason reason);
void startSynergy();
void stopSynergy();
void logOutput();
void logError();
void updateFound(const QString& version);
void refreshStartButton();
protected:
QSettings& settings() { return m_Settings; }
AppConfig& appConfig() { return m_AppConfig; }
QProcess*& synergyProcess() { return m_pSynergy; }
void setSynergyProcess(QProcess* p) { m_pSynergy = p; }
ServerConfig& serverConfig() { return m_ServerConfig; }
void initConnections();
void createMenuBar();
void createStatusBar();
void createTrayIcon();
void loadSettings();
void saveSettings();
void setIcon(qSynergyState state);
void setSynergyState(qSynergyState state);
bool checkForApp(int which, QString& app);
bool clientArgs(QStringList& args, QString& app);
bool serverArgs(QStringList& args, QString& app);
void setStatus(const QString& status);
void sendDaemonCommand(const QString& command, bool showErrors);
void sendIpcMessage(qIpcMessage type, const char* buffer, bool showErrors);
private:
QSettings& m_Settings;
AppConfig& m_AppConfig;
QProcess* m_pSynergy;
int m_SynergyState;
ServerConfig m_ServerConfig;
QTemporaryFile* m_pTempConfigFile;
QSystemTrayIcon* m_pTrayIcon;
QMenu* m_pTrayIconMenu;
bool m_alreadyHidden;
VersionChecker m_versionChecker;
SetupWizard* m_SetupWizard;
IpcLogReader m_IpcLogReader;
};
#endif

View File

@@ -0,0 +1,47 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "NewScreenWidget.h"
#include "ScreenSetupModel.h"
#include <QtCore>
#include <QtGui>
NewScreenWidget::NewScreenWidget(QWidget* parent) :
QLabel(parent)
{
}
void NewScreenWidget::mousePressEvent(QMouseEvent* event)
{
Screen newScreen(tr("Unnamed"));
QByteArray itemData;
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
dataStream << -1 << -1 << newScreen;
QMimeData* pMimeData = new QMimeData;
pMimeData->setData(ScreenSetupModel::mimeType(), itemData);
QDrag* pDrag = new QDrag(this);
pDrag->setMimeData(pMimeData);
pDrag->setPixmap(*pixmap());
pDrag->setHotSpot(event->pos());
pDrag->exec(Qt::CopyAction, Qt::CopyAction);
}

View File

@@ -0,0 +1,39 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(NEWSCREENWIDGET__H)
#define NEWSCREENWIDGET__H
#include <QLabel>
class QMouseEvent;
class QWidget;
class NewScreenWidget : public QLabel
{
Q_OBJECT
public:
NewScreenWidget(QWidget* parent);
protected:
void mousePressEvent(QMouseEvent* event);
};
#endif

View File

@@ -0,0 +1,38 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "QSynergyApplication.h"
#include "MainWindow.h"
#include <QtCore>
#include <QtGui>
QSynergyApplication::QSynergyApplication(int& argc, char** argv) :
QApplication(argc, argv)
{
}
void QSynergyApplication::commitData(QSessionManager&)
{
foreach(QWidget* widget, topLevelWidgets())
{
MainWindow* mainWindow = qobject_cast<MainWindow*>(widget);
if (mainWindow)
mainWindow->saveSettings();
}
}

View File

@@ -0,0 +1,36 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(QSYNERGYAPPLICATION__H)
#define QSYNERGYAPPLICATION__H
#include <QApplication>
class QSessionManager;
class QSynergyApplication : public QApplication
{
public:
QSynergyApplication(int& argc, char** argv);
public:
void commitData(QSessionManager& manager);
};
#endif

146
src/gui/src/Screen.cpp Normal file
View File

@@ -0,0 +1,146 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "Screen.h"
#include <QtCore>
#include <QtGui>
Screen::Screen() :
m_Pixmap(QPixmap(":res/icons/64x64/video-display.png")),
m_Swapped(false)
{
init();
}
Screen::Screen(const QString& name) :
m_Pixmap(QPixmap(":res/icons/64x64/video-display.png")),
m_Swapped(false)
{
init();
setName(name);
}
void Screen::init()
{
name().clear();
aliases().clear();
modifiers().clear();
switchCorners().clear();
fixes().clear();
setSwitchCornerSize(0);
// m_Modifiers, m_SwitchCorners and m_Fixes are QLists we use like fixed-size arrays,
// thus we need to make sure to fill them with the required number of elements.
for (int i = 0; i < NumModifiers; i++)
modifiers() << i;
for (int i = 0; i < NumSwitchCorners; i++)
switchCorners() << false;
for (int i = 0; i < NumFixes; i++)
fixes() << false;
}
void Screen::loadSettings(QSettings& settings)
{
setName(settings.value("name").toString());
if (name().isEmpty())
return;
setSwitchCornerSize(settings.value("switchCornerSize").toInt());
readSettings(settings, aliases(), "alias", QString(""));
readSettings(settings, modifiers(), "modifier", static_cast<int>(DefaultMod), NumModifiers);
readSettings(settings, switchCorners(), "switchCorner", false, NumSwitchCorners);
readSettings(settings, fixes(), "fix", false, NumFixes);
}
void Screen::saveSettings(QSettings& settings) const
{
settings.setValue("name", name());
if (name().isEmpty())
return;
settings.setValue("switchCornerSize", switchCornerSize());
writeSettings(settings, aliases(), "alias");
writeSettings(settings, modifiers(), "modifier");
writeSettings(settings, switchCorners(), "switchCorner");
writeSettings(settings, fixes(), "fix");
}
QTextStream& Screen::writeScreensSection(QTextStream& outStream) const
{
outStream << "\t" << name() << ":" << endl;
for (int i = 0; i < modifiers().size(); i++)
if (modifier(i) != i)
outStream << "\t\t" << modifierName(i) << " = " << modifierName(modifier(i)) << endl;
for (int i = 0; i < fixes().size(); i++)
outStream << "\t\t" << fixName(i) << " = " << (fixes()[i] ? "true" : "false") << endl;
outStream << "\t\t" << "switchCorners = none ";
for (int i = 0; i < switchCorners().size(); i++)
if (switchCorners()[i])
outStream << "+" << switchCornerName(i) << " ";
outStream << endl;
outStream << "\t\t" << "switchCornerSize = " << switchCornerSize() << endl;
return outStream;
}
QTextStream& Screen::writeAliasesSection(QTextStream& outStream) const
{
if (!aliases().isEmpty())
{
outStream << "\t" << name() << ":" << endl;
foreach (const QString& alias, aliases())
outStream << "\t\t" << alias << endl;
}
return outStream;
}
QDataStream& operator<<(QDataStream& outStream, const Screen& screen)
{
return outStream
<< screen.name()
<< screen.switchCornerSize()
<< screen.aliases()
<< screen.modifiers()
<< screen.switchCorners()
<< screen.fixes()
;
}
QDataStream& operator>>(QDataStream& inStream, Screen& screen)
{
return inStream
>> screen.m_Name
>> screen.m_SwitchCornerSize
>> screen.m_Aliases
>> screen.m_Modifiers
>> screen.m_SwitchCorners
>> screen.m_Fixes
;
}

104
src/gui/src/Screen.h Normal file
View File

@@ -0,0 +1,104 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(SCREEN__H)
#define SCREEN__H
#include <QPixmap>
#include <QString>
#include <QList>
#include <QStringList>
#include "BaseConfig.h"
class QSettings;
class QTextStream;
class ScreenSettingsDialog;
class Screen : public BaseConfig
{
friend QDataStream& operator<<(QDataStream& outStream, const Screen& screen);
friend QDataStream& operator>>(QDataStream& inStream, Screen& screen);
friend class ScreenSettingsDialog;
friend class ScreenSetupModel;
friend class ScreenSetupView;
public:
Screen();
Screen(const QString& name);
public:
const QPixmap* pixmap() const { return &m_Pixmap; }
const QString& name() const { return m_Name; }
const QStringList& aliases() const { return m_Aliases; }
bool isNull() const { return m_Name.isEmpty(); }
int modifier(int m) const { return m_Modifiers[m] == DefaultMod ? m : m_Modifiers[m]; }
const QList<int>& modifiers() const { return m_Modifiers; }
bool switchCorner(int c) const { return m_SwitchCorners[c]; }
const QList<bool>& switchCorners() const { return m_SwitchCorners; }
int switchCornerSize() const { return m_SwitchCornerSize; }
bool fix(Fix f) const { return m_Fixes[f]; }
const QList<bool>& fixes() const { return m_Fixes; }
void loadSettings(QSettings& settings);
void saveSettings(QSettings& settings) const;
QTextStream& writeScreensSection(QTextStream& outStream) const;
QTextStream& writeAliasesSection(QTextStream& outStream) const;
bool swapped() const { return m_Swapped; }
protected:
void init();
void setName(const QString& name) { m_Name = name; }
QPixmap* pixmap() { return &m_Pixmap; }
QString& name() { return m_Name; }
void setPixmap(const QPixmap& pixmap) { m_Pixmap = pixmap; }
QStringList& aliases() { return m_Aliases; }
void setModifier(int m, int n) { m_Modifiers[m] = n; }
QList<int>& modifiers() { return m_Modifiers; }
void addAlias(const QString& alias) { m_Aliases.append(alias); }
void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; }
QList<bool>& switchCorners() { return m_SwitchCorners; }
void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; }
void setFix(int f, bool on) { m_Fixes[f] = on; }
QList<bool>& fixes() { return m_Fixes; }
void setSwapped(bool on) { m_Swapped = on; }
private:
QPixmap m_Pixmap;
QString m_Name;
QStringList m_Aliases;
QList<int> m_Modifiers;
QList<bool> m_SwitchCorners;
int m_SwitchCornerSize;
QList<bool> m_Fixes;
bool m_Swapped;
};
typedef QList<Screen> ScreenList;
QDataStream& operator<<(QDataStream& outStream, const Screen& screen);
QDataStream& operator>>(QDataStream& inStream, Screen& screen);
#endif

View File

@@ -0,0 +1,121 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "ScreenSettingsDialog.h"
#include "Screen.h"
#include <QtCore>
#include <QtGui>
ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::ScreenSettingsDialogBase(),
m_pScreen(pScreen)
{
setupUi(this);
QRegExp validScreenName("[a-z_][a-z0-9\\._-]{,31}", Qt::CaseInsensitive);
m_pLineEditName->setText(m_pScreen->name());
m_pLineEditName->setValidator(new QRegExpValidator(validScreenName, m_pLineEditName));
m_pLineEditName->selectAll();
m_pLineEditAlias->setValidator(new QRegExpValidator(validScreenName, m_pLineEditName));
for (int i = 0; i < m_pScreen->aliases().count(); i++)
new QListWidgetItem(m_pScreen->aliases()[i], m_pListAliases);
m_pComboBoxShift->setCurrentIndex(m_pScreen->modifier(Screen::Shift));
m_pComboBoxCtrl->setCurrentIndex(m_pScreen->modifier(Screen::Ctrl));
m_pComboBoxAlt->setCurrentIndex(m_pScreen->modifier(Screen::Alt));
m_pComboBoxMeta->setCurrentIndex(m_pScreen->modifier(Screen::Meta));
m_pComboBoxSuper->setCurrentIndex(m_pScreen->modifier(Screen::Super));
m_pCheckBoxCornerTopLeft->setChecked(m_pScreen->switchCorner(Screen::TopLeft));
m_pCheckBoxCornerTopRight->setChecked(m_pScreen->switchCorner(Screen::TopRight));
m_pCheckBoxCornerBottomLeft->setChecked(m_pScreen->switchCorner(Screen::BottomLeft));
m_pCheckBoxCornerBottomRight->setChecked(m_pScreen->switchCorner(Screen::BottomRight));
m_pSpinBoxSwitchCornerSize->setValue(m_pScreen->switchCornerSize());
m_pCheckBoxCapsLock->setChecked(m_pScreen->fix(Screen::CapsLock));
m_pCheckBoxNumLock->setChecked(m_pScreen->fix(Screen::NumLock));
m_pCheckBoxScrollLock->setChecked(m_pScreen->fix(Screen::ScrollLock));
m_pCheckBoxXTest->setChecked(m_pScreen->fix(Screen::XTest));
}
void ScreenSettingsDialog::accept()
{
if (m_pLineEditName->text().isEmpty())
{
QMessageBox::warning(this, tr("Screen name is empty"), tr("The name for a screen can not be empty. Please fill in a name or cancel the dialog."));
return;
}
m_pScreen->init();
m_pScreen->setName(m_pLineEditName->text());
for (int i = 0; i < m_pListAliases->count(); i++)
m_pScreen->addAlias(m_pListAliases->item(i)->text());
m_pScreen->setModifier(Screen::Shift, m_pComboBoxShift->currentIndex());
m_pScreen->setModifier(Screen::Ctrl, m_pComboBoxCtrl->currentIndex());
m_pScreen->setModifier(Screen::Alt, m_pComboBoxAlt->currentIndex());
m_pScreen->setModifier(Screen::Meta, m_pComboBoxMeta->currentIndex());
m_pScreen->setModifier(Screen::Super, m_pComboBoxSuper->currentIndex());
m_pScreen->setSwitchCorner(Screen::TopLeft, m_pCheckBoxCornerTopLeft->isChecked());
m_pScreen->setSwitchCorner(Screen::TopRight, m_pCheckBoxCornerTopRight->isChecked());
m_pScreen->setSwitchCorner(Screen::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked());
m_pScreen->setSwitchCorner(Screen::BottomRight, m_pCheckBoxCornerBottomRight->isChecked());
m_pScreen->setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value());
m_pScreen->setFix(Screen::CapsLock, m_pCheckBoxCapsLock->isChecked());
m_pScreen->setFix(Screen::NumLock, m_pCheckBoxNumLock->isChecked());
m_pScreen->setFix(Screen::ScrollLock, m_pCheckBoxScrollLock->isChecked());
m_pScreen->setFix(Screen::XTest, m_pCheckBoxXTest->isChecked());
QDialog::accept();
}
void ScreenSettingsDialog::on_m_pButtonAddAlias_clicked()
{
if (!m_pLineEditAlias->text().isEmpty() && m_pListAliases->findItems(m_pLineEditAlias->text(), Qt::MatchFixedString).isEmpty())
{
new QListWidgetItem(m_pLineEditAlias->text(), m_pListAliases);
m_pLineEditAlias->clear();
}
}
void ScreenSettingsDialog::on_m_pLineEditAlias_textChanged(const QString& text)
{
m_pButtonAddAlias->setEnabled(!text.isEmpty());
}
void ScreenSettingsDialog::on_m_pButtonRemoveAlias_clicked()
{
QList<QListWidgetItem*> items = m_pListAliases->selectedItems();
for (int i = 0; i < items.count(); i++)
delete items[i];
}
void ScreenSettingsDialog::on_m_pListAliases_itemSelectionChanged()
{
m_pButtonRemoveAlias->setEnabled(!m_pListAliases->selectedItems().isEmpty());
}

View File

@@ -0,0 +1,52 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(SCREENSETTINGSDIALOG__H)
#define SCREENSETTINGSDIALOG__H
#include <QDialog>
#include "ui_ScreenSettingsDialogBase.h"
class QWidget;
class QString;
class Screen;
class ScreenSettingsDialog : public QDialog, public Ui::ScreenSettingsDialogBase
{
Q_OBJECT
public:
ScreenSettingsDialog(QWidget* parent, Screen* pScreen = NULL);
public slots:
void accept();
private slots:
void on_m_pButtonAddAlias_clicked();
void on_m_pButtonRemoveAlias_clicked();
void on_m_pLineEditAlias_textChanged(const QString& text);
void on_m_pListAliases_itemSelectionChanged();
private:
Screen* m_pScreen;
};
#endif

View File

@@ -0,0 +1,142 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "ScreenSetupModel.h"
#include "Screen.h"
#include <QtCore>
#include <QtGui>
const QString ScreenSetupModel::m_MimeType = "application/x-qsynergy-screen";
ScreenSetupModel::ScreenSetupModel(ScreenList& screens, int numColumns, int numRows) :
QAbstractTableModel(NULL),
m_Screens(screens),
m_NumColumns(numColumns),
m_NumRows(numRows)
{
if (m_NumColumns * m_NumRows > screens.size())
qFatal("Not enough elements (%u) in screens QList for %d columns and %d rows", screens.size(), m_NumColumns, m_NumRows);
}
QVariant ScreenSetupModel::data(const QModelIndex& index, int role) const
{
if (index.isValid() && index.row() < m_NumRows && index.column() < m_NumColumns)
{
switch(role)
{
case Qt::DecorationRole:
if (screen(index).isNull())
break;
return QIcon(*screen(index).pixmap());
case Qt::ToolTipRole:
if (screen(index).isNull())
break;
return QString(tr(
"<center>Screen: <b>%1</b></center>"
"<br>Double click to edit settings"
"<br>Drag screen to the trashcan to remove it")).arg(screen(index).name());
case Qt::DisplayRole:
if (screen(index).isNull())
break;
return screen(index).name();
}
}
return QVariant();
}
Qt::ItemFlags ScreenSetupModel::flags(const QModelIndex& index) const
{
if (!index.isValid() || index.row() >= m_NumRows || index.column() >= m_NumColumns)
return 0;
if (!screen(index).isNull())
return Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled;
return Qt::ItemIsDropEnabled;
}
Qt::DropActions ScreenSetupModel::supportedDropActions() const
{
return Qt::MoveAction | Qt::CopyAction;
}
QStringList ScreenSetupModel::mimeTypes() const
{
return QStringList() << m_MimeType;
}
QMimeData* ScreenSetupModel::mimeData(const QModelIndexList& indexes) const
{
QMimeData* pMimeData = new QMimeData();
QByteArray encodedData;
QDataStream stream(&encodedData, QIODevice::WriteOnly);
foreach (const QModelIndex& index, indexes)
if (index.isValid())
stream << index.column() << index.row() << screen(index);
pMimeData->setData(m_MimeType, encodedData);
return pMimeData;
}
bool ScreenSetupModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent)
{
if (action == Qt::IgnoreAction)
return true;
if (!data->hasFormat(m_MimeType))
return false;
if (!parent.isValid() || row != -1 || column != -1)
return false;
QByteArray encodedData = data->data(m_MimeType);
QDataStream stream(&encodedData, QIODevice::ReadOnly);
int sourceColumn = -1;
int sourceRow = -1;
stream >> sourceColumn;
stream >> sourceRow;
// don't drop screen onto itself
if (sourceColumn == parent.column() && sourceRow == parent.row())
return false;
Screen droppedScreen;
stream >> droppedScreen;
Screen oldScreen = screen(parent.column(), parent.row());
if (!oldScreen.isNull() && sourceColumn != -1 && sourceRow != -1)
{
// mark the screen so it isn't deleted after the dragndrop succeeded
// see ScreenSetupView::startDrag()
oldScreen.setSwapped(true);
screen(sourceColumn, sourceRow) = oldScreen;
}
screen(parent.column(), parent.row()) = droppedScreen;
return true;
}

View File

@@ -0,0 +1,70 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(SCREENSETUPMODEL__H)
#define SCREENSETUPMODEL__H
#include <QAbstractTableModel>
#include <QList>
#include <QString>
#include <QStringList>
#include "Screen.h"
class ScreenSetupView;
class ServerConfigDialog;
class ScreenSetupModel : public QAbstractTableModel
{
Q_OBJECT
friend class ScreenSetupView;
friend class ServerConfigDialog;
public:
ScreenSetupModel(ScreenList& screens, int numColumns, int numRows);
public:
static const QString& mimeType() { return m_MimeType; }
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
int rowCount() const { return m_NumRows; }
int columnCount() const { return m_NumColumns; }
int rowCount(const QModelIndex&) const { return rowCount(); }
int columnCount(const QModelIndex&) const { return columnCount(); }
Qt::DropActions supportedDropActions() const;
Qt::ItemFlags flags(const QModelIndex& index) const;
QStringList mimeTypes() const;
QMimeData* mimeData(const QModelIndexList& indexes) const;
protected:
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
const Screen& screen(const QModelIndex& index) const { return screen(index.column(), index.row()); }
Screen& screen(const QModelIndex& index) { return screen(index.column(), index.row()); }
const Screen& screen(int column, int row) const { return m_Screens[row * m_NumColumns + column]; }
Screen& screen(int column, int row) { return m_Screens[row * m_NumColumns + column]; }
private:
ScreenList& m_Screens;
const int m_NumColumns;
const int m_NumRows;
static const QString m_MimeType;
};
#endif

View File

@@ -0,0 +1,160 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "ScreenSetupView.h"
#include "ScreenSetupModel.h"
#include "ScreenSettingsDialog.h"
#include <QtCore>
#include <QtGui>
ScreenSetupView::ScreenSetupView(QWidget* parent) :
QTableView(parent)
{
setDropIndicatorShown(true);
setDragDropMode(DragDrop);
setSelectionMode(SingleSelection);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setIconSize(QSize(64, 64));
horizontalHeader()->hide();
verticalHeader()->hide();
}
void ScreenSetupView::setModel(ScreenSetupModel* model)
{
QTableView::setModel(model);
setTableSize();
}
ScreenSetupModel* ScreenSetupView::model() const
{
return qobject_cast<ScreenSetupModel*>(QTableView::model());
}
void ScreenSetupView::setTableSize()
{
for (int i = 0; i < model()->columnCount(); i++)
setColumnWidth(i, width() / model()->columnCount());
for (int i = 0; i < model()->rowCount(); i++)
setRowHeight(i, height() / model()->rowCount());
}
void ScreenSetupView::resizeEvent(QResizeEvent* event)
{
setTableSize();
event->ignore();
}
void ScreenSetupView::mouseDoubleClickEvent(QMouseEvent* event)
{
if (event->buttons() & Qt::LeftButton)
{
int col = columnAt(event->pos().x());
int row = rowAt(event->pos().y());
if (!model()->screen(col, row).isNull())
{
ScreenSettingsDialog dlg(this, &model()->screen(col, row));
dlg.exec();
}
}
else
event->ignore();
}
void ScreenSetupView::dragEnterEvent(QDragEnterEvent* event)
{
// we accept anything that enters us by a drag as long as the
// mime type is okay. anything else is dealt with in dragMoveEvent()
if (event->mimeData()->hasFormat(ScreenSetupModel::mimeType()))
event->accept();
else
event->ignore();
}
void ScreenSetupView::dragMoveEvent(QDragMoveEvent* event)
{
if (event->mimeData()->hasFormat(ScreenSetupModel::mimeType()))
{
// where does the event come from? myself or someone else?
if (event->source() == this)
{
// myself is ok, but then it must be a move action, never a copy
event->setDropAction(Qt::MoveAction);
event->accept();
}
else
{
int col = columnAt(event->pos().x());
int row = rowAt(event->pos().y());
// a drop from outside is not allowed if there's a screen already there.
if (!model()->screen(col, row).isNull())
event->ignore();
else
event->acceptProposedAction();
}
}
else
event->ignore();
}
// this is reimplemented from QAbstractItemView::startDrag()
void ScreenSetupView::startDrag(Qt::DropActions)
{
QModelIndexList indexes = selectedIndexes();
if (indexes.count() != 1)
return;
QMimeData* pData = model()->mimeData(indexes);
if (pData == NULL)
return;
QPixmap pixmap = *model()->screen(indexes[0]).pixmap();
QDrag* pDrag = new QDrag(this);
pDrag->setPixmap(pixmap);
pDrag->setMimeData(pData);
pDrag->setHotSpot(QPoint(pixmap.width() / 2, pixmap.height() / 2));
if (pDrag->exec(Qt::MoveAction, Qt::MoveAction) == Qt::MoveAction)
{
selectionModel()->clear();
// make sure to only delete the drag source if screens weren't swapped
// see ScreenSetupModel::dropMimeData
if (!model()->screen(indexes[0]).swapped())
model()->screen(indexes[0]) = Screen();
else
model()->screen(indexes[0]).setSwapped(false);
}
}
QStyleOptionViewItem ScreenSetupView::viewOptions() const
{
QStyleOptionViewItem option = QTableView::viewOptions();
option.showDecorationSelected = true;
option.decorationPosition = QStyleOptionViewItem::Top;
option.displayAlignment = Qt::AlignCenter;
option.textElideMode = Qt::ElideMiddle;
return option;
}

View File

@@ -0,0 +1,56 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(SCREENSETUPVIEW__H)
#define SCREENSETUPVIEW__H
#include <QTableView>
#include <QFlags>
#include "Screen.h"
class QWidget;
class QMouseEvent;
class QResizeEvent;
class QDragEnterEvent;
class ScreenSetupModel;
class ScreenSetupView : public QTableView
{
Q_OBJECT
public:
ScreenSetupView(QWidget* parent);
public:
void setModel(ScreenSetupModel* model);
ScreenSetupModel* model() const;
protected:
void mouseDoubleClickEvent(QMouseEvent*);
void setTableSize();
void resizeEvent(QResizeEvent*);
void dragEnterEvent(QDragEnterEvent* event);
void dragMoveEvent(QDragMoveEvent* event);
void startDrag(Qt::DropActions supportedActions);
QStyleOptionViewItem viewOptions() const;
void scrollTo(const QModelIndex&, ScrollHint) {}
};
#endif

View File

@@ -0,0 +1,264 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "ServerConfig.h"
#include "Hotkey.h"
#include <QtCore>
static const struct
{
int x;
int y;
const char* name;
} neighbourDirs[] =
{
{ 0, -1, "up" },
{ 1, 0, "right" },
{ 0, 1, "down" },
{ -1, 0, "left" },
};
ServerConfig::ServerConfig(QSettings* settings, int numColumns, int numRows) :
m_pSettings(settings),
m_Screens(),
m_NumColumns(numColumns),
m_NumRows(numRows)
{
Q_ASSERT(m_pSettings);
loadSettings();
}
ServerConfig::~ServerConfig()
{
saveSettings();
}
bool ServerConfig::save(const QString& fileName) const
{
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
return false;
save(file);
file.close();
return true;
}
void ServerConfig::save(QFile& file) const
{
QTextStream outStream(&file);
outStream << *this;
}
void ServerConfig::init()
{
switchCorners().clear();
screens().clear();
// m_NumSwitchCorners is used as a fixed size array. See Screen::init()
for (int i = 0; i < NumSwitchCorners; i++)
switchCorners() << false;
// There must always be screen objects for each cell in the screens QList. Unused screens
// are identified by having an empty name.
for (int i = 0; i < numColumns() * numRows(); i++)
addScreen(Screen());
}
void ServerConfig::saveSettings()
{
settings().beginGroup("internalConfig");
settings().remove("");
settings().setValue("numColumns", numColumns());
settings().setValue("numRows", numRows());
settings().setValue("hasHeartbeat", hasHeartbeat());
settings().setValue("heartbeat", heartbeat());
settings().setValue("relativeMouseMoves", relativeMouseMoves());
settings().setValue("screenSaverSync", screenSaverSync());
settings().setValue("win32KeepForeground", win32KeepForeground());
settings().setValue("hasSwitchDelay", hasSwitchDelay());
settings().setValue("switchDelay", switchDelay());
settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap());
settings().setValue("switchDoubleTap", switchDoubleTap());
settings().setValue("switchCornerSize", switchCornerSize());
writeSettings(settings(), switchCorners(), "switchCorner");
settings().beginWriteArray("screens");
for (int i = 0; i < screens().size(); i++)
{
settings().setArrayIndex(i);
screens()[i].saveSettings(settings());
}
settings().endArray();
settings().beginWriteArray("hotkeys");
for (int i = 0; i < hotkeys().size(); i++)
{
settings().setArrayIndex(i);
hotkeys()[i].saveSettings(settings());
}
settings().endArray();
settings().endGroup();
}
void ServerConfig::loadSettings()
{
settings().beginGroup("internalConfig");
setNumColumns(settings().value("numColumns", 5).toInt());
setNumRows(settings().value("numRows", 3).toInt());
// we need to know the number of columns and rows before we can set up ourselves
init();
haveHeartbeat(settings().value("hasHeartbeat", false).toBool());
setHeartbeat(settings().value("heartbeat", 5000).toInt());
setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool());
setScreenSaverSync(settings().value("screenSaverSync", true).toBool());
setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool());
haveSwitchDelay(settings().value("hasSwitchDelay", false).toBool());
setSwitchDelay(settings().value("switchDelay", 250).toInt());
haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool());
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
setSwitchCornerSize(settings().value("switchCornerSize").toInt());
readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners);
int numScreens = settings().beginReadArray("screens");
Q_ASSERT(numScreens <= screens().size());
for (int i = 0; i < numScreens; i++)
{
settings().setArrayIndex(i);
screens()[i].loadSettings(settings());
}
settings().endArray();
int numHotkeys = settings().beginReadArray("hotkeys");
for (int i = 0; i < numHotkeys; i++)
{
settings().setArrayIndex(i);
Hotkey h;
h.loadSettings(settings());
hotkeys().append(h);
}
settings().endArray();
settings().endGroup();
}
int ServerConfig::adjacentScreenIndex(int idx, int deltaColumn, int deltaRow) const
{
if (screens()[idx].isNull())
return -1;
// if we're at the left or right end of the table, don't find results going further left or right
if ((deltaColumn > 0 && (idx+1) % numColumns() == 0)
|| (deltaColumn < 0 && idx % numColumns() == 0))
return -1;
int arrayPos = idx + deltaColumn + deltaRow * numColumns();
if (arrayPos >= screens().size() || arrayPos < 0)
return -1;
return arrayPos;
}
QTextStream& operator<<(QTextStream& outStream, const ServerConfig& config)
{
outStream << "section: screens" << endl;
foreach (const Screen& s, config.screens())
if (!s.isNull())
s.writeScreensSection(outStream);
outStream << "end" << endl << endl;
outStream << "section: aliases" << endl;
foreach (const Screen& s, config.screens())
if (!s.isNull())
s.writeAliasesSection(outStream);
outStream << "end" << endl << endl;
outStream << "section: links" << endl;
for (int i = 0; i < config.screens().size(); i++)
if (!config.screens()[i].isNull())
{
outStream << "\t" << config.screens()[i].name() << ":" << endl;
for (unsigned int j = 0; j < sizeof(neighbourDirs) / sizeof(neighbourDirs[0]); j++)
{
int idx = config.adjacentScreenIndex(i, neighbourDirs[j].x, neighbourDirs[j].y);
if (idx != -1 && !config.screens()[idx].isNull())
outStream << "\t\t" << neighbourDirs[j].name << " = " << config.screens()[idx].name() << endl;
}
}
outStream << "end" << endl << endl;
outStream << "section: options" << endl;
if (config.hasHeartbeat())
outStream << "\t" << "heartbeat = " << config.heartbeat() << endl;
outStream << "\t" << "relativeMouseMoves = " << (config.relativeMouseMoves() ? "true" : "false") << endl;
outStream << "\t" << "screenSaverSync = " << (config.screenSaverSync() ? "true" : "false") << endl;
outStream << "\t" << "win32KeepForeground = " << (config.win32KeepForeground() ? "true" : "false") << endl;
if (config.hasSwitchDelay())
outStream << "\t" << "switchDelay = " << config.switchDelay() << endl;
if (config.hasSwitchDoubleTap())
outStream << "\t" << "switchDoubleTap = " << config.switchDoubleTap() << endl;
outStream << "\t" << "switchCorners = none ";
for (int i = 0; i < config.switchCorners().size(); i++)
if (config.switchCorners()[i])
outStream << "+" << config.switchCornerName(i) << " ";
outStream << endl;
outStream << "\t" << "switchCornerSize = " << config.switchCornerSize() << endl;
foreach(const Hotkey& hotkey, config.hotkeys())
outStream << hotkey;
outStream << "end" << endl << endl;
return outStream;
}
int ServerConfig::numScreens() const
{
int rval = 0;
foreach(const Screen& s, screens())
if (!s.isNull())
rval++;
return rval;
}

113
src/gui/src/ServerConfig.h Normal file
View File

@@ -0,0 +1,113 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(SERVERCONFIG__H)
#define SERVERCONFIG__H
#include <QList>
#include "Screen.h"
#include "BaseConfig.h"
#include "Hotkey.h"
class QTextStream;
class QSettings;
class QString;
class QFile;
class ServerConfigDialog;
class ServerConfig : public BaseConfig
{
friend class ServerConfigDialog;
friend QTextStream& operator<<(QTextStream& outStream, const ServerConfig& config);
public:
ServerConfig(QSettings* settings, int numColumns, int numRows);
~ServerConfig();
public:
const ScreenList& screens() const { return m_Screens; }
int numColumns() const { return m_NumColumns; }
int numRows() const { return m_NumRows; }
bool hasHeartbeat() const { return m_HasHeartbeat; }
int heartbeat() const { return m_Heartbeat; }
bool relativeMouseMoves() const { return m_RelativeMouseMoves; }
bool screenSaverSync() const { return m_ScreenSaverSync; }
bool win32KeepForeground() const { return m_Win32KeepForeground; }
bool hasSwitchDelay() const { return m_HasSwitchDelay; }
int switchDelay() const { return m_SwitchDelay; }
bool hasSwitchDoubleTap() const { return m_HasSwitchDoubleTap; }
int switchDoubleTap() const { return m_SwitchDoubleTap; }
bool switchCorner(int c) const { return m_SwitchCorners[c]; }
int switchCornerSize() const { return m_SwitchCornerSize; }
const QList<bool>& switchCorners() const { return m_SwitchCorners; }
const HotkeyList& hotkeys() const { return m_Hotkeys; }
void saveSettings();
void loadSettings();
bool save(const QString& fileName) const;
void save(QFile& file) const;
int numScreens() const;
protected:
QSettings& settings() { return *m_pSettings; }
ScreenList& screens() { return m_Screens; }
void setScreens(const ScreenList& screens) { m_Screens = screens; }
void addScreen(const Screen& screen) { m_Screens.append(screen); }
void setNumColumns(int n) { m_NumColumns = n; }
void setNumRows(int n) { m_NumRows = n; }
void haveHeartbeat(bool on) { m_HasHeartbeat = on; }
void setHeartbeat(int val) { m_Heartbeat = val; }
void setRelativeMouseMoves(bool on) { m_RelativeMouseMoves = on; }
void setScreenSaverSync(bool on) { m_ScreenSaverSync = on; }
void setWin32KeepForeground(bool on) { m_Win32KeepForeground = on; }
void haveSwitchDelay(bool on) { m_HasSwitchDelay = on; }
void setSwitchDelay(int val) { m_SwitchDelay = val; }
void haveSwitchDoubleTap(bool on) { m_HasSwitchDoubleTap = on; }
void setSwitchDoubleTap(int val) { m_SwitchDoubleTap = val; }
void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; }
void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; }
QList<bool>& switchCorners() { return m_SwitchCorners; }
HotkeyList& hotkeys() { return m_Hotkeys; }
void init();
int adjacentScreenIndex(int idx, int deltaColumn, int deltaRow) const;
private:
QSettings* m_pSettings;
ScreenList m_Screens;
int m_NumColumns;
int m_NumRows;
bool m_HasHeartbeat;
int m_Heartbeat;
bool m_RelativeMouseMoves;
bool m_ScreenSaverSync;
bool m_Win32KeepForeground;
bool m_HasSwitchDelay;
int m_SwitchDelay;
bool m_HasSwitchDoubleTap;
int m_SwitchDoubleTap;
int m_SwitchCornerSize;
QList<bool> m_SwitchCorners;
HotkeyList m_Hotkeys;
};
QTextStream& operator<<(QTextStream& outStream, const ServerConfig& config);
#endif

View File

@@ -0,0 +1,196 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "ServerConfigDialog.h"
#include "ServerConfig.h"
#include "HotkeyDialog.h"
#include "ActionDialog.h"
#include <QtCore>
#include <QtGui>
ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config, const QString& defaultScreenName) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::ServerConfigDialogBase(),
m_OrigServerConfig(config),
m_ServerConfig(config),
m_ScreenSetupModel(serverConfig().screens(), serverConfig().numColumns(), serverConfig().numRows())
{
setupUi(this);
m_pCheckBoxHeartbeat->setChecked(serverConfig().hasHeartbeat());
m_pSpinBoxHeartbeat->setValue(serverConfig().heartbeat());
m_pCheckBoxRelativeMouseMoves->setChecked(serverConfig().relativeMouseMoves());
m_pCheckBoxScreenSaverSync->setChecked(serverConfig().screenSaverSync());
m_pCheckBoxWin32KeepForeground->setChecked(serverConfig().win32KeepForeground());
m_pCheckBoxSwitchDelay->setChecked(serverConfig().hasSwitchDelay());
m_pSpinBoxSwitchDelay->setValue(serverConfig().switchDelay());
m_pCheckBoxSwitchDoubleTap->setChecked(serverConfig().hasSwitchDoubleTap());
m_pSpinBoxSwitchDoubleTap->setValue(serverConfig().switchDoubleTap());
m_pCheckBoxCornerTopLeft->setChecked(serverConfig().switchCorner(BaseConfig::TopLeft));
m_pCheckBoxCornerTopRight->setChecked(serverConfig().switchCorner(BaseConfig::TopRight));
m_pCheckBoxCornerBottomLeft->setChecked(serverConfig().switchCorner(BaseConfig::BottomLeft));
m_pCheckBoxCornerBottomRight->setChecked(serverConfig().switchCorner(BaseConfig::BottomRight));
m_pSpinBoxSwitchCornerSize->setValue(serverConfig().switchCornerSize());
foreach(const Hotkey& hotkey, serverConfig().hotkeys())
m_pListHotkeys->addItem(hotkey.text());
m_pScreenSetupView->setModel(&m_ScreenSetupModel);
if (serverConfig().numScreens() == 0)
model().screen(serverConfig().numColumns() / 2, serverConfig().numRows() / 2) = Screen(defaultScreenName);
}
void ServerConfigDialog::accept()
{
serverConfig().haveHeartbeat(m_pCheckBoxHeartbeat->isChecked());
serverConfig().setHeartbeat(m_pSpinBoxHeartbeat->value());
serverConfig().setRelativeMouseMoves(m_pCheckBoxRelativeMouseMoves->isChecked());
serverConfig().setScreenSaverSync(m_pCheckBoxScreenSaverSync->isChecked());
serverConfig().setWin32KeepForeground(m_pCheckBoxWin32KeepForeground->isChecked());
serverConfig().haveSwitchDelay(m_pCheckBoxSwitchDelay->isChecked());
serverConfig().setSwitchDelay(m_pSpinBoxSwitchDelay->value());
serverConfig().haveSwitchDoubleTap(m_pCheckBoxSwitchDoubleTap->isChecked());
serverConfig().setSwitchDoubleTap(m_pSpinBoxSwitchDoubleTap->value());
serverConfig().setSwitchCorner(BaseConfig::TopLeft, m_pCheckBoxCornerTopLeft->isChecked());
serverConfig().setSwitchCorner(BaseConfig::TopRight, m_pCheckBoxCornerTopRight->isChecked());
serverConfig().setSwitchCorner(BaseConfig::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked());
serverConfig().setSwitchCorner(BaseConfig::BottomRight, m_pCheckBoxCornerBottomRight->isChecked());
serverConfig().setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value());
// now that the dialog has been accepted, copy the new server config to the original one,
// which is a reference to the one in MainWindow.
setOrigServerConfig(serverConfig());
QDialog::accept();
}
void ServerConfigDialog::on_m_pButtonNewHotkey_clicked()
{
Hotkey hotkey;
HotkeyDialog dlg(this, hotkey);
if (dlg.exec() == QDialog::Accepted)
{
serverConfig().hotkeys().append(hotkey);
m_pListHotkeys->addItem(hotkey.text());
}
}
void ServerConfigDialog::on_m_pButtonEditHotkey_clicked()
{
int idx = m_pListHotkeys->currentRow();
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
Hotkey& hotkey = serverConfig().hotkeys()[idx];
HotkeyDialog dlg(this, hotkey);
if (dlg.exec() == QDialog::Accepted)
m_pListHotkeys->currentItem()->setText(hotkey.text());
}
void ServerConfigDialog::on_m_pButtonRemoveHotkey_clicked()
{
int idx = m_pListHotkeys->currentRow();
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
serverConfig().hotkeys().removeAt(idx);
m_pListActions->clear();
delete m_pListHotkeys->item(idx);
}
void ServerConfigDialog::on_m_pListHotkeys_itemSelectionChanged()
{
bool itemsSelected = !m_pListHotkeys->selectedItems().isEmpty();
m_pButtonEditHotkey->setEnabled(itemsSelected);
m_pButtonRemoveHotkey->setEnabled(itemsSelected);
m_pButtonNewAction->setEnabled(itemsSelected);
if (itemsSelected && serverConfig().hotkeys().size() > 0)
{
m_pListActions->clear();
int idx = m_pListHotkeys->row(m_pListHotkeys->selectedItems()[0]);
// There's a bug somewhere around here: We get idx == 1 right after we deleted the next to last item, so idx can
// only possibly be 0. GDB shows we got called indirectly from the delete line in
// on_m_pButtonRemoveHotkey_clicked() above, but the delete is of course necessary and seems correct.
// The while() is a generalized workaround for all that and shouldn't be required.
while (idx >= 0 && idx >= serverConfig().hotkeys().size())
idx--;
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
const Hotkey& hotkey = serverConfig().hotkeys()[idx];
foreach(const Action& action, hotkey.actions())
m_pListActions->addItem(action.text());
}
}
void ServerConfigDialog::on_m_pButtonNewAction_clicked()
{
int idx = m_pListHotkeys->currentRow();
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
Hotkey& hotkey = serverConfig().hotkeys()[idx];
Action action;
ActionDialog dlg(this, serverConfig(), hotkey, action);
if (dlg.exec() == QDialog::Accepted)
{
hotkey.actions().append(action);
m_pListActions->addItem(action.text());
}
}
void ServerConfigDialog::on_m_pButtonEditAction_clicked()
{
int idxHotkey = m_pListHotkeys->currentRow();
Q_ASSERT(idxHotkey >= 0 && idxHotkey < serverConfig().hotkeys().size());
Hotkey& hotkey = serverConfig().hotkeys()[idxHotkey];
int idxAction = m_pListActions->currentRow();
Q_ASSERT(idxAction >= 0 && idxAction < hotkey.actions().size());
Action& action = hotkey.actions()[idxAction];
ActionDialog dlg(this, serverConfig(), hotkey, action);
if (dlg.exec() == QDialog::Accepted)
m_pListActions->currentItem()->setText(action.text());
}
void ServerConfigDialog::on_m_pButtonRemoveAction_clicked()
{
int idxHotkey = m_pListHotkeys->currentRow();
Q_ASSERT(idxHotkey >= 0 && idxHotkey < serverConfig().hotkeys().size());
Hotkey& hotkey = serverConfig().hotkeys()[idxHotkey];
int idxAction = m_pListActions->currentRow();
Q_ASSERT(idxAction >= 0 && idxAction < hotkey.actions().size());
hotkey.actions().removeAt(idxAction);
delete m_pListActions->currentItem();
}
void ServerConfigDialog::on_m_pListActions_itemSelectionChanged()
{
m_pButtonEditAction->setEnabled(!m_pListActions->selectedItems().isEmpty());
m_pButtonRemoveAction->setEnabled(!m_pListActions->selectedItems().isEmpty());
}

View File

@@ -0,0 +1,62 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(SERVERCONFIGDIALOG__H)
#define SERVERCONFIGDIALOG__H
#include "ScreenSetupModel.h"
#include "ServerConfig.h"
#include "ui_ServerConfigDialogBase.h"
#include <QDialog>
class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase
{
Q_OBJECT
public:
ServerConfigDialog(QWidget* parent, ServerConfig& config, const QString& defaultScreenName);
public slots:
void accept();
protected slots:
void on_m_pButtonNewHotkey_clicked();
void on_m_pListHotkeys_itemSelectionChanged();
void on_m_pButtonEditHotkey_clicked();
void on_m_pButtonRemoveHotkey_clicked();
void on_m_pButtonNewAction_clicked();
void on_m_pListActions_itemSelectionChanged();
void on_m_pButtonEditAction_clicked();
void on_m_pButtonRemoveAction_clicked();
protected:
ServerConfig& serverConfig() { return m_ServerConfig; }
void setOrigServerConfig(const ServerConfig& s) { m_OrigServerConfig = s; }
ScreenSetupModel& model() { return m_ScreenSetupModel; }
private:
ServerConfig& m_OrigServerConfig;
ServerConfig m_ServerConfig;
ScreenSetupModel m_ScreenSetupModel;
};
#endif

View File

@@ -0,0 +1,89 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "SettingsDialog.h"
#include <QtCore>
#include <QtGui>
#include "AppConfig.h"
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::SettingsDialogBase(),
m_AppConfig(config)
{
setupUi(this);
m_pCheckBoxAutoConnect->setChecked(appConfig().autoConnect());
m_pLineEditScreenName->setText(appConfig().screenName());
m_pSpinBoxPort->setValue(appConfig().port());
m_pLineEditInterface->setText(appConfig().interface());
m_pComboLogLevel->setCurrentIndex(appConfig().logLevel());
m_pCheckBoxLogToFile->setChecked(appConfig().logToFile());
m_pLineEditLogFilename->setText(appConfig().logFilename());
m_pCheckBoxAutoStart->setChecked(appConfig().autoStart());
m_pCheckBoxAutoHide->setChecked(appConfig().autoHide());
#ifdef Q_OS_WIN
m_pComboBoxGameDevice->setCurrentIndex(appConfig().gameModeIndex());
m_pRadioButtonGamePollDynamic->setChecked(appConfig().gamePollingDynamic());
m_pRadioButtonGamePollStatic->setChecked(!appConfig().gamePollingDynamic());
m_pSpinBoxGamePoll->setValue(appConfig().gamePollingFrequency());
#else
m_pGroupGameDevices->setEnabled(false);
#endif
}
void SettingsDialog::accept()
{
appConfig().setAutoConnect(m_pCheckBoxAutoConnect->isChecked());
appConfig().setScreenName(m_pLineEditScreenName->text());
appConfig().setPort(m_pSpinBoxPort->value());
appConfig().setInterface(m_pLineEditInterface->text());
appConfig().setLogLevel(m_pComboLogLevel->currentIndex());
appConfig().setLogToFile(m_pCheckBoxLogToFile->isChecked());
appConfig().setLogFilename(m_pLineEditLogFilename->text());
appConfig().setAutoStart(m_pCheckBoxAutoStart->isChecked());
appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked());
appConfig().setGameModeIndex(m_pComboBoxGameDevice->currentIndex());
appConfig().setGamePollingDynamic(m_pRadioButtonGamePollDynamic->isChecked());
appConfig().setGamePollingFrequency(m_pSpinBoxGamePoll->value());
QDialog::accept();
}
void SettingsDialog::on_m_pCheckBoxLogToFile_stateChanged(int i)
{
bool checked = i == 2;
m_pLineEditLogFilename->setEnabled(checked);
m_pButtonBrowseLog->setEnabled(checked);
}
void SettingsDialog::on_m_pButtonBrowseLog_clicked()
{
QString fileName = QFileDialog::getSaveFileName(
this, tr("Save log file to..."),
m_pLineEditLogFilename->text(),
"Logs (*.log *.txt)");
if (!fileName.isEmpty())
{
m_pLineEditLogFilename->setText(fileName);
}
}

View File

@@ -0,0 +1,48 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(SETTINGSDIALOG_H)
#define SETTINGSDIALOG_H
#include <QDialog>
#include "ui_SettingsDialogBase.h"
class AppConfig;
class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
{
Q_OBJECT
public:
SettingsDialog(QWidget* parent, AppConfig& config);
static QString browseForSynergyc(QWidget* parent, const QString& programDir, const QString& synergycName);
static QString browseForSynergys(QWidget* parent, const QString& programDir, const QString& synergysName);
protected:
void accept();
AppConfig& appConfig() { return m_AppConfig; }
private:
AppConfig& m_AppConfig;
private slots:
void on_m_pCheckBoxLogToFile_stateChanged(int );
void on_m_pButtonBrowseLog_clicked();
};
#endif

120
src/gui/src/SetupWizard.cpp Normal file
View File

@@ -0,0 +1,120 @@
#include "SetupWizard.h"
#include "MainWindow.h"
#include <QMessageBox>
#include <iostream>
SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
m_MainWindow(mainWindow),
m_StartMain(startMain)
{
setupUi(this);
#if defined(Q_OS_MAC)
// the mac style needs a little more room because of the
// graphic on the left.
resize(600, 500);
setMinimumSize(size());
#elif defined(Q_OS_WIN)
// when areo is disabled on windows, the next/back buttons
// are hidden (must be a qt bug) -- resizing the window
// to +1 of the original height seems to fix this.
// NOTE: calling setMinimumSize after this will break
// it again, so don't do that.
resize(size().width(), size().height() + 1);
#endif
#if !defined(Q_OS_WIN)
m_pServiceRadioButton->setEnabled(false);
m_pServiceRadioButton->setText(tr("Service (Windows only)"));
m_pServiceLabel->setEnabled(false);
m_pDesktopRadioButton->setChecked(true);
#endif
connect(this, SIGNAL(finished(int)), this, SLOT(handlefinished()));
connect(m_pServerRadioButton, SIGNAL(toggled(bool)), m_MainWindow.m_pGroupServer, SLOT(setChecked(bool)));
connect(m_pClientRadioButton, SIGNAL(toggled(bool)), m_MainWindow.m_pGroupClient, SLOT(setChecked(bool)));
}
SetupWizard::~SetupWizard()
{
}
bool SetupWizard::validateCurrentPage()
{
QMessageBox message;
message.setWindowTitle(tr("Setup Synergy"));
message.setIcon(QMessageBox::Information);
bool result = false;
if (currentPage() == m_pNodePage)
{
result = m_pClientRadioButton->isChecked() ||
m_pServerRadioButton->isChecked();
if (!result)
{
message.setText(tr("Please select an option."));
message.exec();
}
}
else if(currentPage() == m_pStartupPage)
{
result = m_pServiceRadioButton->isChecked() ||
m_pDesktopRadioButton->isChecked() ||
m_pNoneRadioButton->isChecked();
if (!result)
{
message.setText(tr("Please select an option."));
message.exec();
}
}
return result;
}
void SetupWizard::handlefinished()
{
close();
AppConfig& appConfig = m_MainWindow.appConfig();
if (m_pServiceRadioButton->isChecked())
{
appConfig.setProcessMode(Service);
}
else if (m_pDesktopRadioButton->isChecked())
{
appConfig.setProcessMode(Desktop);
appConfig.setAutoStart(true);
appConfig.setAutoConnect(true);
}
else if (m_pNoneRadioButton->isChecked())
{
// still use desktop mode, but don't auto start.
appConfig.setProcessMode(Desktop);
}
appConfig.setWizardHasRun(true);
appConfig.saveSettings();
QSettings& settings = m_MainWindow.settings();
if (m_pServerRadioButton->isChecked())
{
settings.setValue("groupServerChecked", true);
settings.setValue("groupClientChecked", false);
}
if (m_pClientRadioButton->isChecked())
{
settings.setValue("groupClientChecked", true);
settings.setValue("groupServerChecked", false);
}
settings.sync();
if (m_StartMain)
{
m_MainWindow.start(true);
}
}

21
src/gui/src/SetupWizard.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <QWizard>
#include "ui_SetupWizardBase.h"
class MainWindow;
class SetupWizard : public QWizard, public Ui::SetupWizardBase
{
Q_OBJECT
public:
SetupWizard(MainWindow& mainWindow, bool startMain);
virtual ~SetupWizard();
bool validateCurrentPage();
protected slots:
void handlefinished();
private:
MainWindow& m_MainWindow;
bool m_StartMain;
};

View File

@@ -0,0 +1,42 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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 "TrashScreenWidget.h"
#include "ScreenSetupModel.h"
#include <QtCore>
#include <QtGui>
void TrashScreenWidget::dragEnterEvent(QDragEnterEvent* event)
{
if (event->mimeData()->hasFormat(ScreenSetupModel::mimeType()))
{
event->setDropAction(Qt::MoveAction);
event->accept();
}
else
event->ignore();
}
void TrashScreenWidget::dropEvent(QDropEvent* event)
{
if (event->mimeData()->hasFormat(ScreenSetupModel::mimeType()))
event->acceptProposedAction();
else
event->ignore();
}

View File

@@ -0,0 +1,41 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#if !defined(TRASHSCREENWIDGET__H)
#define TRASHSCREENWIDGET__H
#include <QLabel>
class QWidget;
class QDragEnterEvent;
class QDropEvent;
class TrashScreenWidget : public QLabel
{
Q_OBJECT
public:
TrashScreenWidget(QWidget* parent) : QLabel(parent) {}
public:
void dragEnterEvent(QDragEnterEvent* event);
void dropEvent(QDropEvent* event);
};
#endif

View File

View File

@@ -0,0 +1,102 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Nick Bolton
*
* 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 "VersionChecker.h"
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QProcess>
#include <QLocale>
#define VERSION_REGEX "(\\d\\.\\d\\.\\d)"
#define VERSION_URL "http://synergy-plus.googlecode.com/svn/web/version.txt"
VersionChecker::VersionChecker()
{
m_manager = new QNetworkAccessManager(this);
connect(m_manager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(replyFinished(QNetworkReply*)));
}
VersionChecker::~VersionChecker()
{
delete m_manager;
}
void VersionChecker::checkLatest()
{
m_manager->get(QNetworkRequest(QUrl(VERSION_URL)));
}
void VersionChecker::replyFinished(QNetworkReply* reply)
{
QString newestVersion = QString(reply->readAll());
if (!newestVersion.isEmpty())
{
QString currentVersion = getVersion();
if (compareVersions(currentVersion, newestVersion) > 0)
emit updateFound(newestVersion);
}
}
int VersionChecker::compareVersions(const QString& left, const QString& right)
{
if (left.compare(right) == 0)
return 0; // versions are same.
QStringList leftSplit = left.split(QRegExp("\\."));
if (leftSplit.size() != 3)
return 1; // assume right wins.
QStringList rightSplit = right.split(QRegExp("\\."));
if (rightSplit.size() != 3)
return -1; // assume left wins.
int leftMajor = leftSplit.at(0).toInt();
int leftMinor = leftSplit.at(1).toInt();
int leftRev = leftSplit.at(2).toInt();
int rightMajor = rightSplit.at(0).toInt();
int rightMinor = rightSplit.at(1).toInt();
int rightRev = rightSplit.at(2).toInt();
bool rightWins =
(rightMajor > leftMajor) ||
((rightMajor >= leftMajor) && (rightMinor > leftMinor)) ||
((rightMajor >= leftMajor) && (rightMinor >= leftMinor) && (rightRev > leftRev));
return rightWins ? 1 : -1;
}
QString VersionChecker::getVersion()
{
QProcess process;
process.start(m_app, QStringList() << "--version");
process.setReadChannel(QProcess::StandardOutput);
if (process.waitForStarted() && process.waitForFinished())
{
QRegExp rx(VERSION_REGEX);
QString text = process.readLine();
if (rx.indexIn(text) != -1)
return rx.cap(1);
}
return tr("Unknown");
}

View File

@@ -0,0 +1,43 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Nick Bolton
*
* 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 <QObject>
#include <QString>
class QNetworkAccessManager;
class QNetworkReply;
class VersionChecker : public QObject
{
Q_OBJECT
public:
VersionChecker();
virtual ~VersionChecker();
void checkLatest();
QString getVersion();
void setApp(const QString& app) { m_app = app; }
int compareVersions(const QString& left, const QString& right);
public slots:
void replyFinished(QNetworkReply* reply);
signals:
void updateFound(const QString& version);
private:
QNetworkAccessManager* m_manager;
QString m_app;
};

103
src/gui/src/main.cpp Normal file
View File

@@ -0,0 +1,103 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
* 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/>.
*/
#define TRAY_RETRY_COUNT 10
#define TRAY_RETRY_WAIT 2000
#include "QSynergyApplication.h"
#include "MainWindow.h"
#include "AppConfig.h"
#include "SetupWizard.h"
#include <QtCore>
#include <QtGui>
#include <QSettings>
class QThreadImpl : public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
int waitForTray();
int main(int argc, char* argv[])
{
QCoreApplication::setOrganizationName("Synergy");
QCoreApplication::setOrganizationDomain("http://synergy-foss.org/");
QCoreApplication::setApplicationName("Synergy");
QSynergyApplication app(argc, argv);
if (!waitForTray())
return -1;
QApplication::setQuitOnLastWindowClosed(false);
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QTranslator synergyTranslator;
synergyTranslator.load("res/lang/" + QLocale::system().name());
app.installTranslator(&synergyTranslator);
QSettings settings;
AppConfig appConfig(&settings);
MainWindow mainWindow(settings, appConfig);
SetupWizard setupWizard(mainWindow, true);
if (appConfig.wizardHasRun())
{
mainWindow.start(false);
}
else
{
setupWizard.show();
}
return app.exec();
}
int waitForTray()
{
// on linux, the system tray may not be available immediately after logging in,
// so keep retrying but give up after a short time.
int trayAttempts = 0;
while (true)
{
if (QSystemTrayIcon::isSystemTrayAvailable())
{
break;
}
if (++trayAttempts > TRAY_RETRY_COUNT)
{
QMessageBox::critical(NULL, "Synergy",
QObject::tr("System tray is unavailable, quitting."));
return false;
}
QThreadImpl::msleep(TRAY_RETRY_WAIT);
}
return true;
}