File indexing completed on 2024-04-28 04:02:31
0001 /*************************************************************************** 0002 dlggrabkey.cpp - keygrabber 0003 ------------------- 0004 begin : Pi máj 30 2003 0005 copyright : (C) 2003 by Tomas Mecir 0006 email : kmuddy@kmuddy.com 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #include "dlggrabkey.h" 0019 0020 #include "kmuddy.h" 0021 0022 #include <QDialogButtonBox> 0023 #include <QLabel> 0024 #include <QPushButton> 0025 #include <QVBoxLayout> 0026 0027 #include <KLocalizedString> 0028 0029 dlgGrabKey::dlgGrabKey (QWidget *parent) : QDialog (parent) 0030 { 0031 KMuddy::self()->setGrabDialog (this); 0032 0033 //initial dialog size 0034 setWindowTitle (i18n ("Keygrabber")); 0035 QVBoxLayout *layout = new QVBoxLayout (this); 0036 0037 QLabel *label = new QLabel (i18n ("Press the desired shortcut..."), this); 0038 0039 QDialogButtonBox *buttons = new QDialogButtonBox (QDialogButtonBox::Cancel,this); 0040 QPushButton *button = buttons->button (QDialogButtonBox::Cancel); 0041 button->setDefault(true); 0042 connect (buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); 0043 connect (buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); 0044 0045 layout->addWidget (label); 0046 layout->addWidget (buttons); 0047 } 0048 0049 dlgGrabKey::~dlgGrabKey () 0050 { 0051 KMuddy::self()->setGrabDialog (nullptr); 0052 } 0053 0054 QSize dlgGrabKey::sizeHint() const 0055 { 0056 return QSize (200, 80); 0057 } 0058 0059 void dlgGrabKey::gotKey (int key, Qt::KeyboardModifiers state) 0060 { 0061 _key = key; 0062 _state = state; 0063 accept (); 0064 } 0065 0066 #include "moc_dlggrabkey.cpp"