Add m_update-object and prepare for doing the bootloader setup for downloading
the device controller firmware.
This commit is contained in:
		
							
								
								
									
										29
									
								
								mainwindow.h
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								mainwindow.h
									
									
									
									
									
								
							@@ -10,6 +10,10 @@ namespace Ui { class MainWindow; }
 | 
				
			|||||||
QT_END_NAMESPACE
 | 
					QT_END_NAMESPACE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "worker.h"
 | 
					#include "worker.h"
 | 
				
			||||||
 | 
					#include "update.h"
 | 
				
			||||||
 | 
					#include "update_dc_event.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define EMERGENCY_LEAVE_BL 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class hwinf;
 | 
					class hwinf;
 | 
				
			||||||
class MainWindow : public QMainWindow {
 | 
					class MainWindow : public QMainWindow {
 | 
				
			||||||
@@ -19,39 +23,60 @@ protected:
 | 
				
			|||||||
    void customEvent(QEvent *event) override;
 | 
					    void customEvent(QEvent *event) override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    MainWindow(hwinf *hw, Worker *worker, QWidget *parent = nullptr);
 | 
					    MainWindow(hwinf *hw, Worker *worker, Update *update, QWidget *parent = nullptr);
 | 
				
			||||||
    ~MainWindow();
 | 
					    ~MainWindow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static const int START_PROGRESS_LOOP = -1;
 | 
					    static const int START_PROGRESS_LOOP = -1;
 | 
				
			||||||
    static const int STOP_PROGRESS_LOOP = -2;
 | 
					    static const int STOP_PROGRESS_LOOP = -2;
 | 
				
			||||||
 | 
					    static const int BL_START_COUNT = 5;
 | 
				
			||||||
 | 
					    static const int BL_CHECK_COUNT = 5;
 | 
				
			||||||
 | 
					    static const int BL_IS_UP_COUNT = 5;
 | 
				
			||||||
 | 
					    static const int BL_STOP_COUNT = 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int progressValue() const { return m_progressValue; }
 | 
					    int progressValue() const { return m_progressValue; }
 | 
				
			||||||
    hwinf *getPlugin() { return m_hw; }
 | 
					    hwinf *getPlugin() { return m_hw; }
 | 
				
			||||||
    hwinf const *getPlugin() const { return m_hw; }
 | 
					    hwinf const *getPlugin() const { return m_hw; }
 | 
				
			||||||
 | 
					    Update *getUpdate() { return m_update; }
 | 
				
			||||||
 | 
					    Update const *getUpdate() const { return m_update; }
 | 
				
			||||||
 | 
					    UpdateDcEvent::UpdateStep updateStep() const { return m_updateStep; }
 | 
				
			||||||
 | 
					    void setUpdateStep(UpdateDcEvent::UpdateStep updateStep) { m_updateStep = updateStep; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public slots:
 | 
					public slots:
 | 
				
			||||||
    void onAppendText(QString, QString suffix = "");
 | 
					    void onAppendText(QString, QString suffix = "");
 | 
				
			||||||
    void onReplaceLast(QStringList, QString suffix = "");
 | 
					    void onReplaceLast(QStringList, QString suffix = "");
 | 
				
			||||||
    void onReplaceLast(QString, QString suffix = "");
 | 
					    void onReplaceLast(QString, QString suffix = "");
 | 
				
			||||||
    void onShowErrorMessage(QString, QString);
 | 
					    void onShowErrorMessage(QString, QString);
 | 
				
			||||||
 | 
					    void onShowStatusMessage(QString, QString);
 | 
				
			||||||
    void onStopStartTimer();
 | 
					    void onStopStartTimer();
 | 
				
			||||||
    void onRestartExitTimer();
 | 
					    void onRestartExitTimer();
 | 
				
			||||||
    void onEnableExit();
 | 
					    void onEnableExit();
 | 
				
			||||||
    void onDisableExit();
 | 
					    void onDisableExit();
 | 
				
			||||||
 | 
					#if EMERGENCY_LEAVE_BL==1
 | 
				
			||||||
 | 
					    void emergencyLeaveBL();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					signals:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if EMERGENCY_LEAVE_BL==1
 | 
				
			||||||
 | 
					    void leaveBL();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private slots:
 | 
					private slots:
 | 
				
			||||||
    void onQuit();
 | 
					    void onQuit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    void scrollDownTextEdit();
 | 
					    void scrollDownTextEdit();
 | 
				
			||||||
 | 
					    void onShowMessage(QString, QString);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Ui::MainWindow *ui;
 | 
					    Ui::MainWindow *ui;
 | 
				
			||||||
    hwinf *m_hw;
 | 
					    hwinf *m_hw;
 | 
				
			||||||
    Worker *m_worker;
 | 
					    Worker *m_worker;
 | 
				
			||||||
    int m_width;
 | 
					    int const m_width;
 | 
				
			||||||
    QTimer *m_startTimer;
 | 
					    QTimer *m_startTimer;
 | 
				
			||||||
    QTimer *m_exitTimer;
 | 
					    QTimer *m_exitTimer;
 | 
				
			||||||
    bool m_progressRunning;
 | 
					    bool m_progressRunning;
 | 
				
			||||||
    int m_progressValue;
 | 
					    int m_progressValue;
 | 
				
			||||||
 | 
					    Update *m_update;
 | 
				
			||||||
 | 
					    UpdateDcEvent::UpdateStep m_updateStep;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
#endif // MAINWINDOW_H
 | 
					#endif // MAINWINDOW_H
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user