#ifndef KYLININSTALLDBUSCALLTHREAD_H
#define KYLININSTALLDBUSCALLTHREAD_H

/*#define KYLIN_OS_DBUS_SERVICE_NAME "cn.kylinos.KylinUpdateManager"
#define KYLIN_OS_DBUS_PATH  "/cn/kylinos/KylinUpdateManager"
#define KYLIN_OS_DBUS_INTERFACE_NAME "cn.kylinos.KylinUpdateManager"
*/

#define KYLIN_OS_DBUS_SERVICE_NAME "com.kylin.systemupgrade"
#define KYLIN_OS_DBUS_PATH  "/com/kylin/systemupgrade"
#define KYLIN_OS_DBUS_INTERFACE_NAME "com.kylin.systemupgrade.interface"


#include <QObject>
#include <QThread>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDebug>
#include <QDBusReply>
#include "kareclass.h"


class KylinInstalldbusCallThread  : public QThread
{
    Q_OBJECT
public:
    KylinInstalldbusCallThread(QString debPath,QString m_appName,QString m_application,QString m_applicationZh,QString m_appVersion, QString kareImage);

private:
    QString           m_debPath;

    QString           m_appName;
    QString           m_application;
    QString           m_applicationZh;
    QString           m_appVersion;

    QString           m_osVersion;

    QDBusInterface   *m_pOsServiceInterface;
    QString           m_loginUserName;
    QString           m_loginUserId;
    QString           m_kareImage;

    int SIGNAL1 = 0;

protected:
    void run();

signals:
    void kylinOsinstallStatus(bool status,QString msg);
    void kylinOsinstalldingStatus(int status);
    void kylinbatchOsinstalldingStatus(int status,QString installname);


public slots:
    void osInstallOverSoftwareAptSlots(bool status,QString erro_string,QString erro_desc);
    void osInstallOverSoftwareSnapSlots(QString string, QMap<QString, QVariant> map);
    void osInstallOverstatus(int status,QString erro_string,QString erro_desc);
    QString getUserName();
    QString getUid();
    QString osVersion();
    bool copyFile(const QString &srcFile, const QString &destFile);
  //  void onCopyFinished(const QString &fileName, bool success);
    void installApp(const QString &fileName, const QString &pkgName, const QString &application, const QString &applicationZh, const QString &version);
    void updateDekstopAndIcon(const QString &pkgName, const QString &application, const QString &applicationZh, const QString &version);
    bool generateDesktop(const QString &pkgName, const QString &application, const QString &applicationZh, const QString &version);
    void getCpuAndGpuInfo(QString &cpuType, QString &gpuVendor);
    bool isAndroidReady(const QString &username, const QString &uid);
    void generateIcon(const QString &pkgName);
   // void sendApkInfoToServer(const QString &os, const QString &cpuType, const QString &gpuVendor, const QString &pkgName, const QString &appName);
    QByteArray getInstalledAppListJsonStr();
  /*  QByteArray encrypt(const QByteArray &md5, const QByteArray &keyBase64);
    void evpError(void);*/





};

#endif // KYLININSTALLDBUSCALLTHREAD_H
