2020-07-30 17:59:34 +08:00
|
|
|
/* -*- Mode: C++; indent-tabs-mode: nil; tab-width: 4 -*-
|
|
|
|
|
* -*- coding: utf-8 -*-
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2020 KylinSoft Co., Ltd.
|
|
|
|
|
*
|
|
|
|
|
* This program 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
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2020-10-21 12:06:10 +08:00
|
|
|
#include <QApplication>
|
|
|
|
|
#include <QScreen>
|
2021-01-21 15:10:27 +08:00
|
|
|
#include "background-plugin.h"
|
2020-03-09 15:04:02 +08:00
|
|
|
#include "clib-syslog.h"
|
2020-03-05 14:01:37 +08:00
|
|
|
|
2020-03-09 15:04:02 +08:00
|
|
|
PluginInterface* BackgroundPlugin::mInstance = nullptr;
|
2020-03-05 14:01:37 +08:00
|
|
|
|
2020-03-05 18:41:01 +08:00
|
|
|
BackgroundPlugin::BackgroundPlugin()
|
|
|
|
|
{
|
2020-10-30 09:22:18 +08:00
|
|
|
manager = new BackgroundManager();
|
2020-03-05 18:41:01 +08:00
|
|
|
}
|
2020-03-05 14:01:37 +08:00
|
|
|
|
2020-03-05 18:41:01 +08:00
|
|
|
BackgroundPlugin::~BackgroundPlugin()
|
|
|
|
|
{
|
2020-03-09 11:06:21 +08:00
|
|
|
CT_SYSLOG(LOG_DEBUG, "background plugin free...");
|
2020-10-21 12:06:10 +08:00
|
|
|
if(manager){
|
|
|
|
|
delete manager;
|
|
|
|
|
manager = nullptr;
|
|
|
|
|
}
|
2020-03-05 18:41:01 +08:00
|
|
|
}
|
|
|
|
|
|
2020-03-09 15:04:02 +08:00
|
|
|
PluginInterface *BackgroundPlugin::getInstance()
|
2020-03-05 18:41:01 +08:00
|
|
|
{
|
|
|
|
|
if (nullptr == mInstance) {
|
|
|
|
|
mInstance = new BackgroundPlugin();
|
|
|
|
|
}
|
2020-03-16 00:44:34 -07:00
|
|
|
|
2020-03-05 18:41:01 +08:00
|
|
|
return mInstance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BackgroundPlugin::activate()
|
|
|
|
|
{
|
2020-10-21 12:06:10 +08:00
|
|
|
syslog (LOG_ERR, "Activating background plugin");
|
|
|
|
|
manager->BackgroundManagerStart();
|
2020-03-05 18:41:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BackgroundPlugin::deactivate()
|
|
|
|
|
{
|
|
|
|
|
CT_SYSLOG (LOG_DEBUG, "Deactivating background plugin");
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-09 15:04:02 +08:00
|
|
|
PluginInterface* createSettingsPlugin()
|
2020-03-05 18:41:01 +08:00
|
|
|
{
|
|
|
|
|
return BackgroundPlugin::getInstance();
|
|
|
|
|
}
|