暂时去掉通知样式设置功能

This commit is contained in:
iaom 2023-07-18 11:42:21 +08:00
parent 87bf44b1f5
commit 2bf244d5b1
6 changed files with 114 additions and 114 deletions

View File

@ -125,30 +125,30 @@ SettingsPropertiesInfo::SettingsPropertiesInfo(SettingsProperty::Property proper
d->m_defaultValue = "false";
break;
case SettingsProperty::PopupStyle:
d->m_name = QStringLiteral("popupStyle");
d->m_displayName = tr("Style of popup notification");
d->m_valueType = d->m_settingsPropertyMetaType;
d->m_defaultValue = "TransientPopup";
break;
case SettingsProperty::TransientPopup:
d->m_name = QStringLiteral("TransientPopup");
d->m_displayName = tr("Popup: displayed in the upper right corner of the screen, will automatically disappear");
d->m_valueType = QMetaType::Int;
break;
case SettingsProperty::ResidentPopup:
d->m_name = QStringLiteral("ResidentPopup");
d->m_displayName = tr("Notice: will remain on the screen until it is closed");
d->m_valueType = QMetaType::Int;
break;
case SettingsProperty::NoPopup:
d->m_name = QStringLiteral("NoPopup");
d->m_displayName = tr("None: notifications will not be displayed on the screen, only be put into notification center");
d->m_valueType = QMetaType::Int;
break;
// case SettingsProperty::PopupStyle:
// d->m_name = QStringLiteral("popupStyle");
// d->m_displayName = tr("Style of popup notification");
// d->m_valueType = d->m_settingsPropertyMetaType;
// d->m_defaultValue = "TransientPopup";
// break;
//
// case SettingsProperty::TransientPopup:
// d->m_name = QStringLiteral("TransientPopup");
// d->m_displayName = tr("Popup: displayed in the upper right corner of the screen, will automatically disappear");
// d->m_valueType = QMetaType::Int;
// break;
//
// case SettingsProperty::ResidentPopup:
// d->m_name = QStringLiteral("ResidentPopup");
// d->m_displayName = tr("Notice: will remain on the screen until it is closed");
// d->m_valueType = QMetaType::Int;
// break;
//
// case SettingsProperty::NoPopup:
// d->m_name = QStringLiteral("NoPopup");
// d->m_displayName = tr("None: notifications will not be displayed on the screen, only be put into notification center");
// d->m_valueType = QMetaType::Int;
// break;
case SettingsProperty::Invalid:
d->m_name = QStringLiteral("Invalid");
@ -211,10 +211,10 @@ SettingsPropertiesInfo SettingsPropertiesInfo::fromName(const QString& name)
{ QStringLiteral("AllowSound"), SettingsProperty::AllowSound },
{ QStringLiteral("ShowContentOnLockScreen"), SettingsProperty::ShowContentOnLockScreen },
{ QStringLiteral("ShowNotificationOnLockScreen"), SettingsProperty::ShowNotificationOnLockScreen },
{ QStringLiteral("popupStyle"), SettingsProperty::PopupStyle },
{ QStringLiteral("TransientPopup"), SettingsProperty::TransientPopup },
{ QStringLiteral("ResidentPopup"), SettingsProperty::ResidentPopup },
{ QStringLiteral("NoPopup"), SettingsProperty::NoPopup }
// { QStringLiteral("popupStyle"), SettingsProperty::PopupStyle },
// { QStringLiteral("TransientPopup"), SettingsProperty::TransientPopup },
// { QStringLiteral("ResidentPopup"), SettingsProperty::ResidentPopup },
// { QStringLiteral("NoPopup"), SettingsProperty::NoPopup }
};
return {propertyHash.value(name)};

View File

@ -47,13 +47,13 @@ enum Property {
AllowNotify = ReceiveNotificationsFromApps + 1, //是否接收当前应用通知bool类型默认值true
AllowSound, //是否打开通知提示声bool类型默认值true
ShowContentOnLockScreen, //锁屏界面是否显示通知内容信息bool类型默认值false
ShowNotificationOnLockScreen, //锁屏界面是否显示通知bool类型默认值false
PopupStyle, //通知样式appNotificationStyle类型默认值Mutative
//single app notification settings中的 popupStyle 类型取值范围
TransientPopup = PopupStyle +1, //横幅模式,显示在右上角,会自动消失
ResidentPopup, //提示模式,会保留在屏幕上,直到被关闭
NoPopup //无,通知不会显示在屏幕上,但是会进入通知中心
ShowNotificationOnLockScreen //锁屏界面是否显示通知bool类型默认值false
// PopupStyle, //通知样式appNotificationStyle类型默认值Mutative
//
// //single app notification settings中的 popupStyle 类型取值范围
// TransientPopup = PopupStyle +1, //横幅模式,显示在右上角,会自动消失
// ResidentPopup, //提示模式,会保留在屏幕上,直到被关闭
// NoPopup //无,通知不会显示在屏幕上,但是会进入通知中心
};
typedef QMap<Property, QVariant> PropertyMap;
}
@ -71,8 +71,8 @@ static const QList<SettingsProperty::Property> SINGLE_APPLICATION_SETTINGS {
SettingsProperty::AllowNotify,
SettingsProperty::AllowSound,
SettingsProperty::ShowContentOnLockScreen,
SettingsProperty::ShowNotificationOnLockScreen,
SettingsProperty::PopupStyle,
SettingsProperty::ShowNotificationOnLockScreen
// SettingsProperty::PopupStyle,
};
} // namespace UkuiNotification

View File

@ -119,10 +119,10 @@ bool SingleApplicationSettings::showNotificationOnLockScreen() const
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ShowNotificationOnLockScreen).name()).toVariant().toBool();
}
SettingsProperty::Property UkuiNotification::SingleApplicationSettings::popupStyle() const
{
return SettingsPropertiesInfo::fromName(d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::PopupStyle).name()).toString()).property();
}
//SettingsProperty::Property UkuiNotification::SingleApplicationSettings::popupStyle() const
//{
// return SettingsPropertiesInfo::fromName(d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::PopupStyle).name()).toString()).property();
//}
void SingleApplicationSettings::settingsDataChanged()
{
@ -148,9 +148,9 @@ void SingleApplicationSettings::settingsDataChanged()
case SettingsProperty::ShowNotificationOnLockScreen:
Q_EMIT showNotificationOnLockScreenChanged(value.toVariant().toBool());
break;
case SettingsProperty::PopupStyle:
Q_EMIT popupStyleChanged(SettingsPropertiesInfo::fromName(value.toString()).property());
break;
// case SettingsProperty::PopupStyle:
// Q_EMIT popupStyleChanged(SettingsPropertiesInfo::fromName(value.toString()).property());
// break;
default:
break;
}
@ -186,10 +186,10 @@ void SingleApplicationSettings::setShowNotificationOnLockScreen(bool enable)
ApplicationsSettings::self()->setAppSetting(d->m_desktopEntry, SettingsProperty::ShowNotificationOnLockScreen, enable);
}
void SingleApplicationSettings::setPopupStyle(SettingsProperty::Property style)
{
ApplicationsSettings::self()->setAppSetting(d->m_desktopEntry, SettingsProperty::PopupStyle, style);
}
//void SingleApplicationSettings::setPopupStyle(SettingsProperty::Property style)
//{
// ApplicationsSettings::self()->setAppSetting(d->m_desktopEntry, SettingsProperty::PopupStyle, style);
//}
QString SingleApplicationSettings::desktopEntry() const
{

View File

@ -34,7 +34,7 @@ class SingleApplicationSettings : public QObject
Q_PROPERTY(bool allowSound READ allowSound WRITE setAllowSound NOTIFY allowSoundChanged)
Q_PROPERTY(bool showContentOnLockScreen READ showContentOnLockScreen WRITE setShowContentOnLockScreen NOTIFY showContentOnLockScreenChanged)
Q_PROPERTY(bool showNotificationOnLockScreen READ showNotificationOnLockScreen WRITE setShowNotificationOnLockScreen NOTIFY showNotificationOnLockScreenChanged)
Q_PROPERTY(SettingsProperty::Property PopupStyle READ popupStyle WRITE setPopupStyle NOTIFY popupStyleChanged)
// Q_PROPERTY(SettingsProperty::Property PopupStyle READ popupStyle WRITE setPopupStyle NOTIFY popupStyleChanged)
public:
explicit SingleApplicationSettings(const QString &desktopEntry = QString(), QObject *parent = nullptr);
SingleApplicationSettings(const SingleApplicationSettings &other);
@ -54,8 +54,8 @@ public:
bool showNotificationOnLockScreen() const;
void setShowNotificationOnLockScreen(bool enable);
SettingsProperty::Property popupStyle() const;
void setPopupStyle(SettingsProperty::Property style);
// SettingsProperty::Property popupStyle() const;
// void setPopupStyle(SettingsProperty::Property style);
QString desktopEntry() const;

View File

@ -40,16 +40,16 @@ void NoticeMenu::initStatus(UkuiNotification::SingleApplicationSettings *setting
m_detailBtn->setChecked(settings->showContentOnLockScreen());
m_showBtn->setChecked(settings->showNotificationOnLockScreen());
int styleId = 0;
UkuiNotification::SettingsProperty::Property style = settings->popupStyle();
if (style == UkuiNotification::SettingsProperty::TransientPopup) {
styleId = 0;
} else if (style == UkuiNotification::SettingsProperty::ResidentPopup) {
styleId = 1;
} else if (style == UkuiNotification::SettingsProperty::NoPopup) {
styleId = 2;
}
m_styleGroup->button(styleId)->setChecked(true);
// int styleId = 0;
// UkuiNotification::SettingsProperty::Property style = settings->popupStyle();
// if (style == UkuiNotification::SettingsProperty::TransientPopup) {
// styleId = 0;
// } else if (style == UkuiNotification::SettingsProperty::ResidentPopup) {
// styleId = 1;
// } else if (style == UkuiNotification::SettingsProperty::NoPopup) {
// styleId = 2;
// }
// m_styleGroup->button(styleId)->setChecked(true);
m_voiceBtn->blockSignals(false);
m_showBtn->blockSignals(false);
@ -78,20 +78,20 @@ void NoticeMenu::setShowOnLockScreenEnable(bool state)
m_showBtn->blockSignals(false);
}
void NoticeMenu::setPopupStyle(UkuiNotification::SettingsProperty::Property style)
{
int styleId = 0;
if (style == UkuiNotification::SettingsProperty::TransientPopup) {
styleId = 0;
} else if (style == UkuiNotification::SettingsProperty::ResidentPopup) {
styleId = 1;
} else if (style == UkuiNotification::SettingsProperty::NoPopup) {
styleId = 2;
}
m_styleGroup->blockSignals(true);
m_styleGroup->button(styleId)->setChecked(true);
m_styleGroup->blockSignals(false);
}
//void NoticeMenu::setPopupStyle(UkuiNotification::SettingsProperty::Property style)
//{
// int styleId = 0;
// if (style == UkuiNotification::SettingsProperty::TransientPopup) {
// styleId = 0;
// } else if (style == UkuiNotification::SettingsProperty::ResidentPopup) {
// styleId = 1;
// } else if (style == UkuiNotification::SettingsProperty::NoPopup) {
// styleId = 2;
// }
// m_styleGroup->blockSignals(true);
// m_styleGroup->button(styleId)->setChecked(true);
// m_styleGroup->blockSignals(false);
//}
void NoticeMenu::initUi()
{
@ -117,25 +117,25 @@ void NoticeMenu::initUi()
QFrame *line_3 = setLine();
QLabel *styletitleLabel = new QLabel(tr("Notification Style"), this);
styletitleLabel->setContentsMargins(24, 0, 0, 0);
m_styleGroup = new QButtonGroup(this);
QFrame *mutativeFrame = new QFrame(this);
m_mutativeBtn = new QRadioButton;
m_styleGroup->addButton(m_mutativeBtn, 0);
setFrame(mutativeFrame, tr("Banner: Appears in the upper right corner of the screen, and disappears automatically"), m_mutativeBtn);
QFrame *alwaysFrame = new QFrame(this);
m_alwaysBtn = new QRadioButton;
m_styleGroup->addButton(m_alwaysBtn, 1);
setFrame(alwaysFrame, tr("Tip:It will be kept on the screen until it is closed"), m_alwaysBtn);
QFrame *noneFrame = new QFrame(this);
m_noneBtn = new QRadioButton;
m_styleGroup->addButton(m_noneBtn, 2);
setFrame(noneFrame, tr("None:Notifications will not be displayed on the screen, but will go to the notification center"), m_noneBtn);
// QLabel *styletitleLabel = new QLabel(tr("Notification Style"), this);
// styletitleLabel->setContentsMargins(24, 0, 0, 0);
//
// m_styleGroup = new QButtonGroup(this);
//
// QFrame *mutativeFrame = new QFrame(this);
// m_mutativeBtn = new QRadioButton;
// m_styleGroup->addButton(m_mutativeBtn, 0);
// setFrame(mutativeFrame, tr("Banner: Appears in the upper right corner of the screen, and disappears automatically"), m_mutativeBtn);
//
// QFrame *alwaysFrame = new QFrame(this);
// m_alwaysBtn = new QRadioButton;
// m_styleGroup->addButton(m_alwaysBtn, 1);
// setFrame(alwaysFrame, tr("Tip:It will be kept on the screen until it is closed"), m_alwaysBtn);
//
// QFrame *noneFrame = new QFrame(this);
// m_noneBtn = new QRadioButton;
// m_styleGroup->addButton(m_noneBtn, 2);
// setFrame(noneFrame, tr("None:Notifications will not be displayed on the screen, but will go to the notification center"), m_noneBtn);
menuLyt->addWidget(voiceFrame);
menuLyt->addWidget(line_1);
@ -144,10 +144,10 @@ void NoticeMenu::initUi()
menuLyt->addWidget(showFrame);
menuLyt->addWidget(line_3);
menuLyt->addSpacing(16);
menuLyt->addWidget(styletitleLabel);
menuLyt->addWidget(mutativeFrame);
menuLyt->addWidget(alwaysFrame);
menuLyt->addWidget(noneFrame);
// menuLyt->addWidget(styletitleLabel);
// menuLyt->addWidget(mutativeFrame);
// menuLyt->addWidget(alwaysFrame);
// menuLyt->addWidget(noneFrame);
menuLyt->addStretch();
// 隐藏未实现模块

View File

@ -578,22 +578,22 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::ShowNotificationOnLockScreen, checked);
});
connect(menu, &NoticeMenu::styleBtnSignals, [=](int id) {
QString str("mutative");
UkuiNotification::SettingsProperty::Property style = UkuiNotification::SettingsProperty::TransientPopup;
if (id == 0) {
str = "mutative";
style = UkuiNotification::SettingsProperty::TransientPopup;
} else if (id == 1) {
str = "always";
style = UkuiNotification::SettingsProperty::ResidentPopup;
} else if (id == 2) {
str = "none";
style = UkuiNotification::SettingsProperty::NoPopup;
}
//Common::buriedSettings(name(), "set notice style", QString("settings"), str);
UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::PopupStyle, style);
});
// connect(menu, &NoticeMenu::styleBtnSignals, [=](int id) {
// QString str("mutative");
// UkuiNotification::SettingsProperty::Property style = UkuiNotification::SettingsProperty::TransientPopup;
// if (id == 0) {
// str = "mutative";
// style = UkuiNotification::SettingsProperty::TransientPopup;
// } else if (id == 1) {
// str = "always";
// style = UkuiNotification::SettingsProperty::ResidentPopup;
// } else if (id == 2) {
// str = "none";
// style = UkuiNotification::SettingsProperty::NoPopup;
// }
// //Common::buriedSettings(name(), "set notice style", QString("settings"), str);
// UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::PopupStyle, style);
// });
}
void Notice::setAppIcon(QLabel *iconlabel, const QString &icon)