#ifndef MAINPROGRAM_H
#define MAINPROGRAM_H

#include "daemon/bluetoothdbus.h"
#include "config/config.h"
#include "mainwidget/traywidget.h"
#include "fileSend/bluetoothfiletransferwidget.h"
#include "component/kyfiledialog.h"
#include "pin/pincodewidget.h"
#include "activeConn/activeconnectionwidget.h"
#include "fileReceive/filereceivingpopupwidget.h"
#include "fileSend/bluetoothfiletransferwidget.h"

#include "ukuistylehelper/ukuistylehelper.h"

#include <glib.h>
#include <glib/gprintf.h>

#include <QString>
#include <QDebug>
#include <QGSettings>
#include <QMap>
#include <QVariant>
#include <QDebug>
#include <QFileDialog>
#include <QListView>
#include <QTreeView>
#include <QFileSystemWatcher>
#include <QStandardPaths>
#define LIST_PATH "/etc/pairDevice.list"

class KDbusInterface;

class MainProgram : public QObject
{
    Q_OBJECT
public:
    explicit MainProgram(bool intel, QObject *parent = nullptr);
    ~MainProgram();
    bool exit_flag = false;

private slots:
    void closeSession();
    void sendFiles(QString address, QString type);

private slots:
    void gsettingsChangedSlot(const QString &);
    void sendTransferFilesMesgSlot(QStringList);
    void sendTransferDeviceMesgSlot(QString address);
    void activeConnectionSlot(QString address, QString name, QString type, int rssi, int timeout);
    void receiveFileSlot(QString address, QString name, QString filename, QString type, QString source, quint64 size);
    void displayPasskeySlot(QString name, QString passkey);
    void requestConfirmationSlot(QString name, QString passkey);

private:
    void initGSettingInfo();

    bool _mIntel;
    QTimer *replyTimer;
    QStringList selectedFiles;
    QMap<QString,QVariant> _mGsetting;
    ActiveConnectionWidget *activeConnectionWidget = nullptr;
    FileReceivingPopupWidget *receiving_widget = nullptr;
    Config *_mConfig = nullptr;
    BluetoothDbus        *_sessionDbus = nullptr;
    BluetoothFileTransferWidget *fileSendWidget = nullptr;
    QList<QString>         *deviceAddressList = nullptr;
    QList<QString>         *deviceTypeList = nullptr;
    PinCodeWidget *pincodewidget = nullptr;
    PinCodeWidget *Keypincodewidget = nullptr;
    QString m_Passkey;

    TrayWidget                *UI = nullptr;
};

#endif // MAINPROGRAM_H
