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 "screenshot-plugin-object.h"
21 
22 #include "configuration/gui/screenshot-configuration-ui-handler.h"
23 #include "configuration/screen-shot-configuration.h"
24 #include "gui/actions/screenshot-actions.h"
25 
26 #include "configuration/gui/configuration-ui-handler-repository.h"
27 #include "gui/windows/main-configuration-window-service.h"
28 #include "gui/windows/main-configuration-window.h"
29 #include "misc/paths-provider.h"
30 
ScreenshotPluginObject(QObject * parent)31 ScreenshotPluginObject::ScreenshotPluginObject(QObject *parent) :
32 		QObject{parent}
33 {
34 }
35 
~ScreenshotPluginObject()36 ScreenshotPluginObject::~ScreenshotPluginObject()
37 {
38 }
39 
setConfigurationUiHandlerRepository(ConfigurationUiHandlerRepository * configurationUiHandlerRepository)40 void ScreenshotPluginObject::setConfigurationUiHandlerRepository(ConfigurationUiHandlerRepository *configurationUiHandlerRepository)
41 {
42 	m_configurationUiHandlerRepository = configurationUiHandlerRepository;
43 }
44 
setMainConfigurationWindowService(MainConfigurationWindowService * mainConfigurationWindowService)45 void ScreenshotPluginObject::setMainConfigurationWindowService(MainConfigurationWindowService *mainConfigurationWindowService)
46 {
47 	m_mainConfigurationWindowService = mainConfigurationWindowService;
48 }
49 
setPathsProvider(PathsProvider * pathsProvider)50 void ScreenshotPluginObject::setPathsProvider(PathsProvider *pathsProvider)
51 {
52 	m_pathsProvider = pathsProvider;
53 }
54 
setScreenshotActions(ScreenshotActions * screenshotActions)55 void ScreenshotPluginObject::setScreenshotActions(ScreenshotActions *screenshotActions)
56 {
57 	m_screenshotActions = screenshotActions;
58 }
59 
setScreenShotConfigurationUiHandler(ScreenShotConfigurationUiHandler * screenShotConfigurationUiHandler)60 void ScreenshotPluginObject::setScreenShotConfigurationUiHandler(ScreenShotConfigurationUiHandler *screenShotConfigurationUiHandler)
61 {
62 	m_screenShotConfigurationUiHandler = screenShotConfigurationUiHandler;
63 }
64 
setScreenShotConfiguration(ScreenShotConfiguration * screenShotConfiguration)65 void ScreenshotPluginObject::setScreenShotConfiguration(ScreenShotConfiguration *screenShotConfiguration)
66 {
67 	m_screenShotConfiguration = screenShotConfiguration;
68 }
69 
init()70 void ScreenshotPluginObject::init()
71 {
72 	m_mainConfigurationWindowService->registerUiFile(m_pathsProvider->dataPath() + QStringLiteral("plugins/configuration/screenshot.ui"));
73 	m_configurationUiHandlerRepository->addConfigurationUiHandler(m_screenShotConfigurationUiHandler);
74 }
75 
done()76 void ScreenshotPluginObject::done()
77 {
78 	m_configurationUiHandlerRepository->removeConfigurationUiHandler(m_screenShotConfigurationUiHandler);
79 	m_mainConfigurationWindowService->unregisterUiFile(m_pathsProvider->dataPath() + QStringLiteral("plugins/configuration/screenshot.ui"));
80 }
81 
82 #include "moc_screenshot-plugin-object.cpp"
83