60 lines
939 B
C
60 lines
939 B
C
|
#ifndef WIDG_H
|
||
|
#define WIDG_H
|
||
|
|
||
|
#include "Menu.h"
|
||
|
#include <QMap>
|
||
|
#include <QSerialPort>
|
||
|
#include <QSerialPortInfo>
|
||
|
#include <QTimer>
|
||
|
#include <QWidget>
|
||
|
|
||
|
namespace Ui {
|
||
|
class Widget;
|
||
|
}
|
||
|
|
||
|
class Widget : public QWidget {
|
||
|
Q_OBJECT
|
||
|
enum Command {
|
||
|
Playback,
|
||
|
Next,
|
||
|
Previous,
|
||
|
Forward,
|
||
|
Back,
|
||
|
Pause,
|
||
|
Return,
|
||
|
Enter
|
||
|
};
|
||
|
|
||
|
public:
|
||
|
explicit Widget(QWidget* parent = 0);
|
||
|
~Widget();
|
||
|
|
||
|
public slots:
|
||
|
void showPlayList();
|
||
|
|
||
|
private slots:
|
||
|
void onSerialError(QSerialPort::SerialPortError error);
|
||
|
void onTimeout();
|
||
|
void onReadyRead();
|
||
|
|
||
|
private:
|
||
|
Ui::Widget* ui;
|
||
|
QStringList fileList;
|
||
|
|
||
|
QTimer* timer;
|
||
|
QSerialPort* serialPort;
|
||
|
QMap<QString, Command> commandMap;
|
||
|
|
||
|
bool isPlayback = false;
|
||
|
QString curChannelName;
|
||
|
QString curFileName;
|
||
|
|
||
|
Menu* menu;
|
||
|
|
||
|
private:
|
||
|
void initSerialPort();
|
||
|
void initCommandMap();
|
||
|
};
|
||
|
|
||
|
#endif // WIDG_H
|