The Player class.
More...
#include <Player.h>
The Player class.
The CSV player class allows users to select a CSV file and "re-play" it with Serial Studio.
◆ Player() [1/3]
◆ Player() [2/3]
CSV::Player::Player |
( |
Player && |
| ) |
|
|
privatedelete |
◆ Player() [3/3]
CSV::Player::Player |
( |
const Player & |
| ) |
|
|
privatedelete |
◆ closeFile
void CSV::Player::closeFile |
( |
| ) |
|
|
slot |
Closes the file & cleans up internal variables. This helps us to reduice memory usage & prepare the module to load another CSV file.
◆ csvFilesPath()
QString CSV::Player::csvFilesPath |
( |
| ) |
const |
Returns the default path for CSV files
◆ filename()
QString CSV::Player::filename |
( |
| ) |
const |
Returns the short filename of the current CSV file
◆ frameCount()
int CSV::Player::frameCount |
( |
| ) |
const |
Returns the total number of frames in the CSV file. This can be calculated by getting the number of rows of the CSV and substracting 1 (because the title cells do not count as a valid frame).
◆ framePosition()
int CSV::Player::framePosition |
( |
| ) |
const |
Returns the current row that we are using to create the JSON data that is feed to the JsonParser class.
◆ getCellValue()
QString CSV::Player::getCellValue |
( |
const int |
row, |
|
|
const int |
column, |
|
|
bool & |
error |
|
) |
| |
|
private |
Safely returns the value in the cell at the given row & column. If an error occurs or the cell does not exist, the value of error shall be set to true
.
◆ getFrame()
QByteArray CSV::Player::getFrame |
( |
const int |
row | ) |
|
|
private |
Generates a frame from the data at the given row. The first item of each row is ignored because it contains the RX date/time, which is used to regulate the interval at which the frames are parsed.
◆ instance()
Returns the only instance of the class
◆ isOpen()
bool CSV::Player::isOpen |
( |
| ) |
const |
Returns true
if an CSV file is open for reading
◆ isPlaying()
bool CSV::Player::isPlaying |
( |
| ) |
const |
Returns true
if the user is currently re-playing the CSV file at real-time speed.
◆ nextFrame
void CSV::Player::nextFrame |
( |
| ) |
|
|
slot |
Reads & processes the next CSV row (until we get to the last row)
◆ openChanged
void CSV::Player::openChanged |
( |
| ) |
|
|
signal |
◆ openFile [1/2]
void CSV::Player::openFile |
( |
| ) |
|
|
slot |
Lets the user select a CSV file
◆ openFile [2/2]
void CSV::Player::openFile |
( |
const QString & |
filePath | ) |
|
|
slot |
Opens a CSV file and valitates it by comparing every data row with the title row. If one of the data rows does not correspond to the title row, the CSV is considered to be invalid.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ pause
void CSV::Player::pause |
( |
| ) |
|
|
slot |
Pauses the CSV playback so that the user can see WTF happened at certain point of the mission.
◆ play
void CSV::Player::play |
( |
| ) |
|
|
slot |
Enables CSV playback at 'live' speed (as it happened when CSV file was saved to the computer).
◆ playerStateChanged
void CSV::Player::playerStateChanged |
( |
| ) |
|
|
signal |
◆ previousFrame
void CSV::Player::previousFrame |
( |
| ) |
|
|
slot |
Reads & processes the previous CSV row (until we get to the first row)
◆ progress()
qreal CSV::Player::progress |
( |
| ) |
const |
Returns the CSV playback progress in a range from 0.0 to 1.0
◆ setProgress
void CSV::Player::setProgress |
( |
const qreal & |
progress | ) |
|
|
slot |
Reads a specific row from the progress range (which can have a value ranging from 0.0 to 1.0).
◆ timestamp()
QString CSV::Player::timestamp |
( |
| ) |
const |
Returns the timestamp of the current data frame / row.
◆ timestampChanged
void CSV::Player::timestampChanged |
( |
| ) |
|
|
signal |
◆ toggle
void CSV::Player::toggle |
( |
| ) |
|
|
slot |
◆ updateData
void CSV::Player::updateData |
( |
| ) |
|
|
privateslot |
Generates a JSON data frame by combining the values of the current CSV row & the structure of the JSON map file loaded in the JsonParser
class.
If playback is enabled, this function calculates the difference in milliseconds between the current row and the next row & schedules a re-call of this function using a timer.
◆ m_csvData
QVector<QVector<QString> > CSV::Player::m_csvData |
|
private |
◆ m_csvFile
QFile CSV::Player::m_csvFile |
|
private |
◆ m_framePos
int CSV::Player::m_framePos |
|
private |
◆ m_playing
bool CSV::Player::m_playing |
|
private |
◆ m_timestamp
QString CSV::Player::m_timestamp |
|
private |
◆ isOpen
◆ isPlaying
bool CSV::Player::isPlaying |
|
read |
◆ progress
qreal CSV::Player::progress |
|
read |
◆ timestamp
QString CSV::Player::timestamp |
|
read |
The documentation for this class was generated from the following files:
- /Users/alex/Documents/GitHub/Serial-Studio/src/CSV/Player.h
- /Users/alex/Documents/GitHub/Serial-Studio/src/CSV/Player.cpp