修复了大量的拼写错误和代码格式问题.
This commit is contained in:
parent
1123c7dc2a
commit
2c7a8e1278
|
@ -15,7 +15,7 @@
|
||||||
<arg name="desktop_entry" type="s" direction="in"/>
|
<arg name="desktop_entry" type="s" direction="in"/>
|
||||||
<arg name="number" type="u" direction="in"/>
|
<arg name="number" type="u" direction="in"/>
|
||||||
</method>
|
</method>
|
||||||
<signal name="UnreadMessageNumberUpdated">
|
<signal name="UnreadMessagesNumberUpdated">
|
||||||
<arg name="desktop_entry" type="s" direction="out"/>
|
<arg name="desktop_entry" type="s" direction="out"/>
|
||||||
<arg name="number" type="u" direction="out"/>
|
<arg name="number" type="u" direction="out"/>
|
||||||
</signal>
|
</signal>
|
||||||
|
|
|
@ -77,7 +77,7 @@ void SettingsManagerPrivate::checkAndLoad()
|
||||||
|
|
||||||
// 读取配置文件
|
// 读取配置文件
|
||||||
QJsonObject settingsData = jsonDocument.object();
|
QJsonObject settingsData = jsonDocument.object();
|
||||||
QString version = settingsData.find("VERSION").value().toString();
|
QString version = settingsData.value("VERSION").toString();
|
||||||
if (version != QString(NOTIFICATION_SETTINGS_VERSION)) {
|
if (version != QString(NOTIFICATION_SETTINGS_VERSION)) {
|
||||||
qDebug() << "Notification settings version is different, need update! configFile:" << version << " new:" << NOTIFICATION_SETTINGS_VERSION;
|
qDebug() << "Notification settings version is different, need update! configFile:" << version << " new:" << NOTIFICATION_SETTINGS_VERSION;
|
||||||
updateSettingsFile();
|
updateSettingsFile();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
namespace UkuiNotification {
|
namespace UkuiNotification {
|
||||||
class PopupNotificationPrivate;
|
class PopupNotificationPrivate;
|
||||||
//TODO 可以增加通知基类,实现多种类型通知
|
|
||||||
typedef QList<QPair<QString, QString>> ActionList;
|
typedef QList<QPair<QString, QString>> ActionList;
|
||||||
class UKUINOTIFICATION_EXPORT PopupNotification
|
class UKUINOTIFICATION_EXPORT PopupNotification
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
set(notification-ukcc-plugin_LIB_SRCS
|
set(notification-ukcc-plugin_LIB_SRCS
|
||||||
notification-ukcc-plugin.cpp
|
notification-ukcc-plugin.cpp
|
||||||
notification-ukcc-plugin.h
|
notification-ukcc-plugin.h
|
||||||
noticemenu.cpp
|
notice-menu.cpp
|
||||||
noticemenu.h)
|
notice-menu.h)
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Widgets LinguistTools REQUIRED)
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Widgets LinguistTools REQUIRED)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets LinguistTools REQUIRED)
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets LinguistTools REQUIRED)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "noticemenu.h"
|
#include "notice-menu.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <ukcc/widgets/fixlabel.h>
|
#include <ukcc/widgets/fixlabel.h>
|
||||||
|
@ -11,12 +11,12 @@ NoticeMenu::NoticeMenu(QWidget *parent) :
|
||||||
setConnect();
|
setConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoticeMenu::initStaus(UkuiNotification::SingleApplicationSettings *settings)
|
void NoticeMenu::initStatus(UkuiNotification::SingleApplicationSettings *settings)
|
||||||
{
|
{
|
||||||
m_voiceBtn->blockSignals(true);
|
m_voiceBtn->blockSignals(true);
|
||||||
m_showBtn->blockSignals(true);
|
m_showBtn->blockSignals(true);
|
||||||
m_detailBtn->blockSignals(true);
|
m_detailBtn->blockSignals(true);
|
||||||
m_styleGrounp->blockSignals(true);
|
m_styleGroup->blockSignals(true);
|
||||||
|
|
||||||
m_voiceBtn->setChecked(settings->allowSound());
|
m_voiceBtn->setChecked(settings->allowSound());
|
||||||
m_detailBtn->setChecked(settings->showContentOnLockScreen());
|
m_detailBtn->setChecked(settings->showContentOnLockScreen());
|
||||||
|
@ -31,12 +31,12 @@ void NoticeMenu::initStaus(UkuiNotification::SingleApplicationSettings *settings
|
||||||
} else if (style == UkuiNotification::SettingsProperty::NoPopup) {
|
} else if (style == UkuiNotification::SettingsProperty::NoPopup) {
|
||||||
styleId = 2;
|
styleId = 2;
|
||||||
}
|
}
|
||||||
m_styleGrounp->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);
|
||||||
m_detailBtn->blockSignals(false);
|
m_detailBtn->blockSignals(false);
|
||||||
m_styleGrounp->blockSignals(false);
|
m_styleGroup->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoticeMenu::setVoiceEnable(bool state)
|
void NoticeMenu::setVoiceEnable(bool state)
|
||||||
|
@ -70,9 +70,9 @@ void NoticeMenu::setPopupStyle(UkuiNotification::SettingsProperty::Property styl
|
||||||
} else if (style == UkuiNotification::SettingsProperty::NoPopup) {
|
} else if (style == UkuiNotification::SettingsProperty::NoPopup) {
|
||||||
styleId = 2;
|
styleId = 2;
|
||||||
}
|
}
|
||||||
m_styleGrounp->blockSignals(true);
|
m_styleGroup->blockSignals(true);
|
||||||
m_styleGrounp->button(styleId)->setChecked(true);
|
m_styleGroup->button(styleId)->setChecked(true);
|
||||||
m_styleGrounp->blockSignals(false);
|
m_styleGroup->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoticeMenu::initUi()
|
void NoticeMenu::initUi()
|
||||||
|
@ -102,21 +102,21 @@ void NoticeMenu::initUi()
|
||||||
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_styleGrounp = 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_styleGrounp->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_styleGrounp->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_styleGrounp->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);
|
||||||
|
@ -189,7 +189,7 @@ void NoticeMenu::setConnect()
|
||||||
connect(m_voiceBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::voiceSignals);
|
connect(m_voiceBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::voiceSignals);
|
||||||
connect(m_detailBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::detailSignals);
|
connect(m_detailBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::detailSignals);
|
||||||
connect(m_showBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::showSignals);
|
connect(m_showBtn, &KSwitchButton::stateChanged, this, &NoticeMenu::showSignals);
|
||||||
connect(m_styleGrounp, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &NoticeMenu::styleBtnSignals);
|
connect(m_styleGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &NoticeMenu::styleBtnSignals);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoticeMenu::showEvent(QShowEvent *event)
|
void NoticeMenu::showEvent(QShowEvent *event)
|
|
@ -16,9 +16,9 @@ class NoticeMenu : public QMenu
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
NoticeMenu(QWidget *parent = nullptr);
|
explicit NoticeMenu(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void initStaus(UkuiNotification::SingleApplicationSettings *settings);
|
void initStatus(UkuiNotification::SingleApplicationSettings *settings);
|
||||||
void setVoiceEnable(bool state);
|
void setVoiceEnable(bool state);
|
||||||
void setDetailShowOnLockScreenEnable(bool state);
|
void setDetailShowOnLockScreenEnable(bool state);
|
||||||
void setShowOnLockScreenEnable(bool state);
|
void setShowOnLockScreenEnable(bool state);
|
||||||
|
@ -36,13 +36,13 @@ private:
|
||||||
KSwitchButton *m_voiceBtn = nullptr;
|
KSwitchButton *m_voiceBtn = nullptr;
|
||||||
KSwitchButton *m_detailBtn = nullptr;
|
KSwitchButton *m_detailBtn = nullptr;
|
||||||
KSwitchButton *m_showBtn = nullptr;
|
KSwitchButton *m_showBtn = nullptr;
|
||||||
QButtonGroup *m_styleGrounp = nullptr;
|
QButtonGroup *m_styleGroup = nullptr;
|
||||||
QRadioButton *m_noneBtn = nullptr;
|
QRadioButton *m_noneBtn = nullptr;
|
||||||
QRadioButton *m_mutativeBtn = nullptr;
|
QRadioButton *m_mutativeBtn = nullptr;
|
||||||
QRadioButton *m_alwaysBtn = nullptr;
|
QRadioButton *m_alwaysBtn = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event);
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void voiceSignals(bool checked);
|
void voiceSignals(bool checked);
|
|
@ -1,22 +1,20 @@
|
||||||
|
|
||||||
#include "notification-ukcc-plugin.h"
|
#include "notification-ukcc-plugin.h"
|
||||||
#include "noticemenu.h"
|
#include "notice-menu.h"
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QTimer>
|
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QFile>
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
#define THEME_QT_SCHEMA "org.ukui.style"
|
#define THEME_QT_SCHEMA "org.ukui.style"
|
||||||
|
|
||||||
class ukToolButton : public QToolButton
|
class ToolButton : public QToolButton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ukToolButton(QWidget *parent = nullptr):
|
explicit ToolButton(QWidget *parent = nullptr):
|
||||||
QToolButton(parent)
|
QToolButton(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -164,9 +162,9 @@ void Notice::initUi(QWidget *widget)
|
||||||
m_noticeAppFrame->setMaximumSize(QSize(16777215, 16777215));
|
m_noticeAppFrame->setMaximumSize(QSize(16777215, 16777215));
|
||||||
m_noticeAppFrame->setFrameShape(QFrame::Box);
|
m_noticeAppFrame->setFrameShape(QFrame::Box);
|
||||||
|
|
||||||
m_applistverticalLayout = new QVBoxLayout(m_noticeAppFrame);
|
m_appListVerticalLayout = new QVBoxLayout(m_noticeAppFrame);
|
||||||
m_applistverticalLayout->setContentsMargins(0,0,0,0);
|
m_appListVerticalLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
m_applistverticalLayout->setSpacing(0);
|
m_appListVerticalLayout->setSpacing(0);
|
||||||
|
|
||||||
NoticeLayout->addWidget(m_noticeLabel);
|
NoticeLayout->addWidget(m_noticeLabel);
|
||||||
NoticeLayout->addWidget(m_getNoticeFrame);
|
NoticeLayout->addWidget(m_getNoticeFrame);
|
||||||
|
@ -206,26 +204,26 @@ void Notice::initNotFaze(QFrame *frame)
|
||||||
QHBoxLayout *autoLyt = new QHBoxLayout(autoOpenFrame);
|
QHBoxLayout *autoLyt = new QHBoxLayout(autoOpenFrame);
|
||||||
autoLyt->setContentsMargins(16, 0, 16, 0);
|
autoLyt->setContentsMargins(16, 0, 16, 0);
|
||||||
QLabel *autoOpenLabel = new QLabel(tr("Automatically turn on"), autoOpenFrame);
|
QLabel *autoOpenLabel = new QLabel(tr("Automatically turn on"), autoOpenFrame);
|
||||||
m_openTimeHCombox = new QComboBox(autoOpenFrame);
|
m_openTimeHComboBox = new QComboBox(autoOpenFrame);
|
||||||
m_openTimeHCombox->setObjectName("opentimehour");
|
m_openTimeHComboBox->setObjectName("opentimehour");
|
||||||
m_openTimeHCombox->setFixedWidth(64);
|
m_openTimeHComboBox->setFixedWidth(64);
|
||||||
m_openTimeMCombox = new QComboBox(autoOpenFrame);
|
m_openTimeMComboBox = new QComboBox(autoOpenFrame);
|
||||||
m_openTimeMCombox->setObjectName("opentimeminute");
|
m_openTimeMComboBox->setObjectName("opentimeminute");
|
||||||
m_openTimeMCombox->setFixedWidth(64);
|
m_openTimeMComboBox->setFixedWidth(64);
|
||||||
m_closeTimeHCombox = new QComboBox(autoOpenFrame);
|
m_closeTimeHComboBox = new QComboBox(autoOpenFrame);
|
||||||
m_closeTimeHCombox->setObjectName("closetimehour");
|
m_closeTimeHComboBox->setObjectName("closetimehour");
|
||||||
m_closeTimeHCombox->setFixedWidth(64);
|
m_closeTimeHComboBox->setFixedWidth(64);
|
||||||
m_closeTimeMCombox = new QComboBox(autoOpenFrame);
|
m_closeTimeMComboBox = new QComboBox(autoOpenFrame);
|
||||||
m_closeTimeMCombox->setObjectName("closetimeminute");
|
m_closeTimeMComboBox->setObjectName("closetimeminute");
|
||||||
m_closeTimeMCombox->setFixedWidth(64);
|
m_closeTimeMComboBox->setFixedWidth(64);
|
||||||
for (int i = 0; i < 24; i++) {
|
for (int i = 0; i < 24; i++) {
|
||||||
m_openTimeHCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
m_openTimeHComboBox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
||||||
m_closeTimeHCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
m_closeTimeHComboBox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 60; i++) {
|
for (int i = 0; i < 60; i++) {
|
||||||
m_openTimeMCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
m_openTimeMComboBox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
||||||
m_closeTimeMCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
m_closeTimeMComboBox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLabel * label_1 = new QLabel(autoOpenFrame);
|
QLabel * label_1 = new QLabel(autoOpenFrame);
|
||||||
|
@ -242,13 +240,13 @@ void Notice::initNotFaze(QFrame *frame)
|
||||||
|
|
||||||
autoLyt->addWidget(autoOpenLabel);
|
autoLyt->addWidget(autoOpenLabel);
|
||||||
autoLyt->addStretch();
|
autoLyt->addStretch();
|
||||||
autoLyt->addWidget(m_openTimeHCombox);
|
autoLyt->addWidget(m_openTimeHComboBox);
|
||||||
autoLyt->addWidget(label_2);
|
autoLyt->addWidget(label_2);
|
||||||
autoLyt->addWidget(m_openTimeMCombox);
|
autoLyt->addWidget(m_openTimeMComboBox);
|
||||||
autoLyt->addWidget(label_1);
|
autoLyt->addWidget(label_1);
|
||||||
autoLyt->addWidget(m_closeTimeHCombox);
|
autoLyt->addWidget(m_closeTimeHComboBox);
|
||||||
autoLyt->addWidget(label_3);
|
autoLyt->addWidget(label_3);
|
||||||
autoLyt->addWidget(m_closeTimeMCombox);
|
autoLyt->addWidget(m_closeTimeMComboBox);
|
||||||
autoLyt->addSpacing(24);
|
autoLyt->addSpacing(24);
|
||||||
autoLyt->addWidget(m_autoOpenSwitchBtn);
|
autoLyt->addWidget(m_autoOpenSwitchBtn);
|
||||||
|
|
||||||
|
@ -263,9 +261,9 @@ void Notice::initNotFaze(QFrame *frame)
|
||||||
setFrame(fullScreenFrame, m_fullScreenSwitchBtn, tr("Automatically open in full screen mode"));
|
setFrame(fullScreenFrame, m_fullScreenSwitchBtn, tr("Automatically open in full screen mode"));
|
||||||
|
|
||||||
QFrame *allowAlarmrRemindersFrame = new QFrame(frame);
|
QFrame *allowAlarmrRemindersFrame = new QFrame(frame);
|
||||||
m_allowAlarmrSwitchBtn= new KSwitchButton();
|
m_allowAlarmSwitchBtn= new KSwitchButton();
|
||||||
m_allowAlarmrSwitchBtn->setObjectName("allowAlarmr");
|
m_allowAlarmSwitchBtn->setObjectName("allowAlarmr");
|
||||||
setFrame(allowAlarmrRemindersFrame, m_allowAlarmrSwitchBtn, tr("Allow automatic alarm reminders in Do Not Disturb mode"));
|
setFrame(allowAlarmrRemindersFrame, m_allowAlarmSwitchBtn, tr("Allow automatic alarm reminders in Do Not Disturb mode"));
|
||||||
|
|
||||||
notFazeLyt->addWidget(autoOpenFrame);
|
notFazeLyt->addWidget(autoOpenFrame);
|
||||||
notFazeLyt->addWidget(line_1);
|
notFazeLyt->addWidget(line_1);
|
||||||
|
@ -289,7 +287,6 @@ void Notice::setFrame(QFrame *frame, KSwitchButton *btn, QString str)
|
||||||
hLyt->addWidget(label);
|
hLyt->addWidget(label);
|
||||||
hLyt->addStretch();
|
hLyt->addStretch();
|
||||||
hLyt->addWidget(btn);
|
hLyt->addWidget(btn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -303,24 +300,24 @@ void Notice::initSearchText()
|
||||||
void Notice::initConnection()
|
void Notice::initConnection()
|
||||||
{
|
{
|
||||||
if (m_globalSettings) {
|
if (m_globalSettings) {
|
||||||
connect(m_openTimeHCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
connect(m_openTimeHComboBox, 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);
|
//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"));
|
m_globalSettings->setScheduleTurnOnDNDTime(QTime::fromString(text + ":" + m_openTimeMComboBox->currentText(), "hh:mm"));
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_openTimeMCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
connect(m_openTimeMComboBox, 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());
|
//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"));
|
m_globalSettings->setScheduleTurnOnDNDTime(QTime::fromString(text + m_openTimeHComboBox->currentText(), "mm:hh"));
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_closeTimeHCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
connect(m_closeTimeHComboBox, 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());
|
//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"));
|
m_globalSettings->setScheduleTurnOffDNDTime(QTime::fromString(text + ":" + m_closeTimeMComboBox->currentText(), "hh:mm"));
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_closeTimeMCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
connect(m_closeTimeMComboBox, 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());
|
//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"));
|
m_globalSettings->setScheduleTurnOffDNDTime(QTime::fromString(text + ":" + m_closeTimeHComboBox->currentText(), "mm:hh"));
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_autoOpenSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
connect(m_autoOpenSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
||||||
|
@ -336,7 +333,7 @@ void Notice::initConnection()
|
||||||
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
||||||
m_globalSettings->setDNDWhileFullScreen(state);
|
m_globalSettings->setDNDWhileFullScreen(state);
|
||||||
});
|
});
|
||||||
connect(m_allowAlarmrSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
connect(m_allowAlarmSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
||||||
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
||||||
m_globalSettings->setNotifyAlarmWhileDND(state);
|
m_globalSettings->setNotifyAlarmWhileDND(state);
|
||||||
});
|
});
|
||||||
|
@ -354,22 +351,22 @@ void Notice::initConnection()
|
||||||
setComBoxStatus(state);
|
setComBoxStatus(state);
|
||||||
});
|
});
|
||||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOnDNDTimeChanged, this, [&](QTime time) {
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOnDNDTimeChanged, this, [&](QTime time) {
|
||||||
m_openTimeHCombox->blockSignals(true);
|
m_openTimeHComboBox->blockSignals(true);
|
||||||
m_openTimeHCombox->setCurrentText(time.toString("hh"));
|
m_openTimeHComboBox->setCurrentText(time.toString("hh"));
|
||||||
m_openTimeHCombox->blockSignals(false);
|
m_openTimeHComboBox->blockSignals(false);
|
||||||
|
|
||||||
m_openTimeMCombox->blockSignals(true);
|
m_openTimeMComboBox->blockSignals(true);
|
||||||
m_openTimeMCombox->setCurrentText(time.toString("mm"));
|
m_openTimeMComboBox->setCurrentText(time.toString("mm"));
|
||||||
m_openTimeMCombox->blockSignals(false);
|
m_openTimeMComboBox->blockSignals(false);
|
||||||
});
|
});
|
||||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOffDNDTimeChanged, this, [&](QTime time) {
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOffDNDTimeChanged, this, [&](QTime time) {
|
||||||
m_closeTimeHCombox->blockSignals(true);
|
m_closeTimeHComboBox->blockSignals(true);
|
||||||
m_closeTimeHCombox->setCurrentText(time.toString("hh"));
|
m_closeTimeHComboBox->setCurrentText(time.toString("hh"));
|
||||||
m_closeTimeHCombox->blockSignals(false);
|
m_closeTimeHComboBox->blockSignals(false);
|
||||||
|
|
||||||
m_closeTimeMCombox->blockSignals(true);
|
m_closeTimeMComboBox->blockSignals(true);
|
||||||
m_closeTimeMCombox->setCurrentText(time.toString("mm"));
|
m_closeTimeMComboBox->setCurrentText(time.toString("mm"));
|
||||||
m_closeTimeMCombox->blockSignals(false);
|
m_closeTimeMComboBox->blockSignals(false);
|
||||||
});
|
});
|
||||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::DNDWhileMultiScreenChanged, this, [&](bool state) {
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::DNDWhileMultiScreenChanged, this, [&](bool state) {
|
||||||
m_multiScreenSwitchBtn->blockSignals(true);
|
m_multiScreenSwitchBtn->blockSignals(true);
|
||||||
|
@ -382,9 +379,9 @@ void Notice::initConnection()
|
||||||
m_fullScreenSwitchBtn->blockSignals(false);
|
m_fullScreenSwitchBtn->blockSignals(false);
|
||||||
});
|
});
|
||||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::notifyAlarmWhileDNDChanged, this, [&](bool state) {
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::notifyAlarmWhileDNDChanged, this, [&](bool state) {
|
||||||
m_allowAlarmrSwitchBtn->blockSignals(true);
|
m_allowAlarmSwitchBtn->blockSignals(true);
|
||||||
m_allowAlarmrSwitchBtn->setChecked(state);
|
m_allowAlarmSwitchBtn->setChecked(state);
|
||||||
m_allowAlarmrSwitchBtn->blockSignals(false);
|
m_allowAlarmSwitchBtn->blockSignals(false);
|
||||||
});
|
});
|
||||||
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::receiveNotificationsFromAppsChanged, this, [&](bool state) {
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::receiveNotificationsFromAppsChanged, this, [&](bool state) {
|
||||||
m_enableSwitchBtn->blockSignals(true);
|
m_enableSwitchBtn->blockSignals(true);
|
||||||
|
@ -405,20 +402,20 @@ void Notice::initNoticeStatus()
|
||||||
m_autoOpenSwitchBtn->blockSignals(false);
|
m_autoOpenSwitchBtn->blockSignals(false);
|
||||||
|
|
||||||
QTime openTime = m_globalSettings->scheduleTurnOnDNDTime();
|
QTime openTime = m_globalSettings->scheduleTurnOnDNDTime();
|
||||||
m_openTimeHCombox->blockSignals(true);
|
m_openTimeHComboBox->blockSignals(true);
|
||||||
m_openTimeHCombox->setCurrentText(openTime.toString("hh"));
|
m_openTimeHComboBox->setCurrentText(openTime.toString("hh"));
|
||||||
m_openTimeHCombox->blockSignals(false);
|
m_openTimeHComboBox->blockSignals(false);
|
||||||
m_openTimeMCombox->blockSignals(true);
|
m_openTimeMComboBox->blockSignals(true);
|
||||||
m_openTimeMCombox->setCurrentText(openTime.toString("mm"));
|
m_openTimeMComboBox->setCurrentText(openTime.toString("mm"));
|
||||||
m_openTimeMCombox->blockSignals(false);
|
m_openTimeMComboBox->blockSignals(false);
|
||||||
|
|
||||||
QTime closeTime = m_globalSettings->scheduleTurnOffDNDTime();
|
QTime closeTime = m_globalSettings->scheduleTurnOffDNDTime();
|
||||||
m_closeTimeHCombox->blockSignals(true);
|
m_closeTimeHComboBox->blockSignals(true);
|
||||||
m_closeTimeHCombox->setCurrentText(closeTime.toString("hh"));
|
m_closeTimeHComboBox->setCurrentText(closeTime.toString("hh"));
|
||||||
m_closeTimeHCombox->blockSignals(false);
|
m_closeTimeHComboBox->blockSignals(false);
|
||||||
m_closeTimeMCombox->blockSignals(true);
|
m_closeTimeMComboBox->blockSignals(true);
|
||||||
m_closeTimeMCombox->setCurrentText(closeTime.toString("mm"));
|
m_closeTimeMComboBox->setCurrentText(closeTime.toString("mm"));
|
||||||
m_closeTimeMCombox->blockSignals(false);
|
m_closeTimeMComboBox->blockSignals(false);
|
||||||
|
|
||||||
m_multiScreenSwitchBtn->blockSignals(true);
|
m_multiScreenSwitchBtn->blockSignals(true);
|
||||||
m_multiScreenSwitchBtn->setChecked(m_globalSettings->DNDWhileMultiScreen());
|
m_multiScreenSwitchBtn->setChecked(m_globalSettings->DNDWhileMultiScreen());
|
||||||
|
@ -426,9 +423,9 @@ void Notice::initNoticeStatus()
|
||||||
m_fullScreenSwitchBtn->blockSignals(true);
|
m_fullScreenSwitchBtn->blockSignals(true);
|
||||||
m_fullScreenSwitchBtn->setChecked(m_globalSettings->DNDWhileFullScreen());
|
m_fullScreenSwitchBtn->setChecked(m_globalSettings->DNDWhileFullScreen());
|
||||||
m_fullScreenSwitchBtn->blockSignals(false);
|
m_fullScreenSwitchBtn->blockSignals(false);
|
||||||
m_allowAlarmrSwitchBtn->blockSignals(true);
|
m_allowAlarmSwitchBtn->blockSignals(true);
|
||||||
m_allowAlarmrSwitchBtn->setChecked(m_globalSettings->notifyAlarmWhileDND());
|
m_allowAlarmSwitchBtn->setChecked(m_globalSettings->notifyAlarmWhileDND());
|
||||||
m_allowAlarmrSwitchBtn->blockSignals(false);
|
m_allowAlarmSwitchBtn->blockSignals(false);
|
||||||
m_enableSwitchBtn->blockSignals(true);
|
m_enableSwitchBtn->blockSignals(true);
|
||||||
m_enableSwitchBtn->setChecked(m_globalSettings->receiveNotificationsFromApps());
|
m_enableSwitchBtn->setChecked(m_globalSettings->receiveNotificationsFromApps());
|
||||||
m_enableSwitchBtn->blockSignals(false);
|
m_enableSwitchBtn->blockSignals(false);
|
||||||
|
@ -463,9 +460,6 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
||||||
QLabel *iconLabel = new QLabel(baseWidget);
|
QLabel *iconLabel = new QLabel(baseWidget);
|
||||||
iconLabel->setFixedSize(32, 32);
|
iconLabel->setFixedSize(32, 32);
|
||||||
|
|
||||||
if (fileName == "ukui-flash-disk")
|
|
||||||
iconName = "drive-removable-media-usb";
|
|
||||||
|
|
||||||
setAppIcon(iconLabel, iconName);
|
setAppIcon(iconLabel, iconName);
|
||||||
connect(m_themeSetting, &QGSettings::changed, [&](const QString &key){
|
connect(m_themeSetting, &QGSettings::changed, [&](const QString &key){
|
||||||
if (key == "iconThemeName")
|
if (key == "iconThemeName")
|
||||||
|
@ -479,7 +473,7 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
||||||
QLabel *nameLabel = new QLabel(baseWidget);
|
QLabel *nameLabel = new QLabel(baseWidget);
|
||||||
nameLabel->setText(localName);
|
nameLabel->setText(localName);
|
||||||
|
|
||||||
ukToolButton *setBtn = new ukToolButton(baseWidget);
|
ToolButton *setBtn = new ToolButton(baseWidget);
|
||||||
setBtn->setProperty("useButtonPalette", true);
|
setBtn->setProperty("useButtonPalette", true);
|
||||||
setBtn->setPopupMode(QToolButton::InstantPopup);
|
setBtn->setPopupMode(QToolButton::InstantPopup);
|
||||||
setBtn->setFixedSize(QSize(36, 36));
|
setBtn->setFixedSize(QSize(36, 36));
|
||||||
|
@ -496,15 +490,15 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
||||||
devHorLayout->addWidget(setBtn);
|
devHorLayout->addWidget(setBtn);
|
||||||
devHorLayout->addWidget(appSwitch);
|
devHorLayout->addWidget(appSwitch);
|
||||||
|
|
||||||
m_applistverticalLayout->addWidget(baseWidget);
|
m_appListVerticalLayout->addWidget(baseWidget);
|
||||||
if (m_applistverticalLayout->count() >= 2) {
|
if (m_appListVerticalLayout->count() >= 2) {
|
||||||
QFrame *line = new QFrame(m_pluginWidget);
|
QFrame *line = new QFrame(m_pluginWidget);
|
||||||
line->setMinimumSize(QSize(0, 1));
|
line->setMinimumSize(QSize(0, 1));
|
||||||
line->setMaximumSize(QSize(16777215, 1));
|
line->setMaximumSize(QSize(16777215, 1));
|
||||||
line->setLineWidth(0);
|
line->setLineWidth(0);
|
||||||
line->setFrameShape(QFrame::HLine);
|
line->setFrameShape(QFrame::HLine);
|
||||||
line->setFrameShadow(QFrame::Sunken);
|
line->setFrameShadow(QFrame::Sunken);
|
||||||
m_applistverticalLayout->insertWidget(m_applistverticalLayout->count() - 1, line);
|
m_appListVerticalLayout->insertWidget(m_appListVerticalLayout->count() - 1, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -513,7 +507,7 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
||||||
appSwitch->blockSignals(false);
|
appSwitch->blockSignals(false);
|
||||||
|
|
||||||
menu->blockSignals(true);
|
menu->blockSignals(true);
|
||||||
menu->initStaus(settings);
|
menu->initStatus(settings);
|
||||||
menu->blockSignals(false);
|
menu->blockSignals(false);
|
||||||
|
|
||||||
connect(appSwitch, &KSwitchButton::stateChanged, [=](bool state) {
|
connect(appSwitch, &KSwitchButton::stateChanged, [=](bool state) {
|
||||||
|
@ -586,13 +580,13 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
||||||
|
|
||||||
void Notice::setAppIcon(QLabel *iconlabel, const QString &icon)
|
void Notice::setAppIcon(QLabel *iconlabel, const QString &icon)
|
||||||
{
|
{
|
||||||
QFileInfo iconfile(QString("/usr/share/pixmaps/"+ icon + ".png"));
|
QFileInfo iconFile(QString("/usr/share/pixmaps/" + icon + ".png"));
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
QIcon currenticon = QIcon::fromTheme(icon);
|
QIcon currentIcon = QIcon::fromTheme(icon);
|
||||||
if (!currenticon.isNull()) {
|
if (!currentIcon.isNull()) {
|
||||||
pixmap = currenticon.pixmap(QSize(32, 32));
|
pixmap = currentIcon.pixmap(QSize(32, 32));
|
||||||
} else if (iconfile.exists()) {
|
} else if (iconFile.exists()) {
|
||||||
pixmap = QPixmap(iconfile.filePath()).scaled(32, 32);
|
pixmap = QPixmap(iconFile.filePath()).scaled(32, 32);
|
||||||
} else {
|
} else {
|
||||||
pixmap = QPixmap(QString(":/img/plugins/autoboot/desktop.png"));
|
pixmap = QPixmap(QString(":/img/plugins/autoboot/desktop.png"));
|
||||||
}
|
}
|
||||||
|
@ -606,16 +600,16 @@ void Notice::setHiddenNoticeApp(bool status)
|
||||||
|
|
||||||
void Notice::setComBoxStatus(bool status)
|
void Notice::setComBoxStatus(bool status)
|
||||||
{
|
{
|
||||||
m_openTimeHCombox->setEnabled(status);
|
m_openTimeHComboBox->setEnabled(status);
|
||||||
m_closeTimeHCombox->setEnabled(status);
|
m_closeTimeHComboBox->setEnabled(status);
|
||||||
m_openTimeMCombox->setEnabled(status);
|
m_openTimeMComboBox->setEnabled(status);
|
||||||
m_closeTimeMCombox->setEnabled(status);
|
m_closeTimeMComboBox->setEnabled(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ukToolButton::paintEvent(QPaintEvent *event)
|
void ToolButton::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QPalette paltte;
|
QPalette palette;
|
||||||
paltte.setColor(QPalette::Button, paltte.base().color());
|
palette.setColor(QPalette::Button, palette.base().color());
|
||||||
this->setPalette(paltte);
|
this->setPalette(palette);
|
||||||
QToolButton::paintEvent(event);
|
QToolButton::paintEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
int pluginTypes() Q_DECL_OVERRIDE;
|
int pluginTypes() Q_DECL_OVERRIDE;
|
||||||
QWidget * pluginUi() Q_DECL_OVERRIDE;
|
QWidget * pluginUi() Q_DECL_OVERRIDE;
|
||||||
const QString name() const Q_DECL_OVERRIDE;
|
const QString name() const Q_DECL_OVERRIDE;
|
||||||
QString translationPath() const;
|
QString translationPath() const override;
|
||||||
bool isShowOnHomePage() const Q_DECL_OVERRIDE;
|
bool isShowOnHomePage() const Q_DECL_OVERRIDE;
|
||||||
QIcon icon() const Q_DECL_OVERRIDE;
|
QIcon icon() const Q_DECL_OVERRIDE;
|
||||||
bool isEnable() const Q_DECL_OVERRIDE;
|
bool isEnable() const Q_DECL_OVERRIDE;
|
||||||
|
@ -71,17 +71,17 @@ private:
|
||||||
KSwitchButton *m_autoOpenSwitchBtn = nullptr;
|
KSwitchButton *m_autoOpenSwitchBtn = nullptr;
|
||||||
KSwitchButton *m_multiScreenSwitchBtn = nullptr;
|
KSwitchButton *m_multiScreenSwitchBtn = nullptr;
|
||||||
KSwitchButton *m_fullScreenSwitchBtn = nullptr;
|
KSwitchButton *m_fullScreenSwitchBtn = nullptr;
|
||||||
KSwitchButton *m_allowAlarmrSwitchBtn = nullptr;
|
KSwitchButton *m_allowAlarmSwitchBtn = nullptr;
|
||||||
KSwitchButton *m_enableSwitchBtn = nullptr;
|
KSwitchButton *m_enableSwitchBtn = nullptr;
|
||||||
|
|
||||||
QComboBox *m_openTimeHCombox = nullptr;
|
QComboBox *m_openTimeHComboBox = nullptr;
|
||||||
QComboBox *m_openTimeMCombox = nullptr;
|
QComboBox *m_openTimeMComboBox = nullptr;
|
||||||
QComboBox *m_closeTimeHCombox = nullptr;
|
QComboBox *m_closeTimeHComboBox = nullptr;
|
||||||
QComboBox *m_closeTimeMCombox = nullptr;
|
QComboBox *m_closeTimeMComboBox = nullptr;
|
||||||
|
|
||||||
QGSettings *m_themeSetting = nullptr;
|
QGSettings *m_themeSetting = nullptr;
|
||||||
|
|
||||||
QVBoxLayout *m_applistverticalLayout = nullptr;
|
QVBoxLayout *m_appListVerticalLayout = nullptr;
|
||||||
|
|
||||||
UkuiNotification::NotificationGlobalSettings *m_globalSettings = nullptr;
|
UkuiNotification::NotificationGlobalSettings *m_globalSettings = nullptr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue