File indexing completed on 2024-03-24 15:44:20
0001 /*************************************************************************** 0002 * Copyright (C) 2012 by Daniel Nicoletti <dantti12@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; see the file COPYING. If not, write to * 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0017 * Boston, MA 02110-1301, USA. * 0018 ***************************************************************************/ 0019 0020 #pragma once 0021 0022 #include "CdDeviceInterface.h" 0023 #include <QDBusObjectPath> 0024 0025 #include "Edid.h" 0026 0027 #include "xlibandxrandr.h" 0028 0029 class Output 0030 { 0031 Q_GADGET 0032 public: 0033 typedef QSharedPointer<Output> Ptr; 0034 typedef QList<Ptr> List; 0035 Output(RROutput output, XRRScreenResources *resources); 0036 ~Output(); 0037 0038 bool isActive() const; 0039 bool isLaptop() const; 0040 bool isPrimary(bool hasXRandR13, Window root) const; 0041 QString name() const; 0042 QString id() const; 0043 void setPath(const QDBusObjectPath &path); 0044 QDBusObjectPath path() const; 0045 CdDeviceInterface *interface(); 0046 RRCrtc crtc() const; 0047 RROutput output() const; 0048 int getGammaSize() const; 0049 void setGamma(XRRCrtcGamma *gamma); 0050 0051 Edid readEdidData(); 0052 QString edidHash() const; 0053 QString connectorType() const; 0054 0055 bool operator==(const Output &output) const; 0056 0057 private: 0058 /** 0059 * Callers should delete the data if not 0 0060 */ 0061 quint8 *readEdidData(size_t &len); 0062 0063 RROutput m_output; 0064 XRRScreenResources *const m_resources; 0065 QString m_edidHash; 0066 QString m_id; 0067 CdDeviceInterface *m_interface = nullptr; 0068 QDBusObjectPath m_path; 0069 0070 bool m_active = false; 0071 bool m_isLaptop = false; 0072 QString m_name; 0073 RRCrtc m_crtc; 0074 };