-
Notifications
You must be signed in to change notification settings - Fork 4
/
processmanager.h
53 lines (40 loc) · 1.06 KB
/
processmanager.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
#ifndef PROCESSMANAGER_H
#define PROCESSMANAGER_H
#include "sbspreset.h"
#include <QObject>
#include <QProcess>
#include <QQueue>
struct PresetRender
{
SBSPreset* preset;
QString suffix;
QSize size;
bool modified;
QProcess* process;
};
Q_DECLARE_METATYPE(PresetRender)
class ProcessManager: QObject
{
Q_OBJECT
ProcessManager();
~ProcessManager();
public:
// main entry
static ProcessManager* get();
static void SchedulePresetRender(SBSPreset* preset, QSize size, QString suffix, bool modified);
static int runningProcessCount();
static void setMaxAllowedProcesses(uint16_t numProcesses);
static void ShutDown();
private slots:
void OnTweakFinished();
signals:
void PresetRenderFinished(PresetRender* p);
private:
// TweakedPresets always take precedence
QQueue<PresetRender> tweakedPresets, runningPresets;
uint16_t numRunningProcesses();
void performSchedullerIteration();
};
extern ProcessManager* g_ProcManager;
extern uint16_t g_ProcManagerMaxAllowedProcesses;
#endif // PROCESSMANAGER_H