File indexing completed on 2024-12-22 04:08:51

0001 /*
0002  *  SPDX-FileCopyrightText: 2012 Daniel Nicoletti <dantti12@gmail.com>
0003  *  SPDX-FileCopyrightText: 2015 Boudewijn Rempt <boud@valdyas.org>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef KIS_COLORD_H
0009 #define KIS_COLORD_H
0010 
0011 #include "dbus-types.h"
0012 
0013 #include <QDBusObjectPath>
0014 #include <QDBusServiceWatcher>
0015 #include <QDBusPendingCallWatcher>
0016 
0017 #include <QMap>
0018 #include <QString>
0019 
0020 #include <QMetaType>
0021 
0022 
0023 #define CD_PROFILE_METADATA_DATA_SOURCE_EDID     "edid"
0024 #define CD_PROFILE_METADATA_DATA_SOURCE_CALIB    "calib"
0025 #define CD_PROFILE_METADATA_DATA_SOURCE_STANDARD "standard"
0026 #define CD_PROFILE_METADATA_DATA_SOURCE_TEST     "test"
0027 
0028 class CdInterface;
0029 struct Device;
0030 
0031 
0032 #include "kritacolord_export.h"
0033 
0034 class KRITACOLORD_EXPORT KisColord : public QObject
0035 {
0036     Q_OBJECT
0037 public:
0038     KisColord(QObject *parent = 0);
0039     ~KisColord() override;
0040 
0041     QStringList devices(const QString &type) const;
0042     const QString deviceName(const QString &id) const;
0043     QByteArray deviceProfile(const QString &id, int profile);
0044 
0045 Q_SIGNALS:
0046     void changed();
0047     void changed(const QString& device);
0048 
0049 
0050 private Q_SLOTS:
0051 
0052     void serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner);
0053 
0054     void gotDevices(QDBusPendingCallWatcher *call);
0055     void deviceChanged(const QDBusObjectPath &objectPath);
0056     void deviceAdded(const QDBusObjectPath &objectPath, bool emitChanged = true);
0057     void deviceRemoved(const QDBusObjectPath &objectPath);
0058 
0059 private:
0060 
0061     void addProfilesToDevice(Device *dev, QList<QDBusObjectPath> profiles) const;
0062 
0063     QMap<QDBusObjectPath, Device*> m_devices;
0064 
0065     CdInterface *m_cdInterface;
0066 };
0067 
0068 #endif // COLORD_KCM_H