#ifndef CONFIG_H
#define CONFIG_H

#include <QObject>
#include <QGSettings>
#include <QString>
#include <QByteArray>
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDebug>
#include <QProcess>
#include <QFile>
#include <QTimer>
#include <QDBusReply>

extern "C"
{
    #include <string>
    #include <glib.h>
    #include <glib/gprintf.h>
}

//全局变量，是否是华为机器, 默认false, 在config.cpp文件定义
enum Environment
{
    NOMAL = 0,
    HUAWEI,
    LAIKA,
    MAVIS
};

//gsetting name define

//名称请勿随意改动，会导致升级时获取的gsetting值不一致，
#define GSETTING_STR_BLUETOOTH_POWER_SWTICH          "switch"
#define GSETTING_STR_BLUETOOTH_DISCOVERABLE_SWTICH   "bluetooth-discoverable-switch"
#define GSETTING_STR_FINALLY_CONNECT_THE_DEVICE      "finally-connect-the-device"
#define GSETTING_STR_ADAPTER_ADDRESS                 "adapter-address"
#define GSETTING_STR_FILE_SAVE_PATH                  "file-save-path"
#define GSETTING_STR_ADAPTER_ADDRESS_LIST            "adapter-address-list"
#define GSETTING_STR_ACTIVE_CONNECTION               "active-connection"
#define GSETTING_STR_ACTIVE_CONNECTION_TRAN          "activeConnection"

#define GSETTING_SCHEMA_UKUIBLUETOOH "org.ukui.bluetooth"
#define GSETTING_SCHEMA_UKCC "org.ukui.control-center.plugins"
#define GSETTING_PACH_UKCC "/org/ukui/control-center/plugins/Bluetooth/"

extern Environment envPC;

class Config : public QObject
{
public:
    Config(QObject *parent = nullptr);
    ~Config();

    static QGSettings *gsetting;
    static QGSettings *ukccGsetting;

    static void SendNotifyMessage(QString);
    static void OpenBluetoothSettings();
    static void CommandToOpenBluetoothSettings();
    static void AppManagerToOpenBluetoothSettings();
    static void LaunchUI();
    static QStringList getDeviceConnectTimeList(QString);
    static void writeKeyFile(QString,QString,qint32);
    static void removeKey(QString);

private:
    QString setting_name;
};

#endif // CONFIG_H
