~saviq/unity8/build-arm64

« back to all changes in this revision

Viewing changes to plugins/Ubuntu/Gestures/TouchGestureArea.cpp

  • Committer: Michał Sawicz
  • Date: 2016-07-15 09:51:02 UTC
  • mfrom: (2400.1.142 unity8)
  • Revision ID: michal.sawicz@canonical.com-20160715095102-hf5ac4iqnfn1itpw
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
#include "TouchGestureArea.h"
18
18
 
19
 
// local
20
 
#include "TouchOwnershipEvent.h"
21
 
#include "TouchRegistry.h"
22
 
#include "UnownedTouchEvent.h"
 
19
#include <UbuntuGestures/TouchOwnershipEvent>
 
20
#include <UbuntuGestures/TouchRegistry>
 
21
#include <UbuntuGestures/UnownedTouchEvent>
 
22
// #include "TouchRegistry.h"
 
23
// #include "UnownedTouchEvent.h"
23
24
 
24
25
#include <QGuiApplication>
25
26
#include <QStyleHints>
374
375
        }
375
376
    }
376
377
 
377
 
    if (m_candidateTouches.count() == 0) {
 
378
    if (m_candidateTouches.isEmpty()) {
378
379
        setInternalStatus(InternalStatus::WaitingForTouch);
379
380
    }
380
381
}
438
439
        }
439
440
    }
440
441
 
441
 
    if (m_watchedTouches.count() == 0) {
 
442
    if (m_watchedTouches.isEmpty()) {
442
443
        setInternalStatus(InternalStatus::WaitingForTouch);
443
444
    }
444
445
}
526
527
    if (updateable) {
527
528
        if (!dragging() && m_status == InternalStatus::Recognized) {
528
529
            bool allWantDrag = !m_liveTouchPoints.isEmpty();
529
 
            Q_FOREACH(auto point, m_liveTouchPoints) {
 
530
            Q_FOREACH(const auto &point, m_liveTouchPoints) {
530
531
                allWantDrag &= point->dragging();
531
532
            }
532
533
            // only dragging if all points are dragging.
588
589
            resyncCachedTouchPoints();
589
590
            break;
590
591
        case InternalStatus::WaitingForMoreTouches:
591
 
            m_recognitionTimer->start(m_recognitionPeriod);
 
592
            m_recognitionTimer->setInterval(m_recognitionPeriod);
 
593
            m_recognitionTimer->start();
592
594
            break;
593
595
        case InternalStatus::Recognized:
594
596
            resyncCachedTouchPoints();
595
597
            break;
596
598
        case InternalStatus::WaitingForRejection:
597
 
            m_recognitionTimer->start(m_releaseRejectPeriod);
 
599
            m_recognitionTimer->setInterval(m_releaseRejectPeriod);
 
600
            m_recognitionTimer->start();
598
601
            break;
599
602
        case InternalStatus::Rejected:
600
603
            resyncCachedTouchPoints();
643
646
QQmlListProperty<GestureTouchPoint> TouchGestureArea::touchPoints()
644
647
{
645
648
    return QQmlListProperty<GestureTouchPoint>(this,
646
 
                                                    0,
647
 
                                                    nullptr,
648
 
                                                    TouchGestureArea::touchPoint_count,
649
 
                                                    TouchGestureArea::touchPoint_at,
650
 
                                               0);
 
649
                                               nullptr,
 
650
                                               TouchGestureArea::touchPoint_count,
 
651
                                               TouchGestureArea::touchPoint_at);
651
652
}
652
653
 
653
654
int TouchGestureArea::minimumTouchPoints() const
718
719
    }
719
720
    m_candidateTouches.clear();
720
721
 
721
 
    if (m_watchedTouches.count() == 0) {
 
722
    if (m_watchedTouches.isEmpty()) {
722
723
        setInternalStatus(InternalStatus::WaitingForTouch);
723
724
    } else {
724
725
        setInternalStatus(InternalStatus::Rejected);