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 "speech-plugin-object.h"
21 
22 #include "speech.h"
23 #include "speech-configuration-ui-handler.h"
24 
25 #include "configuration/gui/configuration-ui-handler-repository.h"
26 #include "gui/windows/main-configuration-window-service.h"
27 #include "gui/windows/main-configuration-window.h"
28 #include "misc/paths-provider.h"
29 #include "notification/notifier-repository.h"
30 
SpeechPluginObject(QObject * parent)31 SpeechPluginObject::SpeechPluginObject(QObject *parent) :
32 		QObject{parent}
33 {
34 }
35 
~SpeechPluginObject()36 SpeechPluginObject::~SpeechPluginObject()
37 {
38 }
39 
setConfigurationUiHandlerRepository(ConfigurationUiHandlerRepository * configurationUiHandlerRepository)40 void SpeechPluginObject::setConfigurationUiHandlerRepository(ConfigurationUiHandlerRepository *configurationUiHandlerRepository)
41 {
42 	m_configurationUiHandlerRepository = configurationUiHandlerRepository;
43 }
44 
setMainConfigurationWindowService(MainConfigurationWindowService * mainConfigurationWindowService)45 void SpeechPluginObject::setMainConfigurationWindowService(MainConfigurationWindowService *mainConfigurationWindowService)
46 {
47 	m_mainConfigurationWindowService = mainConfigurationWindowService;
48 }
49 
setNotifierRepository(NotifierRepository * notifierRepository)50 void SpeechPluginObject::setNotifierRepository(NotifierRepository *notifierRepository)
51 {
52 	m_notifierRepository = notifierRepository;
53 }
54 
setPathsProvider(PathsProvider * pathsProvider)55 void SpeechPluginObject::setPathsProvider(PathsProvider *pathsProvider)
56 {
57 	m_pathsProvider = pathsProvider;
58 }
59 
setSpeechConfigurationUiHandler(SpeechConfigurationUiHandler * speechConfigurationUiHandler)60 void SpeechPluginObject::setSpeechConfigurationUiHandler(SpeechConfigurationUiHandler *speechConfigurationUiHandler)
61 {
62 	m_speechConfigurationUiHandler = speechConfigurationUiHandler;
63 }
64 
setSpeech(Speech * speech)65 void SpeechPluginObject::setSpeech(Speech *speech)
66 {
67 	m_speech = speech;
68 }
69 
init()70 void SpeechPluginObject::init()
71 {
72 
73 	m_mainConfigurationWindowService->registerUiFile(m_pathsProvider->dataPath() + QStringLiteral("plugins/configuration/speech.ui"));
74 	m_configurationUiHandlerRepository->addConfigurationUiHandler(m_speechConfigurationUiHandler);
75 	m_notifierRepository->registerNotifier(m_speech);
76 }
77 
done()78 void SpeechPluginObject::done()
79 {
80 	m_notifierRepository->unregisterNotifier(m_speech);
81 	m_configurationUiHandlerRepository->removeConfigurationUiHandler(m_speechConfigurationUiHandler);
82 	m_mainConfigurationWindowService->unregisterUiFile(m_pathsProvider->dataPath() + QStringLiteral("plugins/configuration/speech.ui"));
83 }
84 
85 #include "moc_speech-plugin-object.cpp"
86