Improve Notification Area settings (#15207)
* Initial UI mockup for notification area settings * First iteration of adapting the code to the Notification area settings UI reorg * Remove redundant code to enable/disable widgets * Reorganize notification area settings UI, improve settings and tooltips text * Auto-wrap tooltips, add tooltips for each group * Remove trailing space * Fix merge error * Further fixes from merge error --------- Co-authored-by: WandererFan <WandererFan@gmail.com>
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include "DlgSettingsNotificationArea.h"
|
||||
#include "ui_DlgSettingsNotificationArea.h"
|
||||
|
||||
@@ -40,10 +42,9 @@ DlgSettingsNotificationArea::DlgSettingsNotificationArea(QWidget* parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
adaptUiToAreaEnabledState(ui->NotificationAreaEnabled->isChecked());
|
||||
connect(ui->NotificationAreaEnabled, &QCheckBox::stateChanged, [this](int state) {
|
||||
bool enabled = state == Qt::CheckState::Checked;
|
||||
this->adaptUiToAreaEnabledState(enabled);
|
||||
connect(ui->NotificationAreaEnabled, &QGroupBox::toggled, [this](int on) {
|
||||
|
||||
bool enabled = on;
|
||||
|
||||
if (enabled) {
|
||||
this->requireRestart();
|
||||
@@ -55,8 +56,16 @@ DlgSettingsNotificationArea::~DlgSettingsNotificationArea() = default;
|
||||
|
||||
void DlgSettingsNotificationArea::saveSettings()
|
||||
{
|
||||
ui->NotificationAreaEnabled->onSave();
|
||||
ui->NonIntrusiveNotificationsEnabled->onSave();
|
||||
// must be done as very first because we create a new instance of NavigatorStyle
|
||||
// where we set some attributes afterwards
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/NotificationArea");
|
||||
|
||||
bool isNotificationAreaEnabled = ui->NotificationAreaEnabled->isChecked();
|
||||
hGrp->SetBool("NotificationAreaEnabled", isNotificationAreaEnabled);
|
||||
bool isNonIntrusiveNotificationsEnabled = ui->NotificationAreaEnabled->isChecked();
|
||||
hGrp->SetBool("NonIntrusiveNotificationsEnabled", isNonIntrusiveNotificationsEnabled);
|
||||
|
||||
ui->maxDuration->onSave();
|
||||
ui->minDuration->onSave();
|
||||
ui->maxNotifications->onSave();
|
||||
@@ -71,8 +80,15 @@ void DlgSettingsNotificationArea::saveSettings()
|
||||
|
||||
void DlgSettingsNotificationArea::loadSettings()
|
||||
{
|
||||
ui->NotificationAreaEnabled->onRestore();
|
||||
ui->NonIntrusiveNotificationsEnabled->onRestore();
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/NotificationArea");
|
||||
|
||||
bool isNotificationAreaEnabled = hGrp->GetBool("NotificationAreaEnabled", true);
|
||||
ui->NotificationAreaEnabled->setChecked(isNotificationAreaEnabled);
|
||||
|
||||
bool isNonIntrusiveNotificationsEnabled = hGrp->GetBool("NonIntrusiveNotificationsEnabled", true);
|
||||
ui->NonIntrusiveNotificationsEnabled->setChecked(isNonIntrusiveNotificationsEnabled);
|
||||
|
||||
ui->maxDuration->onRestore();
|
||||
ui->minDuration->onRestore();
|
||||
ui->maxNotifications->onRestore();
|
||||
@@ -85,21 +101,6 @@ void DlgSettingsNotificationArea::loadSettings()
|
||||
ui->developerWarningSubscriptionEnabled->onRestore();
|
||||
}
|
||||
|
||||
void DlgSettingsNotificationArea::adaptUiToAreaEnabledState(bool enabled)
|
||||
{
|
||||
ui->NonIntrusiveNotificationsEnabled->setEnabled(enabled);
|
||||
ui->maxDuration->setEnabled(enabled);
|
||||
ui->minDuration->setEnabled(enabled);
|
||||
ui->maxNotifications->setEnabled(enabled);
|
||||
ui->maxWidgetMessages->setEnabled(enabled);
|
||||
ui->autoRemoveUserNotifications->setEnabled(enabled);
|
||||
ui->notificationWidth->setEnabled(enabled);
|
||||
ui->hideNonIntrusiveNotificationsWhenWindowDeactivated->setEnabled(enabled);
|
||||
ui->preventNonIntrusiveNotificationsWhenWindowNotActive->setEnabled(enabled);
|
||||
ui->developerErrorSubscriptionEnabled->setEnabled(enabled);
|
||||
ui->developerWarningSubscriptionEnabled->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void DlgSettingsNotificationArea::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
|
||||
Reference in New Issue
Block a user