1 /*
2  * %kadu copyright begin%
3  * Copyright 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
4  * %kadu copyright end%
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "configuration.h"
21 
22 #include "configuration/configuration-api.h"
23 #include "configuration/deprecated-configuration-api.h"
24 #include "misc/memory.h"
25 
Configuration(QString version,std::unique_ptr<ConfigurationApi> configurationApi,QObject * parent)26 Configuration::Configuration(QString version, std::unique_ptr<ConfigurationApi> configurationApi, QObject *parent) :
27 		QObject{parent},
28 		m_version{std::move(version)},
29 		m_configurationApi{std::move(configurationApi)}
30 {
31 	m_deprecatedConfigurationApi = std::make_unique<DeprecatedConfigurationApi>(m_configurationApi.get(), QStringLiteral("kadu.conf"));
32 }
33 
~Configuration()34 Configuration::~Configuration()
35 {
36 }
37 
api() const38 ConfigurationApi * Configuration::api() const
39 {
40 	return m_configurationApi.get();
41 }
42 
deprecatedApi() const43 DeprecatedConfigurationApi * Configuration::deprecatedApi() const
44 {
45 	return m_deprecatedConfigurationApi.get();
46 }
47 
touch()48 void Configuration::touch()
49 {
50 	m_configurationApi->touch(m_version);
51 }
52 
content() const53 QString Configuration::content() const
54 {
55 	return m_configurationApi->configuration();
56 }
57 
58 #include "moc_configuration.cpp"
59