41 lines
1006 B
C
41 lines
1006 B
C
|
#ifndef WIDGET_H
|
||
|
#define WIDGET_H
|
||
|
|
||
|
#include <QWidget>
|
||
|
|
||
|
class CdcUpdater;
|
||
|
class QSerialPortInfo;
|
||
|
class QLineEdit;
|
||
|
class QPushButton;
|
||
|
class QProgressBar;
|
||
|
class QLabel;
|
||
|
|
||
|
class Widget : public QWidget {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
Widget(QWidget *parent = nullptr);
|
||
|
~Widget();
|
||
|
void start();
|
||
|
|
||
|
protected:
|
||
|
void onCdcDeviceDiscovered(const QSerialPortInfo &info);
|
||
|
void onSelectButtonClicked();
|
||
|
void onUpdateFinished();
|
||
|
void dragEnterEvent(QDragEnterEvent *event) final;
|
||
|
void dropEvent(QDropEvent *event) final;
|
||
|
void setControlsEnabled(bool enabled);
|
||
|
void setProgress(int32_t progress);
|
||
|
void setMessage(const QString &message);
|
||
|
|
||
|
private:
|
||
|
QLineEdit *m_fileEditor = nullptr;
|
||
|
QPushButton *m_selectButton = nullptr;
|
||
|
QPushButton *m_startButton = nullptr;
|
||
|
std::shared_ptr<CdcUpdater> m_updater;
|
||
|
bool m_updating = false;
|
||
|
QProgressBar *m_progressBar = nullptr;
|
||
|
QLabel *m_messageLabel = nullptr;
|
||
|
};
|
||
|
#endif // WIDGET_H
|