新增ukui-control-center插件;修复部分设置项接口问题;
This commit is contained in:
parent
293715a9c7
commit
da3ad85741
|
@ -16,6 +16,7 @@ set(REQUIRED_QT_VERSION 5.12.8)
|
|||
|
||||
add_subdirectory(notification-server)
|
||||
add_subdirectory(libukui-notification)
|
||||
add_subdirectory(notification-ukcc-plugin)
|
||||
if(BUILD_TEST)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
|
|
@ -38,7 +38,7 @@ bool NotificationClientPrivate::init()
|
|||
}
|
||||
m_watcher = new QDBusServiceWatcher(QStringLiteral("org.freedesktop.Notifications"),
|
||||
conn,
|
||||
QDBusServiceWatcher::WatchForOwnerChange,
|
||||
QDBusServiceWatcher::WatchForOwnerChange,
|
||||
this);
|
||||
connect(m_watcher, &QDBusServiceWatcher::serviceOwnerChanged, this, &NotificationClientPrivate::serviceChange);
|
||||
return registerClient();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "applications-settings.h"
|
||||
#include <mutex>
|
||||
#include <QQmlEngine>
|
||||
#include <QDebug>
|
||||
#include "settings-manager.h"
|
||||
#include <QJsonObject>
|
||||
|
||||
|
@ -29,7 +30,7 @@ ApplicationsSettings *UkuiNotification::ApplicationsSettings::self()
|
|||
return s_self;
|
||||
}
|
||||
|
||||
UkuiNotification::ApplicationsSettings::ApplicationsSettings(QObject *parent) : QObject(parent), d(new ApplicationsSettingsPrivate)
|
||||
ApplicationsSettings::ApplicationsSettings(QObject *parent) : QObject(parent), d(new ApplicationsSettingsPrivate)
|
||||
{
|
||||
d->m_settingsData = SettingsManager::self()->getAllAppSettings();
|
||||
connect(SettingsManager::self(), &SettingsManager::appUninstalled, this, &ApplicationsSettings::applicationUninstalled);
|
||||
|
@ -44,23 +45,25 @@ ApplicationsSettings::~ApplicationsSettings()
|
|||
d = nullptr;
|
||||
}
|
||||
}
|
||||
SingleApplicationSettings ApplicationsSettings::creatSettings(const PopupNotification ¬ification)
|
||||
|
||||
SingleApplicationSettings &ApplicationsSettings::creatSettings(const PopupNotification ¬ification)
|
||||
{
|
||||
QString desktopEntry = notification.desktopEntry();
|
||||
if(desktopEntry.isEmpty()) {
|
||||
desktopEntry = QStringLiteral("default");
|
||||
}
|
||||
if(d->m_cache.contains(desktopEntry)) {
|
||||
return d->m_cache.value(desktopEntry);
|
||||
return d->m_cache[desktopEntry];
|
||||
}
|
||||
return d->m_cache.insert(desktopEntry, SingleApplicationSettings(desktopEntry)).value();
|
||||
d->m_cache[desktopEntry].init(desktopEntry);
|
||||
return d->m_cache[desktopEntry];
|
||||
}
|
||||
|
||||
ApplicationsSettingsHash &ApplicationsSettings::getAllApplicationsSettings()
|
||||
{
|
||||
for(const QString &desktopEntry : d->m_settingsData.keys()) {
|
||||
if(!d->m_cache.contains(desktopEntry)) {
|
||||
d->m_cache.insert(desktopEntry, SingleApplicationSettings(desktopEntry));
|
||||
d->m_cache[desktopEntry].init(desktopEntry);
|
||||
}
|
||||
}
|
||||
return d->m_cache;
|
||||
|
@ -77,6 +80,7 @@ QJsonObject ApplicationsSettings::getAppSettings(const QString &appDesktopName)
|
|||
}
|
||||
return value.toObject();
|
||||
}
|
||||
|
||||
bool ApplicationsSettings::setAppSetting(const QString &appDesktopName, SettingsProperty::Property key,
|
||||
const QVariant &value)
|
||||
{
|
||||
|
|
|
@ -20,12 +20,8 @@ class ApplicationsSettings : public QObject
|
|||
public:
|
||||
static ApplicationsSettings *self();
|
||||
~ApplicationsSettings();
|
||||
/**
|
||||
* 初始化一个应用设置项实例,使用完毕后需要调用者进行回收
|
||||
* @param notification
|
||||
* @return SingleApplicationSettings
|
||||
*/
|
||||
SingleApplicationSettings creatSettings(const PopupNotification ¬ification);
|
||||
|
||||
SingleApplicationSettings &creatSettings(const PopupNotification ¬ification);
|
||||
ApplicationsSettingsHash &getAllApplicationsSettings();
|
||||
/**
|
||||
* @brief getAppSettings
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "notification-global-settings.h"
|
||||
#include <QJsonObject>
|
||||
#include <QQmlEngine>
|
||||
#include <QDebug>
|
||||
#include "settings-manager.h"
|
||||
#include "settings-properties.h"
|
||||
#include "settings-properties-info.h"
|
||||
|
@ -37,7 +38,7 @@ NotificationGlobalSettings::~NotificationGlobalSettings()
|
|||
|
||||
bool NotificationGlobalSettings::scheduleTurnOnDND()
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ScheduleTurnOnDND).name()).toBool();
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ScheduleTurnOnDND).name()).toVariant().toBool();
|
||||
}
|
||||
|
||||
QTime NotificationGlobalSettings::scheduleTurnOnDNDTime()
|
||||
|
@ -52,22 +53,22 @@ QTime NotificationGlobalSettings::scheduleTurnOffDNDTime()
|
|||
|
||||
bool NotificationGlobalSettings::DNDWhileMultiScreen()
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::DNDWhileMultiScreen).name()).toBool();
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::DNDWhileMultiScreen).name()).toVariant().toBool();
|
||||
}
|
||||
|
||||
bool NotificationGlobalSettings::DNDWhileFullScreen()
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::DNDWhileFullScreen).name()).toBool();
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::DNDWhileFullScreen).name()).toVariant().toBool();
|
||||
}
|
||||
|
||||
bool NotificationGlobalSettings::notifyAlarmWhileDND()
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::NotifyAlarmWhileDND).name()).toBool();
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::NotifyAlarmWhileDND).name()).toVariant().toBool();
|
||||
}
|
||||
|
||||
bool NotificationGlobalSettings::receiveNotificationsFromApps()
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ReceiveNotificationsFromApps).name()).toBool();
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ReceiveNotificationsFromApps).name()).toVariant().toBool();
|
||||
}
|
||||
|
||||
void NotificationGlobalSettings::settingsDataChanged()
|
||||
|
@ -78,24 +79,31 @@ void NotificationGlobalSettings::settingsDataChanged()
|
|||
QJsonValue value = data.value(name);
|
||||
if(d->m_settings.value(name) != value) {
|
||||
d->m_settings.insert(name, value);
|
||||
}
|
||||
switch (property) {
|
||||
case SettingsProperty::ScheduleTurnOnDND:
|
||||
Q_EMIT scheduleTurnOnDNDChanged(value.toBool());
|
||||
case SettingsProperty::ScheduleTurnOnDNDTime:
|
||||
Q_EMIT scheduleTurnOnDNDTimeChanged(QTime::fromString(value.toString(), "HHmm"));
|
||||
case SettingsProperty::ScheduleTurnOffDNDTime:
|
||||
Q_EMIT scheduleTurnOffDNDTimeChanged(QTime::fromString(value.toString(), "HHmm"));
|
||||
case SettingsProperty::DNDWhileMultiScreen:
|
||||
Q_EMIT DNDWhileMultiScreenChanged(value.toBool());
|
||||
case SettingsProperty::DNDWhileFullScreen:
|
||||
Q_EMIT DNDWhileFullScreenChanged(value.toBool());
|
||||
case SettingsProperty::NotifyAlarmWhileDND:
|
||||
Q_EMIT notifyAlarmWhileDNDChanged(value.toBool());
|
||||
case SettingsProperty::ReceiveNotificationsFromApps:
|
||||
Q_EMIT receiveNotificationsFromAppsChanged(value.toBool());
|
||||
default:
|
||||
break;
|
||||
switch (property) {
|
||||
case SettingsProperty::ScheduleTurnOnDND:
|
||||
Q_EMIT scheduleTurnOnDNDChanged(value.toVariant().toBool());
|
||||
break;
|
||||
case SettingsProperty::ScheduleTurnOnDNDTime:
|
||||
Q_EMIT scheduleTurnOnDNDTimeChanged(QTime::fromString(value.toString(), "HHmm"));
|
||||
break;
|
||||
case SettingsProperty::ScheduleTurnOffDNDTime:
|
||||
Q_EMIT scheduleTurnOffDNDTimeChanged(QTime::fromString(value.toString(), "HHmm"));
|
||||
break;
|
||||
case SettingsProperty::DNDWhileMultiScreen:
|
||||
Q_EMIT DNDWhileMultiScreenChanged(value.toVariant().toBool());
|
||||
break;
|
||||
case SettingsProperty::DNDWhileFullScreen:
|
||||
Q_EMIT DNDWhileFullScreenChanged(value.toVariant().toBool());
|
||||
break;
|
||||
case SettingsProperty::NotifyAlarmWhileDND:
|
||||
Q_EMIT notifyAlarmWhileDNDChanged(value.toVariant().toBool());
|
||||
break;
|
||||
case SettingsProperty::ReceiveNotificationsFromApps:
|
||||
Q_EMIT receiveNotificationsFromAppsChanged(value.toVariant().toBool());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class NotificationGlobalSettings : public QObject
|
|||
Q_PROPERTY(bool receiveNotificationsFromApps READ receiveNotificationsFromApps WRITE setReceiveNotificationsFromApps NOTIFY receiveNotificationsFromAppsChanged)
|
||||
|
||||
public:
|
||||
NotificationGlobalSettings(QObject *parent);
|
||||
NotificationGlobalSettings(QObject *parent = nullptr);
|
||||
~NotificationGlobalSettings();
|
||||
/**
|
||||
* 自动开启勿扰模式
|
||||
|
|
|
@ -50,7 +50,7 @@ private:
|
|||
* @param appInfo
|
||||
* appInfo中的key为QString类型的desktop文件路径,value为QStringList类型的数据集,目前依次包括local_name、icon,可扩展
|
||||
*/
|
||||
void getAppInfo(QMap<QString, QStringList> appInfoMap);
|
||||
void getAppInfo(QMap<QString, QStringList> &appInfoMap);
|
||||
|
||||
void initSettingsData(QJsonObject &data);
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ void SettingsManagerPrivate::checkAndLoad()
|
|||
lockFile.lock();
|
||||
QFile settingsFile(SETTINGS_FILE_PATH_NAME);
|
||||
if (!settingsFile.exists()) {
|
||||
qDebug() << SETTINGS_FILE_PATH_NAME << " is not exist, start create settings file.";
|
||||
createSettingsFile();
|
||||
lockFile.unlock();
|
||||
return;
|
||||
|
@ -87,6 +88,7 @@ void SettingsManagerPrivate::checkAndLoad()
|
|||
} else {
|
||||
m_settingsData.swap(settingsData);
|
||||
Q_EMIT settingsUpdateFinished();
|
||||
m_watcher->addPath(SETTINGS_FILE_PATH_NAME);
|
||||
}
|
||||
lockFile.unlock();
|
||||
}
|
||||
|
@ -139,7 +141,7 @@ void SettingsManagerPrivate::updateSettingsFile()
|
|||
Q_EMIT settingsUpdateFinished();
|
||||
}
|
||||
|
||||
void SettingsManagerPrivate::getAppInfo(QMap<QString, QStringList> appInfoMap)
|
||||
void SettingsManagerPrivate::getAppInfo(QMap<QString, QStringList> &appInfoMap)
|
||||
{
|
||||
QVector<UkuiSearch::AppInfoResult> appInfoResults;
|
||||
if (!m_appDataServiceClient->getAppInfoResults(appInfoResults)) {
|
||||
|
@ -167,8 +169,8 @@ void SettingsManagerPrivate::initSettingsData(QJsonObject &data)
|
|||
QJsonObject applicationsSettings;
|
||||
QMap<QString, QStringList> appInfoMap;
|
||||
getAppInfo(appInfoMap);
|
||||
for (auto &appInfoPair : appInfoMap) {
|
||||
applicationsSettings.insert(appInfoPair.first(), m_applicationDefaultSettings);
|
||||
for (auto info = appInfoMap.begin(); info != appInfoMap.end(); info++) {
|
||||
applicationsSettings.insert(info.key(), m_applicationDefaultSettings);
|
||||
}
|
||||
data.insert(QStringLiteral("Applications"), applicationsSettings);
|
||||
//TODO: 配置文件中增加应用local Name?
|
||||
|
@ -193,6 +195,9 @@ void SettingsManagerPrivate::desktopFileAdd(const QVector<UkuiSearch::AppInfoRes
|
|||
|
||||
void SettingsManagerPrivate::desktopFileDelete(const QStringList &data)
|
||||
{
|
||||
if (data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (qApp->property("IS_UKUI_NOTIFICATION_SERVICE").toBool()) {
|
||||
QJsonObject applicationsSettings = m_settingsData.value(QStringLiteral("Applications")).toObject();
|
||||
for (const QString &app : data) {
|
||||
|
|
|
@ -4,15 +4,18 @@
|
|||
|
||||
#include "single-application-settings.h"
|
||||
#include <QJsonObject>
|
||||
#include <QDebug>
|
||||
#include "settings-properties-info.h"
|
||||
#include "applications-settings.h"
|
||||
|
||||
|
||||
namespace UkuiNotification{
|
||||
class SingleApplicationSettingsPrivate
|
||||
{
|
||||
friend class SingleApplicationSettings;
|
||||
public:
|
||||
SingleApplicationSettingsPrivate();
|
||||
SingleApplicationSettingsPrivate(const SingleApplicationSettingsPrivate &other);
|
||||
~SingleApplicationSettingsPrivate();
|
||||
private:
|
||||
QJsonObject m_settings;
|
||||
|
@ -26,6 +29,12 @@ SingleApplicationSettingsPrivate::SingleApplicationSettingsPrivate()
|
|||
|
||||
}
|
||||
|
||||
SingleApplicationSettingsPrivate::SingleApplicationSettingsPrivate(const SingleApplicationSettingsPrivate &other)
|
||||
{
|
||||
m_settings = other.m_settings;
|
||||
m_desktopEntry = other.m_desktopEntry;
|
||||
}
|
||||
|
||||
SingleApplicationSettingsPrivate::~SingleApplicationSettingsPrivate()
|
||||
{
|
||||
|
||||
|
@ -35,12 +44,7 @@ SingleApplicationSettings::SingleApplicationSettings(const QString &desktopEntry
|
|||
: QObject(parent)
|
||||
, d(new SingleApplicationSettingsPrivate)
|
||||
{
|
||||
d->m_desktopEntry = desktopEntry;
|
||||
d->m_settings = ApplicationsSettings::self()->getAppSettings(desktopEntry);
|
||||
if(d->m_desktopEntry != QStringLiteral("default") && !d->m_desktopEntry.isEmpty()) {
|
||||
connect(ApplicationsSettings::self(), &ApplicationsSettings::applicationUninstalled, this, &SingleApplicationSettings::appUninstalled);
|
||||
connect(ApplicationsSettings::self(), &ApplicationsSettings::settingsUpdated, this, &SingleApplicationSettings::settingsDataChanged);
|
||||
}
|
||||
init(desktopEntry);
|
||||
}
|
||||
|
||||
SingleApplicationSettings::SingleApplicationSettings(const SingleApplicationSettings &other)
|
||||
|
@ -68,27 +72,37 @@ SingleApplicationSettings::~SingleApplicationSettings()
|
|||
}
|
||||
}
|
||||
|
||||
bool SingleApplicationSettings::allowNotify()
|
||||
void SingleApplicationSettings::init(const QString &desktopEntry)
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::AllowNotify).name()).toBool();
|
||||
d->m_desktopEntry = desktopEntry;
|
||||
d->m_settings = ApplicationsSettings::self()->getAppSettings(desktopEntry);
|
||||
if(d->m_desktopEntry != QStringLiteral("default") && !d->m_desktopEntry.isEmpty()) {
|
||||
connect(ApplicationsSettings::self(), &ApplicationsSettings::applicationUninstalled, this, &SingleApplicationSettings::appUninstalled);
|
||||
connect(ApplicationsSettings::self(), &ApplicationsSettings::settingsUpdated, this, &SingleApplicationSettings::settingsDataChanged);
|
||||
}
|
||||
}
|
||||
|
||||
bool SingleApplicationSettings::allowSound()
|
||||
bool SingleApplicationSettings::allowNotify() const
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::AllowSound).name()).toBool();
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::AllowNotify).name()).toVariant().toBool();
|
||||
}
|
||||
|
||||
bool SingleApplicationSettings::showContentOnLockScreen()
|
||||
bool SingleApplicationSettings::allowSound() const
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ShowContentOnLockScreen).name()).toBool();
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::AllowSound).name()).toVariant().toBool();
|
||||
}
|
||||
|
||||
bool SingleApplicationSettings::showNotificationOnLockScreen()
|
||||
bool SingleApplicationSettings::showContentOnLockScreen() const
|
||||
{
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ShowNotificationOnLockScreen).name()).toBool();
|
||||
return d->m_settings.value(SettingsPropertiesInfo(SettingsProperty::ShowContentOnLockScreen).name()).toVariant().toBool();
|
||||
}
|
||||
|
||||
SettingsProperty::Property UkuiNotification::SingleApplicationSettings::popupStyle()
|
||||
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();
|
||||
}
|
||||
|
@ -107,15 +121,20 @@ void SingleApplicationSettings::settingsDataChanged()
|
|||
}
|
||||
switch (property) {
|
||||
case SettingsProperty::AllowNotify:
|
||||
Q_EMIT allowNotifyChanged(value.toBool());
|
||||
Q_EMIT allowNotifyChanged(value.toVariant().toBool());
|
||||
break;
|
||||
case SettingsProperty::AllowSound:
|
||||
Q_EMIT allowSoundChanged(value.toBool());
|
||||
Q_EMIT allowSoundChanged(value.toVariant().toBool());
|
||||
break;
|
||||
case SettingsProperty::ShowContentOnLockScreen:
|
||||
Q_EMIT showContentOnLockScreenChanged(value.toBool());
|
||||
Q_EMIT showContentOnLockScreenChanged(value.toVariant().toBool());
|
||||
break;
|
||||
case SettingsProperty::ShowNotificationOnLockScreen:
|
||||
Q_EMIT showNotificationOnLockScreenChanged(value.toBool());
|
||||
Q_EMIT showNotificationOnLockScreenChanged(value.toVariant().toBool());
|
||||
break;
|
||||
case SettingsProperty::PopupStyle:
|
||||
Q_EMIT popupStyleChanged(SettingsPropertiesInfo::fromName(value.toString()).property());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef UKUI_NOTIFICATION_SINGLE_APPLICATION_SETTINGS_H
|
||||
#define UKUI_NOTIFICATION_SINGLE_APPLICATION_SETTINGS_H
|
||||
#include <QObject>
|
||||
#include <settings-properties.h>
|
||||
#include "settings-properties.h"
|
||||
#include <QJsonObject>
|
||||
namespace UkuiNotification {
|
||||
class SingleApplicationSettingsPrivate;
|
||||
|
@ -27,19 +27,21 @@ public:
|
|||
SingleApplicationSettings &operator=(SingleApplicationSettings &&other) Q_DECL_NOEXCEPT;
|
||||
~SingleApplicationSettings();
|
||||
|
||||
bool allowNotify();
|
||||
void init(const QString &desktopEntry);
|
||||
|
||||
bool allowNotify() const;
|
||||
void setAllowNotify(bool enable);
|
||||
|
||||
bool allowSound();
|
||||
bool allowSound() const ;
|
||||
void setAllowSound(bool enable);
|
||||
|
||||
bool showContentOnLockScreen();
|
||||
bool showContentOnLockScreen() const ;
|
||||
void setShowContentOnLockScreen(bool enable);
|
||||
|
||||
bool showNotificationOnLockScreen();
|
||||
bool showNotificationOnLockScreen() const;
|
||||
void setShowNotificationOnLockScreen(bool enable);
|
||||
|
||||
SettingsProperty::Property popupStyle();
|
||||
SettingsProperty::Property popupStyle() const;
|
||||
void setPopupStyle(SettingsProperty::Property style);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "notification-server-config.h"
|
||||
#include "utils.h"
|
||||
#include "notification-close-reason.h"
|
||||
#include "notification-settings/settings-manager.h"
|
||||
|
||||
using namespace NotificationServer;
|
||||
|
||||
|
@ -115,6 +116,7 @@ bool ServerPrivate::init()
|
|||
qWarning() << "Failed to register Notification DBus object!" << conn.lastError().message();
|
||||
return false;
|
||||
}
|
||||
UkuiNotification::SettingsManager::self();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -187,4 +189,4 @@ bool Server::init()
|
|||
return d->init();
|
||||
}
|
||||
|
||||
Server::~Server() = default;
|
||||
Server::~Server() = default;
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
set(notification-ukcc-plugin_LIB_SRCS
|
||||
notification-ukcc-plugin.cpp
|
||||
notification-ukcc-plugin.h
|
||||
noticemenu.cpp
|
||||
noticemenu.h)
|
||||
|
||||
add_library(notification-ukcc-plugin SHARED ${notification-ukcc-plugin_LIB_SRCS})
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Widgets REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
set(UKUI_NOTIFICATION_EXTERNAL_LIBS "")
|
||||
set(UKUI_NOTIFICATION_PC_PKGS kysdk-qtwidgets)
|
||||
|
||||
foreach(PC_LIB IN ITEMS ${UKUI_NOTIFICATION_PC_PKGS})
|
||||
pkg_check_modules(${PC_LIB} REQUIRED ${PC_LIB})
|
||||
if(${${PC_LIB}_FOUND})
|
||||
include_directories(${${PC_LIB}_INCLUDE_DIRS})
|
||||
link_directories(${${PC_LIB}_LIBRARY_DIRS})
|
||||
list(APPEND UKUI_NOTIFICATION_EXTERNAL_LIBS ${${PC_LIB}_LIBRARIES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||
include_directories(../libukui-notification)
|
||||
|
||||
target_link_libraries(notification-ukcc-plugin
|
||||
PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::DBus
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
ukui-notification
|
||||
ukcc
|
||||
)
|
||||
|
||||
install(TARGETS notification-ukcc-plugin DESTINATION /usr/lib/x86_64-linux-gnu/ukui-control-center)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef APPDETAIL_H
|
||||
#define APPDETAIL_H
|
||||
|
||||
#define MESSAGES_KEY "messages"
|
||||
#define VOICE_KEY "voice"
|
||||
#define MAXIMINE_KEY "maximize"
|
||||
#define NAME_KEY_US "name-us"
|
||||
#define NAME_KEY_CN "name-cn"
|
||||
|
||||
#endif // APPDETAIL_H
|
|
@ -0,0 +1,204 @@
|
|||
#include "noticemenu.h"
|
||||
#include <QDebug>
|
||||
#include <QVBoxLayout>
|
||||
#include <ukcc/widgets/fixlabel.h>
|
||||
|
||||
NoticeMenu::NoticeMenu(QWidget *parent) :
|
||||
QMenu(parent)
|
||||
{
|
||||
setFixedSize(380, 380);
|
||||
initUi();
|
||||
setConnect();
|
||||
}
|
||||
|
||||
void NoticeMenu::initStaus(const UkuiNotification::SingleApplicationSettings &settings)
|
||||
{
|
||||
m_voiceBtn->blockSignals(true);
|
||||
m_showBtn->blockSignals(true);
|
||||
m_detailBtn->blockSignals(true);
|
||||
m_styleGrounp->blockSignals(true);
|
||||
|
||||
m_voiceBtn->setChecked(settings.allowSound());
|
||||
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_styleGrounp->button(styleId)->setChecked(true);
|
||||
|
||||
m_voiceBtn->blockSignals(false);
|
||||
m_showBtn->blockSignals(false);
|
||||
m_detailBtn->blockSignals(false);
|
||||
m_styleGrounp->blockSignals(false);
|
||||
}
|
||||
|
||||
void NoticeMenu::setVoiceEnable(bool state)
|
||||
{
|
||||
m_voiceBtn->blockSignals(true);
|
||||
m_voiceBtn->setChecked(state);
|
||||
m_voiceBtn->blockSignals(false);
|
||||
}
|
||||
|
||||
void NoticeMenu::setDetailShowOnLockScreenEnable(bool state)
|
||||
{
|
||||
m_detailBtn->blockSignals(true);
|
||||
m_detailBtn->setChecked(state);
|
||||
m_detailBtn->blockSignals(false);
|
||||
}
|
||||
|
||||
void NoticeMenu::setShowOnLockScreenEnable(bool state)
|
||||
{
|
||||
m_showBtn->blockSignals(true);
|
||||
m_showBtn->setChecked(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_styleGrounp->blockSignals(true);
|
||||
m_styleGrounp->button(styleId)->setChecked(true);
|
||||
m_styleGrounp->blockSignals(false);
|
||||
}
|
||||
|
||||
void NoticeMenu::initUi()
|
||||
{
|
||||
QVBoxLayout *menuLyt = new QVBoxLayout(this);
|
||||
menuLyt->setSpacing(0);
|
||||
menuLyt->setContentsMargins(8, 0, 8, 0);
|
||||
|
||||
QFrame *voiceFrame = new QFrame(this);
|
||||
m_voiceBtn = new KSwitchButton;
|
||||
setFrame(voiceFrame, tr("Beep sound when notified"), m_voiceBtn);
|
||||
|
||||
QFrame *line_1 = setLine();
|
||||
|
||||
QFrame *detailFrame = new QFrame(this);
|
||||
m_detailBtn = new KSwitchButton;
|
||||
setFrame(detailFrame, tr("Show message on screenlock"), m_detailBtn);
|
||||
|
||||
QFrame *line_2 = setLine();
|
||||
|
||||
QFrame *showFrame = new QFrame(this);
|
||||
m_showBtn = new KSwitchButton;
|
||||
setFrame(showFrame, tr("Show noticfication on screenlock"), m_showBtn);
|
||||
|
||||
QFrame *line_3 = setLine();
|
||||
|
||||
QLabel *styletitleLabel = new QLabel(tr("Notification Style"), this);
|
||||
styletitleLabel->setContentsMargins(24, 0, 0, 0);
|
||||
|
||||
m_styleGrounp = new QButtonGroup(this);
|
||||
|
||||
QFrame *mutativeFrame = new QFrame(this);
|
||||
m_mutativeBtn = new QRadioButton;
|
||||
m_styleGrounp->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_styleGrounp->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_styleGrounp->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);
|
||||
menuLyt->addWidget(detailFrame);
|
||||
menuLyt->addWidget(line_2);
|
||||
menuLyt->addWidget(showFrame);
|
||||
menuLyt->addWidget(line_3);
|
||||
menuLyt->addSpacing(16);
|
||||
menuLyt->addWidget(styletitleLabel);
|
||||
menuLyt->addWidget(mutativeFrame);
|
||||
menuLyt->addWidget(alwaysFrame);
|
||||
menuLyt->addWidget(noneFrame);
|
||||
menuLyt->addStretch();
|
||||
|
||||
// 隐藏未实现模块
|
||||
// voiceFrame->hide();
|
||||
// line_1->hide();
|
||||
// detailFrame->hide();
|
||||
// line_2->hide();
|
||||
// line_3->hide();
|
||||
// styletitleLabel->hide();
|
||||
// mutativeFrame->hide();
|
||||
// alwaysFrame->hide();
|
||||
// noneFrame->hide();
|
||||
// setFixedHeight(60);
|
||||
|
||||
}
|
||||
|
||||
void NoticeMenu::setFrame(QFrame *frame, QString str, KSwitchButton *btn)
|
||||
{
|
||||
frame->setFixedHeight(60);
|
||||
frame->setFrameShape(QFrame::NoFrame);
|
||||
QHBoxLayout *hLyt = new QHBoxLayout(frame);
|
||||
hLyt->setContentsMargins(24, 0, 24, 0);
|
||||
hLyt->setSpacing(8);
|
||||
FixLabel *label = new FixLabel(str, frame);
|
||||
label->setFixedWidth(250);
|
||||
hLyt->addWidget(label);
|
||||
hLyt->addStretch();
|
||||
hLyt->addWidget(btn);
|
||||
}
|
||||
|
||||
void NoticeMenu::setFrame(QFrame *frame, QString str, QRadioButton *btn)
|
||||
{
|
||||
frame->setFixedHeight(48);
|
||||
frame->setFrameShape(QFrame::NoFrame);
|
||||
QHBoxLayout *hLyt = new QHBoxLayout(frame);
|
||||
hLyt->setContentsMargins(24, 0, 24, 0);
|
||||
FixLabel *label = new FixLabel(str, frame);
|
||||
label->setFixedWidth(288);
|
||||
hLyt->addWidget(btn);
|
||||
hLyt->addWidget(label);
|
||||
hLyt->addStretch();
|
||||
}
|
||||
|
||||
QFrame *NoticeMenu::setLine()
|
||||
{
|
||||
QFrame *line = new QFrame();
|
||||
line->setMinimumSize(QSize(0, 1));
|
||||
line->setMaximumSize(QSize(16777215, 1));
|
||||
line->setLineWidth(0);
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
return line;
|
||||
}
|
||||
|
||||
void NoticeMenu::setConnect()
|
||||
{
|
||||
connect(m_voiceBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::voiceSignals);
|
||||
connect(m_detailBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::detailSignals);
|
||||
connect(m_showBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::showSignals);
|
||||
connect(m_styleGrounp, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &NoticeMenu::styleBtnSignals);
|
||||
}
|
||||
|
||||
void NoticeMenu::showEvent(QShowEvent *event)
|
||||
{
|
||||
int menuXPos = this->pos().x();
|
||||
int menuWidth = this->size().width()-4;
|
||||
int buttonWidth = 36;
|
||||
QPoint pos = QPoint(menuXPos - menuWidth + buttonWidth,
|
||||
this->pos().y());
|
||||
this->move(pos);
|
||||
QMenu::showEvent(event);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
#ifndef NOTICEMENU_H
|
||||
#define NOTICEMENU_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMenu>
|
||||
#include <QRadioButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QFrame>
|
||||
|
||||
#include <kswitchbutton.h>
|
||||
#include "notification-settings/applications-settings.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
class NoticeMenu : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NoticeMenu(QWidget *parent = nullptr);
|
||||
|
||||
void initStaus(const UkuiNotification::SingleApplicationSettings &settings);
|
||||
void setVoiceEnable(bool state);
|
||||
void setDetailShowOnLockScreenEnable(bool state);
|
||||
void setShowOnLockScreenEnable(bool state);
|
||||
void setPopupStyle(UkuiNotification::SettingsProperty::Property style);
|
||||
|
||||
static QFrame *setLine();
|
||||
|
||||
private:
|
||||
void initUi();
|
||||
void setFrame(QFrame *frame, QString str, KSwitchButton *btn);
|
||||
void setFrame(QFrame *frame, QString str, QRadioButton *btn);
|
||||
void setConnect();
|
||||
|
||||
private:
|
||||
KSwitchButton *m_voiceBtn = nullptr;
|
||||
KSwitchButton *m_detailBtn = nullptr;
|
||||
KSwitchButton *m_showBtn = nullptr;
|
||||
QButtonGroup *m_styleGrounp = nullptr;
|
||||
QRadioButton *m_noneBtn = nullptr;
|
||||
QRadioButton *m_mutativeBtn = nullptr;
|
||||
QRadioButton *m_alwaysBtn = nullptr;
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
void voiceSignals(bool checked);
|
||||
void detailSignals(bool checked);
|
||||
void showSignals(bool checked);
|
||||
void styleBtnSignals(int id);
|
||||
};
|
||||
|
||||
#endif // NOTICEMENU_H
|
|
@ -0,0 +1,604 @@
|
|||
|
||||
#include "notification-ukcc-plugin.h"
|
||||
#include "noticemenu.h"
|
||||
#include <QFileDialog>
|
||||
#include <QTimer>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QSettings>
|
||||
#include <QToolButton>
|
||||
#include <QFile>
|
||||
#include <QThread>
|
||||
|
||||
#define THEME_QT_SCHEMA "org.ukui.style"
|
||||
|
||||
class ukToolButton : public QToolButton
|
||||
{
|
||||
public:
|
||||
ukToolButton(QWidget *parent = nullptr):
|
||||
QToolButton(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
};
|
||||
|
||||
Notice::Notice()
|
||||
{
|
||||
m_pluginName = tr("Notice");
|
||||
m_pluginType = SYSTEM;
|
||||
|
||||
if (QGSettings::isSchemaInstalled(THEME_QT_SCHEMA)) {
|
||||
QByteArray id(THEME_QT_SCHEMA);
|
||||
m_themeSetting = new QGSettings(id, QByteArray(), this);
|
||||
}
|
||||
if (!m_globalSettings) {
|
||||
m_globalSettings = new UkuiNotification::NotificationGlobalSettings();
|
||||
}
|
||||
if (!m_appInfo) {
|
||||
m_appInfo = new UkuiSearch::ApplicationInfo();
|
||||
}
|
||||
|
||||
m_pluginWidget = new QWidget;
|
||||
m_pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
initUi(m_pluginWidget);
|
||||
initSearchText();
|
||||
initNoticeStatus();
|
||||
initConnection();
|
||||
initListUI();
|
||||
}
|
||||
|
||||
Notice::~Notice()
|
||||
{
|
||||
if (m_globalSettings) {
|
||||
delete m_globalSettings;
|
||||
m_globalSettings = nullptr;
|
||||
}
|
||||
if (m_appInfo) {
|
||||
delete m_appInfo;
|
||||
m_appInfo = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QString Notice::plugini18nName()
|
||||
{
|
||||
return m_pluginName;
|
||||
}
|
||||
|
||||
int Notice::pluginTypes()
|
||||
{
|
||||
return m_pluginType;
|
||||
}
|
||||
|
||||
QWidget *Notice::pluginUi()
|
||||
{
|
||||
return m_pluginWidget;
|
||||
}
|
||||
|
||||
const QString Notice::name() const
|
||||
{
|
||||
return QStringLiteral("Notice");
|
||||
}
|
||||
|
||||
bool Notice::isShowOnHomePage() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QIcon Notice::icon() const
|
||||
{
|
||||
return QIcon::fromTheme("ukui-tool-symbolic");
|
||||
}
|
||||
|
||||
bool Notice::isEnable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Notice::initUi(QWidget *widget)
|
||||
{
|
||||
QVBoxLayout *mverticalLayout = new QVBoxLayout(widget);
|
||||
mverticalLayout->setSpacing(0);
|
||||
mverticalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QFrame *notFazeFrame = new QFrame(widget);
|
||||
initNotFaze(notFazeFrame);
|
||||
|
||||
QWidget *Noticewidget = new QWidget(widget);
|
||||
Noticewidget->setMinimumSize(QSize(550, 0));
|
||||
Noticewidget->setMaximumSize(QSize(16777215, 16777215));
|
||||
|
||||
QVBoxLayout *NoticeLayout = new QVBoxLayout(Noticewidget);
|
||||
NoticeLayout->setContentsMargins(0, 0, 0, 0);
|
||||
NoticeLayout->setSpacing(8);
|
||||
|
||||
m_noticeLabel = new TitleLabel(Noticewidget);
|
||||
m_notFazeLabel = new TitleLabel();
|
||||
m_notFazeLabel->setText(tr("NotFaze Mode"));
|
||||
|
||||
LightLabel *notFazeLabel = new LightLabel(tr("(Notification banners, prompts will be hidden, and notification sounds will be muted)"));
|
||||
QFrame *distrubFrame = new QFrame(widget);
|
||||
distrubFrame->setMinimumWidth(550);
|
||||
distrubFrame->setMaximumWidth(16777215);
|
||||
|
||||
QHBoxLayout *distrubLyt = new QHBoxLayout(distrubFrame);
|
||||
distrubLyt->setContentsMargins(0, 0, 0, 0);
|
||||
distrubLyt->addWidget(m_notFazeLabel);
|
||||
distrubLyt->addSpacing(4);
|
||||
distrubLyt->addWidget(notFazeLabel, Qt::AlignLeft);
|
||||
|
||||
m_getNoticeFrame = new QFrame(Noticewidget);
|
||||
m_getNoticeFrame->setMinimumSize(QSize(550, 60));
|
||||
m_getNoticeFrame->setMaximumSize(QSize(16777215, 60));
|
||||
m_getNoticeFrame->setFrameShape(QFrame::Box);
|
||||
|
||||
QHBoxLayout *mGetNoticeLayout = new QHBoxLayout(m_getNoticeFrame);
|
||||
mGetNoticeLayout->setContentsMargins(16,0,16,0);
|
||||
|
||||
m_getNoticeLabel = new QLabel(m_getNoticeFrame);
|
||||
m_getNoticeLabel->setFixedWidth(550);
|
||||
m_enableSwitchBtn = new KSwitchButton(m_getNoticeFrame);
|
||||
m_enableSwitchBtn->setObjectName("getnoticeinfo");
|
||||
|
||||
mGetNoticeLayout->addWidget(m_getNoticeLabel,Qt::AlignLeft);
|
||||
mGetNoticeLayout->addStretch();
|
||||
mGetNoticeLayout->addWidget(m_enableSwitchBtn);
|
||||
|
||||
m_noticeAppFrame = new QFrame(Noticewidget);
|
||||
m_noticeAppFrame->setMinimumSize(QSize(550, 0));
|
||||
m_noticeAppFrame->setMaximumSize(QSize(16777215, 16777215));
|
||||
m_noticeAppFrame->setFrameShape(QFrame::Box);
|
||||
|
||||
m_applistverticalLayout = new QVBoxLayout(m_noticeAppFrame);
|
||||
m_applistverticalLayout->setContentsMargins(0,0,0,0);
|
||||
m_applistverticalLayout->setSpacing(0);
|
||||
|
||||
NoticeLayout->addWidget(m_noticeLabel);
|
||||
NoticeLayout->addWidget(m_getNoticeFrame);
|
||||
NoticeLayout->addWidget(m_noticeAppFrame);
|
||||
|
||||
if (1) {
|
||||
mverticalLayout->addWidget(distrubFrame);
|
||||
mverticalLayout->addSpacing(8);
|
||||
mverticalLayout->addWidget(notFazeFrame);
|
||||
mverticalLayout->addSpacing(32);
|
||||
} else {
|
||||
distrubFrame->hide();
|
||||
notFazeFrame->hide();
|
||||
}
|
||||
mverticalLayout->addWidget(Noticewidget);
|
||||
mverticalLayout->addStretch();
|
||||
|
||||
}
|
||||
|
||||
void Notice::initNotFaze(QFrame *frame)
|
||||
{
|
||||
frame->setMinimumSize(QSize(550, 0));
|
||||
frame->setMaximumSize(QSize(16777215, 16777215));
|
||||
frame->setFrameShape(QFrame::Box);
|
||||
|
||||
QVBoxLayout *notFazeLyt = new QVBoxLayout(frame);
|
||||
notFazeLyt->setContentsMargins(0, 0, 0, 0);
|
||||
notFazeLyt->setSpacing(0);
|
||||
|
||||
QFrame *line_1 = NoticeMenu::setLine();
|
||||
QFrame *line_2 = NoticeMenu::setLine();
|
||||
QFrame *line_3 = NoticeMenu::setLine();
|
||||
|
||||
QFrame *autoOpenFrame = new QFrame(frame);
|
||||
autoOpenFrame->setMinimumSize(550, 60);
|
||||
autoOpenFrame->setMaximumSize(16777215, 60);
|
||||
QHBoxLayout *autoLyt = new QHBoxLayout(autoOpenFrame);
|
||||
autoLyt->setContentsMargins(16, 0, 16, 0);
|
||||
QLabel *autoOpenLabel = new QLabel(tr("Automatically turn on"), autoOpenFrame);
|
||||
m_openTimeHCombox = new QComboBox(autoOpenFrame);
|
||||
m_openTimeHCombox->setObjectName("opentimehour");
|
||||
m_openTimeHCombox->setFixedWidth(64);
|
||||
m_openTimeMCombox = new QComboBox(autoOpenFrame);
|
||||
m_openTimeMCombox->setObjectName("opentimeminute");
|
||||
m_openTimeMCombox->setFixedWidth(64);
|
||||
m_closeTimeHCombox = new QComboBox(autoOpenFrame);
|
||||
m_closeTimeHCombox->setObjectName("closetimehour");
|
||||
m_closeTimeHCombox->setFixedWidth(64);
|
||||
m_closeTimeMCombox = new QComboBox(autoOpenFrame);
|
||||
m_closeTimeMCombox->setObjectName("closetimeminute");
|
||||
m_closeTimeMCombox->setFixedWidth(64);
|
||||
for (int i = 0; i < 24; i++) {
|
||||
m_openTimeHCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
||||
m_closeTimeHCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 60; i++) {
|
||||
m_openTimeMCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
||||
m_closeTimeMCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
||||
}
|
||||
|
||||
QLabel * label_1 = new QLabel(autoOpenFrame);
|
||||
label_1->setFixedWidth(20);
|
||||
label_1->setText(tr("to"));
|
||||
QLabel *label_2 = new QLabel(autoOpenFrame);
|
||||
label_2->setFixedWidth(4);
|
||||
label_2->setText(":");
|
||||
QLabel *label_3 = new QLabel(autoOpenFrame);
|
||||
label_3->setFixedWidth(4);
|
||||
label_3->setText(":");
|
||||
m_autoOpenSwitchBtn = new KSwitchButton(autoOpenFrame);
|
||||
m_autoOpenSwitchBtn->setObjectName("autoopen");
|
||||
|
||||
autoLyt->addWidget(autoOpenLabel);
|
||||
autoLyt->addStretch();
|
||||
autoLyt->addWidget(m_openTimeHCombox);
|
||||
autoLyt->addWidget(label_2);
|
||||
autoLyt->addWidget(m_openTimeMCombox);
|
||||
autoLyt->addWidget(label_1);
|
||||
autoLyt->addWidget(m_closeTimeHCombox);
|
||||
autoLyt->addWidget(label_3);
|
||||
autoLyt->addWidget(m_closeTimeMCombox);
|
||||
autoLyt->addSpacing(24);
|
||||
autoLyt->addWidget(m_autoOpenSwitchBtn);
|
||||
|
||||
QFrame *multiScreenFrame = new QFrame(frame);
|
||||
m_multiScreenSwitchBtn= new KSwitchButton();
|
||||
m_multiScreenSwitchBtn->setObjectName("multiscreen");
|
||||
setFrame(multiScreenFrame, m_multiScreenSwitchBtn, tr("Automatically turn on when multiple screens are connected"));
|
||||
|
||||
QFrame *fullScreenFrame = new QFrame(frame);
|
||||
m_fullScreenSwitchBtn= new KSwitchButton();
|
||||
m_fullScreenSwitchBtn->setObjectName("fullscreen");
|
||||
setFrame(fullScreenFrame, m_fullScreenSwitchBtn, tr("Automatically open in full screen mode"));
|
||||
|
||||
QFrame *allowAlarmrRemindersFrame = new QFrame(frame);
|
||||
m_allowAlarmrSwitchBtn= new KSwitchButton();
|
||||
m_allowAlarmrSwitchBtn->setObjectName("allowAlarmr");
|
||||
setFrame(allowAlarmrRemindersFrame, m_allowAlarmrSwitchBtn, tr("Allow automatic alarm reminders in Do Not Disturb mode"));
|
||||
|
||||
notFazeLyt->addWidget(autoOpenFrame);
|
||||
notFazeLyt->addWidget(line_1);
|
||||
notFazeLyt->addWidget(multiScreenFrame);
|
||||
notFazeLyt->addWidget(line_2);
|
||||
notFazeLyt->addWidget(fullScreenFrame);
|
||||
notFazeLyt->addWidget(line_3);
|
||||
notFazeLyt->addWidget(allowAlarmrRemindersFrame);
|
||||
}
|
||||
|
||||
void Notice::setFrame(QFrame *frame, KSwitchButton *btn, QString str)
|
||||
{
|
||||
frame->setMinimumSize(QSize(550, 60));
|
||||
frame->setMaximumSize(QSize(16777215, 60));
|
||||
frame->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
QHBoxLayout *hLyt = new QHBoxLayout(frame);
|
||||
hLyt->setContentsMargins(16, 0, 16, 0);
|
||||
QLabel *label = new QLabel(str, frame);
|
||||
|
||||
hLyt->addWidget(label);
|
||||
hLyt->addStretch();
|
||||
hLyt->addWidget(btn);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Notice::initSearchText()
|
||||
{
|
||||
m_noticeLabel->setText(tr("Notice Settings"));
|
||||
//~ contents_path /notice/Get notifications from the app
|
||||
m_getNoticeLabel->setText(tr("Get notifications from the app"));
|
||||
}
|
||||
|
||||
void Notice::initConnection()
|
||||
{
|
||||
if (m_globalSettings) {
|
||||
connect(m_openTimeHCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
||||
//Utils::buriedSettings(name(), "open time(hour) when auto turn on do not disturb mode", QString("settings"), text);
|
||||
m_globalSettings->setScheduleTurnOnDNDTime(QTime().fromString(QString("%1%2%3").arg(text).arg(":").arg(m_openTimeMCombox->currentText()), "hh:mm"));
|
||||
});
|
||||
|
||||
connect(m_openTimeMCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
||||
//Utils::buriedSettings(name(), "open time(minute) when auto turn on do not disturb mode", QString("settings"), m_openTimeMCombox->currentText());
|
||||
m_globalSettings->setScheduleTurnOnDNDTime(QTime().fromString(QString("%1%2%3").arg(text).arg(":").arg(m_openTimeHCombox->currentText()), "mm:hh"));
|
||||
});
|
||||
|
||||
connect(m_closeTimeHCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
||||
//Utils::buriedSettings(name(), "close time(hour) when auto turn on do not disturb mode", QString("settings"), m_closeTimeMCombox->currentText());
|
||||
m_globalSettings->setScheduleTurnOffDNDTime(QTime().fromString(QString("%1%2%3").arg(text).arg(":").arg(m_closeTimeMCombox->currentText()), "hh:mm"));
|
||||
});
|
||||
|
||||
connect(m_closeTimeMCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
||||
//Utils::buriedSettings(name(), "close time(minute) when auto turn on do not disturb mode", QString("settings"), m_closeTimeMCombox->currentText());
|
||||
m_globalSettings->setScheduleTurnOffDNDTime(QTime().fromString(QString("%1%2%3").arg(text).arg(":").arg(m_closeTimeHCombox->currentText()), "mm:hh"));
|
||||
});
|
||||
|
||||
connect(m_autoOpenSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
||||
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
||||
m_globalSettings->setScheduleTurnOnDND(state);
|
||||
setComBoxStatus(state);
|
||||
});
|
||||
connect(m_multiScreenSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
||||
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
||||
m_globalSettings->setDNDWhileMultiScreen(state);
|
||||
});
|
||||
connect(m_fullScreenSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
||||
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
||||
m_globalSettings->setDNDWhileFullScreen(state);
|
||||
});
|
||||
connect(m_allowAlarmrSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
||||
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
||||
m_globalSettings->setNotifyAlarmWhileDND(state);
|
||||
});
|
||||
connect(m_enableSwitchBtn, &KSwitchButton::stateChanged, [&](bool state){
|
||||
//Utils::buriedSettings(name(), "whether to get the notification from the app", QString("settings"), state ? "true" : "false");
|
||||
m_globalSettings->blockSignals(true);
|
||||
m_globalSettings->setReceiveNotificationsFromApps(state);
|
||||
m_globalSettings->blockSignals(false);
|
||||
setHiddenNoticeApp(state);
|
||||
});
|
||||
|
||||
|
||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOnDNDChanged, this, [&](bool state) {
|
||||
m_autoOpenSwitchBtn->blockSignals(true);
|
||||
m_autoOpenSwitchBtn->setChecked(state);
|
||||
m_autoOpenSwitchBtn->blockSignals(false);
|
||||
setComBoxStatus(state);
|
||||
});
|
||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOnDNDTimeChanged, this, [&](QTime time) {
|
||||
m_openTimeHCombox->blockSignals(true);
|
||||
m_openTimeHCombox->setCurrentText(time.toString("hh"));
|
||||
m_openTimeHCombox->blockSignals(false);
|
||||
|
||||
m_openTimeMCombox->blockSignals(true);
|
||||
m_openTimeMCombox->setCurrentText(time.toString("mm"));
|
||||
m_openTimeMCombox->blockSignals(false);
|
||||
});
|
||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOffDNDTimeChanged, this, [&](QTime time) {
|
||||
m_closeTimeHCombox->blockSignals(true);
|
||||
m_closeTimeHCombox->setCurrentText(time.toString("hh"));
|
||||
m_closeTimeHCombox->blockSignals(false);
|
||||
|
||||
m_closeTimeMCombox->blockSignals(true);
|
||||
m_closeTimeMCombox->setCurrentText(time.toString("mm"));
|
||||
m_closeTimeMCombox->blockSignals(false);
|
||||
});
|
||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::DNDWhileMultiScreenChanged, this, [&](bool state) {
|
||||
m_multiScreenSwitchBtn->blockSignals(true);
|
||||
m_multiScreenSwitchBtn->setChecked(state);
|
||||
m_multiScreenSwitchBtn->blockSignals(false);
|
||||
});
|
||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::DNDWhileFullScreenChanged, this, [&](bool state) {
|
||||
m_fullScreenSwitchBtn->blockSignals(true);
|
||||
m_fullScreenSwitchBtn->setChecked(state);
|
||||
m_fullScreenSwitchBtn->blockSignals(false);
|
||||
});
|
||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::notifyAlarmWhileDNDChanged, this, [&](bool state) {
|
||||
m_allowAlarmrSwitchBtn->blockSignals(true);
|
||||
m_allowAlarmrSwitchBtn->setChecked(state);
|
||||
m_allowAlarmrSwitchBtn->blockSignals(false);
|
||||
});
|
||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::receiveNotificationsFromAppsChanged, this, [&](bool state) {
|
||||
m_enableSwitchBtn->blockSignals(true);
|
||||
m_enableSwitchBtn->setChecked(state);
|
||||
m_enableSwitchBtn->blockSignals(false);
|
||||
setHiddenNoticeApp(state);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Notice::initNoticeStatus()
|
||||
{
|
||||
if (m_globalSettings) {
|
||||
m_autoOpenSwitchBtn->blockSignals(true);
|
||||
m_autoOpenSwitchBtn->setChecked(m_globalSettings->scheduleTurnOnDND());
|
||||
setComBoxStatus(m_autoOpenSwitchBtn->isChecked());
|
||||
m_autoOpenSwitchBtn->blockSignals(false);
|
||||
|
||||
QTime openTime = m_globalSettings->scheduleTurnOnDNDTime();
|
||||
m_openTimeHCombox->blockSignals(true);
|
||||
m_openTimeHCombox->setCurrentText(openTime.toString("hh"));
|
||||
m_openTimeHCombox->blockSignals(false);
|
||||
m_openTimeMCombox->blockSignals(true);
|
||||
m_openTimeMCombox->setCurrentText(openTime.toString("mm"));
|
||||
m_openTimeMCombox->blockSignals(false);
|
||||
|
||||
QTime closeTime = m_globalSettings->scheduleTurnOffDNDTime();
|
||||
m_closeTimeHCombox->blockSignals(true);
|
||||
m_closeTimeHCombox->setCurrentText(closeTime.toString("hh"));
|
||||
m_closeTimeHCombox->blockSignals(false);
|
||||
m_closeTimeMCombox->blockSignals(true);
|
||||
m_closeTimeMCombox->setCurrentText(closeTime.toString("mm"));
|
||||
m_closeTimeMCombox->blockSignals(false);
|
||||
|
||||
m_multiScreenSwitchBtn->blockSignals(true);
|
||||
m_multiScreenSwitchBtn->setChecked(m_globalSettings->DNDWhileMultiScreen());
|
||||
m_multiScreenSwitchBtn->blockSignals(false);
|
||||
m_fullScreenSwitchBtn->blockSignals(true);
|
||||
m_fullScreenSwitchBtn->setChecked(m_globalSettings->DNDWhileFullScreen());
|
||||
m_fullScreenSwitchBtn->blockSignals(false);
|
||||
m_allowAlarmrSwitchBtn->blockSignals(true);
|
||||
m_allowAlarmrSwitchBtn->setChecked(m_globalSettings->notifyAlarmWhileDND());
|
||||
m_allowAlarmrSwitchBtn->blockSignals(false);
|
||||
m_enableSwitchBtn->blockSignals(true);
|
||||
m_enableSwitchBtn->setChecked(m_globalSettings->receiveNotificationsFromApps());
|
||||
m_enableSwitchBtn->blockSignals(false);
|
||||
}
|
||||
|
||||
setHiddenNoticeApp(m_enableSwitchBtn->isChecked());
|
||||
}
|
||||
|
||||
void Notice::initListUI()
|
||||
{
|
||||
UkuiNotification::ApplicationsSettingsHash &appDataHash = UkuiNotification::ApplicationsSettings::self()->getAllApplicationsSettings();
|
||||
for (auto &key : appDataHash.keys()) {
|
||||
initItemUi(key, appDataHash[key]);
|
||||
}
|
||||
}
|
||||
|
||||
void Notice::initItemUi(const QString &desktopPath, const UkuiNotification::SingleApplicationSettings &settings)
|
||||
{
|
||||
QString localName = m_appInfo->getInfo(desktopPath, UkuiSearch::ApplicationProperty::LocalName).toString();
|
||||
QString iconName = m_appInfo->getInfo(desktopPath, UkuiSearch::ApplicationProperty::Icon).toString();
|
||||
QString fileName = desktopPath.left(desktopPath.indexOf(QLatin1Char('.')));
|
||||
|
||||
QFrame *baseWidget = new QFrame(m_noticeAppFrame);
|
||||
baseWidget->setMinimumWidth(550);
|
||||
baseWidget->setMaximumWidth(16777215);
|
||||
baseWidget->setFixedHeight(60);
|
||||
baseWidget->setFrameShape(QFrame::Shape::NoFrame);
|
||||
baseWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
QLabel *iconLabel = new QLabel(baseWidget);
|
||||
iconLabel->setFixedSize(32, 32);
|
||||
|
||||
if (fileName == "ukui-flash-disk")
|
||||
iconName = "drive-removable-media-usb";
|
||||
|
||||
setAppIcon(iconLabel, iconName);
|
||||
connect(m_themeSetting, &QGSettings::changed, [&](const QString &key){
|
||||
if (key == "iconThemeName")
|
||||
setAppIcon(iconLabel, iconName);
|
||||
});
|
||||
|
||||
QHBoxLayout *devHorLayout = new QHBoxLayout(baseWidget);
|
||||
devHorLayout->setSpacing(8);
|
||||
devHorLayout->setContentsMargins(16, 0, 16, 0);
|
||||
|
||||
QLabel *nameLabel = new QLabel(baseWidget);
|
||||
nameLabel->setText(localName);
|
||||
|
||||
ukToolButton *setBtn = new ukToolButton(baseWidget);
|
||||
setBtn->setProperty("useButtonPalette", true);
|
||||
setBtn->setPopupMode(QToolButton::InstantPopup);
|
||||
setBtn->setFixedSize(QSize(36, 36));
|
||||
setBtn->setIcon(QIcon::fromTheme("view-more-horizontal-symbolic"));
|
||||
|
||||
NoticeMenu *menu = new NoticeMenu(setBtn);
|
||||
setBtn->setMenu(menu);
|
||||
|
||||
KSwitchButton *appSwitch = new KSwitchButton(baseWidget);
|
||||
|
||||
devHorLayout->addWidget(iconLabel);
|
||||
devHorLayout->addWidget(nameLabel);
|
||||
devHorLayout->addStretch();
|
||||
devHorLayout->addWidget(setBtn);
|
||||
devHorLayout->addWidget(appSwitch);
|
||||
|
||||
m_applistverticalLayout->addWidget(baseWidget);
|
||||
if (m_applistverticalLayout->count() >= 2) {
|
||||
QFrame *line = new QFrame(m_pluginWidget);
|
||||
line->setMinimumSize(QSize(0, 1));
|
||||
line->setMaximumSize(QSize(16777215, 1));
|
||||
line->setLineWidth(0);
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
m_applistverticalLayout->insertWidget(m_applistverticalLayout->count() - 1, line);
|
||||
}
|
||||
|
||||
|
||||
appSwitch->blockSignals(true);
|
||||
appSwitch->setChecked(settings.allowNotify());
|
||||
appSwitch->blockSignals(false);
|
||||
|
||||
menu->blockSignals(true);
|
||||
menu->initStaus(settings);
|
||||
menu->blockSignals(false);
|
||||
|
||||
connect(&settings, &UkuiNotification::SingleApplicationSettings::allowNotifyChanged, [=](bool state) {
|
||||
appSwitch->blockSignals(true);
|
||||
appSwitch->setChecked(state);
|
||||
appSwitch->blockSignals(false);
|
||||
});
|
||||
connect(&settings, &UkuiNotification::SingleApplicationSettings::allowSoundChanged, [=](bool state) {
|
||||
menu->blockSignals(true);
|
||||
menu->setVoiceEnable(state);
|
||||
menu->blockSignals(false);
|
||||
});
|
||||
connect(&settings, &UkuiNotification::SingleApplicationSettings::showContentOnLockScreenChanged, [=](bool state) {
|
||||
menu->blockSignals(true);
|
||||
menu->setDetailShowOnLockScreenEnable(state);
|
||||
menu->blockSignals(false);
|
||||
});
|
||||
connect(&settings, &UkuiNotification::SingleApplicationSettings::showNotificationOnLockScreenChanged, [=](bool state) {
|
||||
menu->blockSignals(true);
|
||||
menu->setShowOnLockScreenEnable(state);
|
||||
menu->blockSignals(false);
|
||||
});
|
||||
connect(&settings, &UkuiNotification::SingleApplicationSettings::popupStyleChanged, [=](UkuiNotification::SettingsProperty::Property style) {
|
||||
menu->blockSignals(true);
|
||||
menu->setShowOnLockScreenEnable(style);
|
||||
menu->blockSignals(false);
|
||||
});
|
||||
connect(&settings, &UkuiNotification::SingleApplicationSettings::uninstalled, [=]() {
|
||||
baseWidget->hide();
|
||||
});
|
||||
|
||||
|
||||
connect(menu, &NoticeMenu::voiceSignals, [=](bool checked) {
|
||||
//Common::buriedSettings(name(), "whether prompt sound during notification", QString("settings"), checked ? "true" : "false");
|
||||
UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::AllowSound, checked);
|
||||
});
|
||||
|
||||
connect(menu, &NoticeMenu::detailSignals, [=](bool checked) {
|
||||
//Common::buriedSettings(name(), "whether to show the message content in the lock screen interface", QString("settings"), checked ? "true" : "false");
|
||||
UkuiNotification::ApplicationsSettings::self()->setAppSetting(desktopPath, UkuiNotification::SettingsProperty::ShowContentOnLockScreen, checked);
|
||||
});
|
||||
|
||||
connect(menu, &NoticeMenu::showSignals, [=](bool checked) {
|
||||
//Common::buriedSettings(name(), "whether to show the notice in the lock screen interface", QString("settings"), checked ? "true" : "false");
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
void Notice::setAppIcon(QLabel *iconlabel, const QString &icon)
|
||||
{
|
||||
QFileInfo iconfile(QString("/usr/share/pixmaps/"+ icon + ".png"));
|
||||
QPixmap pixmap;
|
||||
QIcon currenticon = QIcon::fromTheme(icon);
|
||||
if (!currenticon.isNull()) {
|
||||
pixmap = currenticon.pixmap(QSize(32, 32));
|
||||
} else if (iconfile.exists()) {
|
||||
pixmap = QPixmap(iconfile.filePath()).scaled(32, 32);
|
||||
} else {
|
||||
pixmap = QPixmap(QString(":/img/plugins/autoboot/desktop.png"));
|
||||
}
|
||||
iconlabel->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void Notice::setHiddenNoticeApp(bool status)
|
||||
{
|
||||
m_noticeAppFrame->setVisible(status);
|
||||
}
|
||||
|
||||
void Notice::setComBoxStatus(bool status)
|
||||
{
|
||||
m_openTimeHCombox->setEnabled(status);
|
||||
m_closeTimeHCombox->setEnabled(status);
|
||||
m_openTimeMCombox->setEnabled(status);
|
||||
m_closeTimeMCombox->setEnabled(status);
|
||||
}
|
||||
|
||||
void ukToolButton::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette paltte;
|
||||
paltte.setColor(QPalette::Button, paltte.base().color());
|
||||
this->setPalette(paltte);
|
||||
QToolButton::paintEvent(event);
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
#ifndef NOTIFICATION_UKCC_PLUGIN_H
|
||||
#define NOTIFICATION_UKCC_PLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtPlugin>
|
||||
#include <QPushButton>
|
||||
#include <QDebug>
|
||||
#include <QVector>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDir>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <ukui-search/application-info.h>
|
||||
|
||||
#include <kysdk/applications/kswitchbutton.h>
|
||||
#include <ukcc/interface/interface.h>
|
||||
#include <ukcc/widgets/titlelabel.h>
|
||||
#include <ukcc/widgets/lightlabel.h>
|
||||
|
||||
#include "notification-settings/applications-settings.h"
|
||||
#include "notification-settings/notification-global-settings.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
class Notice : public QObject, CommonInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.ukcc.CommonInterface")
|
||||
Q_INTERFACES(CommonInterface)
|
||||
|
||||
public:
|
||||
Notice();
|
||||
~Notice();
|
||||
|
||||
QString plugini18nName() Q_DECL_OVERRIDE;
|
||||
int pluginTypes() Q_DECL_OVERRIDE;
|
||||
QWidget * pluginUi() Q_DECL_OVERRIDE;
|
||||
const QString name() const Q_DECL_OVERRIDE;
|
||||
bool isShowOnHomePage() const Q_DECL_OVERRIDE;
|
||||
QIcon icon() const Q_DECL_OVERRIDE;
|
||||
bool isEnable() const Q_DECL_OVERRIDE;
|
||||
|
||||
void initUi(QWidget *widget);
|
||||
void initNotFaze(QFrame *frame);
|
||||
void setFrame(QFrame *frame, KSwitchButton *btn, QString str);
|
||||
void initSearchText();
|
||||
void initConnection();
|
||||
void initNoticeStatus();
|
||||
void initListUI();
|
||||
void initItemUi(const QString &desktopPath, const UkuiNotification::SingleApplicationSettings &settings);
|
||||
void setAppIcon(QLabel *iconlabel, const QString &icon);
|
||||
|
||||
private:
|
||||
void setHiddenNoticeApp(bool status);
|
||||
void setComBoxStatus(bool status);
|
||||
|
||||
private:
|
||||
QString m_pluginName;
|
||||
int m_pluginType;
|
||||
|
||||
QWidget *m_pluginWidget = nullptr;
|
||||
|
||||
TitleLabel *m_noticeLabel = nullptr;
|
||||
TitleLabel *m_notFazeLabel = nullptr;
|
||||
QLabel *m_getNoticeLabel = nullptr;
|
||||
|
||||
QFrame *m_noticeAppFrame = nullptr;
|
||||
QFrame *m_getNoticeFrame = nullptr;
|
||||
|
||||
KSwitchButton *m_autoOpenSwitchBtn = nullptr;
|
||||
KSwitchButton *m_multiScreenSwitchBtn = nullptr;
|
||||
KSwitchButton *m_fullScreenSwitchBtn = nullptr;
|
||||
KSwitchButton *m_allowAlarmrSwitchBtn = nullptr;
|
||||
KSwitchButton *m_enableSwitchBtn = nullptr;
|
||||
|
||||
QComboBox *m_openTimeHCombox = nullptr;
|
||||
QComboBox *m_openTimeMCombox = nullptr;
|
||||
QComboBox *m_closeTimeHCombox = nullptr;
|
||||
QComboBox *m_closeTimeMCombox = nullptr;
|
||||
|
||||
QGSettings *m_themeSetting = nullptr;
|
||||
|
||||
QVBoxLayout *m_applistverticalLayout = nullptr;
|
||||
|
||||
UkuiNotification::NotificationGlobalSettings *m_globalSettings = nullptr;
|
||||
|
||||
UkuiSearch::ApplicationInfo *m_appInfo = nullptr;
|
||||
};
|
||||
|
||||
#endif // NOTIFICATION_UKCC_PLUGIN_H
|
Loading…
Reference in New Issue