-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathmain.cpp
47 lines (35 loc) · 1.23 KB
/
main.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
#include <csignal>
#include <iostream>
#include "WallpaperEngine/Application/CApplicationContext.h"
#include "WallpaperEngine/Application/CWallpaperApplication.h"
#include "WallpaperEngine/WebBrowser/CWebBrowserContext.h"
#include "common.h"
WallpaperEngine::Application::CWallpaperApplication* appPointer;
void signalhandler(int sig)
{
if (appPointer == nullptr)
return;
appPointer->signal (sig);
}
void initLogging ()
{
sLog.addOutput (new std::ostream (std::cout.rdbuf ()));
sLog.addError (new std::ostream (std::cerr.rdbuf ()));
}
int main (int argc, char* argv[]) {
initLogging ();
WallpaperEngine::WebBrowser::CWebBrowserContext webBrowserContext(argc, argv);
WallpaperEngine::Application::CApplicationContext appContext (argc, argv);
// halt if the list-properties option was specified
if (appContext.settings.general.onlyListProperties)
return 0;
WallpaperEngine::Application::CWallpaperApplication app (appContext, webBrowserContext);
appPointer = &app;
// attach signals to gracefully stop
std::signal (SIGINT, signalhandler);
std::signal (SIGTERM, signalhandler);
// show the wallpaper application
app.show ();
appPointer = nullptr;
return 0;
}