1 /*
2  * %kadu copyright begin%
3  * Copyright 2015 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-ui-handler-repository.h"
21 
ConfigurationUiHandlerRepository(QObject * parent)22 ConfigurationUiHandlerRepository::ConfigurationUiHandlerRepository(QObject *parent) :
23 		QObject{parent}
24 {
25 }
26 
~ConfigurationUiHandlerRepository()27 ConfigurationUiHandlerRepository::~ConfigurationUiHandlerRepository()
28 {
29 }
30 
addConfigurationUiHandler(ConfigurationUiHandler * configurationUiHandler)31 void ConfigurationUiHandlerRepository::addConfigurationUiHandler(ConfigurationUiHandler *configurationUiHandler)
32 {
33 	auto found = std::find(begin(), end(), configurationUiHandler);
34 	if (found == end())
35 	{
36 		m_configuratorUiHandlers.push_back(configurationUiHandler);
37 		emit configurationUiHandlerAdded(configurationUiHandler);
38 	}
39 }
40 
removeConfigurationUiHandler(ConfigurationUiHandler * configurationUiHandler)41 void ConfigurationUiHandlerRepository::removeConfigurationUiHandler(ConfigurationUiHandler *configurationUiHandler)
42 {
43 	auto found = std::find(begin(), end(), configurationUiHandler);
44 	if (found != end())
45 	{
46 		m_configuratorUiHandlers.erase(found);
47 		emit configurationUiHandlerRemoved(configurationUiHandler);
48 	}
49 }
50