-
Notifications
You must be signed in to change notification settings - Fork 4
/
systray.cpp
42 lines (34 loc) · 1.13 KB
/
systray.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <QApplication>
#include <QDebug>
#include "systray.h"
Systray::Systray(QObject *parent) : QObject(parent)
{
m_menu = new QMenu();
QAction *a_toggle = m_menu->addAction(tr("&Show/Hide"));
m_menu->addSeparator();
QAction *a_reposition = m_menu->addAction(tr("&Reposition..."));
QAction *a_configure = m_menu->addAction(tr("&Configuration..."));
m_menu->addSeparator();
QAction *a_exit = m_menu->addAction(tr("E&xit"));
QObject::connect( a_configure, SIGNAL(triggered()), this, SIGNAL(openConfig()) );
QObject::connect( a_reposition, SIGNAL(triggered()), this, SIGNAL(openReposition()) );
QObject::connect( a_toggle, SIGNAL(triggered()), this, SIGNAL(toggle()) );
QObject::connect( a_exit, SIGNAL(triggered()), this, SLOT(exit()) );
m_systray.setContextMenu(m_menu);
QIcon icon(":/lewl.png");
m_systray.setIcon(icon);
m_systray.setVisible(true);
}
Systray::~Systray()
{
m_menu->deleteLater();
}
void Systray::showMessage(const QString &message)
{
m_systray.showMessage("TwitchOverlay", message);
}
void Systray::exit()
{
qDebug() << "Exiting...";
QApplication::exit(0);
}