File indexing completed on 2024-04-21 15:08:51

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 <QQuaternion>
0023 #include <QString>
0024 
0025 class Edid
0026 {
0027 public:
0028     Edid();
0029     Edid(const quint8 *data, size_t length);
0030     bool parse(const quint8 *data, size_t length);
0031     bool isValid() const;
0032 
0033     QString deviceId(const QString &fallbackName = QString()) const;
0034     QString name() const;
0035     QString vendor() const;
0036     QString serial() const;
0037     QString eisaId() const;
0038     QString hash() const;
0039     QString pnpId() const;
0040     uint width() const;
0041     uint height() const;
0042     qreal gamma() const;
0043     QQuaternion red() const;
0044     QQuaternion green() const;
0045     QQuaternion blue() const;
0046     QQuaternion white() const;
0047 
0048 private:
0049     int edidGetBit(int in, int bit) const;
0050     int edidGetBits(int in, int begin, int end) const;
0051     double edidDecodeFraction(int high, int low) const;
0052     QString edidParseString(const quint8 *data) const;
0053 
0054     bool m_valid = false;
0055     QString m_monitorName;
0056     QString m_vendorName;
0057     QString m_serialNumber;
0058     QString m_eisaId;
0059     QString m_checksum;
0060     QString m_pnpId;
0061     uint m_width;
0062     uint m_height;
0063     qreal m_gamma;
0064     QQuaternion m_red;
0065     QQuaternion m_green;
0066     QQuaternion m_blue;
0067     QQuaternion m_white;
0068 };
0069 
0070 Q_DECLARE_METATYPE(Edid)