plugins/colord-integration: Expose outputs managed by Workspace
Workspace knows better about managed outputs, and it removes one more dependency on Platform::enabledOutputs() and the corresponding signals.
This commit is contained in:
parent
82c1cf3de2
commit
1fccb3daf1
1 changed files with 7 additions and 12 deletions
|
@ -7,9 +7,8 @@
|
||||||
#include "colordintegration.h"
|
#include "colordintegration.h"
|
||||||
#include "colorddevice.h"
|
#include "colorddevice.h"
|
||||||
#include "colordlogging.h"
|
#include "colordlogging.h"
|
||||||
#include "main.h"
|
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "platform.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include <QDBusPendingCallWatcher>
|
#include <QDBusPendingCallWatcher>
|
||||||
#include <QDBusServiceWatcher>
|
#include <QDBusServiceWatcher>
|
||||||
|
@ -36,26 +35,22 @@ ColordIntegration::ColordIntegration()
|
||||||
|
|
||||||
void ColordIntegration::initialize()
|
void ColordIntegration::initialize()
|
||||||
{
|
{
|
||||||
const Platform *platform = kwinApp()->platform();
|
|
||||||
|
|
||||||
m_colordInterface = new CdInterface(QStringLiteral("org.freedesktop.ColorManager"),
|
m_colordInterface = new CdInterface(QStringLiteral("org.freedesktop.ColorManager"),
|
||||||
QStringLiteral("/org/freedesktop/ColorManager"),
|
QStringLiteral("/org/freedesktop/ColorManager"),
|
||||||
QDBusConnection::systemBus(), this);
|
QDBusConnection::systemBus(), this);
|
||||||
|
|
||||||
const QVector<Output *> outputs = platform->outputs();
|
const QList<Output *> outputs = workspace()->outputs();
|
||||||
for (Output *output : outputs) {
|
for (Output *output : outputs) {
|
||||||
handleOutputAdded(output);
|
handleOutputAdded(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(platform, &Platform::outputAdded, this, &ColordIntegration::handleOutputAdded);
|
connect(workspace(), &Workspace::outputAdded, this, &ColordIntegration::handleOutputAdded);
|
||||||
connect(platform, &Platform::outputRemoved, this, &ColordIntegration::handleOutputRemoved);
|
connect(workspace(), &Workspace::outputRemoved, this, &ColordIntegration::handleOutputRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColordIntegration::teardown()
|
void ColordIntegration::teardown()
|
||||||
{
|
{
|
||||||
const Platform *platform = kwinApp()->platform();
|
const QList<Output *> outputs = workspace()->outputs();
|
||||||
|
|
||||||
const QVector<Output *> outputs = platform->outputs();
|
|
||||||
for (Output *output : outputs) {
|
for (Output *output : outputs) {
|
||||||
handleOutputRemoved(output);
|
handleOutputRemoved(output);
|
||||||
}
|
}
|
||||||
|
@ -63,8 +58,8 @@ void ColordIntegration::teardown()
|
||||||
delete m_colordInterface;
|
delete m_colordInterface;
|
||||||
m_colordInterface = nullptr;
|
m_colordInterface = nullptr;
|
||||||
|
|
||||||
disconnect(platform, &Platform::outputAdded, this, &ColordIntegration::handleOutputAdded);
|
disconnect(workspace(), &Workspace::outputAdded, this, &ColordIntegration::handleOutputAdded);
|
||||||
disconnect(platform, &Platform::outputRemoved, this, &ColordIntegration::handleOutputRemoved);
|
disconnect(workspace(), &Workspace::outputRemoved, this, &ColordIntegration::handleOutputRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColordIntegration::handleOutputAdded(Output *output)
|
void ColordIntegration::handleOutputAdded(Output *output)
|
||||||
|
|
Loading…
Reference in a new issue