2014-11-18 11:00:31 +00:00
|
|
|
/*
|
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
2016-09-07 14:24:00 +00:00
|
|
|
* Copyright (C) 2014-2016 Symless Ltd.
|
2014-11-18 11:00:31 +00:00
|
|
|
*
|
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2014-11-18 11:00:31 +00:00
|
|
|
*
|
|
|
|
|
* 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 "AddClientDialog.h"
|
|
|
|
|
#include "ui_AddClientDialogBase.h"
|
|
|
|
|
|
|
|
|
|
#include <QLabel>
|
2024-07-02 19:07:06 +00:00
|
|
|
#include <QPushButton>
|
2014-11-18 11:00:31 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
AddClientDialog::AddClientDialog(const QString &clientName, QWidget *parent)
|
|
|
|
|
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
2024-07-16 13:36:44 +00:00
|
|
|
Ui::AddClientDialog(),
|
|
|
|
|
m_AddResult(kAddClientIgnore) {
|
2024-07-02 19:07:06 +00:00
|
|
|
setupUi(this);
|
|
|
|
|
|
2024-07-16 13:36:44 +00:00
|
|
|
m_pLabelHead->setText(
|
|
|
|
|
"A client wants to connect. "
|
|
|
|
|
"Please choose a location for " +
|
|
|
|
|
clientName + ".");
|
2024-07-02 19:07:06 +00:00
|
|
|
|
|
|
|
|
QIcon icon(":res/icons/64x64/video-display.png");
|
|
|
|
|
QSize IconSize(32, 32);
|
|
|
|
|
|
|
|
|
|
m_pButtonLeft = new QPushButton(this);
|
|
|
|
|
m_pButtonLeft->setIcon(icon);
|
|
|
|
|
m_pButtonLeft->setIconSize(IconSize);
|
|
|
|
|
gridLayout->addWidget(m_pButtonLeft, 2, 0, 1, 1, Qt::AlignCenter);
|
|
|
|
|
connect(m_pButtonLeft, SIGNAL(clicked()), this, SLOT(handleButtonLeft()));
|
|
|
|
|
|
|
|
|
|
m_pButtonUp = new QPushButton(this);
|
|
|
|
|
m_pButtonUp->setIcon(icon);
|
|
|
|
|
m_pButtonUp->setIconSize(IconSize);
|
|
|
|
|
gridLayout->addWidget(m_pButtonUp, 1, 1, 1, 1, Qt::AlignCenter);
|
|
|
|
|
connect(m_pButtonUp, SIGNAL(clicked()), this, SLOT(handleButtonUp()));
|
|
|
|
|
|
|
|
|
|
m_pButtonRight = new QPushButton(this);
|
|
|
|
|
m_pButtonRight->setIcon(icon);
|
|
|
|
|
m_pButtonRight->setIconSize(IconSize);
|
|
|
|
|
gridLayout->addWidget(m_pButtonRight, 2, 2, 1, 1, Qt::AlignCenter);
|
|
|
|
|
connect(m_pButtonRight, SIGNAL(clicked()), this, SLOT(handleButtonRight()));
|
|
|
|
|
|
|
|
|
|
m_pButtonDown = new QPushButton(this);
|
|
|
|
|
m_pButtonDown->setIcon(icon);
|
|
|
|
|
m_pButtonDown->setIconSize(IconSize);
|
|
|
|
|
gridLayout->addWidget(m_pButtonDown, 3, 1, 1, 1, Qt::AlignCenter);
|
|
|
|
|
connect(m_pButtonDown, SIGNAL(clicked()), this, SLOT(handleButtonDown()));
|
|
|
|
|
|
|
|
|
|
m_pLabelCenter = new QLabel(this);
|
|
|
|
|
m_pLabelCenter->setPixmap(QPixmap(":res/icons/64x64/video-display.png"));
|
|
|
|
|
gridLayout->addWidget(m_pLabelCenter, 2, 1, 1, 1, Qt::AlignCenter);
|
2014-11-18 11:00:31 +00:00
|
|
|
|
2014-11-20 14:28:08 +00:00
|
|
|
#if defined(Q_OS_MAC)
|
2024-07-02 19:07:06 +00:00
|
|
|
m_pDialogButtonBox->setLayoutDirection(Qt::RightToLeft);
|
2014-11-20 14:28:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
QPushButton *advanced =
|
|
|
|
|
m_pDialogButtonBox->addButton("Advanced", QDialogButtonBox::HelpRole);
|
|
|
|
|
connect(advanced, SIGNAL(clicked()), this, SLOT(handleButtonAdvanced()));
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
AddClientDialog::~AddClientDialog() {
|
|
|
|
|
delete m_pButtonUp;
|
|
|
|
|
delete m_pButtonDown;
|
|
|
|
|
delete m_pButtonLeft;
|
|
|
|
|
delete m_pButtonRight;
|
|
|
|
|
delete m_pLabelCenter;
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void AddClientDialog::handleButtonLeft() {
|
|
|
|
|
m_AddResult = kAddClientLeft;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void AddClientDialog::handleButtonUp() {
|
|
|
|
|
m_AddResult = kAddClientUp;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void AddClientDialog::handleButtonRight() {
|
|
|
|
|
m_AddResult = kAddClientRight;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void AddClientDialog::handleButtonDown() {
|
|
|
|
|
m_AddResult = kAddClientDown;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void AddClientDialog::handleButtonAdvanced() {
|
|
|
|
|
m_AddResult = kAddClientOther;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|