Changeset View
Changeset View
Standalone View
Standalone View
effects/mouseclick/mouseclick.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 45 | { | |||
---|---|---|---|---|---|
47 | m_enabled = false; | 47 | m_enabled = false; | ||
48 | 48 | | |||
49 | QAction* a = new QAction(this); | 49 | QAction* a = new QAction(this); | ||
50 | a->setObjectName(QStringLiteral("ToggleMouseClick")); | 50 | a->setObjectName(QStringLiteral("ToggleMouseClick")); | ||
51 | a->setText(i18n("Toggle Mouse Click Effect")); | 51 | a->setText(i18n("Toggle Mouse Click Effect")); | ||
52 | KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Asterisk); | 52 | KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Asterisk); | ||
53 | KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Asterisk); | 53 | KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Asterisk); | ||
54 | effects->registerGlobalShortcut(Qt::META + Qt::Key_Asterisk, a); | 54 | effects->registerGlobalShortcut(Qt::META + Qt::Key_Asterisk, a); | ||
55 | connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleEnabled())); | 55 | connect(a, &QAction::triggered, this, &MouseClickEffect::toggleEnabled); | ||
56 | 56 | | |||
57 | reconfigure(ReconfigureAll); | 57 | reconfigure(ReconfigureAll); | ||
58 | 58 | | |||
59 | m_buttons[0] = new MouseButton(i18nc("Left mouse button", "Left"), Qt::LeftButton); | 59 | m_buttons[0] = new MouseButton(i18nc("Left mouse button", "Left"), Qt::LeftButton); | ||
60 | m_buttons[1] = new MouseButton(i18nc("Middle mouse button", "Middle"), Qt::MiddleButton); | 60 | m_buttons[1] = new MouseButton(i18nc("Middle mouse button", "Middle"), Qt::MiddleButton); | ||
61 | m_buttons[2] = new MouseButton(i18nc("Right mouse button", "Right"), Qt::RightButton); | 61 | m_buttons[2] = new MouseButton(i18nc("Right mouse button", "Right"), Qt::RightButton); | ||
62 | } | 62 | } | ||
63 | 63 | | |||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Line(s) | 221 | { | |||
222 | return (button & buttons) && !(button & oldButtons); | 222 | return (button & buttons) && !(button & oldButtons); | ||
223 | } | 223 | } | ||
224 | 224 | | |||
225 | void MouseClickEffect::toggleEnabled() | 225 | void MouseClickEffect::toggleEnabled() | ||
226 | { | 226 | { | ||
227 | m_enabled = !m_enabled; | 227 | m_enabled = !m_enabled; | ||
228 | 228 | | |||
229 | if (m_enabled) { | 229 | if (m_enabled) { | ||
230 | connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)), | 230 | connect(effects, &EffectsHandler::mouseChanged, this, &MouseClickEffect::slotMouseChanged); | ||
231 | SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers))); | | |||
232 | effects->startMousePolling(); | 231 | effects->startMousePolling(); | ||
233 | } else { | 232 | } else { | ||
234 | disconnect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)), | 233 | disconnect(effects, &EffectsHandler::mouseChanged, this, &MouseClickEffect::slotMouseChanged); | ||
235 | this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers))); | | |||
236 | effects->stopMousePolling(); | 234 | effects->stopMousePolling(); | ||
237 | } | 235 | } | ||
238 | 236 | | |||
239 | qDeleteAll(m_clicks); | 237 | qDeleteAll(m_clicks); | ||
240 | m_clicks.clear(); | 238 | m_clicks.clear(); | ||
241 | 239 | | |||
242 | for (int i = 0; i < BUTTON_COUNT; ++i) { | 240 | for (int i = 0; i < BUTTON_COUNT; ++i) { | ||
243 | m_buttons[i]->m_time = 0; | 241 | m_buttons[i]->m_time = 0; | ||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |