暂时去掉通知样式设置功能
This commit is contained in:
parent
87bf44b1f5
commit
2bf244d5b1
|
@ -125,30 +125,30 @@ SettingsPropertiesInfo::SettingsPropertiesInfo(SettingsProperty::Property proper
|
||||||
d->m_defaultValue = "false";
|
d->m_defaultValue = "false";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SettingsProperty::PopupStyle:
|
// case SettingsProperty::PopupStyle:
|
||||||
d->m_name = QStringLiteral("popupStyle");
|
// d->m_name = QStringLiteral("popupStyle");
|
||||||
d->m_displayName = tr("Style of popup notification");
|
// d->m_displayName = tr("Style of popup notification");
|
||||||
d->m_valueType = d->m_settingsPropertyMetaType;
|
// d->m_valueType = d->m_settingsPropertyMetaType;
|
||||||
d->m_defaultValue = "TransientPopup";
|
// d->m_defaultValue = "TransientPopup";
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
case SettingsProperty::TransientPopup:
|
// case SettingsProperty::TransientPopup:
|
||||||
d->m_name = QStringLiteral("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_displayName = tr("Popup: displayed in the upper right corner of the screen, will automatically disappear");
|
||||||
d->m_valueType = QMetaType::Int;
|
// d->m_valueType = QMetaType::Int;
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
case SettingsProperty::ResidentPopup:
|
// case SettingsProperty::ResidentPopup:
|
||||||
d->m_name = QStringLiteral("ResidentPopup");
|
// d->m_name = QStringLiteral("ResidentPopup");
|
||||||
d->m_displayName = tr("Notice: will remain on the screen until it is closed");
|
// d->m_displayName = tr("Notice: will remain on the screen until it is closed");
|
||||||
d->m_valueType = QMetaType::Int;
|
// d->m_valueType = QMetaType::Int;
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
case SettingsProperty::NoPopup:
|
// case SettingsProperty::NoPopup:
|
||||||
d->m_name = QStringLiteral("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_displayName = tr("None: notifications will not be displayed on the screen, only be put into notification center");
|
||||||
d->m_valueType = QMetaType::Int;
|
// d->m_valueType = QMetaType::Int;
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case SettingsProperty::Invalid:
|
case SettingsProperty::Invalid:
|
||||||
d->m_name = QStringLiteral("Invalid");
|
d->m_name = QStringLiteral("Invalid");
|
||||||
|
@ -211,10 +211,10 @@ SettingsPropertiesInfo SettingsPropertiesInfo::fromName(const QString& name)
|
||||||
{ QStringLiteral("AllowSound"), SettingsProperty::AllowSound },
|
{ QStringLiteral("AllowSound"), SettingsProperty::AllowSound },
|
||||||
{ QStringLiteral("ShowContentOnLockScreen"), SettingsProperty::ShowContentOnLockScreen },
|
{ QStringLiteral("ShowContentOnLockScreen"), SettingsProperty::ShowContentOnLockScreen },
|
||||||
{ QStringLiteral("ShowNotificationOnLockScreen"), SettingsProperty::ShowNotificationOnLockScreen },
|
{ QStringLiteral("ShowNotificationOnLockScreen"), SettingsProperty::ShowNotificationOnLockScreen },
|
||||||
{ QStringLiteral("popupStyle"), SettingsProperty::PopupStyle },
|
// { QStringLiteral("popupStyle"), SettingsProperty::PopupStyle },
|
||||||
{ QStringLiteral("TransientPopup"), SettingsProperty::TransientPopup },
|
// { QStringLiteral("TransientPopup"), SettingsProperty::TransientPopup },
|
||||||
{ QStringLiteral("ResidentPopup"), SettingsProperty::ResidentPopup },
|
// { QStringLiteral("ResidentPopup"), SettingsProperty::ResidentPopup },
|
||||||
{ QStringLiteral("NoPopup"), SettingsProperty::NoPopup }
|
// { QStringLiteral("NoPopup"), SettingsProperty::NoPopup }
|
||||||
};
|
};
|
||||||
|
|
||||||
return {propertyHash.value(name)};
|
return {propertyHash.value(name)};
|
||||||
|
|
|
@ -47,13 +47,13 @@ enum Property {
|
||||||
AllowNotify = ReceiveNotificationsFromApps + 1, //是否接收当前应用通知,bool类型,默认值true
|
AllowNotify = ReceiveNotificationsFromApps + 1, //是否接收当前应用通知,bool类型,默认值true
|
||||||
AllowSound, //是否打开通知提示声,bool类型,默认值true
|
AllowSound, //是否打开通知提示声,bool类型,默认值true
|
||||||
ShowContentOnLockScreen, //锁屏界面是否显示通知内容信息,bool类型,默认值false
|
ShowContentOnLockScreen, //锁屏界面是否显示通知内容信息,bool类型,默认值false
|
||||||
ShowNotificationOnLockScreen, //锁屏界面是否显示通知,bool类型,默认值false
|
ShowNotificationOnLockScreen //锁屏界面是否显示通知,bool类型,默认值false
|
||||||
PopupStyle, //通知样式,appNotificationStyle类型,默认值Mutative
|
// PopupStyle, //通知样式,appNotificationStyle类型,默认值Mutative
|
||||||
|
//
|
||||||
//single app notification settings中的 popupStyle 类型取值范围
|
// //single app notification settings中的 popupStyle 类型取值范围
|
||||||
TransientPopup = PopupStyle +1, //横幅模式,显示在右上角,会自动消失
|
// TransientPopup = PopupStyle +1, //横幅模式,显示在右上角,会自动消失
|
||||||
ResidentPopup, //提示模式,会保留在屏幕上,直到被关闭
|
// ResidentPopup, //提示模式,会保留在屏幕上,直到被关闭
|
||||||
NoPopup //无,通知不会显示在屏幕上,但是会进入通知中心
|
// NoPopup //无,通知不会显示在屏幕上,但是会进入通知中心
|
||||||
};
|
};
|
||||||
typedef QMap<Property, QVariant> PropertyMap;
|
typedef QMap<Property, QVariant> PropertyMap;
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,8 @@ static const QList<SettingsProperty::Property> SINGLE_APPLICATION_SETTINGS {
|
||||||
SettingsProperty::AllowNotify,
|
SettingsProperty::AllowNotify,
|
||||||
SettingsProperty::AllowSound,
|
SettingsProperty::AllowSound,
|
||||||
SettingsProperty::ShowContentOnLockScreen,
|
SettingsProperty::ShowContentOnLockScreen,
|
||||||
SettingsProperty::ShowNotificationOnLockScreen,
|
SettingsProperty::ShowNotificationOnLockScreen
|
||||||
SettingsProperty::PopupStyle,
|
// SettingsProperty::PopupStyle,
|
||||||
};
|
};
|
||||||
} // namespace UkuiNotification
|
} // namespace UkuiNotification
|
||||||
|
|
||||||
|
|
|
@ -119,10 +119,10 @@ bool SingleApplicationSettings::showNotificationOnLockScreen() const
|
||||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ShowNotificationOnLockScreen).name()).toVariant().toBool();
|
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ShowNotificationOnLockScreen).name()).toVariant().toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsProperty::Property UkuiNotification::SingleApplicationSettings::popupStyle() const
|
//SettingsProperty::Property UkuiNotification::SingleApplicationSettings::popupStyle() const
|
||||||
{
|
//{
|
||||||
return SettingsPropertiesInfo::fromName(d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::PopupStyle).name()).toString()).property();
|
// return SettingsPropertiesInfo::fromName(d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::PopupStyle).name()).toString()).property();
|
||||||
}
|
//}
|
||||||
|
|
||||||
void SingleApplicationSettings::settingsDataChanged()
|
void SingleApplicationSettings::settingsDataChanged()
|
||||||
{
|
{
|
||||||
|
@ -148,9 +148,9 @@ void SingleApplicationSettings::settingsDataChanged()
|
||||||
case SettingsProperty::ShowNotificationOnLockScreen:
|
case SettingsProperty::ShowNotificationOnLockScreen:
|
||||||
Q_EMIT showNotificationOnLockScreenChanged(value.toVariant().toBool());
|
Q_EMIT showNotificationOnLockScreenChanged(value.toVariant().toBool());
|
||||||
break;
|
break;
|
||||||
case SettingsProperty::PopupStyle:
|
// case SettingsProperty::PopupStyle:
|
||||||
Q_EMIT popupStyleChanged(SettingsPropertiesInfo::fromName(value.toString()).property());
|
// Q_EMIT popupStyleChanged(SettingsPropertiesInfo::fromName(value.toString()).property());
|
||||||
break;
|
// break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -186,10 +186,10 @@ void SingleApplicationSettings::setShowNotificationOnLockScreen(bool enable)
|
||||||
ApplicationsSettings::self()->setAppSetting(d->m_desktopEntry, SettingsProperty::ShowNotificationOnLockScreen, enable);
|
ApplicationsSettings::self()->setAppSetting(d->m_desktopEntry, SettingsProperty::ShowNotificationOnLockScreen, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleApplicationSettings::setPopupStyle(SettingsProperty::Property style)
|
//void SingleApplicationSettings::setPopupStyle(SettingsProperty::Property style)
|
||||||
{
|
//{
|
||||||
ApplicationsSettings::self()->setAppSetting(d->m_desktopEntry, SettingsProperty::PopupStyle, style);
|
// ApplicationsSettings::self()->setAppSetting(d->m_desktopEntry, SettingsProperty::PopupStyle, style);
|
||||||
}
|
//}
|
||||||
|
|
||||||
QString SingleApplicationSettings::desktopEntry() const
|
QString SingleApplicationSettings::desktopEntry() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ class SingleApplicationSettings : public QObject
|
||||||
Q_PROPERTY(bool allowSound READ allowSound WRITE setAllowSound NOTIFY allowSoundChanged)
|
Q_PROPERTY(bool allowSound READ allowSound WRITE setAllowSound NOTIFY allowSoundChanged)
|
||||||
Q_PROPERTY(bool showContentOnLockScreen READ showContentOnLockScreen WRITE setShowContentOnLockScreen NOTIFY showContentOnLockScreenChanged)
|
Q_PROPERTY(bool showContentOnLockScreen READ showContentOnLockScreen WRITE setShowContentOnLockScreen NOTIFY showContentOnLockScreenChanged)
|
||||||
Q_PROPERTY(bool showNotificationOnLockScreen READ showNotificationOnLockScreen WRITE setShowNotificationOnLockScreen NOTIFY showNotificationOnLockScreenChanged)
|
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:
|
public:
|
||||||
explicit SingleApplicationSettings(const QString &desktopEntry = QString(), QObject *parent = nullptr);
|
explicit SingleApplicationSettings(const QString &desktopEntry = QString(), QObject *parent = nullptr);
|
||||||
SingleApplicationSettings(const SingleApplicationSettings &other);
|
SingleApplicationSettings(const SingleApplicationSettings &other);
|
||||||
|
@ -54,8 +54,8 @@ public:
|
||||||
bool showNotificationOnLockScreen() const;
|
bool showNotificationOnLockScreen() const;
|
||||||
void setShowNotificationOnLockScreen(bool enable);
|
void setShowNotificationOnLockScreen(bool enable);
|
||||||
|
|
||||||
SettingsProperty::Property popupStyle() const;
|
// SettingsProperty::Property popupStyle() const;
|
||||||
void setPopupStyle(SettingsProperty::Property style);
|
// void setPopupStyle(SettingsProperty::Property style);
|
||||||
|
|
||||||
QString desktopEntry() const;
|
QString desktopEntry() const;
|
||||||
|
|
||||||
|
|
|
@ -40,16 +40,16 @@ void NoticeMenu::initStatus(UkuiNotification::SingleApplicationSettings *setting
|
||||||
m_detailBtn->setChecked(settings->showContentOnLockScreen());
|
m_detailBtn->setChecked(settings->showContentOnLockScreen());
|
||||||
m_showBtn->setChecked(settings->showNotificationOnLockScreen());
|
m_showBtn->setChecked(settings->showNotificationOnLockScreen());
|
||||||
|
|
||||||
int styleId = 0;
|
// int styleId = 0;
|
||||||
UkuiNotification::SettingsProperty::Property style = settings->popupStyle();
|
// UkuiNotification::SettingsProperty::Property style = settings->popupStyle();
|
||||||
if (style == UkuiNotification::SettingsProperty::TransientPopup) {
|
// if (style == UkuiNotification::SettingsProperty::TransientPopup) {
|
||||||
styleId = 0;
|
// styleId = 0;
|
||||||
} else if (style == UkuiNotification::SettingsProperty::ResidentPopup) {
|
// } else if (style == UkuiNotification::SettingsProperty::ResidentPopup) {
|
||||||
styleId = 1;
|
// styleId = 1;
|
||||||
} else if (style == UkuiNotification::SettingsProperty::NoPopup) {
|
// } else if (style == UkuiNotification::SettingsProperty::NoPopup) {
|
||||||
styleId = 2;
|
// styleId = 2;
|
||||||
}
|
// }
|
||||||
m_styleGroup->button(styleId)->setChecked(true);
|
// m_styleGroup->button(styleId)->setChecked(true);
|
||||||
|
|
||||||
m_voiceBtn->blockSignals(false);
|
m_voiceBtn->blockSignals(false);
|
||||||
m_showBtn->blockSignals(false);
|
m_showBtn->blockSignals(false);
|
||||||
|
@ -78,20 +78,20 @@ void NoticeMenu::setShowOnLockScreenEnable(bool state)
|
||||||
m_showBtn->blockSignals(false);
|
m_showBtn->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoticeMenu::setPopupStyle(UkuiNotification::SettingsProperty::Property style)
|
//void NoticeMenu::setPopupStyle(UkuiNotification::SettingsProperty::Property style)
|
||||||
{
|
//{
|
||||||
int styleId = 0;
|
// int styleId = 0;
|
||||||
if (style == UkuiNotification::SettingsProperty::TransientPopup) {
|
// if (style == UkuiNotification::SettingsProperty::TransientPopup) {
|
||||||
styleId = 0;
|
// styleId = 0;
|
||||||
} else if (style == UkuiNotification::SettingsProperty::ResidentPopup) {
|
// } else if (style == UkuiNotification::SettingsProperty::ResidentPopup) {
|
||||||
styleId = 1;
|
// styleId = 1;
|
||||||
} else if (style == UkuiNotification::SettingsProperty::NoPopup) {
|
// } else if (style == UkuiNotification::SettingsProperty::NoPopup) {
|
||||||
styleId = 2;
|
// styleId = 2;
|
||||||
}
|
// }
|
||||||
m_styleGroup->blockSignals(true);
|
// m_styleGroup->blockSignals(true);
|
||||||
m_styleGroup->button(styleId)->setChecked(true);
|
// m_styleGroup->button(styleId)->setChecked(true);
|
||||||
m_styleGroup->blockSignals(false);
|
// m_styleGroup->blockSignals(false);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void NoticeMenu::initUi()
|
void NoticeMenu::initUi()
|
||||||
{
|
{
|
||||||
|
@ -117,25 +117,25 @@ void NoticeMenu::initUi()
|
||||||
|
|
||||||
QFrame *line_3 = setLine();
|
QFrame *line_3 = setLine();
|
||||||
|
|
||||||
QLabel *styletitleLabel = new QLabel(tr("Notification Style"), this);
|
// QLabel *styletitleLabel = new QLabel(tr("Notification Style"), this);
|
||||||
styletitleLabel->setContentsMargins(24, 0, 0, 0);
|
// styletitleLabel->setContentsMargins(24, 0, 0, 0);
|
||||||
|
//
|
||||||
m_styleGroup = new QButtonGroup(this);
|
// m_styleGroup = new QButtonGroup(this);
|
||||||
|
//
|
||||||
QFrame *mutativeFrame = new QFrame(this);
|
// QFrame *mutativeFrame = new QFrame(this);
|
||||||
m_mutativeBtn = new QRadioButton;
|
// m_mutativeBtn = new QRadioButton;
|
||||||
m_styleGroup->addButton(m_mutativeBtn, 0);
|
// m_styleGroup->addButton(m_mutativeBtn, 0);
|
||||||
setFrame(mutativeFrame, tr("Banner: Appears in the upper right corner of the screen, and disappears automatically"), m_mutativeBtn);
|
// setFrame(mutativeFrame, tr("Banner: Appears in the upper right corner of the screen, and disappears automatically"), m_mutativeBtn);
|
||||||
|
//
|
||||||
QFrame *alwaysFrame = new QFrame(this);
|
// QFrame *alwaysFrame = new QFrame(this);
|
||||||
m_alwaysBtn = new QRadioButton;
|
// m_alwaysBtn = new QRadioButton;
|
||||||
m_styleGroup->addButton(m_alwaysBtn, 1);
|
// m_styleGroup->addButton(m_alwaysBtn, 1);
|
||||||
setFrame(alwaysFrame, tr("Tip:It will be kept on the screen until it is closed"), m_alwaysBtn);
|
// setFrame(alwaysFrame, tr("Tip:It will be kept on the screen until it is closed"), m_alwaysBtn);
|
||||||
|
//
|
||||||
QFrame *noneFrame = new QFrame(this);
|
// QFrame *noneFrame = new QFrame(this);
|
||||||
m_noneBtn = new QRadioButton;
|
// m_noneBtn = new QRadioButton;
|
||||||
m_styleGroup->addButton(m_noneBtn, 2);
|
// 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);
|
// 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(voiceFrame);
|
||||||
menuLyt->addWidget(line_1);
|
menuLyt->addWidget(line_1);
|
||||||
|
@ -144,10 +144,10 @@ void NoticeMenu::initUi()
|
||||||
menuLyt->addWidget(showFrame);
|
menuLyt->addWidget(showFrame);
|
||||||
menuLyt->addWidget(line_3);
|
menuLyt->addWidget(line_3);
|
||||||
menuLyt->addSpacing(16);
|
menuLyt->addSpacing(16);
|
||||||
menuLyt->addWidget(styletitleLabel);
|
// menuLyt->addWidget(styletitleLabel);
|
||||||
menuLyt->addWidget(mutativeFrame);
|
// menuLyt->addWidget(mutativeFrame);
|
||||||
menuLyt->addWidget(alwaysFrame);
|
// menuLyt->addWidget(alwaysFrame);
|
||||||
menuLyt->addWidget(noneFrame);
|
// menuLyt->addWidget(noneFrame);
|
||||||
menuLyt->addStretch();
|
menuLyt->addStretch();
|
||||||
|
|
||||||
// 隐藏未实现模块
|
// 隐藏未实现模块
|
||||||
|
|
|
@ -578,22 +578,22 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
||||||
UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::ShowNotificationOnLockScreen, checked);
|
UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::ShowNotificationOnLockScreen, checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(menu, &NoticeMenu::styleBtnSignals, [=](int id) {
|
// connect(menu, &NoticeMenu::styleBtnSignals, [=](int id) {
|
||||||
QString str("mutative");
|
// QString str("mutative");
|
||||||
UkuiNotification::SettingsProperty::Property style = UkuiNotification::SettingsProperty::TransientPopup;
|
// UkuiNotification::SettingsProperty::Property style = UkuiNotification::SettingsProperty::TransientPopup;
|
||||||
if (id == 0) {
|
// if (id == 0) {
|
||||||
str = "mutative";
|
// str = "mutative";
|
||||||
style = UkuiNotification::SettingsProperty::TransientPopup;
|
// style = UkuiNotification::SettingsProperty::TransientPopup;
|
||||||
} else if (id == 1) {
|
// } else if (id == 1) {
|
||||||
str = "always";
|
// str = "always";
|
||||||
style = UkuiNotification::SettingsProperty::ResidentPopup;
|
// style = UkuiNotification::SettingsProperty::ResidentPopup;
|
||||||
} else if (id == 2) {
|
// } else if (id == 2) {
|
||||||
str = "none";
|
// str = "none";
|
||||||
style = UkuiNotification::SettingsProperty::NoPopup;
|
// style = UkuiNotification::SettingsProperty::NoPopup;
|
||||||
}
|
// }
|
||||||
//Common::buriedSettings(name(), "set notice style", QString("settings"), str);
|
// //Common::buriedSettings(name(), "set notice style", QString("settings"), str);
|
||||||
UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::PopupStyle, style);
|
// UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::PopupStyle, style);
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notice::setAppIcon(QLabel *iconlabel, const QString &icon)
|
void Notice::setAppIcon(QLabel *iconlabel, const QString &icon)
|
||||||
|
|
Loading…
Reference in New Issue