File indexing completed on 2024-04-28 16:49:43

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #ifndef KSCREEN_DOCTOR_H
0008 #define KSCREEN_DOCTOR_H
0009 
0010 #include <QCommandLineParser>
0011 #include <QObject>
0012 
0013 #include "output.h"
0014 #include "types.h"
0015 
0016 namespace KScreen
0017 {
0018 class ConfigOperation;
0019 class Dpms;
0020 
0021 class Doctor : public QObject
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit Doctor(QObject *parent = nullptr);
0027     ~Doctor() override;
0028 
0029     void setOptionList(const QStringList &positionalArgs);
0030     void start(QCommandLineParser *m_parser);
0031     void configReceived(KScreen::ConfigOperation *op);
0032     OutputPtr findOutput(const QString &query);
0033     KScreen::ModePtr findMode(OutputPtr output, const QString &query);
0034 
0035     void showBackends() const;
0036     void showOutputs() const;
0037     void showJson() const;
0038 
0039     void setEnabled(OutputPtr output, bool enable = true);
0040     void setPosition(OutputPtr output, const QPoint &pos);
0041     bool setMode(OutputPtr output, const QString &query);
0042     void setScale(OutputPtr output, qreal scale);
0043     void setRotation(OutputPtr output, KScreen::Output::Rotation rot);
0044     void setOverscan(OutputPtr output, uint32_t overscan);
0045     void setVrrPolicy(OutputPtr output, KScreen::Output::VrrPolicy policy);
0046     void setRgbRange(OutputPtr output, KScreen::Output::RgbRange rgbRange);
0047     void setPrimary(OutputPtr output);
0048     void setPriority(OutputPtr output, uint32_t priority);
0049 
0050 Q_SIGNALS:
0051     void outputsChanged();
0052     void started();
0053     void configChanged();
0054 
0055 private:
0056     // static QString modeString(KWayland::Server::OutputDeviceInterface* outputdevice, int mid);
0057     void applyConfig();
0058     void parseOutputArgs();
0059     KScreen::ConfigPtr m_config;
0060     QCommandLineParser *m_parser;
0061     bool m_changed;
0062     QStringList m_outputArgs;
0063     Dpms *m_dpmsClient;
0064 };
0065 
0066 } // namespace
0067 
0068 #endif // KSCREEN_WAYLAND_SCREEN_H