| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/dynamic-shortcuts/shortcutcatcher.cpp`/ |
| 2 | |
| 3 | #include "dynamic-shortcuts/shortcutcatcher.h"cxx . . $ `<file>/src/librssguard/dynamic-shortcuts/shortcutcatcher.h`/ |
| 4 | |
| 5 | #include "gui/reusable/plaintoolbutton.h"cxx . . $ `<file>/src/librssguard/gui/reusable/plaintoolbutton.h`/ |
| 6 | #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/ |
| 7 | |
| 8 | #include <QHBoxLayout> |
| 9 | #include <QKeySequenceEdit> |
| 10 | |
| 11 | ShortcutCatchercxx . . $ ShortcutCatcher#::ShortcutCatchercxx . . $ ShortcutCatcher#ShortcutCatcher(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 12 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent), m_isRecordingcxx . . $ ShortcutCatcher#m_isRecording.(false), m_numKeycxx . . $ ShortcutCatcher#m_numKey.(0), m_modifierKeyscxx . . $ ShortcutCatcher#m_modifierKeys.(0U) { |
| 13 | // Setup layout of the control |
| 14 | m_layoutcxx . . $ ShortcutCatcher#m_layout. = new QHBoxLayoutcxx . . $ QHBoxLayout#QHBoxLayout(108f35f7aa7f3cf9).(this); |
| 15 | |
| 16 | m_layoutcxx . . $ ShortcutCatcher#m_layout.->setContentsMarginscxx . . $ QLayout#setContentsMargins(79c4c8645766fc71).({cxx . . $ QMargins#QMargins(ced63f7c635d850d).}); |
| 17 | m_layoutcxx . . $ ShortcutCatcher#m_layout.->setSpacingcxx . . $ QBoxLayout#setSpacing(d4f767463ce0a6b3).(1); |
| 18 | |
| 19 | // Create reset button. |
| 20 | m_btnResetcxx . . $ ShortcutCatcher#m_btnReset. = new PlainToolButtoncxx . . $ PlainToolButton#PlainToolButton(108f35f7aa7f3cf9).(this); |
| 21 | m_btnResetcxx . . $ ShortcutCatcher#m_btnReset.->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("document-revert"))); |
| 22 | m_btnResetcxx . . $ ShortcutCatcher#m_btnReset.->setFocusPolicycxx . . $ QWidget#setFocusPolicy(84f385f4ea7c1696).(Qtcxx . . $ Qt/::FocusPolicycxx . . $ Qt/FocusPolicy#::NoFocuscxx . . $ Qt/NoFocus.); |
| 23 | m_btnResetcxx . . $ ShortcutCatcher#m_btnReset.->setToolTipcxx . . $ QWidget#setToolTip(3520e46b33348bf6).(trcxx . . $ ShortcutCatcher#tr(75d9f1c324b4579d).("Reset to original shortcut.")); |
| 24 | |
| 25 | // Create clear button. |
| 26 | m_btnClearcxx . . $ ShortcutCatcher#m_btnClear. = new PlainToolButtoncxx . . $ PlainToolButton#PlainToolButton(108f35f7aa7f3cf9).(this); |
| 27 | m_btnClearcxx . . $ ShortcutCatcher#m_btnClear.->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("list-remove"))); |
| 28 | m_btnClearcxx . . $ ShortcutCatcher#m_btnClear.->setFocusPolicycxx . . $ QWidget#setFocusPolicy(84f385f4ea7c1696).(Qtcxx . . $ Qt/::FocusPolicycxx . . $ Qt/FocusPolicy#::NoFocuscxx . . $ Qt/NoFocus.); |
| 29 | m_btnClearcxx . . $ ShortcutCatcher#m_btnClear.->setToolTipcxx . . $ QWidget#setToolTip(3520e46b33348bf6).(trcxx . . $ ShortcutCatcher#tr(75d9f1c324b4579d).("Clear current shortcut.")); |
| 30 | |
| 31 | // Clear main shortcut catching button. |
| 32 | m_shortcutBoxcxx . . $ ShortcutCatcher#m_shortcutBox. = new QKeySequenceEditcxx . . $ QKeySequenceEdit#QKeySequenceEdit(108f35f7aa7f3cf9).(this); |
| 33 | m_shortcutBoxcxx . . $ ShortcutCatcher#m_shortcutBox.->setFocusPolicycxx . . $ QWidget#setFocusPolicy(84f385f4ea7c1696).(Qtcxx . . $ Qt/::FocusPolicycxx . . $ Qt/FocusPolicy#::StrongFocuscxx . . $ Qt/StrongFocus.); |
| 34 | m_shortcutBoxcxx . . $ ShortcutCatcher#m_shortcutBox.->setMinimumWidthcxx . . $ QWidget#setMinimumWidth(d4f767463ce0a6b3).(170); |
| 35 | m_shortcutBoxcxx . . $ ShortcutCatcher#m_shortcutBox.->setToolTipcxx . . $ QWidget#setToolTip(3520e46b33348bf6).(trcxx . . $ ShortcutCatcher#tr(75d9f1c324b4579d).("Click and hit new shortcut.")); |
| 36 | |
| 37 | // Add all buttons to the layout. |
| 38 | m_layoutcxx . . $ ShortcutCatcher#m_layout.->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(m_shortcutBoxcxx . . $ ShortcutCatcher#m_shortcutBox.); |
| 39 | m_layoutcxx . . $ ShortcutCatcher#m_layout.->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(m_btnResetcxx . . $ ShortcutCatcher#m_btnReset.); |
| 40 | m_layoutcxx . . $ ShortcutCatcher#m_layout.->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(m_btnClearcxx . . $ ShortcutCatcher#m_btnClear.); |
| 41 | |
| 42 | // Establish needed connections. |
| 43 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_btnResetcxx . . $ ShortcutCatcher#m_btnReset., &QToolButtoncxx . . $ QToolButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &ShortcutCatchercxx . . $ ShortcutCatcher#::resetShortcutcxx . . $ ShortcutCatcher#resetShortcut(49f6e7a06ebc5aa8).); |
| 44 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_btnClearcxx . . $ ShortcutCatcher#m_btnClear., &QToolButtoncxx . . $ QToolButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &ShortcutCatchercxx . . $ ShortcutCatcher#::clearShortcutcxx . . $ ShortcutCatcher#clearShortcut(49f6e7a06ebc5aa8).); |
| 45 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_shortcutBoxcxx . . $ ShortcutCatcher#m_shortcutBox., &QKeySequenceEditcxx . . $ QKeySequenceEdit#::keySequenceChangedcxx . . $ QKeySequenceEdit#keySequenceChanged(462600f892e8a1ee)., this, &ShortcutCatchercxx . . $ ShortcutCatcher#::shortcutChangedcxx . . $ ShortcutCatcher#shortcutChanged(462600f892e8a1ee).); |
| 46 | } |
| 47 | |
| 48 | QKeySequencecxx . . $ QKeySequence# ShortcutCatchercxx . . $ ShortcutCatcher#::shortcutcxx . . $ ShortcutCatcher#shortcut(61730174ff4ccd18).() const { |
| 49 | return m_shortcutBoxcxx . . $ ShortcutCatcher#m_shortcutBox.->keySequencecxx . . $ QKeySequenceEdit#keySequence(61730174ff4ccd18).(); |
| 50 | } |
| 51 | |
| 52 | void ShortcutCatchercxx . . $ ShortcutCatcher#::setDefaultShortcutcxx . . $ ShortcutCatcher#setDefaultShortcut(462600f892e8a1ee).(const QKeySequencecxx . . $ QKeySequence#& key) { |
| 53 | m_defaultSequencecxx . . $ ShortcutCatcher#m_defaultSequence. =cxx . . $ QKeySequence#`operator=`(6bd9aa6c7b0adf00). key; |
| 54 | setShortcutcxx . . $ ShortcutCatcher#setShortcut(462600f892e8a1ee).(key); |
| 55 | } |
| 56 | |
| 57 | void ShortcutCatchercxx . . $ ShortcutCatcher#::setShortcutcxx . . $ ShortcutCatcher#setShortcut(462600f892e8a1ee).(const QKeySequencecxx . . $ QKeySequence#& key) { |
| 58 | m_shortcutBoxcxx . . $ ShortcutCatcher#m_shortcutBox.->setKeySequencecxx . . $ QKeySequenceEdit#setKeySequence(462600f892e8a1ee).(key); |
| 59 | } |
| 60 | |
| 61 | void ShortcutCatchercxx . . $ ShortcutCatcher#::resetShortcutcxx . . $ ShortcutCatcher#resetShortcut(49f6e7a06ebc5aa8).() { |
| 62 | setShortcutcxx . . $ ShortcutCatcher#setShortcut(462600f892e8a1ee).(m_defaultSequencecxx . . $ ShortcutCatcher#m_defaultSequence.); |
| 63 | } |
| 64 | |
| 65 | void ShortcutCatchercxx . . $ ShortcutCatcher#::clearShortcutcxx . . $ ShortcutCatcher#clearShortcut(49f6e7a06ebc5aa8).() { |
| 66 | setShortcutcxx . . $ ShortcutCatcher#setShortcut(462600f892e8a1ee).(QKeySequencecxx . . $ QKeySequence#QKeySequence(49f6e7a06ebc5aa8).()); |
| 67 | } |
| 68 | |
| 69 | QActioncxx . . $ QAction#* ShortcutCatchercxx . . $ ShortcutCatcher#::actioncxx . . $ ShortcutCatcher#action(50f6a0536a8019cb).() const { |
| 70 | return m_actioncxx . . $ ShortcutCatcher#m_action.; |
| 71 | } |
| 72 | |
| 73 | void ShortcutCatchercxx . . $ ShortcutCatcher#::setActioncxx . . $ ShortcutCatcher#setAction(92b1e80c0a7f1406).(QActioncxx . . $ QAction#* act) { |
| 74 | m_actioncxx . . $ ShortcutCatcher#m_action. = act; |
| 75 | } |