RecordControlApplication/Widget.h

85 lines
1.5 KiB
C++
Executable File

#ifndef WIDG_H
#define WIDG_H
#include "Channel.h"
#include "Menu.h"
#include "Message.h"
#include "ProgressBar.h"
#include <QDebug>
#include <QDir>
#include <QMap>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QTimer>
#include <QWidget>
namespace Ui {
class Widget;
}
class Widget : public QWidget {
Q_OBJECT
enum Command {
CmdPlayback,
CmdNext,
CmdPrevious,
CmdForward,
CmdBack,
CmdPause,
CmdReturn,
CmdEnter
};
public:
explicit Widget(QWidget* parent = 0);
~Widget();
public slots:
void showPlayList();
private slots:
void onSerialError(QSerialPort::SerialPortError error);
void onTimeout();
void onReadyRead();
void onProgressTimeout();
void onPlayEnd();
void onShowRecordLabel(bool show);
private:
Ui::Widget* ui;
QStringList fileList;
QTimer* timer;
QSerialPort* serialPort;
QMap<QString, Command> commandMap;
QTimer* progressTimer;
bool isPlayback = false;
QString curPlayChannel;
QString curSelectChannel;
QString curPlayFilename;
Menu* menu;
ProgressBar* progressBar;
Message* message;
private:
void initSerialPort();
void initCommandMap();
void receivePlayback();
void receivePrevious();
void receiveNext();
void seek(QString type);
void receivePasue();
void receiveEnter();
void receiveReturn();
void playOneChannel();
void playTwoChannels();
Channel* findChannelByName(QString name);
};
#endif // WIDG_H