mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-02-02 08:37:38 +00:00
Add launch of capture when the tray-icon is clicked
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user