/*
 * Copyright 2022 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 (at your option) 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 <https://www.gnu.org/licenses/>.
 */

#ifndef APPMANAGER_H
#define APPMANAGER_H

#include <QObject>
#include <KWindowSystem>
#include "dbusinterfaces/statusmanagerinterface.h"
class AppManagerService;
class AppLauncher;
class WhiteListManager;
class MemoryMonitor;
class AppManager : public QObject
{
    Q_OBJECT
public:
    explicit AppManager(QObject *parent = nullptr);

    Q_INVOKABLE bool LaunchApp(const QString &desktopFile);
    Q_INVOKABLE bool LaunchAppWithArguments(const QString &desktopFile,const QStringList &args);
    Q_INVOKABLE bool LaunchXdgFile(const QString &desktopFile, const QString &fileName);
    Q_INVOKABLE bool LaunchDefaultAppWithUrl(const QString &url);
    Q_INVOKABLE void SetPowerSavingModeEnable(bool isPowerSaving);
    Q_INVOKABLE bool AddToWhiteList(const QString &desktopFile, const QString &option);
    Q_INVOKABLE bool RemoveFromWhiteList(const QString &desktopFile, const QString &option);
    Q_INVOKABLE bool ActiveProcessByWid(const uint &wid);
    Q_INVOKABLE QStringList WhiteListsOfApp(const QString &desktopFile);
    Q_INVOKABLE QString AppDesktopFileNameByPid(qint64 pid);
    Q_INVOKABLE QString AppDesktopFileNameByWid(qint64 wid);

#if 0
    Q_INVOKABLE QList<uint> RunningApplications();
#endif

Q_SIGNALS:
    void startSuccess();

private:
    AppManagerService *m_service;
    AppLauncher *m_appLauncher;
    WhiteListManager *m_whiteListManager;
    com::kylin::statusmanager::interface *m_statusManagerInterface;
#if 0
    MemoryMonitor *m_memMonitor;
#endif
};

#endif // APPMANAGER_H
