-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnthaxiaApp.cpp
More file actions
91 lines (75 loc) · 2.79 KB
/
AnthaxiaApp.cpp
File metadata and controls
91 lines (75 loc) · 2.79 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/***********************************************************************
*
* This file is part of Anthaxia.
*
* Anthaxia is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Anthaxia is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Anthaxia. If not, see <http://www.gnu.org/licenses/>.
*
***********************************************************************/
#include "AnthaxiaApp.h"
#include "Settings/Settings.h"
#include "plugins/PluginManager.h"
#include "servicesystem/serviceprovider.h"
#include "servicesystem/ModelControlService.h"
#include "model/ModelControl.h"
#include "qt/PsUI.h"
#include "Logging/Logging.h"
#include "Poco/AutoPtr.h"
#include "Poco/Path.h"
#include "Poco/Util/LoggingConfigurator.h"
#include "Poco/Util/MapConfiguration.h"
#include "Poco/Util/PropertyFileConfiguration.h"
using Poco::Path;
using Poco::Util::LoggingConfigurator;
using Poco::Util::AbstractConfiguration;
using Poco::Util::MapConfiguration;
using Poco::Util::PropertyFileConfiguration;
void AnthaxiaApp::initialize(Application& self) {
Settings::loadSettings("procsim.rc");
Poco::AutoPtr<AbstractConfiguration> pConfig;
if (Path("logging.cfg").isFile())
{
pConfig = new PropertyFileConfiguration("logging.cfg");
} else
{
pConfig = new MapConfiguration();
}
LoggingConfigurator configurator;
configurator.configure(pConfig);
Poco::LogStream log_stream(Poco::Logger::get("core.AnthaxiaApp"));
LOG_DEBUG("Logging initialized; continue initialization of the rest");
addSubsystem( new PluginManager() );
// Make sure the model control is instantiated
(void)ModelControl::getInstance();
// Make sure the service system is present
(void)ServiceSystem::getServiceSystem();
registerModelControlService();
Application::initialize(self);
}
void AnthaxiaApp::uninitialize() {
Poco::LogStream log_stream(Poco::Logger::get("core.AnthaxiaApp"));
LOG_DEBUG("Uninitializing the application");
Settings::saveSettings("procsim.rc");
}
int AnthaxiaApp::main(const std::vector<std::string>& args) {
PsUI theUI;
// TODO: This is so ugly at the moment. How can I pass the necessary
// arguments to the Qt application object??
int argc = 0;
char *argv[] = {""};
theUI.parseArgs(argc, argv);
theUI.install();
theUI.loop();
theUI.uninstall();
return EXIT_OK;
}