#ifndef WIDG_H #define WIDG_H #include "Channel.h" #include "Menu.h" #include "Message.h" #include "ProgressBar.h" #include #include #include #include #include #include #include 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 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