diff --git a/ChangeLog b/ChangeLog index 4db4ec6b78..6e9ba7ce00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ Enhancements: - #6959 Update synergy UI. Setup wizard - #6969 Update synergy UI. Validation for aliases. - #6973 Update synergy UI. Main window +- #6977 Update synergy UI. Configure server - #6962 | #6965 Add macOS 10.13 builder =========== diff --git a/src/gui/src/NewScreenWidget.cpp b/src/gui/src/NewScreenWidget.cpp deleted file mode 100644 index 7873e8b1c4..0000000000 --- a/src/gui/src/NewScreenWidget.cpp +++ /dev/null @@ -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 . - */ - -#include "NewScreenWidget.h" -#include "ScreenSetupModel.h" - -#include -#include - -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); -} - diff --git a/src/gui/src/NewScreenWidget.h b/src/gui/src/NewScreenWidget.h deleted file mode 100644 index 67ff44f68a..0000000000 --- a/src/gui/src/NewScreenWidget.h +++ /dev/null @@ -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 . - */ - -#if !defined(NEWSCREENWIDGET__H) - -#define NEWSCREENWIDGET__H - -#include - -class QMouseEvent; -class QWidget; - -class NewScreenWidget : public QLabel -{ - Q_OBJECT - - public: - NewScreenWidget(QWidget* parent); - - protected: - void mousePressEvent(QMouseEvent* event); -}; - -#endif - diff --git a/src/gui/src/ScreenSettingsDialog.cpp b/src/gui/src/ScreenSettingsDialog.cpp index c919357ab6..206f079395 100644 --- a/src/gui/src/ScreenSettingsDialog.cpp +++ b/src/gui/src/ScreenSettingsDialog.cpp @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "validators/ScreenNameValidator.h" +#include "validators/AliasValidator.h" #include "ScreenSettingsDialog.h" #include "Screen.h" @@ -31,12 +33,10 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen,cons setupUi(this); m_pLineEditName->setText(m_pScreen->name()); - m_NameValidator = std::make_unique(m_pLineEditName, m_pLabelNameError, pScreens); - m_pLineEditName->setValidator(m_NameValidator.get()); + m_pLineEditName->setValidator(new validators::ScreenNameValidator(m_pLineEditName, m_pLabelNameError, pScreens)); m_pLineEditName->selectAll(); - m_AliasValidator = std::make_unique(m_pLineEditAlias, m_pLabelAliasError); - m_pLineEditAlias->setValidator(m_AliasValidator.get()); + m_pLineEditAlias->setValidator(new validators::AliasValidator(m_pLineEditAlias, m_pLabelAliasError)); for (int i = 0; i < m_pScreen->aliases().count(); i++) 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_pCheckBoxScrollLock->setChecked(m_pScreen->fix(Screen::ScrollLock)); m_pCheckBoxXTest->setChecked(m_pScreen->fix(Screen::XTest)); + + resize(400, 625); } void ScreenSettingsDialog::accept() diff --git a/src/gui/src/ScreenSettingsDialog.h b/src/gui/src/ScreenSettingsDialog.h index 3153d9399e..ff0eb7beb0 100644 --- a/src/gui/src/ScreenSettingsDialog.h +++ b/src/gui/src/ScreenSettingsDialog.h @@ -22,8 +22,6 @@ #include #include -#include "validators/ScreenNameValidator.h" -#include "validators/AliasValidator.h" #include "ui_ScreenSettingsDialogBase.h" @@ -51,8 +49,6 @@ class ScreenSettingsDialog : public QDialog, public Ui::ScreenSettingsDialogBase private: Screen* m_pScreen; - std::unique_ptr m_NameValidator; - std::unique_ptr m_AliasValidator; }; diff --git a/src/gui/src/ScreenSettingsDialogBase.ui b/src/gui/src/ScreenSettingsDialogBase.ui index bb81bfc589..dbff2c99a7 100644 --- a/src/gui/src/ScreenSettingsDialogBase.ui +++ b/src/gui/src/ScreenSettingsDialogBase.ui @@ -6,118 +6,803 @@ 0 0 - 442 - 481 + 491 + 751 + + + 0 + 0 + + + + + 400 + 600 + + - Screen Settings + Computer settings + + 6 + + + 11 + + + 12 + + + 11 + + + 6 + - - - - - Screen &name: - - - m_pLineEditName - - - - - - - 255 - - - - - - - - - color: #EC4C47; + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + 13 + + + 13 + + + 13 + + + 13 + + + + + 14 + + + + + Computer &name + + + m_pLineEditName + + + + + + + + 0 + 0 + + + + 255 + + + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + color: #EC4C47; font-size: 13px; font-family: Arial; font-weight: bold; + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Qt::Vertical - - + + QSizePolicy::Fixed - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 20 + 10 + - + - - - - - true - - - - false - - - - A&liases - - - false - - - - - - 255 - - + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + true + + + + QGroupBox::title{ + left: -5px; + top: -3px; +} + + + &Modifier keys + + + false + + + + 8 + + + 8 + + + 0 + + + 8 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Al&t + + + m_pComboBoxAlt + + + + + + + 3 + + + + Shift + + + + + Ctrl + + + + + Alt + + + + + Meta + + + + + Super + + + + + None + + + + + + + + S&uper + + + m_pComboBoxSuper + + + + + + + 4 + + + + Shift + + + + + Ctrl + + + + + Alt + + + + + Meta + + + + + Super + + + + + None + + + + + + + + 1 + + + + Shift + + + + + Ctrl + + + + + Alt + + + + + Meta + + + + + Super + + + + + None + + + + + + + + &Ctrl + + + m_pComboBoxCtrl + + + + + + + + 40 + 16777215 + + + + &Shift + + + m_pComboBoxShift + + + + + + + + 40 + 16777215 + + + + M&eta + + + m_pComboBoxMeta + + + + + + + + Shift + - - - - false + + + Ctrl + + + + + Alt + + + + + Meta + + + + + Super + + + + + None + + + + + + + + 2 + + + + Shift + + + + + Ctrl + + + + + Alt + + + + + Meta + + + + + Super + + + + + None + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + true + + + + QGroupBox::title{ + left: -5px; + top: -3px; +} + + + &Dead corners defaults + + + false + + + + 10 + + + 13 + + + 10 + + + 9 + + + + + Bottom-left + + + + + + + Top-right + + + + + + + Top-left + + + + + + + Bottom-right + + + + + + + + + + 0 + 0 + - &Add + Corner si&ze + + + m_pSpinBoxSwitchCornerSize - + - Qt::Vertical + Qt::Horizontal + + + QSizePolicy::Fixed - 20 - 126 + 8 + 20 - - - - QAbstractItemView::ExtendedSelection + + + + + 0 + 0 + + + + + 55 + 0 + - - - - false + + + + + + Qt::Vertical + + + + 20 + 9 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + true + + + + QGroupBox::title{ + left: -5px; + top: -3px; +} + + + &Fixes + + + false + + + + 13 + + + 13 + + + 6 + + + 13 + + + + + Fix SCROLL LOCK key + + + + + + + Fix CAPS LOCK key + + + + + + + Fix XTest for Xinerama + + + false + + + + + + + Fix NUM LOCK key + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + false + + + + QGroupBox::title{ + left: -5px; + top: -3px; +} + + + A&liases + + + false + + + + 0 + + + + + 0 + + + 0 + + + + + + 168 + 20 + - - &Remove + + margin-right: 7px; + + + 255 - + color: #EC4C47; @@ -128,333 +813,163 @@ font-weight: bold; - - - - - - - - - - true - - - - &Modifier keys - - - false - - - - - - &Shift: - - - m_pComboBoxShift + + true - - - - - Shift - - - - - Ctrl - - - - - Alt - - - - - Meta - - - - - Super - - - - - None - - - - - - - - &Ctrl: + + + + Qt::Vertical - - m_pComboBoxCtrl + + QSizePolicy::Fixed - - - - - - 1 + + + 20 + 3 + - - - Shift - - - - - Ctrl - - - - - Alt - - - - - Meta - - - - - Super - - - - - None - - - + - - - - Al&t: + + + + 0 - - m_pComboBoxAlt + + 0 - - - - - - 2 - - - - Shift - - - - - Ctrl - - - - Alt - - - - - Meta - - - - - Super - + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 117 + 20 + + + - - None - + + + false + + + + 0 + 0 + + + + + 43 + 20 + + + + Qt::LeftToRight + + + QPushButton#m_pButtonAddAlias{ +left: 30px; +} + + + &Add + + - + - - - - M&eta: + + + + Qt::Vertical - - m_pComboBoxMeta + + + 20 + 40 + - + - - - - 3 + + + + + + 3 + + + 0 + + + 0 + + + + + + 0 + 0 + - - - Shift - - - - - Ctrl - - - - - Alt - - - - - Meta - - - - - Super - - - - - None - - - - - - - - S&uper: + + + 0 + 0 + - - m_pComboBoxSuper + + + 16777215 + 65 + - - - - - - 4 + + margin-right: 7px; + + + QAbstractItemView::ExtendedSelection - - - Shift - - - - - Ctrl - - - - - Alt - - - - - Meta - - - - - Super - - - - - None - - - - + + Qt::Vertical + + QSizePolicy::Fixed + 20 - 40 + 3 - - - - - - - - - - - - true - - - - &Dead corners - - - false - - - - - - Top-left - - - - - - - Top-right - - - - - - - Bottom-left + + + + 2 - - - - - - Bottom-right + + 0 - - - - - - - - Corner Si&ze: - - - m_pSpinBoxSwitchCornerSize - - - - + Qt::Horizontal @@ -467,85 +982,50 @@ font-weight: bold; - + + + false + + + &Remove + + - - - - - - - - true - - - - &Fixes - - - false - - - - - - Fix CAPS LOCK key - - - - - - - Fix NUM LOCK key - - - - - - - Fix SCROLL LOCK key - - - - - - - Fix XTest for Xinerama - - - false - - - - - + + Qt::Vertical + + QSizePolicy::Preferred + 20 - 40 + 5 - - - + + + - + Qt::Vertical + + QSizePolicy::Fixed + 20 - 40 + 10 @@ -560,6 +1040,22 @@ font-weight: bold; + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 8 + + + + diff --git a/src/gui/src/ScreenSetupModel.cpp b/src/gui/src/ScreenSetupModel.cpp index 40e93c87bc..a622436fef 100644 --- a/src/gui/src/ScreenSetupModel.cpp +++ b/src/gui/src/ScreenSetupModel.cpp @@ -141,3 +141,22 @@ bool ScreenSetupModel::dropMimeData(const QMimeData* data, Qt::DropAction action 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()); +} + diff --git a/src/gui/src/ScreenSetupModel.h b/src/gui/src/ScreenSetupModel.h index 726c6ed8bf..2bf5f31918 100644 --- a/src/gui/src/ScreenSetupModel.h +++ b/src/gui/src/ScreenSetupModel.h @@ -51,6 +51,7 @@ class ScreenSetupModel : public QAbstractTableModel Qt::ItemFlags flags(const QModelIndex& index) const; QStringList mimeTypes() const; QMimeData* mimeData(const QModelIndexList& indexes) const; + bool isFull() const; protected: 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()); } 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]; } + void addScreen(const Screen& newScreen); private: ScreenList& m_Screens; diff --git a/src/gui/src/ServerConfigDialog.cpp b/src/gui/src/ServerConfigDialog.cpp index 7b921f5fb6..bf004dfd4f 100644 --- a/src/gui/src/ServerConfigDialog.cpp +++ b/src/gui/src/ServerConfigDialog.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +#include "ScreenSettingsDialog.h" #include "ServerConfigDialog.h" #include "ServerConfig.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) @@ -262,6 +266,24 @@ void ServerConfigDialog::on_m_pListActions_itemSelectionChanged() 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) { m_pLabelConfigFile->setEnabled(checked); diff --git a/src/gui/src/ServerConfigDialog.h b/src/gui/src/ServerConfigDialog.h index 3d06187fd6..9acc51e236 100644 --- a/src/gui/src/ServerConfigDialog.h +++ b/src/gui/src/ServerConfigDialog.h @@ -50,6 +50,8 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase void on_m_pButtonEditAction_clicked(); void on_m_pButtonRemoveAction_clicked(); void on_m_pCheckBoxEnableClipboard_stateChanged(int state); + void on_m_pButtonAddComputer_clicked(); + void onScreenRemoved(); void on_m_pCheckBoxUseExternalConfig_toggled(bool checked = false); bool on_m_pButtonBrowseConfigFile_clicked(); diff --git a/src/gui/src/ServerConfigDialogBase.ui b/src/gui/src/ServerConfigDialogBase.ui index 186a777822..e9c9d6530c 100644 --- a/src/gui/src/ServerConfigDialogBase.ui +++ b/src/gui/src/ServerConfigDialogBase.ui @@ -6,16 +6,28 @@ 0 0 - 795 - 534 + 778 + 508 + + + 0 + 0 + + Server Configuration + + + 0 + 0 + + 0 @@ -24,8 +36,23 @@ Screens and links + + 6 + + + 5 + + + 6 + + + 5 + + + 6 + @@ -48,6 +75,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -56,8 +96,14 @@ 0 + + + 310 + 16777215 + + - Configure the layout of your synergy server configuration. + Configure the layout of your computer dispalys by dragging to where you want. Qt::AlignCenter @@ -65,31 +111,86 @@ true + + -1 + - - - Drag this button to the grid to add a new screen. - - - QFrame::StyledPanel + + + Qt::Horizontal - - QFrame::Raised + + + 40 + 20 + - - + + + + + + 0 - - :/res/icons/64x64/video-display.png + + 0 - + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + Add computer + + + true + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + 0 + 0 + + 0 @@ -99,7 +200,7 @@ 16777215 - 273 + 16777215 @@ -116,40 +217,6 @@ - - - - - 1 - 0 - - - - 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. - - - Qt::AlignCenter - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -284,357 +351,334 @@ Double click on a screen to edit its settings. Advanced server settings - - - - - true - + + 9 + + + 9 + + + + + 0 - - &Switch + + 0 - - - - - - - true - - - Switch &after waiting - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - 10 - - - 10000 - - - 10 - - - 250 - - - - - - - ms - - - - - - - - - - - true - - - Switch on double &tap within - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - 10 - - - 10000 - - - 10 - - - 250 - - - - - - - ms - - - - - - - - - Qt::Vertical + + 0 + + + + + + true + + + + QGroupBox::title{ + left: -5px; + top: -2px; +} + + + &Switch computer + + + + 6 - - - 20 - 40 - + + 6 + + + 6 - - - - - - - - - - false - - - - &Options - - - - - - - - Enable clipboard sharing - - - true - - - - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + + true + + + Switch &after waiting + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + 10 + + + 10000 + + + 10 + + + 250 + + + + + + + ms + + + + - - - false - - - 50 - - - 3 - - - - - - - MB - - + + + + + true + + + Switch on double &tap within + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + 10 + + + 10000 + + + 10 + + + 250 + + + + + + + ms + + + + - - - - - true - - - Don't take &foreground window on Windows servers - - - - - - - true - - - Use &relative mouse moves - - - - - - - Qt::Vertical - - - - 20 - 16 - - - - - - - - Ignore auto config clients + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + + + + + + true + + + + QGroupBox::title{ + left: -2px; + top: -2px; +} + + + Clipboard sharing + + + + 6 - - - - - - - true - - - &Check clients every + + + 6 - + + + + + 0 + 0 + + + + Enable clipboard sharing + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + 10000 + + + 3 + + + + + + + mb + + + + - + - Qt::Horizontal + Qt::Vertical - 40 - 20 + 20 + 60 - - - - false - - - 1000 - - - 30000 - - - 1000 - - - 5000 - - - - - - - ms - - - - - - - - Disable lock to screen - - - - - + + + - + + + + Qt::Vertical + + + + 20 + 40 + + + + + true + + QGroupBox::title{ + left: -5px; + top: -2px; +} + - &Dead corners + &Dead corners for this computer false - + + 6 + + To&p-left - + Top-rig&ht - + &Bottom-left - + Bottom-ri&ght - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + @@ -646,35 +690,196 @@ Double click on a screen to edit its settings. - + + + 30000 + + + + + + + px + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + + + 0 + + + 0 + + + + + + false + + + + QGroupBox::title{ + left: -5px; + top: -2px; +} + + + &Options + + + + 12 + + + + + Qt::Vertical + + + + 20 + 16 + + + + + + + + true + + + padding-left: 2px; + + + Use &relative mouse moves + + + + + + + 9 + + + 0 + + + + + true + + + left: -2px; + + + &Check clients every + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + + 0 + 0 + + + + 1000 + + + 30000 + + + 1000 + + + 5000 + + + + + + + ms + + + + + + + + + padding-left: 2px; + + + Ignore auto config clients + + + + + + + padding-left: 2px; + + + Disable lock to screen + + + + + + + true + + + padding-left: 2px; + + + Don't take &foreground window on Windows servers + + + + + + + + + + Qt::Vertical + + QSizePolicy::Fixed + 20 - 40 + 13 @@ -963,11 +1168,6 @@ Double click on a screen to edit its settings.
ScreenSetupView.h
1 - - NewScreenWidget - QLabel -
NewScreenWidget.h
-
TrashScreenWidget QLabel diff --git a/src/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp index 87af94aa2f..f1f2ae87f7 100644 --- a/src/gui/src/SettingsDialog.cpp +++ b/src/gui/src/SettingsDialog.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see . */ #include "SettingsDialog.h" +#include "validators/ScreenNameValidator.h" #include "CoreInterface.h" #include "SynergyLocale.h" @@ -52,8 +53,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) : enableControls(appConfig().isWritable()); const auto& serveConfig = m_pMainWindow->serverConfig(); - m_ScreenNameValidator = std::make_unique(m_pLineEditScreenName, m_pLabelNameError, (&serveConfig.screens())); - m_pLineEditScreenName->setValidator(m_ScreenNameValidator.get()); + m_pLineEditScreenName->setValidator(new validators::ScreenNameValidator(m_pLineEditScreenName, m_pLabelNameError, (&serveConfig.screens()))); connect(m_pLineEditLogFilename, SIGNAL(textChanged(QString)), this, SLOT(onChange())); connect(m_pComboLogLevel, SIGNAL(currentIndexChanged(int)), this, SLOT(onChange())); diff --git a/src/gui/src/SettingsDialog.h b/src/gui/src/SettingsDialog.h index 7c8f4fc4b5..6ea7ea3544 100644 --- a/src/gui/src/SettingsDialog.h +++ b/src/gui/src/SettingsDialog.h @@ -23,7 +23,7 @@ #include #include #include "ui_SettingsDialogBase.h" -#include "validators/ScreenNameValidator.h" + #include "SynergyLocale.h" #include "CoreInterface.h" @@ -70,7 +70,6 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase SynergyLocale m_Locale; CoreInterface m_CoreInterface; BonjourWindows* m_pBonjourWindows; - std::unique_ptr m_ScreenNameValidator; /// @brief Stores settings scope at start of settings dialog /// This is neccessary to restore state if user changes diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index 5c9187ee34..16998fbbda 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -25,8 +25,7 @@ SetupWizard::SetupWizard(MainWindow& mainWindow) : setupUi(this); m_pLineEditName->setText(m_MainWindow.appConfig().screenName()); - m_ScreenNameValidator = std::make_unique(m_pLineEditName, label_ErrorMessage); - m_pLineEditName->setValidator(m_ScreenNameValidator.get()); + m_pLineEditName->setValidator(new validators::ScreenNameValidator(m_pLineEditName, label_ErrorMessage)); connect(m_pButtonApply, SIGNAL(clicked()), this, SLOT(accept())); connect(m_pLineEditName, SIGNAL(textEdited(QString)), this, SLOT(onNameChanged())); diff --git a/src/gui/src/SetupWizard.h b/src/gui/src/SetupWizard.h index 17a2c2c9fc..eb4622f29f 100644 --- a/src/gui/src/SetupWizard.h +++ b/src/gui/src/SetupWizard.h @@ -19,7 +19,6 @@ #include #include "ui_SetupWizardBase.h" #include -#include "validators/ScreenNameValidator.h" class MainWindow; @@ -36,7 +35,6 @@ class SetupWizard : public QDialog, public Ui::SetupWizardBase private: MainWindow& m_MainWindow; - std::unique_ptr m_ScreenNameValidator; private slots: void onNameChanged(); diff --git a/src/gui/src/TrashScreenWidget.cpp b/src/gui/src/TrashScreenWidget.cpp index 9d980d978e..056ab0856c 100644 --- a/src/gui/src/TrashScreenWidget.cpp +++ b/src/gui/src/TrashScreenWidget.cpp @@ -36,8 +36,13 @@ void TrashScreenWidget::dragEnterEvent(QDragEnterEvent* event) void TrashScreenWidget::dropEvent(QDropEvent* event) { if (event->mimeData()->hasFormat(ScreenSetupModel::mimeType())) + { event->acceptProposedAction(); + emit screenRemoved(); + } else + { event->ignore(); + } } diff --git a/src/gui/src/TrashScreenWidget.h b/src/gui/src/TrashScreenWidget.h index 524b39eed2..39e2442ac0 100644 --- a/src/gui/src/TrashScreenWidget.h +++ b/src/gui/src/TrashScreenWidget.h @@ -36,6 +36,10 @@ class TrashScreenWidget : public QLabel public: void dragEnterEvent(QDragEnterEvent* event); void dropEvent(QDropEvent* event); + + signals: + void screenRemoved(); + }; #endif