RecordControlApplication/Widget.h

85 lines
1.5 KiB
C
Raw Normal View History

2024-01-18 15:41:43 +08:00
#ifndef WIDG_H
#define WIDG_H
2024-03-04 16:22:40 +08:00
#include "Channel.h"
2024-01-18 15:41:43 +08:00
#include "Menu.h"
2024-03-04 16:22:40 +08:00
#include "Message.h"
#include "ProgressBar.h"
#include <QDebug>
#include <QDir>
2024-01-18 15:41:43 +08:00
#include <QMap>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QTimer>
#include <QWidget>
namespace Ui {
class Widget;
}
class Widget : public QWidget {
Q_OBJECT
enum Command {
2024-03-04 16:22:40 +08:00
CmdPlayback,
CmdNext,
CmdPrevious,
CmdForward,
CmdBack,
CmdPause,
CmdReturn,
CmdEnter
2024-01-18 15:41:43 +08:00
};
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();
2024-03-04 16:22:40 +08:00
void onShowRecordLabel(bool show);
2024-01-18 15:41:43 +08:00
private:
Ui::Widget* ui;
QStringList fileList;
QTimer* timer;
QSerialPort* serialPort;
QMap<QString, Command> commandMap;
QTimer* progressTimer;
2024-01-18 15:41:43 +08:00
bool isPlayback = false;
QString curPlayChannel;
QString curSelectChannel;
2024-03-04 16:22:40 +08:00
QString curPlayFilename;
2024-01-18 15:41:43 +08:00
Menu* menu;
ProgressBar* progressBar;
2024-03-04 16:22:40 +08:00
Message* message;
2024-01-18 15:41:43 +08:00
private:
void initSerialPort();
void initCommandMap();
2024-03-04 16:22:40 +08:00
void receivePlayback();
void receivePrevious();
void receiveNext();
void seek(QString type);
void receivePasue();
void receiveEnter();
void receiveReturn();
void playOneChannel();
void playTwoChannels();
Channel* findChannelByName(QString name);
};
2024-01-18 15:41:43 +08:00
#endif // WIDG_H