Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 4a177884 authored by Roman Gilg's avatar Roman Gilg

[kded] Cleanup KScreenDaemon class

Summary:
Do not export class, privatize and unvirtualize members. Rename
config init function, cleanup includes and white space.

Test Plan: Manually in Wayland session.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: broulik, davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D16875
parent 980b1007
......@@ -19,7 +19,6 @@
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
*************************************************************************************/
#include "daemon.h"
#include "serializer.h"
#include "generator.h"
......@@ -28,22 +27,20 @@
#include "kscreen_daemon_debug.h"
#include "osdmanager.h"
#include <QTimer>
#include <QAction>
#include <QShortcut>
#include <QLoggingCategory>
#include <kscreen/log.h>
#include <kscreen/output.h>
#include <kscreen/configmonitor.h>
#include <kscreen/getconfigoperation.h>
#include <kscreen/setconfigoperation.h>
#include <KLocalizedString>
#include <KActionCollection>
#include <KPluginFactory>
#include <KGlobalAccel>
#include <kscreen/log.h>
#include <kscreen/config.h>
#include <kscreen/output.h>
#include <kscreen/configmonitor.h>
#include <kscreen/getconfigoperation.h>
#include <kscreen/setconfigoperation.h>
#include <QTimer>
#include <QAction>
#include <QShortcut>
K_PLUGIN_FACTORY_WITH_JSON(KScreenDaemonFactory,
"kscreen.json",
......@@ -59,10 +56,10 @@ KScreenDaemon::KScreenDaemon(QObject* parent, const QList< QVariant >& )
{
KScreen::Log::instance();
QMetaObject::invokeMethod(this, "requestConfig", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "getInitialConfig", Qt::QueuedConnection);
}
void KScreenDaemon::requestConfig()
void KScreenDaemon::getInitialConfig()
{
connect(new KScreen::GetConfigOperation, &KScreen::GetConfigOperation::finished,
this, [this](KScreen::ConfigOperation* op) {
......@@ -105,7 +102,6 @@ void KScreenDaemon::init()
m_lidClosedTimer->setSingleShot(true);
connect(m_lidClosedTimer, &QTimer::timeout, this, &KScreenDaemon::lidClosedTimeout);
connect(Device::self(), &Device::lidClosedChanged, this, &KScreenDaemon::lidClosedChanged);
connect(Device::self(), &Device::resumingFromSuspend, this,
[&]() {
......@@ -122,7 +118,6 @@ void KScreenDaemon::init()
m_lidClosedTimer->stop();
});
connect(Generator::self(), &Generator::ready,
this, &KScreenDaemon::applyConfig);
......@@ -215,7 +210,6 @@ void KScreenDaemon::applyOsdAction(KScreen::OsdAction::Action action)
doApplyConfig(Generator::self()->displaySwitch(Generator::Clone));
return;
}
Q_UNREACHABLE();
}
......@@ -232,7 +226,8 @@ void KScreenDaemon::applyIdealConfig()
}
}
void logConfig(const KScreen::ConfigPtr &config) {
void logConfig(const KScreen::ConfigPtr &config)
{
if (config) {
foreach (auto o, config->outputs()) {
if (o->isConnected()) {
......
/*************************************************************************************
/************************************************************************************
* Copyright (C) 2012 by Alejandro Fiestas Olivares <afiestas@kde.org> *
* Copyright 2018 Roman Gilg <subdiff@gmail.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -15,72 +16,72 @@
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
*************************************************************************************/
#ifndef KSCREEN_DAEMON_H
#define KSCREEN_DAEMON_H
#include <QVariant>
#include <kdedmodule.h>
#include "osdaction.h"
#include <kscreen/config.h>
#include "generator.h"
#include "osdmanager.h"
#include <kdedmodule.h>
class QTimer;
#include <QVariant>
namespace KScreen
{
class ConfigOperation;
class OsdManager;
}
class Q_DECL_EXPORT KScreenDaemon : public KDEDModule
class QTimer;
class KScreenDaemon : public KDEDModule
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.KScreen")
public:
KScreenDaemon(QObject *parent, const QList<QVariant>&);
~KScreenDaemon() override;
public Q_SLOTS:
virtual void requestConfig();
void init();
void applyConfig();
void applyKnownConfig();
void applyIdealConfig();
void configChanged();
void saveCurrentConfig();
void displayButton();
void lidClosedChanged(bool lidIsClosed);
void lidClosedTimeout();
void setMonitorForChanges(bool enabled);
void outputConnectedChanged();
void showOutputIdentifier();
void applyOsdAction(KScreen::OsdAction::Action action);
// DBus
void applyLayoutPreset(const QString &presetName);
Q_SIGNALS:
// DBus
void outputConnected(const QString &outputName);
void unknownOutputConnected(const QString &outputName);
protected:
virtual void doApplyConfig(const KScreen::ConfigPtr &config);
void monitorConnectedChange();
void disableOutput(KScreen::ConfigPtr &config, KScreen::OutputPtr &output);
void showOsd(const QString &icon, const QString &text);
KScreen::ConfigPtr m_monitoredConfig;
bool m_monitoring;
QTimer* m_changeCompressor;
QTimer* m_saveTimer;
QTimer* m_lidClosedTimer;
KScreen::OsdManager *m_osdManager;
public:
KScreenDaemon(QObject *parent, const QList<QVariant>&);
~KScreenDaemon() override;
public Q_SLOTS:
// DBus
void applyLayoutPreset(const QString &presetName);
Q_SIGNALS:
// DBus
void outputConnected(const QString &outputName);
void unknownOutputConnected(const QString &outputName);
private:
Q_INVOKABLE void getInitialConfig();
void init();
void applyConfig();
void applyKnownConfig();
void applyIdealConfig();
void configChanged();
void saveCurrentConfig();
void displayButton();
void lidClosedChanged(bool lidIsClosed);
void lidClosedTimeout();
void setMonitorForChanges(bool enabled);
void outputConnectedChanged();
void showOutputIdentifier();
void applyOsdAction(KScreen::OsdAction::Action action);
void doApplyConfig(const KScreen::ConfigPtr &config);
void monitorConnectedChange();
void disableOutput(KScreen::ConfigPtr &config, KScreen::OutputPtr &output);
void showOsd(const QString &icon, const QString &text);
KScreen::ConfigPtr m_monitoredConfig;
bool m_monitoring;
QTimer* m_changeCompressor;
QTimer* m_saveTimer;
QTimer* m_lidClosedTimer;
KScreen::OsdManager *m_osdManager;
};
#endif /*KSCREEN_DAEMON_H*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment