-
Notifications
You must be signed in to change notification settings - Fork 1
/
maindialog.h
85 lines (67 loc) · 2.78 KB
/
maindialog.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef MAINDIALOG_H
#define MAINDIALOG_H
////////////////////////////////////////////////////////////////////////////////
// MainDialog is the main application window
#include <QDialog>
#include "common.h"
#include "externalprogressbar.h"
namespace Ui {
class MainDialog;
}
class MainDialog : public QDialog
{
Q_OBJECT
public:
explicit MainDialog(QWidget *parent = 0);
~MainDialog();
private:
Ui::MainDialog *ui;
protected:
// Image file currently selected by the user
QString m_ImageFile;
// Size of the image file (cached here to avoid excessive file system requests)
quint64 m_ImageSize;
// Remember the last opened directory to suggest it automatically on next Open
QString m_LastOpenedDir;
// Whether image is being written at the moment or not
bool m_IsWriting;
// Flag indicating that flash disks enumerating is pending
bool m_EnumFlashDevicesWaiting;
// Abstraction layer for projecting the progress bar into operating system (if supported)
ExternalProgressBar m_ExtProgressBar;
// Retrieves information about the selected file and displays it in the dialog
void preprocessImageFile(const QString& newImageFile);
// Starts writing data to the device
void writeToDevice(bool zeroing);
// Frees the GUI-specific allocated resources
void cleanup();
// Reimplemented event handlers for drag&drop support
void dragEnterEvent(QDragEnterEvent* event);
void dropEvent(QDropEvent* event);
// Reimplemented event handlers for protecting dialog closing during operation
void closeEvent(QCloseEvent* event);
void keyPressEvent(QKeyEvent* event);
// Reloads the list of USB flash disks
void enumFlashDevices();
public slots:
// Suggests to select image file using the Open File dialog
void openImageFile();
// Schedules reloading the list of USB flash disks to run when possible
void scheduleEnumFlashDevices();
// Starts writing the image
void writeImageToDevice();
// Clears the selected USB device
void clearDevice();
// Updates GUI to the "writing" mode (progress bar shown, controls disabled)
// Also sets the progress bar limits
void showWritingProgress(int maxValue);
// Updates GUI to the "idle" mode (progress bar hidden, controls enabled)
void hideWritingProgress();
// Increments the progress bar counter by the specified number
void updateProgressBar(int increment);
// Displays the message about successful completion and returns to the "idle" mode
void showSuccessMessage(QString msg);
// Displays the specified error message and returns to the "idle" mode
void showErrorMessage(QString msg);
};
#endif // MAINDIALOG_H