From 65393234c7f5ee3caee48ac2397212e96f8a5ed4 Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Sun, 31 Dec 2023 01:22:27 +0330 Subject: [PATCH 1/3] add config to disable grim warrning close #3186 --- flameshot.example.ini | 3 +++ src/utils/confighandler.cpp | 1 + src/utils/confighandler.h | 1 + src/utils/screengrabber.cpp | 3 +++ 4 files changed, 8 insertions(+) diff --git a/flameshot.example.ini b/flameshot.example.ini index a33eb071ed..f804b11780 100644 --- a/flameshot.example.ini +++ b/flameshot.example.ini @@ -48,6 +48,9 @@ ;; Whether the tray icon is disabled (bool) ;disabledTrayIcon=false ; +;; Disable Grim Warnnig notification +;disabledGrimWarnning=true +; ;; Automatically close daemon when it's not needed (not available on Windows) ;autoCloseIdleDaemon=false ; diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index cb9ae5d7e0..b0148c42f9 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -78,6 +78,7 @@ static QMap> OPTION("showSidePanelButton" ,Bool ( true )), OPTION("showDesktopNotification" ,Bool ( true )), OPTION("disabledTrayIcon" ,Bool ( false )), + OPTION("disabledGrimWarnning" ,Bool ( false )), OPTION("historyConfirmationToDelete" ,Bool ( true )), #if !defined(DISABLE_UPDATE_CHECKER) OPTION("checkForUpdates" ,Bool ( true )), diff --git a/src/utils/confighandler.h b/src/utils/confighandler.h index aedd732915..5493e0a9d9 100644 --- a/src/utils/confighandler.h +++ b/src/utils/confighandler.h @@ -88,6 +88,7 @@ class ConfigHandler : public QObject bool) CONFIG_GETTER_SETTER(filenamePattern, setFilenamePattern, QString) CONFIG_GETTER_SETTER(disabledTrayIcon, setDisabledTrayIcon, bool) + CONFIG_GETTER_SETTER(disabledGrimWarnning, disabledGrimWarnning, bool) CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int) CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int) CONFIG_GETTER_SETTER(keepOpenAppLauncher, setKeepOpenAppLauncher, bool) diff --git a/src/utils/screengrabber.cpp b/src/utils/screengrabber.cpp index 062c4bdeea..89770663a3 100644 --- a/src/utils/screengrabber.cpp +++ b/src/utils/screengrabber.cpp @@ -12,6 +12,7 @@ #include #include #include +#include "src/utils/confighandler.h" #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) #include "request.h" @@ -141,10 +142,12 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok) "activate the grim-based general wayland screenshot adapter"); freeDesktopPortal(ok, res); #else + if (!ConfigHandler().disabledGrimWarnning()) { AbstractLogger::warning() << tr("grim's screenshot component is implemented based on " "wlroots, it may not be used in GNOME or similar " "desktop environments"); + } generalGrimScreenshot(ok, res); #endif break; From de2150a8d3262ff171503921fb74cd42eec0d835 Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Tue, 25 Jun 2024 19:48:18 +0330 Subject: [PATCH 2/3] fix typo --- flameshot.example.ini | 4 ++-- src/utils/confighandler.cpp | 2 +- src/utils/confighandler.h | 2 +- src/utils/screengrabber.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flameshot.example.ini b/flameshot.example.ini index f804b11780..2717479d51 100644 --- a/flameshot.example.ini +++ b/flameshot.example.ini @@ -48,8 +48,8 @@ ;; Whether the tray icon is disabled (bool) ;disabledTrayIcon=false ; -;; Disable Grim Warnnig notification -;disabledGrimWarnning=true +;; Disable Grim Warning notification +;disabledGrimWarning=true ; ;; Automatically close daemon when it's not needed (not available on Windows) ;autoCloseIdleDaemon=false diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index b0148c42f9..485fb26575 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -78,7 +78,7 @@ static QMap> OPTION("showSidePanelButton" ,Bool ( true )), OPTION("showDesktopNotification" ,Bool ( true )), OPTION("disabledTrayIcon" ,Bool ( false )), - OPTION("disabledGrimWarnning" ,Bool ( false )), + OPTION("disabledGrimWarning" ,Bool ( false )), OPTION("historyConfirmationToDelete" ,Bool ( true )), #if !defined(DISABLE_UPDATE_CHECKER) OPTION("checkForUpdates" ,Bool ( true )), diff --git a/src/utils/confighandler.h b/src/utils/confighandler.h index 5493e0a9d9..f2eb4ad940 100644 --- a/src/utils/confighandler.h +++ b/src/utils/confighandler.h @@ -88,7 +88,7 @@ class ConfigHandler : public QObject bool) CONFIG_GETTER_SETTER(filenamePattern, setFilenamePattern, QString) CONFIG_GETTER_SETTER(disabledTrayIcon, setDisabledTrayIcon, bool) - CONFIG_GETTER_SETTER(disabledGrimWarnning, disabledGrimWarnning, bool) + CONFIG_GETTER_SETTER(disabledGrimWarning, disabledGrimWarning, bool) CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int) CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int) CONFIG_GETTER_SETTER(keepOpenAppLauncher, setKeepOpenAppLauncher, bool) diff --git a/src/utils/screengrabber.cpp b/src/utils/screengrabber.cpp index 89770663a3..ebd3a10993 100644 --- a/src/utils/screengrabber.cpp +++ b/src/utils/screengrabber.cpp @@ -142,7 +142,7 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok) "activate the grim-based general wayland screenshot adapter"); freeDesktopPortal(ok, res); #else - if (!ConfigHandler().disabledGrimWarnning()) { + if (!ConfigHandler().disabledGrimWarning()) { AbstractLogger::warning() << tr("grim's screenshot component is implemented based on " "wlroots, it may not be used in GNOME or similar " From a46f8e4874b26c9320f645cb9fb59651cf783f54 Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:28:52 +0330 Subject: [PATCH 3/3] fix format with clang-format --- src/utils/screengrabber.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/screengrabber.cpp b/src/utils/screengrabber.cpp index ebd3a10993..9ce3854f43 100644 --- a/src/utils/screengrabber.cpp +++ b/src/utils/screengrabber.cpp @@ -4,6 +4,7 @@ #include "screengrabber.h" #include "abstractlogger.h" #include "src/core/qguiappcurrentscreen.h" +#include "src/utils/confighandler.h" #include "src/utils/filenamehandler.h" #include "src/utils/systemnotification.h" #include @@ -12,7 +13,6 @@ #include #include #include -#include "src/utils/confighandler.h" #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) #include "request.h" @@ -142,12 +142,12 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok) "activate the grim-based general wayland screenshot adapter"); freeDesktopPortal(ok, res); #else - if (!ConfigHandler().disabledGrimWarning()) { - AbstractLogger::warning() - << tr("grim's screenshot component is implemented based on " - "wlroots, it may not be used in GNOME or similar " - "desktop environments"); - } + if (!ConfigHandler().disabledGrimWarning()) { + AbstractLogger::warning() << tr( + "grim's screenshot component is implemented based on " + "wlroots, it may not be used in GNOME or similar " + "desktop environments"); + } generalGrimScreenshot(ok, res); #endif break;