diff --git a/src/config/geneneralconf.cpp b/src/config/geneneralconf.cpp index a5ef99f5..66b1664d 100644 --- a/src/config/geneneralconf.cpp +++ b/src/config/geneneralconf.cpp @@ -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; diff --git a/src/config/geneneralconf.h b/src/config/geneneralconf.h index ae40ef76..4f1b0877 100644 --- a/src/config/geneneralconf.h +++ b/src/config/geneneralconf.h @@ -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(); }; diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 18382678..9777d053 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -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() { diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index d9dcd5b7..573778e3 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -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"))) { diff --git a/src/utils/confighandler.h b/src/utils/confighandler.h index f37704cf..1690caeb 100644 --- a/src/utils/confighandler.h +++ b/src/utils/confighandler.h @@ -67,6 +67,9 @@ public: bool startupLaunchValue(); void setStartupLaunch(const bool); + bool showStartupLaunchMessage(); + void setShowStartupLaunchMessage(const bool); + int contrastOpacityValue(); void setContrastOpacity(const int);