#include "SysTray.h"
#include <QApplication>
#include <QThread>

extern QThread  workThread;

SysTray::SysTray(QObject *parent) :
    QSystemTrayIcon(parent)
{
    _CreatMenu();

    setIcon(QIcon(":fm.ico"));
}

void SysTray::_CreatMenu()
{
    m_menu = new QMenu();
    m_menu->setObjectName("trayMenu");
    QAction *acQuit = new QAction(QString::fromLocal8Bit("退出"), m_menu);
    connect(acQuit, &QAction::triggered, this, &SysTray::onActionQuitTriggered);

    m_menu->addAction(acQuit);
    setContextMenu(m_menu);
}

void SysTray::onActionQuitTriggered()
{
    //workThread.terminate();

    qApp->exit(-1);
}
