/* -*- Mode: C++; indent-tabs-mode: nil; tab-width: 4 -*-
 * -*- coding: utf-8 -*-
 *
 * Copyright (C) 2023 KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef XRANDR_ADAPTOR_H
#define XRANDR_ADAPTOR_H

#include <QtCore/QObject>
#include <QtDBus/QtDBus>
QT_BEGIN_NAMESPACE
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QVariant;
QT_END_NAMESPACE

/*
 * Adaptor class for interface org.ukui.SettingsDaemon.xrandr
 */
class XrandrAdaptor: public QDBusAbstractAdaptor
{
    Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", "org.ukui.SettingsDaemon.xrandr")
    Q_CLASSINFO("D-Bus Introspection", ""
                                       "  <interface name=\"org.ukui.SettingsDaemon.xrandr\">\n"
                                       "    <signal name=\"screensParamChanged\">\n"
                                       "    <arg direction=\"out\" type=\"i\" name=\"screensParam\"/>\n"
                                       "    </signal>\n"
                                       "    <signal name=\"screenModeChanged\">\n"
                                       "      <arg direction=\"out\" type=\"i\" name=\"screenMode\"/>\n"
                                       "    </signal>\n"
                                       "    <signal name=\"primaryChanged\">\n"
                                       "      <arg direction=\"out\" type=\"i\" name=\"x\"/>\n"
                                       "      <arg direction=\"out\" type=\"i\" name=\"y\"/>\n"
                                       "      <arg direction=\"out\" type=\"i\" name=\"width\"/>\n"
                                       "      <arg direction=\"out\" type=\"i\" name=\"height\"/>\n"
                                       "      <arg direction=\"out\" type=\"i\" name=\"rotation\"/>\n"
                                       "    </signal>\n"
                                       "    <signal name=\"screenAdded\">\n"
                                       "      <arg direction=\"out\" type=\"s\" name=\"screenName\"/>\n"
                                       "    </signal>\n"
                                       "    <signal name=\"screenRemoved\">\n"
                                       "      <arg direction=\"out\" type=\"s\" name=\"screenName\"/>\n"
                                       "    </signal>\n"
                                       "    <signal name=\"screenStateChanged\">\n"
                                       "      <arg direction=\"out\" type=\"s\" name=\"screenName\"/>\n"
                                       "      <arg direction=\"out\" type=\"i\" name=\"state\"/>\n"
                                       "    </signal>\n"
                                       "    <method name=\"getScreensParam\">\n"
                                       "      <arg direction=\"out\" type=\"s\"/>\n"
                                       "      <arg direction=\"in\" type=\"s\" name=\"appName\"/>\n"
                                       "    </method>\n"
                                       "    <method name=\"setScreensParam\">\n"
                                       "      <arg direction=\"out\" type=\"i\"/>\n"
                                       "      <arg direction=\"in\" type=\"s\" name=\"screensParam\"/>\n"
                                       "      <arg direction=\"in\" type=\"s\" name=\"appName\"/>\n"
                                       "    </method>\n"
                                       "    <method name=\"setScreenMode\">\n"
                                       "      <arg direction=\"out\" type=\"i\"/>\n"
                                       "      <arg direction=\"in\" type=\"s\" name=\"modeName\"/>\n"
                                       "      <arg direction=\"in\" type=\"s\" name=\"appName\"/>\n"
                                       "    </method>\n"
                                       "    <method name=\"getScreenMode\">\n"
                                       "      <arg direction=\"out\" type=\"i\"/>\n"
                                       "      <arg direction=\"in\" type=\"s\" name=\"appName\"/>\n"
                                       "    </method>\n"
                                       "  </interface>\n"
                                       "")
public:
    XrandrAdaptor(QObject *parent);
    virtual ~XrandrAdaptor();

public: // PROPERTIES

public Q_SLOTS: // METHODS
    int setScreenMode(const QString &modeName, const QString &appName);
    int setScreensParam(const QString &modeName, const QString &appName);

    int getScreenMode(const QString &appName);
    QString getScreensParam(const QString &appName);

Q_SIGNALS: // SIGNALS
    void screensParamChanged(const QString &screensParam);
    void screenModeChanged(const int screenMode);
    void screenAdded(QString screenName);
    void screenRemoved(QString screenName);
    void screenStateChanged(QString screenName, bool state);
    void primaryChanged(const int x, const int y, const int width, const int height, const int rotation);
};

#endif
