aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-archiver/imgDialog.h
blob: 943e3ebd13e1d65e1aac49cdfe2ff7ec424864fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//===========================================
//  Lumina-Desktop source code
//  Copyright (c) 2016, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
// Dialog front-end for the "dd" utility to burn an IMG file to a USB stick
//===========================================
#ifndef _LUMINA_ARCHIVER_IMAGE_DIALOG_H
#define _LUMINA_ARCHIVER_IMAGE_DIALOG_H
#include <QDialog>
#include <QTimer>
#include <QProcess>
#include <QCloseEvent>
#include <QDebug>
#include <QDateTime>

 namespace Ui{
	class imgDialog;
};

class imgDialog : public QDialog{
	Q_OBJECT
public:
	imgDialog(QWidget *parent = 0);
	~imgDialog();

	void loadIMG(QString filepath);
	
private:
	Ui::imgDialog *ui;
	QProcess *ddProc;
	QTimer *procTimer;
	bool BSD_signal;
	QString lastmsg;
	double unitdiv;
	QDateTime startTime;
private slots:
	void start_process();
	void cancel();
	void loadDeviceList();

	void getProcStatus();
	void procInfoAvailable();
	void procFinished();

protected:
	void closeEvent(QCloseEvent *ev){
	  if(ddProc==0 || ddProc->state()==QProcess::NotRunning){
	    //Nothing special going on
	    QDialog::closeEvent(ev); //normal close procedure
	  }else{
	    //Process running - run the cancel routine first
	    ev->ignore();
	    QTimer::singleShot(0, this, SLOT(cancel()) );
	  }
	};

};

#endif
bgstack15