diff --git a/docs/dev/qsettings.md b/docs/dev/qsettings.md index 6a4c439a..d0b44b76 100644 --- a/docs/dev/qsettings.md +++ b/docs/dev/qsettings.md @@ -25,4 +25,8 @@ - show Help message - value: "showHelp" - type: bool - - description: show Help message in capture mode. + - description: show Help messages in capture mode. +- show Help message + - value: "showDesktopNotification" + - type: bool + - description: show every desktop notification. diff --git a/src/capture/capturewidget.cpp b/src/capture/capturewidget.cpp index 27715e79..df7e3e30 100644 --- a/src/capture/capturewidget.cpp +++ b/src/capture/capturewidget.cpp @@ -164,7 +164,7 @@ void CaptureWidget::paintEvent(QPaintEvent *) { QString helpTxt = tr("Select an area with the mouse, or press Esc to exit." "\nPress Enter to capture the screen." - "\nPress Right Click to choose the tool color."); + "\nPress Right Click to show the color picker."); // We draw the white contrasting background for the text, using the //same text and options to get the boundingRect that the text will have. @@ -394,10 +394,15 @@ void CaptureWidget::keyPressEvent(QKeyEvent *e) { void CaptureWidget::saveScreenshot() { hide(); + QString path; if (m_selection.isNull()) { - m_screenshot->graphicalSave(QRect(), this); + path = m_screenshot->graphicalSave(QRect(), this); } else { // save full screen when no selection - m_screenshot->graphicalSave(getExtendedSelection(), this); + path = m_screenshot->graphicalSave(getExtendedSelection(), this); + } + if (!path.isEmpty()) { + QString saveMessage(tr("Capture saved in ")); + Q_EMIT newMessage(saveMessage + path); } close(); } diff --git a/src/config/geneneralconf.cpp b/src/config/geneneralconf.cpp index 1459b0a6..1b8fc2d1 100644 --- a/src/config/geneneralconf.cpp +++ b/src/config/geneneralconf.cpp @@ -8,14 +8,19 @@ GeneneralConf::GeneneralConf(QWidget *parent) : QFrame(parent) { setFrameStyle(QFrame::StyledPanel); m_layout = new QVBoxLayout(this); - initHelpShow(); + initShowHelp(); + initShowDesktopNotification(); } void GeneneralConf::showHelpChanged(bool checked) { QSettings().setValue("showHelp", checked); } -void GeneneralConf::initHelpShow() { +void GeneneralConf::showDesktopNotificationChanged(bool checked) { + QSettings().setValue("showDesktopNotification", checked); +} + +void GeneneralConf::initShowHelp() { QCheckBox *c = new QCheckBox(tr("Show help message"), this); QSettings settings; bool checked = settings.value("showHelp").toBool(); @@ -26,3 +31,15 @@ void GeneneralConf::initHelpShow() { connect(c, &QCheckBox::clicked, this, &GeneneralConf::showHelpChanged); } + +void GeneneralConf::initShowDesktopNotification() { + QCheckBox *c = new QCheckBox(tr("Show desktop notifications"), this); + QSettings settings; + bool checked = settings.value("showDesktopNotification").toBool(); + c->setChecked(checked); + c->setToolTip(tr("Show desktop notifications")); + m_layout->addWidget(c); + + connect(c, &QCheckBox::clicked, this, + &GeneneralConf::showDesktopNotificationChanged); +} diff --git a/src/config/geneneralconf.h b/src/config/geneneralconf.h index 8244c887..98818699 100644 --- a/src/config/geneneralconf.h +++ b/src/config/geneneralconf.h @@ -12,11 +12,13 @@ public: private slots: void showHelpChanged(bool checked); + void showDesktopNotificationChanged(bool checked); private: QVBoxLayout *m_layout; - void initHelpShow(); + void initShowHelp(); + void initShowDesktopNotification(); }; #endif // GENENERALCONF_H diff --git a/src/controller.cpp b/src/controller.cpp index 67c992c6..5919dbcc 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -85,6 +85,7 @@ void Controller::initDefaults() { if (!settings.value("initiated").toBool()) { settings.setValue("initiated", true); settings.setValue("showHelp", true); + settings.setValue("showDesktopNotification", true); settings.setValue("drawColor", QColor(Qt::red)); //settings.setValue("mouseVisible", false); settings.setValue("uiColor", QColor(116, 0, 150)); @@ -140,5 +141,8 @@ void Controller::openInfoWindow() { } void Controller::showMessage(QString msg) { - m_trayIcon->showMessage("Flameshot Info", msg); + bool showMessages = QSettings().value("showDesktopNotification").toBool(); + if (showMessages) { + m_trayIcon->showMessage("Flameshot Info", msg); + } }