MythTV  master
Public Member Functions | Protected Member Functions | Private Attributes | List of all members

Contains the points in a stroke, and translates them into gestures. More...

#include <mythgesture.h>

Collaboration diagram for MythGesture:
Collaboration graph
[legend]

Public Member Functions

 MythGesture (size_t max_points=10000, size_t min_points=50, size_t max_sequence=20, size_t scale_ratio=4, float bin_percent=0.07)
 Create a new stroke, specifying tuning values. More...
 
 ~MythGesture ()
 
void start (void)
 Start recording. More...
 
void stop (void)
 Stop recording. More...
 
bool recording (void) const
 Determine if the stroke is being recorded. More...
 
MythGestureEventgesture (void) const
 Complete the gesture event of the last completed stroke. More...
 
bool record (const QPoint &p)
 Record a point. More...
 
bool hasMinimumPoints (void) const
 Determine if the stroke has the minimum required points. More...
 

Protected Member Functions

QString translate (void)
 Translate the stroke into a sequence. More...
 
void adjustExtremes (int x, int y)
 Adjust horizontal and vertical extremes. More...
 

Private Attributes

bool m_recording {false}
 
int m_minX {10000}
 
int m_maxX {-1}
 
int m_minY {10000}
 
int m_maxY {-1}
 
size_t m_maxPoints {10000}
 
size_t m_minPoints {50}
 
size_t m_maxSequence {20}
 
int m_scaleRatio {4}
 
float m_binPercent {0.07F}
 
MythGestureEvent::Gesture m_lastGesture {MythGestureEvent::MaxGesture}
 
QList< QPoint > m_points
 
MythGesturePrivatep {nullptr}
 

Detailed Description

Contains the points in a stroke, and translates them into gestures.

Because the indended use of the stop method is to be called by either the expiration of a timer or when an event is called (or both at the same time) it must have a mutex.

Definition at line 146 of file mythgesture.h.

Constructor & Destructor Documentation

◆ MythGesture()

MythGesture::MythGesture ( size_t  max_points = 10000,
size_t  min_points = 50,
size_t  max_sequence = 20,
size_t  scale_ratio = 4,
float  bin_percent = 0.07 
)
explicit

Create a new stroke, specifying tuning values.

Parameters
max_pointsThe maximum number of points to record.
min_pointsThe minimum number of points to record.
max_sequenceThe maximum producible sequence size.
scale_ratioThe stroke scale ratio
bin_percentThe bin count percentage required to add to the sequence.

Definition at line 59 of file mythgesture.cpp.

◆ ~MythGesture()

MythGesture::~MythGesture ( )

Definition at line 101 of file mythgesture.cpp.

Member Function Documentation

◆ start()

void MythGesture::start ( void  )

Start recording.

Definition at line 124 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter().

◆ stop()

void MythGesture::stop ( void  )

Stop recording.

This method stores the gesture, as it is, and resets all information.

Definition at line 132 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter(), and MythMainWindow::mouseTimeout().

◆ recording()

bool MythGesture::recording ( void  ) const

Determine if the stroke is being recorded.

Returns
True if recording is in progress, otherwise, false.

Definition at line 115 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter(), MythMainWindow::mouseTimeout(), and record().

◆ gesture()

MythGestureEvent * MythGesture::gesture ( void  ) const

Complete the gesture event of the last completed stroke.

Returns
A new gesture event, or nullptr on error.

Definition at line 150 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter(), and MythMainWindow::mouseTimeout().

◆ record()

bool MythGesture::record ( const QPoint &  p)

Record a point.

Parameters
pThe point to record.
Returns
True if the point was recorded, otherwise, false.

Definition at line 272 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter().

◆ hasMinimumPoints()

bool MythGesture::hasMinimumPoints ( void  ) const
inline

Determine if the stroke has the minimum required points.

Returns
true if the gesture can be translated, otherwise, false.

Definition at line 199 of file mythgesture.h.

◆ translate()

QString MythGesture::translate ( void  )
protected

Translate the stroke into a sequence.

Returns
The sequence string made by the mouse.
Note
The points will be removed during this method.

Definition at line 172 of file mythgesture.cpp.

Referenced by stop().

◆ adjustExtremes()

void MythGesture::adjustExtremes ( int  x,
int  y 
)
protected

Adjust horizontal and vertical extremes.

Parameters
xThe new horizontal extreme.
yThe new vertical extreme

Definition at line 107 of file mythgesture.cpp.

Referenced by record().

Member Data Documentation

◆ m_recording

bool MythGesture::m_recording {false}
private

Definition at line 221 of file mythgesture.h.

Referenced by recording(), start(), and stop().

◆ m_minX

int MythGesture::m_minX {10000}
private

Definition at line 222 of file mythgesture.h.

Referenced by adjustExtremes(), stop(), and translate().

◆ m_maxX

int MythGesture::m_maxX {-1}
private

Definition at line 223 of file mythgesture.h.

Referenced by adjustExtremes(), stop(), and translate().

◆ m_minY

int MythGesture::m_minY {10000}
private

Definition at line 224 of file mythgesture.h.

Referenced by adjustExtremes(), stop(), and translate().

◆ m_maxY

int MythGesture::m_maxY {-1}
private

Definition at line 225 of file mythgesture.h.

Referenced by adjustExtremes(), stop(), and translate().

◆ m_maxPoints

size_t MythGesture::m_maxPoints {10000}
private

Definition at line 226 of file mythgesture.h.

Referenced by record(), and translate().

◆ m_minPoints

size_t MythGesture::m_minPoints {50}
private

Definition at line 227 of file mythgesture.h.

Referenced by hasMinimumPoints(), and translate().

◆ m_maxSequence

size_t MythGesture::m_maxSequence {20}
private

Definition at line 228 of file mythgesture.h.

Referenced by translate().

◆ m_scaleRatio

int MythGesture::m_scaleRatio {4}
private

Definition at line 229 of file mythgesture.h.

Referenced by translate().

◆ m_binPercent

float MythGesture::m_binPercent {0.07F}
private

Definition at line 230 of file mythgesture.h.

Referenced by translate().

◆ m_lastGesture

MythGestureEvent::Gesture MythGesture::m_lastGesture {MythGestureEvent::MaxGesture}
private

Definition at line 231 of file mythgesture.h.

Referenced by gesture(), MythGesture(), and stop().

◆ m_points

QList<QPoint> MythGesture::m_points
private

Definition at line 232 of file mythgesture.h.

Referenced by hasMinimumPoints(), record(), and translate().

◆ p

MythGesturePrivate* MythGesture::p {nullptr}
private

Definition at line 234 of file mythgesture.h.

Referenced by MythGesture(), recording(), start(), stop(), and ~MythGesture().


The documentation for this class was generated from the following files: