File indexing completed on 2024-05-12 09:36:13

0001 /*
0002  *  SPDX-FileCopyrightText: 2021 Méven Car <meven.car@enioka.com>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 #pragma once
0007 
0008 #include "qwayland-kde-output-device-v2.h"
0009 
0010 #include <QObject>
0011 #include <QSize>
0012 
0013 namespace KScreen
0014 {
0015 class WaylandOutputDeviceMode : public QObject, public QtWayland::kde_output_device_mode_v2
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     WaylandOutputDeviceMode(struct ::kde_output_device_mode_v2 *object);
0021 
0022     ~WaylandOutputDeviceMode() override;
0023 
0024     int refreshRate() const;
0025     QSize size() const;
0026     bool preferred() const;
0027 
0028     bool operator==(const WaylandOutputDeviceMode &other);
0029 
0030     static WaylandOutputDeviceMode *get(struct ::kde_output_device_mode_v2 *object);
0031 
0032 Q_SIGNALS:
0033     void removed();
0034 
0035 protected:
0036     void kde_output_device_mode_v2_size(int32_t width, int32_t height) override;
0037     void kde_output_device_mode_v2_refresh(int32_t refresh) override;
0038     void kde_output_device_mode_v2_preferred() override;
0039     void kde_output_device_mode_v2_removed() override;
0040 
0041 private:
0042     int m_refreshRate = 60000;
0043     QSize m_size;
0044     bool m_preferred = false;
0045 };
0046 
0047 }