-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
126 lines (106 loc) · 4.31 KB
/
mainwindow.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
///
/// mainwindow.h
///
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
/// include
#include <QMainWindow>
#include <vector>
#include <appManager.h>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
/// friend class to implement the GUI abstract class defined in appManager.h
class GUI_Interface_Impl;
class MainWindow : public QMainWindow
{
Q_OBJECT
private slots:
/// browse to the directory to perform benchmarking
void on_dirBrowseBtn_clicked();
/// start performing the benchmark
void on_StartBtn_clicked();
/// go to the website
void on_AboutBtn_clicked();
void on_BlockSizeStartCombo_currentIndexChanged(int index);
void on_BlockSizeEndCombo_currentIndexChanged(int index);
public:
/// friend class to implement the GUI abstract class defined in appManager.h
friend class GUI_Interface_Impl;
/// constructor
MainWindow(QWidget *parent = nullptr);
~MainWindow();
/// push the directory browse view
bool SelectFileDialog(std::string & file, const std::string & filter);
/// update the GUI control to show the I/O block sizes for the test
void updateBlockSizeList();
/// get the start I/O block size index from the GUI combobox
unsigned int blockSizeStartIndex();
/// get the end IO block size index from the GUI combobox
unsigned int blockSizeEndIndex() ;
/// get the file size index from the GUI combobox
unsigned int fileSizeComboIndex() ;
/// user want to validate the write data?
bool isValidateChecked() ;
/// get the root directory
std::string rootDirectory() ;
/// update the status message on the GUI
void updateStatusMessage(std::string msg) ;
/// append the new I/O block size to the GUI
void appendToBlockSize(std::string size) ;
/// append the new write rate to the GUI
void appendToWriteRate(std::string size) ;
/// append the new read rate to the GUI
void appendToReadRate(std::string size) ;
/// enable or disable the GUI controls
void restrictGUIElements(bool state);
/// update the GUI progreess bar
void updateProgressBar(int value);
/// go to the website function
void goToWebsite();
/// GUI interface object
GUI_Interface_Impl * UI;
/// appManager object
appManager *manager;
/// Ui Mainwindow object
Ui::MainWindow *ui;
};
///
/// Class GUI_Interface_Impl driven from the abstract class GUI_Interface.
///
/// class for accessing the GUI controls.
///
class GUI_Interface_Impl : public GUI_Interface
{
public:
/// construction takes a reference from the GUI object so we can call the GUI setters and getters
GUI_Interface_Impl(MainWindow * form)
: Form(form)
{ }
virtual ~GUI_Interface_Impl() { }
/// get the start I/O block size index from the GUI combobox
virtual unsigned int blockSizeStartIndex() { return Form->blockSizeStartIndex(); }
/// get the end IO block size index from the GUI combobox
virtual unsigned int blockSizeEndIndex() { return Form->blockSizeEndIndex(); }
/// get the file size index from the GUI combobox
virtual unsigned int fileSizeComboIndex() { return Form->fileSizeComboIndex(); }
/// user want to validate the write data?
virtual bool isValidateChecked() { return Form->isValidateChecked(); }
/// get the root directory
virtual std::string rootDirectory() { return Form->rootDirectory(); }
/// update the status message on the GUI
virtual void updateStatusMessage(std::string msg) { Form->updateStatusMessage(msg); }
/// append the new I/O block size to the GUI
virtual void appendToBlockSize(std::string size) { Form->appendToBlockSize(size); }
/// append the new write rate to the GUI
virtual void appendToWriteRate(std::string size){ Form->appendToWriteRate(size); }
/// append the new read rate to the GUI
virtual void appendToReadRate(std::string size) { Form->appendToReadRate(size); }
/// enable or disable the GUI controls
virtual void restrictGUIElements(bool state) { Form->restrictGUIElements(state); }
/// update the GUI progreess bar
virtual void updateProgressBar(int value) { Form->updateProgressBar(value); }
protected:
MainWindow * Form;
};
#endif // MAINWINDOW_H