on xenial help sign in
no need to prepend namespace when using is set
commit3b0ac700342e3924448fa0f7864253a86b299d73 authorZsombor Egri <zsombor.egri@canonical.com> dateWed 13 Jul 2016, 10:29 (10 years ago) parent5062185
5 files changed+19−17
plugins/Ubuntu/Gestures/AxisVelocityCalculator.cpp+3−3 plugins/Ubuntu/Gestures/TouchGate.cpp+7−5 plugins/Ubuntu/Gestures/TouchGestureArea.cpp+7−7 tests/plugins/Ubuntu/Gestures/tst_AxisVelocityCalculator.cpp+1−1 tests/utils/modules/Unity/Test/testutil.cpp+1−1
plugins/Ubuntu/Gestures/AxisVelocityCalculator.cpp+3−3
@@ -24,11 +24,11 @@
2424UG_USE_NAMESPACE
2525
2626AxisVelocityCalculator::AxisVelocityCalculator(QObject *parent)
27− : AxisVelocityCalculator(UG_PREPEND_NAMESPACE(SharedTimeSource)(new UG_PREPEND_NAMESPACE(RealTimeSource)), parent)
27+ : AxisVelocityCalculator(SharedTimeSource(new RealTimeSource), parent)
2828{
2929}
3030
31−AxisVelocityCalculator::AxisVelocityCalculator(const UG_PREPEND_NAMESPACE(SharedTimeSource) &timeSource,
31+AxisVelocityCalculator::AxisVelocityCalculator(const SharedTimeSource &timeSource,
3232 QObject *parent)
3333 : QObject(parent)
3434 , m_timeSource(timeSource)
@@ -136,7 +136,7 @@ int AxisVelocityCalculator::numSamples() const
136136 }
137137}
138138
139−void AxisVelocityCalculator::setTimeSource(const UG_PREPEND_NAMESPACE(SharedTimeSource) &timeSource)
139+void AxisVelocityCalculator::setTimeSource(const SharedTimeSource &timeSource)
140140{
141141 m_timeSource = timeSource;
142142
plugins/Ubuntu/Gestures/TouchGate.cpp+7−5
@@ -30,6 +30,8 @@
3030#define ugDebug(params) ((void)0)
3131#endif // TOUCHGATE_DEBUG
3232
33+UG_USE_NAMESPACE
34+
3335TouchGate::TouchGate(QQuickItem *parent)
3436 : QQuickItem(parent)
3537{
@@ -39,8 +41,8 @@ TouchGate::TouchGate(QQuickItem *parent)
3941
4042bool TouchGate::event(QEvent *e)
4143{
42− if (e->type() == UG_PREPEND_NAMESPACE(TouchOwnershipEvent)::touchOwnershipEventType()) {
43− touchOwnershipEvent(static_cast<UG_PREPEND_NAMESPACE(TouchOwnershipEvent*)>(e));
44+ if (e->type() == TouchOwnershipEvent::touchOwnershipEventType()) {
45+ touchOwnershipEvent(static_cast<TouchOwnershipEvent*>(e));
4446 return true;
4547 } else {
4648 return QQuickItem::event(e);
@@ -62,7 +64,7 @@ void TouchGate::touchEvent(QTouchEvent *event)
6264 Q_ASSERT(!m_touchInfoMap.contains(touchPoint.id()));
6365 m_touchInfoMap[touchPoint.id()].ownership = OwnershipRequested;
6466 m_touchInfoMap[touchPoint.id()].ended = false;
65− UG_PREPEND_NAMESPACE(TouchRegistry)::instance()->requestTouchOwnership(touchPoint.id(), this);
67+ TouchRegistry::instance()->requestTouchOwnership(touchPoint.id(), this);
6668 }
6769
6870 if (m_touchInfoMap.contains(touchPoint.id())) {
@@ -107,12 +109,12 @@ void TouchGate::itemChange(ItemChange change, const ItemChangeData &value)
107109{
108110 if (change == QQuickItem::ItemSceneChange) {
109111 if (value.window != nullptr) {
110− value.window->installEventFilter(UG_PREPEND_NAMESPACE(TouchRegistry)::instance());
112+ value.window->installEventFilter(TouchRegistry::instance());
111113 }
112114 }
113115}
114116
115−void TouchGate::touchOwnershipEvent(UG_PREPEND_NAMESPACE(TouchOwnershipEvent) *event)
117+void TouchGate::touchOwnershipEvent(TouchOwnershipEvent *event)
116118{
117119 // TODO: Optimization: batch those actions as TouchOwnershipEvents
118120 // might come one right after the other.
plugins/Ubuntu/Gestures/TouchGestureArea.cpp+7−7
@@ -137,7 +137,7 @@ TouchGestureArea::TouchGestureArea(QQuickItem* parent)
137137 , m_recognitionPeriod(50)
138138 , m_releaseRejectPeriod(100)
139139{
140− setRecognitionTimer(new UG_PREPEND_NAMESPACE(Timer)(this));
140+ setRecognitionTimer(new Timer(this));
141141 m_recognitionTimer->setInterval(m_recognitionPeriod);
142142 m_recognitionTimer->setSingleShot(true);
143143}
@@ -154,18 +154,18 @@ TouchGestureArea::~TouchGestureArea()
154154bool TouchGestureArea::event(QEvent *event)
155155{
156156 // Process unowned touch events (handles update/release for incomplete gestures)
157− if (event->type() == UG_PREPEND_NAMESPACE(TouchOwnershipEvent)::touchOwnershipEventType()) {
158− touchOwnershipEvent(static_cast<UG_PREPEND_NAMESPACE(TouchOwnershipEvent*)>(event));
157+ if (event->type() == TouchOwnershipEvent::touchOwnershipEventType()) {
158+ touchOwnershipEvent(static_cast<TouchOwnershipEvent*>(event));
159159 return true;
160− } else if (event->type() == UG_PREPEND_NAMESPACE(UnownedTouchEvent)::unownedTouchEventType()) {
161− unownedTouchEvent(static_cast<UG_PREPEND_NAMESPACE(UnownedTouchEvent*)>(event)->touchEvent());
160+ } else if (event->type() == UnownedTouchEvent::unownedTouchEventType()) {
161+ unownedTouchEvent(static_cast<UnownedTouchEvent*>(event)->touchEvent());
162162 return true;
163163 }
164164
165165 return QQuickItem::event(event);
166166}
167167
168−void TouchGestureArea::touchOwnershipEvent(UG_PREPEND_NAMESPACE(TouchOwnershipEvent) *event)
168+void TouchGestureArea::touchOwnershipEvent(TouchOwnershipEvent *event)
169169{
170170 int touchId = event->touchId();
171171 tgaDebug("touchOwnershipEvent - id:" << touchId << ", gained:" << event->gained());
@@ -610,7 +610,7 @@ void TouchGestureArea::setInternalStatus(uint newStatus)
610610 }
611611}
612612
613−void TouchGestureArea::setRecognitionTimer(UG_PREPEND_NAMESPACE(AbstractTimer) *timer)
613+void TouchGestureArea::setRecognitionTimer(AbstractTimer *timer)
614614{
615615 int interval = 0;
616616 bool timerWasRunning = false;
tests/plugins/Ubuntu/Gestures/tst_AxisVelocityCalculator.cpp+1−1
@@ -20,7 +20,7 @@
2020
2121#include <AxisVelocityCalculator.h>
2222
23−class FakeTimeSource : public UbuntuGestures::TimeSource {
23+class FakeTimeSource : public UG_PREPEND_NAMESPACE(TimeSource) {
2424public:
2525 FakeTimeSource() : m_value(0) {}
2626
tests/utils/modules/Unity/Test/testutil.cpp+1−1
@@ -82,7 +82,7 @@ TouchEventSequenceWrapper *TestUtil::touchEvent(QQuickItem *item)
8282 // Tests can be *very* slow to run and we don't want things timing out because
8383 // of that. So give it fake timers to use (they will never time out)
8484 if (!m_putFakeTimerFactoryInTouchRegistry) {
85− UG_PREPEND_NAMESPACE(TouchRegistry)::instance()->setTimerFactory(new UG_PREPEND_NAMESPACE(FakeTimerFactory));
85+ TouchRegistry::instance()->setTimerFactory(new FakeTimerFactory);
8686 m_putFakeTimerFactoryInTouchRegistry = true;
8787 }
8888