-
Notifications
You must be signed in to change notification settings - Fork 2
/
sc2switcher.cpp
executable file
·49 lines (39 loc) · 1007 Bytes
/
sc2switcher.cpp
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
#include <obs-module.h>
#include <QAction>
#include <QMainWindow>
#include "Config.h"
#include "log.h"
#include "SC2Data.h"
#include "SceneSwitcher.h"
#include "ScoreTracker.h"
#include "Webhook.h"
#include "forms/SettingsDialog.h"
OBS_DECLARE_MODULE()
SceneSwitcher* sw = nullptr;
ScoreTracker* st = nullptr;
Webhook* wh = nullptr;
bool obs_module_load(void) {
obs_frontend_add_save_callback(LoadSaveHandler, nullptr);
//set up the settings dialog
QAction *action = (QAction*)obs_frontend_add_tools_menu_qaction(
"SC2Switcher");
auto cb = []() {
QMainWindow *window =
(QMainWindow*)obs_frontend_get_main_window();
SettingsDialog sd(window);
sd.exec();
};
action->connect(action, &QAction::triggered, cb);
// sc2
SC2Data::Instance = new SC2Data();
// listeners
sw = new SceneSwitcher(SC2Data::Instance);
st = new ScoreTracker(SC2Data::Instance);
wh = new Webhook(SC2Data::Instance);
return true;
}
void obs_module_unload(void) {
Config::free();
delete sw;
delete wh;
}