Add launch of capture when the tray-icon is clicked

This commit is contained in:
lupoDharkael
2017-06-06 14:31:20 +02:00
parent 86f7655b81
commit 0ba53389d2
2 changed files with 10 additions and 1 deletions

View File

@@ -23,7 +23,6 @@
#include <QAction>
#include <QApplication>
#include <QMenu>
#include <QSystemTrayIcon>
#include <QSettings>
#include <QFile>
@@ -75,6 +74,8 @@ void Controller::createTrayIcon() {
m_trayIcon->setToolTip("Flameshot");
m_trayIcon->setContextMenu(m_trayIconMenu);
m_trayIcon->setIcon(QIcon(":img/flameshot.svg"));
connect(m_trayIcon, &QSystemTrayIcon::activated,
this, &Controller::trayIconActivated);
}
// initDefaults inits the global config in the very first run of the program
@@ -109,6 +110,12 @@ void Controller::initDefaults() {
}
}
void Controller::trayIconActivated(QSystemTrayIcon::ActivationReason r) {
if (r == QSystemTrayIcon::Trigger) {
createCapture();
}
}
// creation of a new capture
void Controller::createCapture() {
if (!m_captureWindow) {