2014-11-18 11:00:31 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- 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"
|
2024-10-18 22:32:27 +00:00
|
|
|
#include "ui_AddClientDialog.h"
|
2014-11-18 11:00:31 +00:00
|
|
|
|
|
|
|
|
#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-10-18 22:32:27 +00:00
|
|
|
ui{std::make_unique<Ui::AddClientDialog>()},
|
2024-10-17 18:04:35 +00:00
|
|
|
m_AddResult(kAddClientIgnore)
|
|
|
|
|
{
|
2024-10-18 22:32:27 +00:00
|
|
|
ui->setupUi(this);
|
2024-07-02 19:07:06 +00:00
|
|
|
|
2024-10-18 22:32:27 +00:00
|
|
|
ui->m_pLabelHead->setText(
|
2024-07-16 13:36:44 +00:00
|
|
|
"A client wants to connect. "
|
|
|
|
|
"Please choose a location for " +
|
2024-10-17 18:04:35 +00:00
|
|
|
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);
|
2024-10-18 22:32:27 +00:00
|
|
|
ui->gridLayout->addWidget(m_pButtonLeft, 2, 0, 1, 1, Qt::AlignCenter);
|
2024-10-17 18:04:35 +00:00
|
|
|
connect(m_pButtonLeft, &QPushButton::clicked, this, &AddClientDialog::handleButtonLeft);
|
2024-07-02 19:07:06 +00:00
|
|
|
|
|
|
|
|
m_pButtonUp = new QPushButton(this);
|
|
|
|
|
m_pButtonUp->setIcon(icon);
|
|
|
|
|
m_pButtonUp->setIconSize(IconSize);
|
2024-10-18 22:32:27 +00:00
|
|
|
ui->gridLayout->addWidget(m_pButtonUp, 1, 1, 1, 1, Qt::AlignCenter);
|
2024-10-17 18:04:35 +00:00
|
|
|
connect(m_pButtonUp, &QPushButton::clicked, this, &AddClientDialog::handleButtonUp);
|
2024-07-02 19:07:06 +00:00
|
|
|
|
|
|
|
|
m_pButtonRight = new QPushButton(this);
|
|
|
|
|
m_pButtonRight->setIcon(icon);
|
|
|
|
|
m_pButtonRight->setIconSize(IconSize);
|
2024-10-18 22:32:27 +00:00
|
|
|
ui->gridLayout->addWidget(m_pButtonRight, 2, 2, 1, 1, Qt::AlignCenter);
|
2024-10-17 18:04:35 +00:00
|
|
|
connect(m_pButtonRight, &QPushButton::clicked, this, &AddClientDialog::handleButtonRight);
|
2024-07-02 19:07:06 +00:00
|
|
|
|
|
|
|
|
m_pButtonDown = new QPushButton(this);
|
|
|
|
|
m_pButtonDown->setIcon(icon);
|
|
|
|
|
m_pButtonDown->setIconSize(IconSize);
|
2024-10-18 22:32:27 +00:00
|
|
|
ui->gridLayout->addWidget(m_pButtonDown, 3, 1, 1, 1, Qt::AlignCenter);
|
2024-10-17 18:04:35 +00:00
|
|
|
connect(m_pButtonDown, &QPushButton::clicked, this, &AddClientDialog::handleButtonDown);
|
2024-07-02 19:07:06 +00:00
|
|
|
|
|
|
|
|
m_pLabelCenter = new QLabel(this);
|
|
|
|
|
m_pLabelCenter->setPixmap(QPixmap(":res/icons/64x64/video-display.png"));
|
2024-10-18 22:32:27 +00:00
|
|
|
ui->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-10-18 22:32:27 +00:00
|
|
|
ui->m_pDialogButtonBox->setLayoutDirection(Qt::RightToLeft);
|
2014-11-20 14:28:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
2024-10-18 22:32:27 +00:00
|
|
|
QPushButton *advanced = ui->m_pDialogButtonBox->addButton("Advanced", QDialogButtonBox::HelpRole);
|
2024-10-17 18:04:35 +00:00
|
|
|
connect(advanced, &QPushButton::clicked, this, &AddClientDialog::handleButtonAdvanced);
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-18 22:32:27 +00:00
|
|
|
AddClientDialog::~AddClientDialog() = default;
|
2014-11-18 11:00:31 +00:00
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void AddClientDialog::handleButtonLeft()
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
m_AddResult = kAddClientLeft;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void AddClientDialog::handleButtonUp()
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
m_AddResult = kAddClientUp;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void AddClientDialog::handleButtonRight()
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
m_AddResult = kAddClientRight;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void AddClientDialog::handleButtonDown()
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
m_AddResult = kAddClientDown;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void AddClientDialog::handleButtonAdvanced()
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
m_AddResult = kAddClientOther;
|
|
|
|
|
close();
|
2014-11-18 11:00:31 +00:00
|
|
|
}
|