2 Copyright (C) 2012, 2013 by Glad Deschrijver <glad.deschrijver@gmail.com>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License or (at your option) version 3 or any later version
8 accepted by the membership of KDE e.V. (or its successor approved
9 by the membership of KDE e.V.), which shall act as a proxy
10 defined in Section 14 of version 3 of the license.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "ShortcutConfigDialog.h"
23 #ifndef QT_NO_SHORTCUT
25 #include <QDialogButtonBox>
27 #include "ShortcutConfigWidget.h"
28 #include "ShortcutHandler.h"
33 ShortcutConfigDialog::ShortcutConfigDialog(QWidget
*parent
)
37 setWindowTitle(tr("Configure Shortcuts") + QLatin1String(" - ") + tr("Trojitá"));
39 m_shortcutConfigWidget
= new ShortcutConfigWidget(this);
40 connect(m_shortcutConfigWidget
, &ShortcutConfigWidget::shortcutsChanged
, this, &ShortcutConfigDialog::shortcutsChanged
);
42 QDialogButtonBox
*buttonBox
= new QDialogButtonBox(this);
43 buttonBox
->addButton(QDialogButtonBox::Ok
);
44 buttonBox
->addButton(QDialogButtonBox::Cancel
);
45 connect(buttonBox
, &QDialogButtonBox::accepted
, this, &ShortcutConfigDialog::accept
);
46 connect(buttonBox
, &QDialogButtonBox::rejected
, this, &ShortcutConfigDialog::reject
);
48 QWidget
*buttonWidget
= new QWidget(this);
49 QHBoxLayout
*buttonLayout
= new QHBoxLayout(buttonWidget
);
50 buttonLayout
->addWidget(m_shortcutConfigWidget
->clearButton());
51 buttonLayout
->addWidget(m_shortcutConfigWidget
->useDefaultButton());
52 buttonLayout
->addStretch();
53 buttonLayout
->addWidget(buttonBox
);
54 buttonLayout
->setContentsMargins(0, 0, 0, 0);
56 QVBoxLayout
*mainLayout
= new QVBoxLayout
;
57 mainLayout
->addWidget(m_shortcutConfigWidget
);
58 mainLayout
->addWidget(buttonWidget
);
59 setLayout(mainLayout
);
62 ShortcutConfigDialog::~ShortcutConfigDialog()
66 /***************************************************************************/
68 void ShortcutConfigDialog::setExclusivityGroups(const QList
<QStringList
> &groups
)
70 m_shortcutConfigWidget
->setExclusivityGroups(groups
);
73 void ShortcutConfigDialog::setActionDescriptions(const QHash
<QString
, ActionDescription
> &actionDescriptions
)
75 m_shortcutConfigWidget
->setActionDescriptions(actionDescriptions
);
78 /***************************************************************************/
80 void ShortcutConfigDialog::accept()
82 m_shortcutConfigWidget
->accept();
86 void ShortcutConfigDialog::reject()
88 m_shortcutConfigWidget
->reject();
94 #endif // QT_NO_SHORTCUT