Changeset View
Changeset View
Standalone View
Standalone View
effects/desktopgrid/desktopgrid.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 50 | DesktopGridEffect::DesktopGridEffect() | |||
---|---|---|---|---|---|
59 | , gridSize() | 59 | , gridSize() | ||
60 | , orientation(Qt::Horizontal) | 60 | , orientation(Qt::Horizontal) | ||
61 | , activeCell(1, 1) | 61 | , activeCell(1, 1) | ||
62 | , scale() | 62 | , scale() | ||
63 | , unscaledBorder() | 63 | , unscaledBorder() | ||
64 | , scaledSize() | 64 | , scaledSize() | ||
65 | , scaledOffset() | 65 | , scaledOffset() | ||
66 | , m_proxy(0) | 66 | , m_proxy(0) | ||
67 | , m_activateAction(new QAction(this)) | ||||
67 | { | 68 | { | ||
68 | // Load shortcuts | 69 | // Load shortcuts | ||
69 | QAction* a = new QAction(this); | 70 | QAction* a = m_activateAction; | ||
70 | a->setObjectName(QStringLiteral("ShowDesktopGrid")); | 71 | a->setObjectName(QStringLiteral("ShowDesktopGrid")); | ||
71 | a->setText(i18n("Show Desktop Grid")); | 72 | a->setText(i18n("Show Desktop Grid")); | ||
72 | KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8); | 73 | KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8); | ||
73 | KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8); | 74 | KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8); | ||
74 | shortcut = KGlobalAccel::self()->shortcut(a); | 75 | shortcut = KGlobalAccel::self()->shortcut(a); | ||
75 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F8, a); | 76 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F8, a); | ||
76 | effects->registerTouchpadSwipeShortcut(SwipeDirection::Up, a); | 77 | effects->registerTouchpadSwipeShortcut(SwipeDirection::Up, a); | ||
77 | connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle())); | 78 | connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle())); | ||
Show All 34 Lines | 99 | { | |||
112 | timeline.setCurveShape(QTimeLine::EaseInOutCurve); | 113 | timeline.setCurveShape(QTimeLine::EaseInOutCurve); | ||
113 | timeline.setDuration(zoomDuration); | 114 | timeline.setDuration(zoomDuration); | ||
114 | 115 | | |||
115 | border = DesktopGridConfig::borderWidth(); | 116 | border = DesktopGridConfig::borderWidth(); | ||
116 | desktopNameAlignment = Qt::Alignment(DesktopGridConfig::desktopNameAlignment()); | 117 | desktopNameAlignment = Qt::Alignment(DesktopGridConfig::desktopNameAlignment()); | ||
117 | layoutMode = DesktopGridConfig::layoutMode(); | 118 | layoutMode = DesktopGridConfig::layoutMode(); | ||
118 | customLayoutRows = DesktopGridConfig::customLayoutRows(); | 119 | customLayoutRows = DesktopGridConfig::customLayoutRows(); | ||
119 | m_usePresentWindows = DesktopGridConfig::presentWindows(); | 120 | m_usePresentWindows = DesktopGridConfig::presentWindows(); | ||
121 | | ||||
122 | // deactivate and activate all touch border | ||||
123 | const QVector<ElectricBorder> relevantBorders{ElectricLeft, ElectricTop, ElectricRight, ElectricBottom}; | ||||
124 | for (auto e : relevantBorders) { | ||||
125 | effects->unregisterTouchBorder(e, m_activateAction); | ||||
126 | } | ||||
127 | const auto touchBorders = DesktopGridConfig::touchBorderActivate(); | ||||
128 | for (int i : touchBorders) { | ||||
129 | effects->registerTouchBorder(ElectricBorder(i), m_activateAction); | ||||
130 | } | ||||
120 | } | 131 | } | ||
121 | 132 | | |||
122 | //----------------------------------------------------------------------------- | 133 | //----------------------------------------------------------------------------- | ||
123 | // Screen painting | 134 | // Screen painting | ||
124 | 135 | | |||
125 | void DesktopGridEffect::prePaintScreen(ScreenPrePaintData& data, int time) | 136 | void DesktopGridEffect::prePaintScreen(ScreenPrePaintData& data, int time) | ||
126 | { | 137 | { | ||
127 | if (timeline.currentValue() != 0 || activated || (isUsingPresentWindows() && isMotionManagerMovingWindows())) { | 138 | if (timeline.currentValue() != 0 || activated || (isUsingPresentWindows() && isMotionManagerMovingWindows())) { | ||
▲ Show 20 Lines • Show All 1319 Lines • Show Last 20 Lines |