on xenial help sign in
no need to prepend namespace when using is set
3b0ac70Zsombor Egri
plugins/Ubuntu/Gestures/AxisVelocityCalculator.cpp+3−3
@@ -24,11 +24,11 @@
24UG_USE_NAMESPACE
24UG_USE_NAMESPACE
25
25
26AxisVelocityCalculator::AxisVelocityCalculator(QObject *parent)
26AxisVelocityCalculator::AxisVelocityCalculator(QObject *parent)
27− : AxisVelocityCalculator(UG_PREPEND_NAMESPACE(SharedTimeSource)(new UG_PREPEND_NAMESPACE(RealTimeSource)), parent)
27+ : AxisVelocityCalculator(SharedTimeSource(new RealTimeSource), parent)
28{
28{
29}
29}
30
30
31−AxisVelocityCalculator::AxisVelocityCalculator(const UG_PREPEND_NAMESPACE(SharedTimeSource) &timeSource,
31+AxisVelocityCalculator::AxisVelocityCalculator(const SharedTimeSource &timeSource,
32 QObject *parent)
32 QObject *parent)
33 : QObject(parent)
33 : QObject(parent)
34 , m_timeSource(timeSource)
34 , m_timeSource(timeSource)
@@ -136,7 +136,7 @@ int AxisVelocityCalculator::numSamples() const
136 }
136 }
137}
137}
138
138
139−void AxisVelocityCalculator::setTimeSource(const UG_PREPEND_NAMESPACE(SharedTimeSource) &timeSource)
139+void AxisVelocityCalculator::setTimeSource(const SharedTimeSource &timeSource)
140{
140{
141 m_timeSource = timeSource;
141 m_timeSource = timeSource;
142
142
plugins/Ubuntu/Gestures/TouchGate.cpp+7−5
@@ -30,6 +30,8 @@
30#define ugDebug(params) ((void)0)
30#define ugDebug(params) ((void)0)
31#endif // TOUCHGATE_DEBUG
31#endif // TOUCHGATE_DEBUG
32
32
33+UG_USE_NAMESPACE
34+
33TouchGate::TouchGate(QQuickItem *parent)
35TouchGate::TouchGate(QQuickItem *parent)
34 : QQuickItem(parent)
36 : QQuickItem(parent)
35{
37{
@@ -39,8 +41,8 @@ TouchGate::TouchGate(QQuickItem *parent)
39
41
40bool TouchGate::event(QEvent *e)
42bool TouchGate::event(QEvent *e)
41{
43{
42− if (e->type() == UG_PREPEND_NAMESPACE(TouchOwnershipEvent)::touchOwnershipEventType()) {
44+ if (e->type() == TouchOwnershipEvent::touchOwnershipEventType()) {
43− touchOwnershipEvent(static_cast<UG_PREPEND_NAMESPACE(TouchOwnershipEvent*)>(e));
45+ touchOwnershipEvent(static_cast<TouchOwnershipEvent*>(e));
44 return true;
46 return true;
45 } else {
47 } else {
46 return QQuickItem::event(e);
48 return QQuickItem::event(e);
@@ -62,7 +64,7 @@ void TouchGate::touchEvent(QTouchEvent *event)
62 Q_ASSERT(!m_touchInfoMap.contains(touchPoint.id()));
64 Q_ASSERT(!m_touchInfoMap.contains(touchPoint.id()));
63 m_touchInfoMap[touchPoint.id()].ownership = OwnershipRequested;
65 m_touchInfoMap[touchPoint.id()].ownership = OwnershipRequested;
64 m_touchInfoMap[touchPoint.id()].ended = false;
66 m_touchInfoMap[touchPoint.id()].ended = false;
65− UG_PREPEND_NAMESPACE(TouchRegistry)::instance()->requestTouchOwnership(touchPoint.id(), this);
67+ TouchRegistry::instance()->requestTouchOwnership(touchPoint.id(), this);
66 }
68 }
67
69
68 if (m_touchInfoMap.contains(touchPoint.id())) {
70 if (m_touchInfoMap.contains(touchPoint.id())) {
@@ -107,12 +109,12 @@ void TouchGate::itemChange(ItemChange change, const ItemChangeData &value)
107{
109{
108 if (change == QQuickItem::ItemSceneChange) {
110 if (change == QQuickItem::ItemSceneChange) {
109 if (value.window != nullptr) {
111 if (value.window != nullptr) {
110− value.window->installEventFilter(UG_PREPEND_NAMESPACE(TouchRegistry)::instance());
112+ value.window->installEventFilter(TouchRegistry::instance());
111 }
113 }
112 }
114 }
113}
115}
114
116
115−void TouchGate::touchOwnershipEvent(UG_PREPEND_NAMESPACE(TouchOwnershipEvent) *event)
117+void TouchGate::touchOwnershipEvent(TouchOwnershipEvent *event)
116{
118{
117 // TODO: Optimization: batch those actions as TouchOwnershipEvents
119 // TODO: Optimization: batch those actions as TouchOwnershipEvents
118 // might come one right after the other.
120 // might come one right after the other.
plugins/Ubuntu/Gestures/TouchGestureArea.cpp+7−7
@@ -137,7 +137,7 @@ TouchGestureArea::TouchGestureArea(QQuickItem* parent)
137 , m_recognitionPeriod(50)
137 , m_recognitionPeriod(50)
138 , m_releaseRejectPeriod(100)
138 , m_releaseRejectPeriod(100)
139{
139{
140− setRecognitionTimer(new UG_PREPEND_NAMESPACE(Timer)(this));
140+ setRecognitionTimer(new Timer(this));
141 m_recognitionTimer->setInterval(m_recognitionPeriod);
141 m_recognitionTimer->setInterval(m_recognitionPeriod);
142 m_recognitionTimer->setSingleShot(true);
142 m_recognitionTimer->setSingleShot(true);
143}
143}
@@ -154,18 +154,18 @@ TouchGestureArea::~TouchGestureArea()
154bool TouchGestureArea::event(QEvent *event)
154bool TouchGestureArea::event(QEvent *event)
155{
155{
156 // Process unowned touch events (handles update/release for incomplete gestures)
156 // Process unowned touch events (handles update/release for incomplete gestures)
157− if (event->type() == UG_PREPEND_NAMESPACE(TouchOwnershipEvent)::touchOwnershipEventType()) {
157+ if (event->type() == TouchOwnershipEvent::touchOwnershipEventType()) {
158− touchOwnershipEvent(static_cast<UG_PREPEND_NAMESPACE(TouchOwnershipEvent*)>(event));
158+ touchOwnershipEvent(static_cast<TouchOwnershipEvent*>(event));
159 return true;
159 return true;
160− } else if (event->type() == UG_PREPEND_NAMESPACE(UnownedTouchEvent)::unownedTouchEventType()) {
160+ } else if (event->type() == UnownedTouchEvent::unownedTouchEventType()) {
161− unownedTouchEvent(static_cast<UG_PREPEND_NAMESPACE(UnownedTouchEvent*)>(event)->touchEvent());
161+ unownedTouchEvent(static_cast<UnownedTouchEvent*>(event)->touchEvent());
162 return true;
162 return true;
163 }
163 }
164
164
165 return QQuickItem::event(event);
165 return QQuickItem::event(event);
166}
166}
167
167
168−void TouchGestureArea::touchOwnershipEvent(UG_PREPEND_NAMESPACE(TouchOwnershipEvent) *event)
168+void TouchGestureArea::touchOwnershipEvent(TouchOwnershipEvent *event)
169{
169{
170 int touchId = event->touchId();
170 int touchId = event->touchId();
171 tgaDebug("touchOwnershipEvent - id:" << touchId << ", gained:" << event->gained());
171 tgaDebug("touchOwnershipEvent - id:" << touchId << ", gained:" << event->gained());
@@ -610,7 +610,7 @@ void TouchGestureArea::setInternalStatus(uint newStatus)
610 }
610 }
611}
611}
612
612
613−void TouchGestureArea::setRecognitionTimer(UG_PREPEND_NAMESPACE(AbstractTimer) *timer)
613+void TouchGestureArea::setRecognitionTimer(AbstractTimer *timer)
614{
614{
615 int interval = 0;
615 int interval = 0;
616 bool timerWasRunning = false;
616 bool timerWasRunning = false;
tests/plugins/Ubuntu/Gestures/tst_AxisVelocityCalculator.cpp+1−1
@@ -20,7 +20,7 @@
20
20
21#include <AxisVelocityCalculator.h>
21#include <AxisVelocityCalculator.h>
22
22
23−class FakeTimeSource : public UbuntuGestures::TimeSource {
23+class FakeTimeSource : public UG_PREPEND_NAMESPACE(TimeSource) {
24public:
24public:
25 FakeTimeSource() : m_value(0) {}
25 FakeTimeSource() : m_value(0) {}
26
26
tests/utils/modules/Unity/Test/testutil.cpp+1−1
@@ -82,7 +82,7 @@ TouchEventSequenceWrapper *TestUtil::touchEvent(QQuickItem *item)
82 // Tests can be *very* slow to run and we don't want things timing out because
82 // Tests can be *very* slow to run and we don't want things timing out because
83 // of that. So give it fake timers to use (they will never time out)
83 // of that. So give it fake timers to use (they will never time out)
84 if (!m_putFakeTimerFactoryInTouchRegistry) {
84 if (!m_putFakeTimerFactoryInTouchRegistry) {
85− UG_PREPEND_NAMESPACE(TouchRegistry)::instance()->setTimerFactory(new UG_PREPEND_NAMESPACE(FakeTimerFactory));
85+ TouchRegistry::instance()->setTimerFactory(new FakeTimerFactory);
86 m_putFakeTimerFactoryInTouchRegistry = true;
86 m_putFakeTimerFactoryInTouchRegistry = true;
87 }
87 }
88
88