blob: 9f4204d7e30b03b11e2b9765e1f101aeb186af27 (
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
|
#ifndef WAV_LOAD_COORDINATOR_HPP
#define WAV_LOAD_COORDINATOR_HPP
#include <functional>
#include <memory>
#include <QFutureWatcher>
#include <QObject>
#include "Audio/WavInputLoader.hpp"
class WavLoadCoordinator : public QObject
{
Q_OBJECT
public:
using Result = std::shared_ptr<Radio::WavInputResult>;
using Work = std::function<Result ()>;
explicit WavLoadCoordinator (QObject * parent = nullptr);
~WavLoadCoordinator () override;
bool start (Work work);
bool isLoading () const;
Result result () const;
void waitForFinished ();
Q_SIGNALS:
void loadingChanged (bool loading);
void resultReady ();
private:
void handleFinished ();
bool loading_ {false};
Result result_;
QFutureWatcher<Result> watcher_;
};
#endif // WAV_LOAD_COORDINATOR_HPP
|