mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Add an optional "Silent" flag for QgsTask, which hides the operating
system level success/fail notifications for that task
This commit is contained in:
parent
4c3502bee2
commit
11d52c2cdb
@ -49,6 +49,7 @@ clean up and terminate at the earliest possible convenience.
|
||||
CanCancel,
|
||||
CancelWithoutPrompt,
|
||||
Hidden,
|
||||
Silent,
|
||||
AllFlags,
|
||||
};
|
||||
typedef QFlags<QgsTask::Flag> Flags;
|
||||
|
@ -16417,7 +16417,11 @@ void QgisApp::onTaskCompleteShowNotify( long taskId, int status )
|
||||
{
|
||||
long long minTime = QgsSettings().value( QStringLiteral( "minTaskLengthForSystemNotification" ), 5, QgsSettings::App ).toLongLong() * 1000;
|
||||
QgsTask *task = QgsApplication::taskManager()->task( taskId );
|
||||
if ( task && !( task->flags() & QgsTask::Flag::Hidden ) && task->elapsedTime() >= minTime )
|
||||
if ( task
|
||||
&& !(
|
||||
( task->flags() & QgsTask::Hidden )
|
||||
|| ( task->flags() & QgsTask::Silent ) )
|
||||
&& task->elapsedTime() >= minTime )
|
||||
{
|
||||
if ( status == QgsTask::Complete )
|
||||
showSystemNotification( tr( "Task complete" ), task->description() );
|
||||
|
@ -74,6 +74,7 @@ class CORE_EXPORT QgsTask : public QObject
|
||||
CanCancel = 1 << 1, //!< Task can be canceled
|
||||
CancelWithoutPrompt = 1 << 2, //!< Task can be canceled without any users prompts, e.g. when closing a project or QGIS.
|
||||
Hidden = 1 << 3, //!< Hide task from GUI (since QGIS 3.26)
|
||||
Silent = 1 << 4, //!< Don't show task updates (such as completion/failure messages) as operating-system level notifications (since QGIS 3.26)
|
||||
AllFlags = CanCancel, //!< Task supports all flags
|
||||
};
|
||||
Q_DECLARE_FLAGS( Flags, Flag )
|
||||
|
Loading…
x
Reference in New Issue
Block a user