mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-02-13 05:54:01 +00:00
Merge pull request #25 from namecheap/feature/RND-547-flameshot-popup-on-windows-after-start-in-tray
Show notification popup after application start in tray
This commit is contained in:
@@ -36,6 +36,7 @@ GeneneralConf::GeneneralConf(QWidget *parent) : QWidget(parent) {
|
||||
initShowDesktopNotification();
|
||||
initShowTrayIcon();
|
||||
initAutostart();
|
||||
initShowStartupLaunchMessage();
|
||||
initCloseAfterCapture();
|
||||
initCopyAndCloseAfterUpload();
|
||||
|
||||
@@ -78,6 +79,10 @@ void GeneneralConf::autostartChanged(bool checked) {
|
||||
ConfigHandler().setStartupLaunch(checked);
|
||||
}
|
||||
|
||||
void GeneneralConf::showStartupLaunchMessageChanged(bool checked) {
|
||||
ConfigHandler().setShowStartupLaunchMessage(checked);
|
||||
}
|
||||
|
||||
void GeneneralConf::closeAfterCaptureChanged(bool checked) {
|
||||
ConfigHandler().setCloseAfterScreenshot(checked);
|
||||
}
|
||||
@@ -201,8 +206,7 @@ void GeneneralConf::initConfingButtons() {
|
||||
}
|
||||
|
||||
void GeneneralConf::initAutostart() {
|
||||
m_autostart =
|
||||
new QCheckBox(tr("Launch at startup"), this);
|
||||
m_autostart = new QCheckBox(tr("Launch at startup"), this);
|
||||
ConfigHandler config;
|
||||
bool checked = config.startupLaunchValue();
|
||||
m_autostart->setChecked(checked);
|
||||
@@ -213,6 +217,19 @@ void GeneneralConf::initAutostart() {
|
||||
&GeneneralConf::autostartChanged);
|
||||
}
|
||||
|
||||
void GeneneralConf::initShowStartupLaunchMessage() {
|
||||
m_showStartupLaunchMessage = new QCheckBox(tr("Show welcome message on launch"), this);
|
||||
ConfigHandler config;
|
||||
bool checked = config.showStartupLaunchMessage();
|
||||
m_showStartupLaunchMessage->setChecked(checked);
|
||||
m_showStartupLaunchMessage->setToolTip(tr("Launch Flameshot"));
|
||||
m_layout->addWidget(m_showStartupLaunchMessage);
|
||||
|
||||
connect(m_showStartupLaunchMessage, &QCheckBox::clicked, [](bool checked) {
|
||||
ConfigHandler().setShowStartupLaunchMessage(checked);
|
||||
});
|
||||
}
|
||||
|
||||
void GeneneralConf::initCloseAfterCapture() {
|
||||
m_closeAfterCapture = new QCheckBox(tr("Close application after capture"), this);
|
||||
ConfigHandler config;
|
||||
|
||||
@@ -36,6 +36,7 @@ private slots:
|
||||
void showDesktopNotificationChanged(bool checked);
|
||||
void showTrayIconChanged(bool checked);
|
||||
void autostartChanged(bool checked);
|
||||
void showStartupLaunchMessageChanged(bool checked);
|
||||
void closeAfterCaptureChanged(bool checked);
|
||||
void importConfiguration();
|
||||
void exportFileConfiguration();
|
||||
@@ -47,6 +48,7 @@ private:
|
||||
QCheckBox *m_showTray;
|
||||
QCheckBox *m_helpMessage;
|
||||
QCheckBox *m_autostart;
|
||||
QCheckBox *m_showStartupLaunchMessage;
|
||||
QCheckBox *m_closeAfterCapture;
|
||||
QCheckBox *m_copyAndCloseAfterUpload;
|
||||
QPushButton *m_importButton;
|
||||
@@ -58,6 +60,7 @@ private:
|
||||
void initShowTrayIcon();
|
||||
void initConfingButtons();
|
||||
void initAutostart();
|
||||
void initShowStartupLaunchMessage();
|
||||
void initCloseAfterCapture();
|
||||
void initCopyAndCloseAfterUpload();
|
||||
};
|
||||
|
||||
@@ -226,6 +226,12 @@ void Controller::enableTrayIcon() {
|
||||
};
|
||||
connect(m_trayIcon, &QSystemTrayIcon::activated, this, trayIconActivated);
|
||||
m_trayIcon->show();
|
||||
if (ConfigHandler().showStartupLaunchMessage()) {
|
||||
m_trayIcon->showMessage("Flameshot",
|
||||
QObject::tr("Hello, I'm here! Click icon in the tray to take a screenshot or click with a right button to see more options."),
|
||||
QSystemTrayIcon::Information,
|
||||
3000);
|
||||
}
|
||||
}
|
||||
|
||||
void Controller::disableTrayIcon() {
|
||||
|
||||
@@ -321,6 +321,17 @@ void ConfigHandler::setStartupLaunch(const bool start) {
|
||||
m_settings.setValue(QStringLiteral("startupLaunch"), start);
|
||||
}
|
||||
|
||||
bool ConfigHandler::showStartupLaunchMessage() {
|
||||
if (!m_settings.contains(QStringLiteral("showStartupLaunchMessage"))) {
|
||||
m_settings.setValue(QStringLiteral("showStartupLaunchMessage"), true);
|
||||
}
|
||||
return m_settings.value(QStringLiteral("showStartupLaunchMessage")).toBool();
|
||||
}
|
||||
|
||||
void ConfigHandler::setShowStartupLaunchMessage(const bool showStartupLaunchMessage){
|
||||
m_settings.setValue(QStringLiteral("showStartupLaunchMessage"), showStartupLaunchMessage);
|
||||
}
|
||||
|
||||
int ConfigHandler::contrastOpacityValue() {
|
||||
int opacity = 190;
|
||||
if (m_settings.contains(QStringLiteral("contrastOpacity"))) {
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
bool startupLaunchValue();
|
||||
void setStartupLaunch(const bool);
|
||||
|
||||
bool showStartupLaunchMessage();
|
||||
void setShowStartupLaunchMessage(const bool);
|
||||
|
||||
int contrastOpacityValue();
|
||||
void setContrastOpacity(const int);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user