2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2008 Volker Lanz <vl@fidra.de>
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2012-06-10 16:50:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "HotkeyDialog.h"
|
2024-10-18 22:47:32 +00:00
|
|
|
#include "ui_HotkeyDialog.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
HotkeyDialog::HotkeyDialog(QWidget *parent, Hotkey &hotkey)
|
|
|
|
|
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
2024-10-18 22:47:32 +00:00
|
|
|
ui{std::make_unique<Ui::HotkeyDialog>()},
|
2024-10-17 18:04:35 +00:00
|
|
|
m_Hotkey(hotkey)
|
|
|
|
|
{
|
2024-10-18 22:47:32 +00:00
|
|
|
ui->setupUi(this);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-10-18 22:47:32 +00:00
|
|
|
ui->m_pKeySequenceWidgetHotkey->setText(m_Hotkey.text());
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-18 22:47:32 +00:00
|
|
|
HotkeyDialog::~HotkeyDialog() = default;
|
|
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
void HotkeyDialog::accept()
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
if (!sequenceWidget()->valid())
|
|
|
|
|
return;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
hotkey().setKeySequence(sequenceWidget()->keySequence());
|
|
|
|
|
QDialog::accept();
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
2024-10-18 22:47:32 +00:00
|
|
|
|
|
|
|
|
const KeySequenceWidget *HotkeyDialog::sequenceWidget() const
|
|
|
|
|
{
|
|
|
|
|
return ui->m_pKeySequenceWidgetHotkey;
|
|
|
|
|
}
|