NotificationArea: Preference dialog add preferences to control inactive window behaviour

This commit is contained in:
Abdullah Tahiri
2023-03-21 09:38:01 +01:00
committed by abdullahtahiriyo
parent 83eca46308
commit 885824f8c8
2 changed files with 48 additions and 0 deletions

View File

@@ -49,6 +49,8 @@ DlgSettingsNotificationArea::DlgSettingsNotificationArea(QWidget* parent)
ui->maxNotifications->setEnabled(true);
ui->maxWidgetMessages->setEnabled(true);
ui->autoRemoveUserNotifications->setEnabled(true);
ui->hideNonIntrusiveNotificationsWhenWindowDeactivated->setEnabled(true);
ui->preventNonIntrusiveNotificationsWhenWindowNotActive->setEnabled(true);
QMessageBox::information(this, tr("Notification Area"),
tr("Activation of the Notification Area only takes effect after an application restart."));
}
@@ -60,6 +62,8 @@ DlgSettingsNotificationArea::DlgSettingsNotificationArea(QWidget* parent)
ui->maxNotifications->setEnabled(false);
ui->maxWidgetMessages->setEnabled(false);
ui->autoRemoveUserNotifications->setEnabled(false);
ui->hideNonIntrusiveNotificationsWhenWindowDeactivated->setEnabled(false);
ui->preventNonIntrusiveNotificationsWhenWindowNotActive->setEnabled(false);
// N.B: Deactivation is handled by the Notification Area itself, as it listens to all its configuration parameters.
}
});
@@ -79,6 +83,8 @@ void DlgSettingsNotificationArea::saveSettings()
ui->maxWidgetMessages->onSave();
ui->autoRemoveUserNotifications->onSave();
ui->notificationWidth->onSave();
ui->hideNonIntrusiveNotificationsWhenWindowDeactivated->onSave();
ui->preventNonIntrusiveNotificationsWhenWindowNotActive->onSave();
}
void DlgSettingsNotificationArea::loadSettings()
@@ -91,6 +97,9 @@ void DlgSettingsNotificationArea::loadSettings()
ui->maxWidgetMessages->onRestore();
ui->autoRemoveUserNotifications->onRestore();
ui->notificationWidth->onRestore();
ui->hideNonIntrusiveNotificationsWhenWindowDeactivated->onRestore();
ui->preventNonIntrusiveNotificationsWhenWindowNotActive->onRestore();
}
void DlgSettingsNotificationArea::changeEvent(QEvent *e)

View File

@@ -133,6 +133,45 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="Gui::PrefCheckBox" name="hideNonIntrusiveNotificationsWhenWindowDeactivated">
<property name="toolTip">
<string>Any open non-intrusive notifications will disappear when another window is activated</string>
</property>
<property name="text">
<string>Hide when other window is activated</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>HideNonIntrusiveNotificationsWhenWindowDeactivated</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>NotificationArea</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="Gui::PrefCheckBox" name="preventNonIntrusiveNotificationsWhenWindowNotActive">
<property name="toolTip">
<string>Prevent non-intrusive notifications from appearing when the FreeCAD Window is not the active window</string>
</property>
<property name="text">
<string>Do not show when inactive</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>PreventNonIntrusiveNotificationsWhenWindowNotActive</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>NotificationArea</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>