Merge branch 'master' into SYNERGY-799-Update-Synergy-UI.-Settings-window

This commit is contained in:
Serhii Hadzhilov 2021-04-15 18:04:26 +03:00
commit 95d9ce36dc
17 changed files with 1565 additions and 908 deletions

View file

@ -15,6 +15,7 @@ Enhancements:
- #6959 Update synergy UI. Setup wizard - #6959 Update synergy UI. Setup wizard
- #6969 Update synergy UI. Validation for aliases. - #6969 Update synergy UI. Validation for aliases.
- #6973 Update synergy UI. Main window - #6973 Update synergy UI. Main window
- #6977 Update synergy UI. Configure server
- #6962 | #6965 Add macOS 10.13 builder - #6962 | #6965 Add macOS 10.13 builder
=========== ===========

View file

@ -1,48 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* 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 LICENSE 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

@ -1,40 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* 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 LICENSE 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

@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "validators/ScreenNameValidator.h"
#include "validators/AliasValidator.h"
#include "ScreenSettingsDialog.h" #include "ScreenSettingsDialog.h"
#include "Screen.h" #include "Screen.h"
@ -31,12 +33,10 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen,cons
setupUi(this); setupUi(this);
m_pLineEditName->setText(m_pScreen->name()); m_pLineEditName->setText(m_pScreen->name());
m_NameValidator = std::make_unique<validators::ScreenNameValidator>(m_pLineEditName, m_pLabelNameError, pScreens); m_pLineEditName->setValidator(new validators::ScreenNameValidator(m_pLineEditName, m_pLabelNameError, pScreens));
m_pLineEditName->setValidator(m_NameValidator.get());
m_pLineEditName->selectAll(); m_pLineEditName->selectAll();
m_AliasValidator = std::make_unique<validators::AliasValidator>(m_pLineEditAlias, m_pLabelAliasError); m_pLineEditAlias->setValidator(new validators::AliasValidator(m_pLineEditAlias, m_pLabelAliasError));
m_pLineEditAlias->setValidator(m_AliasValidator.get());
for (int i = 0; i < m_pScreen->aliases().count(); i++) for (int i = 0; i < m_pScreen->aliases().count(); i++)
new QListWidgetItem(m_pScreen->aliases()[i], m_pListAliases); new QListWidgetItem(m_pScreen->aliases()[i], m_pListAliases);
@ -57,6 +57,8 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen,cons
m_pCheckBoxNumLock->setChecked(m_pScreen->fix(Screen::NumLock)); m_pCheckBoxNumLock->setChecked(m_pScreen->fix(Screen::NumLock));
m_pCheckBoxScrollLock->setChecked(m_pScreen->fix(Screen::ScrollLock)); m_pCheckBoxScrollLock->setChecked(m_pScreen->fix(Screen::ScrollLock));
m_pCheckBoxXTest->setChecked(m_pScreen->fix(Screen::XTest)); m_pCheckBoxXTest->setChecked(m_pScreen->fix(Screen::XTest));
resize(400, 625);
} }
void ScreenSettingsDialog::accept() void ScreenSettingsDialog::accept()

View file

@ -22,8 +22,6 @@
#include <memory> #include <memory>
#include <QDialog> #include <QDialog>
#include "validators/ScreenNameValidator.h"
#include "validators/AliasValidator.h"
#include "ui_ScreenSettingsDialogBase.h" #include "ui_ScreenSettingsDialogBase.h"
@ -51,8 +49,6 @@ class ScreenSettingsDialog : public QDialog, public Ui::ScreenSettingsDialogBase
private: private:
Screen* m_pScreen; Screen* m_pScreen;
std::unique_ptr<validators::ScreenNameValidator> m_NameValidator;
std::unique_ptr<validators::AliasValidator> m_AliasValidator;
}; };

File diff suppressed because it is too large Load diff

View file

@ -141,3 +141,22 @@ bool ScreenSetupModel::dropMimeData(const QMimeData* data, Qt::DropAction action
return true; return true;
} }
void ScreenSetupModel::addScreen(const Screen& newScreen)
{
auto screenTest = std::find_if(m_Screens.begin(), m_Screens.end(),
[](const Screen& item) { return item.isNull(); });
if (screenTest != m_Screens.end())
{
(*screenTest) = newScreen;
}
}
bool ScreenSetupModel::isFull() const
{
auto emptyScreen = std::find_if(m_Screens.cbegin(), m_Screens.cend(),
[](const Screen& item) { return item.isNull(); });
return (emptyScreen == m_Screens.cend());
}

View file

@ -51,6 +51,7 @@ class ScreenSetupModel : public QAbstractTableModel
Qt::ItemFlags flags(const QModelIndex& index) const; Qt::ItemFlags flags(const QModelIndex& index) const;
QStringList mimeTypes() const; QStringList mimeTypes() const;
QMimeData* mimeData(const QModelIndexList& indexes) const; QMimeData* mimeData(const QModelIndexList& indexes) const;
bool isFull() const;
protected: protected:
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent); bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
@ -58,6 +59,7 @@ class ScreenSetupModel : public QAbstractTableModel
Screen& screen(const QModelIndex& index) { 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]; } 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]; } Screen& screen(int column, int row) { return m_Screens[row * m_NumColumns + column]; }
void addScreen(const Screen& newScreen);
private: private:
ScreenList& m_Screens; ScreenList& m_Screens;

View file

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ScreenSettingsDialog.h"
#include "ServerConfigDialog.h" #include "ServerConfigDialog.h"
#include "ServerConfig.h" #include "ServerConfig.h"
#include "HotkeyDialog.h" #include "HotkeyDialog.h"
@ -82,6 +83,9 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) :
} }
} }
} }
m_pButtonAddComputer->setEnabled(!model().isFull());
connect(m_pTrashScreenWidget, SIGNAL(screenRemoved()), this, SLOT(onScreenRemoved()));
} }
void ServerConfigDialog::showEvent(QShowEvent* event) void ServerConfigDialog::showEvent(QShowEvent* event)
@ -262,6 +266,24 @@ void ServerConfigDialog::on_m_pListActions_itemSelectionChanged()
m_pButtonRemoveAction->setEnabled(!m_pListActions->selectedItems().isEmpty()); m_pButtonRemoveAction->setEnabled(!m_pListActions->selectedItems().isEmpty());
} }
void ServerConfigDialog::on_m_pButtonAddComputer_clicked()
{
Screen newScreen("");
ScreenSettingsDialog dlg(this, &newScreen, &model().m_Screens);
if (dlg.exec() == QDialog::Accepted)
{
model().addScreen(newScreen);
}
m_pButtonAddComputer->setEnabled(!model().isFull());
}
void ServerConfigDialog::onScreenRemoved()
{
m_pButtonAddComputer->setEnabled(true);
}
void ServerConfigDialog::on_m_pCheckBoxUseExternalConfig_toggled(bool checked) void ServerConfigDialog::on_m_pCheckBoxUseExternalConfig_toggled(bool checked)
{ {
m_pLabelConfigFile->setEnabled(checked); m_pLabelConfigFile->setEnabled(checked);

View file

@ -50,6 +50,8 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase
void on_m_pButtonEditAction_clicked(); void on_m_pButtonEditAction_clicked();
void on_m_pButtonRemoveAction_clicked(); void on_m_pButtonRemoveAction_clicked();
void on_m_pCheckBoxEnableClipboard_stateChanged(int state); void on_m_pCheckBoxEnableClipboard_stateChanged(int state);
void on_m_pButtonAddComputer_clicked();
void onScreenRemoved();
void on_m_pCheckBoxUseExternalConfig_toggled(bool checked = false); void on_m_pCheckBoxUseExternalConfig_toggled(bool checked = false);
bool on_m_pButtonBrowseConfigFile_clicked(); bool on_m_pButtonBrowseConfigFile_clicked();

View file

@ -6,16 +6,28 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>795</width> <width>778</width>
<height>534</height> <height>508</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Server Configuration</string> <string>Server Configuration</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<widget class="QTabWidget" name="m_pTabWidget"> <widget class="QTabWidget" name="m_pTabWidget">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
@ -24,8 +36,23 @@
<string>Screens and links</string> <string>Screens and links</string>
</attribute> </attribute>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item> <item>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<item> <item>
<widget class="TrashScreenWidget" name="m_pTrashScreenWidget"> <widget class="TrashScreenWidget" name="m_pTrashScreenWidget">
<property name="acceptDrops"> <property name="acceptDrops">
@ -48,6 +75,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_2">
<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> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="sizePolicy"> <property name="sizePolicy">
@ -56,8 +96,14 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize">
<size>
<width>310</width>
<height>16777215</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Configure the layout of your synergy server configuration.</string> <string>Configure the layout of your computer dispalys by dragging to where you want.</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
@ -65,31 +111,86 @@
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="indent">
<number>-1</number>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="NewScreenWidget" name="m_pLabelNewScreenWidget"> <spacer name="horizontalSpacer_3">
<property name="toolTip"> <property name="orientation">
<string>Drag this button to the grid to add a new screen.</string> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="frameShape"> <property name="sizeHint" stdset="0">
<enum>QFrame::StyledPanel</enum> <size>
<width>40</width>
<height>20</height>
</size>
</property> </property>
<property name="frameShadow"> </spacer>
<enum>QFrame::Raised</enum> </item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property> </property>
<property name="leftMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer_2">
<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>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_pButtonAddComputer">
<property name="text"> <property name="text">
<string/> <string>Add computer</string>
</property> </property>
<property name="pixmap"> <property name="default">
<pixmap resource="../res/Synergy.qrc">:/res/icons/64x64/video-display.png</pixmap> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</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>10</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="ScreenSetupView" name="m_pScreenSetupView"> <widget class="ScreenSetupView" name="m_pScreenSetupView">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -99,7 +200,7 @@
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>273</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="acceptDrops"> <property name="acceptDrops">
@ -116,40 +217,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="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" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="m_pTabHotkeys"> <widget class="QWidget" name="m_pTabHotkeys">
@ -284,17 +351,49 @@ Double click on a screen to edit its settings.</string>
<string>Advanced server settings</string> <string>Advanced server settings</string>
</attribute> </attribute>
<layout class="QGridLayout"> <layout class="QGridLayout">
<item row="0" column="0"> <property name="leftMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="m_pGroupSwitch"> <widget class="QGroupBox" name="m_pGroupSwitch">
<property name="font"> <property name="font">
<font> <font>
<kerning>true</kerning> <kerning>true</kerning>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">QGroupBox::title{
left: -5px;
top: -2px;
}</string>
</property>
<property name="title"> <property name="title">
<string>&amp;Switch</string> <string>&amp;Switch computer</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item> <item>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<item> <item>
@ -401,37 +500,58 @@ Double click on a screen to edit its settings.</string>
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</widget>
</item>
<item> <item>
<spacer> <spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>13</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> <item>
</widget> <widget class="QGroupBox" name="groupBox_3">
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="m_pGroupOptions">
<property name="font"> <property name="font">
<font> <font>
<kerning>false</kerning> <kerning>true</kerning>
</font> </font>
</property> </property>
<property name="title"> <property name="styleSheet">
<string>&amp;Options</string> <string notr="true">QGroupBox::title{
left: -2px;
top: -2px;
}</string>
</property> </property>
<layout class="QGridLayout"> <property name="title">
<item row="8" column="0"> <string>Clipboard sharing</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="topMargin">
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<item> <item>
<widget class="QCheckBox" name="m_pCheckBoxEnableClipboard"> <widget class="QCheckBox" name="m_pCheckBoxEnableClipboard">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Enable clipboard sharing</string> <string>Enable clipboard sharing</string>
</property> </property>
@ -459,7 +579,7 @@ Double click on a screen to edit its settings.</string>
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>50</number> <number>10000</number>
</property> </property>
<property name="value"> <property name="value">
<number>3</number> <number>3</number>
@ -469,33 +589,154 @@ Double click on a screen to edit its settings.</string>
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>MB</string> <string>mb</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0"> <item>
<widget class="QCheckBox" name="m_pCheckBoxWin32KeepForeground"> <spacer name="verticalSpacer_3">
<property name="enabled"> <property name="orientation">
<bool>true</bool> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>60</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</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>
<item row="4" column="0" colspan="3">
<widget class="QGroupBox" name="m_pGroupSwitchCorners">
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox::title{
left: -5px;
top: -2px;
}</string>
</property>
<property name="title">
<string>&amp;Dead corners for this computer</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout">
<property name="topMargin">
<number>6</number>
</property>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="m_pCheckBoxCornerTopLeft">
<property name="text"> <property name="text">
<string>Don't take &amp;foreground window on Windows servers</string> <string>To&amp;p-left</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="3" colspan="2">
<widget class="QCheckBox" name="m_pCheckBoxRelativeMouseMoves"> <widget class="QCheckBox" name="m_pCheckBoxCornerTopRight">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text"> <property name="text">
<string>Use &amp;relative mouse moves</string> <string>Top-rig&amp;ht</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="0"> <item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="m_pCheckBoxCornerBottomLeft">
<property name="text">
<string>&amp;Bottom-left</string>
</property>
</widget>
</item>
<item row="2" column="3" colspan="2">
<widget class="QCheckBox" name="m_pCheckBoxCornerBottomRight">
<property name="text">
<string>Bottom-ri&amp;ght</string>
</property>
</widget>
</item>
<item row="1" column="5">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<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">
<property name="maximum">
<number>30000</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>px</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="2">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="m_pGroupOptions">
<property name="font">
<font>
<kerning>false</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox::title{
left: -5px;
top: -2px;
}</string>
</property>
<property name="title">
<string>&amp;Options</string>
</property>
<layout class="QGridLayout">
<property name="verticalSpacing">
<number>12</number>
</property>
<item row="11" column="0">
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -508,20 +749,35 @@ Double click on a screen to edit its settings.</string>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConfigClient"> <widget class="QCheckBox" name="m_pCheckBoxRelativeMouseMoves">
<property name="enabled">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">padding-left: 2px;</string>
</property>
<property name="text"> <property name="text">
<string>Ignore auto config clients</string> <string>Use &amp;relative mouse moves</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<property name="spacing">
<number>9</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QCheckBox" name="m_pCheckBoxHeartbeat"> <widget class="QCheckBox" name="m_pCheckBoxHeartbeat">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="styleSheet">
<string notr="true">left: -2px;</string>
</property>
<property name="text"> <property name="text">
<string>&amp;Check clients every</string> <string>&amp;Check clients every</string>
</property> </property>
@ -545,6 +801,12 @@ Double click on a screen to edit its settings.</string>
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum"> <property name="minimum">
<number>1000</number> <number>1000</number>
</property> </property>
@ -568,113 +830,56 @@ Double click on a screen to edit its settings.</string>
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConfigClient">
<property name="styleSheet">
<string notr="true">padding-left: 2px;</string>
</property>
<property name="text">
<string>Ignore auto config clients</string>
</property>
</widget>
</item>
<item row="6" column="0"> <item row="6" column="0">
<widget class="QCheckBox" name="m_pCheckBoxDisableLockToScreen"> <widget class="QCheckBox" name="m_pCheckBoxDisableLockToScreen">
<property name="styleSheet">
<string notr="true">padding-left: 2px;</string>
</property>
<property name="text"> <property name="text">
<string>Disable lock to screen</string> <string>Disable lock to screen</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="3" column="0">
</widget> <widget class="QCheckBox" name="m_pCheckBoxWin32KeepForeground">
</item> <property name="enabled">
<item row="1" column="0" colspan="2"> <bool>true</bool>
<widget class="QGroupBox" name="m_pGroupSwitchCorners">
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property> </property>
<property name="title"> <property name="styleSheet">
<string>&amp;Dead corners</string> <string notr="true">padding-left: 2px;</string>
</property> </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"> <property name="text">
<string>To&amp;p-left</string> <string>Don't take &amp;foreground window on Windows servers</string>
</property> </property>
</widget> </widget>
</item> </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" stdset="0">
<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" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0"> </layout>
<spacer> </item>
<item row="3" column="0">
<spacer name="verticalSpacer_5">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>13</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -998,11 +1203,6 @@ Double click on a screen to edit its settings.</string>
<header>ScreenSetupView.h</header> <header>ScreenSetupView.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>NewScreenWidget</class>
<extends>QLabel</extends>
<header>NewScreenWidget.h</header>
</customwidget>
<customwidget> <customwidget>
<class>TrashScreenWidget</class> <class>TrashScreenWidget</class>
<extends>QLabel</extends> <extends>QLabel</extends>

View file

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "SettingsDialog.h" #include "SettingsDialog.h"
#include "validators/ScreenNameValidator.h"
#include "CoreInterface.h" #include "CoreInterface.h"
#include "SynergyLocale.h" #include "SynergyLocale.h"
@ -52,8 +53,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
enableControls(appConfig().isWritable()); enableControls(appConfig().isWritable());
const auto& serveConfig = m_pMainWindow->serverConfig(); const auto& serveConfig = m_pMainWindow->serverConfig();
m_ScreenNameValidator = std::make_unique<validators::ScreenNameValidator>(m_pLineEditScreenName, m_pLabelNameError, (&serveConfig.screens())); m_pLineEditScreenName->setValidator(new validators::ScreenNameValidator(m_pLineEditScreenName, m_pLabelNameError, (&serveConfig.screens())));
m_pLineEditScreenName->setValidator(m_ScreenNameValidator.get());
connect(m_pLineEditLogFilename, SIGNAL(textChanged(QString)), this, SLOT(onChange())); connect(m_pLineEditLogFilename, SIGNAL(textChanged(QString)), this, SLOT(onChange()));
connect(m_pComboLogLevel, SIGNAL(currentIndexChanged(int)), this, SLOT(onChange())); connect(m_pComboLogLevel, SIGNAL(currentIndexChanged(int)), this, SLOT(onChange()));

View file

@ -23,7 +23,7 @@
#include <memory> #include <memory>
#include <QDialog> #include <QDialog>
#include "ui_SettingsDialogBase.h" #include "ui_SettingsDialogBase.h"
#include "validators/ScreenNameValidator.h"
#include "SynergyLocale.h" #include "SynergyLocale.h"
#include "CoreInterface.h" #include "CoreInterface.h"
@ -70,7 +70,6 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
SynergyLocale m_Locale; SynergyLocale m_Locale;
CoreInterface m_CoreInterface; CoreInterface m_CoreInterface;
BonjourWindows* m_pBonjourWindows; BonjourWindows* m_pBonjourWindows;
std::unique_ptr<validators::ScreenNameValidator> m_ScreenNameValidator;
/// @brief Stores settings scope at start of settings dialog /// @brief Stores settings scope at start of settings dialog
/// This is neccessary to restore state if user changes /// This is neccessary to restore state if user changes

View file

@ -25,8 +25,7 @@ SetupWizard::SetupWizard(MainWindow& mainWindow) :
setupUi(this); setupUi(this);
m_pLineEditName->setText(m_MainWindow.appConfig().screenName()); m_pLineEditName->setText(m_MainWindow.appConfig().screenName());
m_ScreenNameValidator = std::make_unique<validators::ScreenNameValidator>(m_pLineEditName, label_ErrorMessage); m_pLineEditName->setValidator(new validators::ScreenNameValidator(m_pLineEditName, label_ErrorMessage));
m_pLineEditName->setValidator(m_ScreenNameValidator.get());
connect(m_pButtonApply, SIGNAL(clicked()), this, SLOT(accept())); connect(m_pButtonApply, SIGNAL(clicked()), this, SLOT(accept()));
connect(m_pLineEditName, SIGNAL(textEdited(QString)), this, SLOT(onNameChanged())); connect(m_pLineEditName, SIGNAL(textEdited(QString)), this, SLOT(onNameChanged()));

View file

@ -19,7 +19,6 @@
#include <memory> #include <memory>
#include "ui_SetupWizardBase.h" #include "ui_SetupWizardBase.h"
#include <QDialog> #include <QDialog>
#include "validators/ScreenNameValidator.h"
class MainWindow; class MainWindow;
@ -36,7 +35,6 @@ protected:
private: private:
MainWindow& m_MainWindow; MainWindow& m_MainWindow;
std::unique_ptr<validators::ScreenNameValidator> m_ScreenNameValidator;
private slots: private slots:
void onNameChanged(); void onNameChanged();

View file

@ -36,8 +36,13 @@ void TrashScreenWidget::dragEnterEvent(QDragEnterEvent* event)
void TrashScreenWidget::dropEvent(QDropEvent* event) void TrashScreenWidget::dropEvent(QDropEvent* event)
{ {
if (event->mimeData()->hasFormat(ScreenSetupModel::mimeType())) if (event->mimeData()->hasFormat(ScreenSetupModel::mimeType()))
{
event->acceptProposedAction(); event->acceptProposedAction();
emit screenRemoved();
}
else else
{
event->ignore(); event->ignore();
}
} }

View file

@ -36,6 +36,10 @@ class TrashScreenWidget : public QLabel
public: public:
void dragEnterEvent(QDragEnterEvent* event); void dragEnterEvent(QDragEnterEvent* event);
void dropEvent(QDropEvent* event); void dropEvent(QDropEvent* event);
signals:
void screenRemoved();
}; };
#endif #endif