-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.hpp
40 lines (32 loc) · 1.12 KB
/
mainwindow.hpp
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <atomic>
#include <memory> //for std::unique_ptr
#include <thread>
//: to keep our include lists and compile times short we only provide forward
//: declarations for classes we only have pointers to
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent, const char *config_file);
~MainWindow() noexcept override;
private slots:
void closeEvent(QCloseEvent *ev) override;
void toggleRecording();
private:
// function for loading / saving the config file
QString find_config_file(const char *filename);
void load_config(const QString &filename);
void save_config(const QString &filename);
//: `std::unique_ptr` prevents us from copying objects we should only have
//: once and automatically deletes the objects when the `unique_ptr` goes
//: out of scope.
std::unique_ptr<std::thread> reader{nullptr};
std::unique_ptr<Ui::MainWindow> ui; // window pointer
std::atomic<bool> shutdown{false}; // flag indicating whether the recording thread should quit
};
#endif // MAINWINDOW_H