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_min_x {10000}
 
int m_max_x {-1}
 
int m_min_y {10000}
 
int m_max_y {-1}
 
size_t m_max_points {10000}
 
size_t m_min_points {50}
 
size_t m_max_sequence {20}
 
int m_scale_ratio {4}
 
float m_bin_percent {0.07F}
 
MythGestureEvent::Gesture m_last_gesture {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 144 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 55 of file mythgesture.cpp.

◆ ~MythGesture()

MythGesture::~MythGesture ( )

Definition at line 97 of file mythgesture.cpp.

Member Function Documentation

◆ start()

void MythGesture::start ( void  )

Start recording.

Definition at line 120 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 128 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 111 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 146 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 273 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 197 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 168 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 103 of file mythgesture.cpp.

Referenced by record().

Member Data Documentation

◆ m_recording

bool MythGesture::m_recording {false}
private

Definition at line 219 of file mythgesture.h.

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

◆ m_min_x

int MythGesture::m_min_x {10000}
private

Definition at line 220 of file mythgesture.h.

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

◆ m_max_x

int MythGesture::m_max_x {-1}
private

Definition at line 221 of file mythgesture.h.

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

◆ m_min_y

int MythGesture::m_min_y {10000}
private

Definition at line 222 of file mythgesture.h.

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

◆ m_max_y

int MythGesture::m_max_y {-1}
private

Definition at line 223 of file mythgesture.h.

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

◆ m_max_points

size_t MythGesture::m_max_points {10000}
private

Definition at line 224 of file mythgesture.h.

Referenced by record(), and translate().

◆ m_min_points

size_t MythGesture::m_min_points {50}
private

Definition at line 225 of file mythgesture.h.

Referenced by hasMinimumPoints(), and translate().

◆ m_max_sequence

size_t MythGesture::m_max_sequence {20}
private

Definition at line 226 of file mythgesture.h.

Referenced by translate().

◆ m_scale_ratio

int MythGesture::m_scale_ratio {4}
private

Definition at line 227 of file mythgesture.h.

Referenced by translate().

◆ m_bin_percent

float MythGesture::m_bin_percent {0.07F}
private

Definition at line 228 of file mythgesture.h.

Referenced by translate().

◆ m_last_gesture

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

Definition at line 229 of file mythgesture.h.

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

◆ m_points

QList<QPoint> MythGesture::m_points
private

Definition at line 230 of file mythgesture.h.

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

◆ p

MythGesturePrivate* MythGesture::p {nullptr}
private

Definition at line 232 of file mythgesture.h.

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


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