mirror of https://github.com/cutefishos/settings
Add notifications page and complete do not disturb mode
parent
709fa0b56b
commit
8d212bbea2
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||||
|
<metadata>
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||||
|
<dc:title/>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs>
|
||||||
|
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color:#363636; } .ColorScheme-Text { color:#363636; }</style>
|
||||||
|
</defs>
|
||||||
|
<path d="m7.9945 0.12126c-3.2459 0-5.9065 2.575-6.03 5.8495l-0.0039 0.23595v3.7897l-0.92934 2.3328-0.04323 0.13336-0.02161 0.13336c-0.0507 0.48691 0.19389 0.92625 0.60712 1.1059l0.12574 0.04513c0.08507 0.02395 0.17284 0.03488 0.26132 0.03488h2.0159v-4e-3h1.1848a3.0179 3.1515 0 0 0 2.8391 2.101 3.0179 3.1515 0 0 0 2.8391-2.101h2.1907v4e-3h1.004l0.13556-0.0103 0.11593-0.02873c0.45542-0.13551 0.75448-0.54089 0.75448-1.0115l-0.0099-0.13747-0.01376-0.09028c-0.01277-0.05977-0.03033-0.11759-0.05306-0.1744l-0.93128-2.3349v-3.7773l-0.0038-0.23595-0.01376-0.2339c-0.24202-3.1731-2.8524-5.6259-6.0203-5.6259zm0 1.0505c2.7132 0 4.9222 2.1367 5.0279 4.8401l0.0039 0.21545v3.8738l0.0393 0.20107 0.96864 2.4293-0.04519 0.0021h-2.9709a3.0179 3.1515 0 0 0 0-0.0062h-1.0059a2.0119 2.101 0 0 1 0 0.0062l-4.0239-0.0021a2.0119 2.101 0 0 1 0-0.0041h-1.006a3.0179 3.1515 0 0 0 0 0.0041h-3.0218l0.96864-2.4293 0.03733-0.20107v-3.884l0.0039-0.21545 0.01375-0.22364c0.21127-2.5857 2.372-4.6062 5.0103-4.6062zm-1.7291 12.606h3.4698a2.0119 2.101 0 0 1-1.7349 1.0505 2.0119 2.101 0 0 1-1.7349-1.0505z" fill="#fff" stroke="#fff" stroke-width=".24242"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 CutefishOS Team.
|
||||||
|
*
|
||||||
|
* Author: Kate Leet <kateleet@cutefishos.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "notifications.h"
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QDBusInterface>
|
||||||
|
#include <QDBusPendingCall>
|
||||||
|
|
||||||
|
Notifications::Notifications(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::UserScope, "cutefishos", "notification");
|
||||||
|
m_doNotDisturb = settings.value("DoNotDisturb", false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Notifications::doNotDisturb() const
|
||||||
|
{
|
||||||
|
return m_doNotDisturb;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notifications::setDoNotDisturb(bool enabled)
|
||||||
|
{
|
||||||
|
m_doNotDisturb = enabled;
|
||||||
|
|
||||||
|
QDBusInterface iface("com.cutefish.Notification",
|
||||||
|
"/Notification",
|
||||||
|
"com.cutefish.Notification", QDBusConnection::sessionBus());
|
||||||
|
|
||||||
|
if (iface.isValid()) {
|
||||||
|
iface.asyncCall("setDoNotDisturb", enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit doNotDisturbChanged();
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 CutefishOS Team.
|
||||||
|
*
|
||||||
|
* Author: Kate Leet <kateleet@cutefishos.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NOTIFICATIONS_H
|
||||||
|
#define NOTIFICATIONS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class Notifications : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool doNotDisturb READ doNotDisturb WRITE setDoNotDisturb NOTIFY doNotDisturbChanged)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Notifications(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
bool doNotDisturb() const;
|
||||||
|
void setDoNotDisturb(bool enabled);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void doNotDisturbChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_doNotDisturb;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NOTIFICATIONS_H
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 CutefishOS Team.
|
||||||
|
*
|
||||||
|
* Author: Kate Leet <kateleet@cutefishos.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick 2.12
|
||||||
|
import QtQuick.Controls 2.12
|
||||||
|
import QtQuick.Layouts 1.12
|
||||||
|
import FishUI 1.0 as FishUI
|
||||||
|
import Cutefish.Settings 1.0
|
||||||
|
import "../"
|
||||||
|
|
||||||
|
ItemPage {
|
||||||
|
headerTitle: qsTr("Notifications")
|
||||||
|
|
||||||
|
Notifications {
|
||||||
|
id: notifications
|
||||||
|
}
|
||||||
|
|
||||||
|
Scrollable {
|
||||||
|
anchors.fill: parent
|
||||||
|
contentHeight: layout.implicitHeight
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: layout
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
RoundedItem {
|
||||||
|
RowLayout {
|
||||||
|
Label {
|
||||||
|
text: qsTr("Do Not Disturb")
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Switch {
|
||||||
|
checked: notifications.doNotDisturb
|
||||||
|
Layout.fillHeight: true
|
||||||
|
onClicked: notifications.doNotDisturb = checked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue