#ifndef DBUSSERVICE_H
#define DBUSSERVICE_H

#include <QDBusConnection>
#include <QObject>
#include <QString>

namespace MultitaskView {

// 前置声明。解决dbusservice.h和multitaskviewmanager.h
// 相互引用引发QtCreator提示DBusService类型找不到的问题
class MultitaskViewManager;

class DBusService : public QObject
{
    Q_OBJECT

    Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.MultitaskView")

public:
    DBusService(MultitaskViewManager* viewManager,
                QObject *parent = nullptr);

    ~DBusService();

public slots:

    void show();

    void hide();

private:

    bool startService();

    bool stopService();

private:

    MultitaskViewManager* viewManager_ = nullptr;

    QString serviceName_ = "org.kde.KWin";

    QString servicePath_ = "/MultitaskView";

    QDBusConnection connection_;
};

} // namespace MultitaskView

#endif // DBUSSERVICE_H
