Add notifications page and complete do not disturb mode

pull/55/head
kateleet 4 years ago
parent 709fa0b56b
commit 8d212bbea2

@ -39,6 +39,7 @@ set(SRCS
src/language.cpp
src/about.cpp
src/background.cpp
src/notifications.cpp
src/password.cpp
src/batteryhistorymodel.cpp
src/cicontheme.cpp

@ -19,6 +19,7 @@
#include "powermanager.h"
#include "touchpad.h"
#include "networkproxy.h"
#include "notifications.h"
#include "cursor/cursorthememodel.h"
#include "cursor/mouse.h"
@ -79,6 +80,7 @@ Application::Application(int &argc, char **argv)
qmlRegisterType<TimeZoneMap>(uri, 1, 0, "TimeZoneMap");
qmlRegisterType<Touchpad>(uri, 1, 0, "Touchpad");
qmlRegisterType<NetworkProxy>(uri, 1, 0, "NetworkProxy");
qmlRegisterType<Notifications>(uri, 1, 0, "Notifications");
qmlRegisterSingletonType<Password>(uri, 1, 0, "Password", passwordSingleton);

@ -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

@ -46,7 +46,7 @@ ItemPage {
ColumnLayout {
id: layout
anchors.fill: parent
spacing: FishUI.Units.largeSpacing
spacing: FishUI.Units.largeSpacing * 2
RoundedItem {
spacing: FishUI.Units.largeSpacing * 1.5

@ -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
}
}
}
}
}
}

@ -159,6 +159,15 @@ Item {
category: qsTr("System")
}
ListElement {
title: qsTr("Notifications")
name: "notifications"
page: "qrc:/qml/Notification/Main.qml"
iconSource: "notifications.svg"
iconColor: "#F16884"
category: qsTr("System")
}
ListElement {
title: qsTr("Sound")
name: "sound"

@ -141,5 +141,7 @@
<file>images/dark/audio-input-microphone-medium-symbolic.svg</file>
<file>qml/DefaultApp/Main.qml</file>
<file>images/sidebar/dark/defaultapps.svg</file>
<file>qml/Notification/Main.qml</file>
<file>images/sidebar/dark/notifications.svg</file>
</qresource>
</RCC>

@ -774,6 +774,16 @@
<source>Terminal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Notification/Main.qml" line="28"/>
<source>Notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Notification/Main.qml" line="45"/>
<source>Do Not Disturb</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PairDialog</name>
@ -871,12 +881,12 @@
<translation type="unfinished">Appearance</translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="172"/>
<location filename="../src/qml/SideBar.qml" line="181"/>
<source>Mouse</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="208"/>
<location filename="../src/qml/SideBar.qml" line="217"/>
<source>Default Applications</source>
<translation type="unfinished"></translation>
</message>
@ -905,47 +915,53 @@
<location filename="../src/qml/SideBar.qml" line="168"/>
<location filename="../src/qml/SideBar.qml" line="177"/>
<location filename="../src/qml/SideBar.qml" line="186"/>
<location filename="../src/qml/SideBar.qml" line="204"/>
<location filename="../src/qml/SideBar.qml" line="195"/>
<location filename="../src/qml/SideBar.qml" line="213"/>
<location filename="../src/qml/SideBar.qml" line="222"/>
<location filename="../src/qml/SideBar.qml" line="231"/>
<location filename="../src/qml/SideBar.qml" line="240"/>
<location filename="../src/qml/SideBar.qml" line="249"/>
<location filename="../src/qml/SideBar.qml" line="258"/>
<source>System</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="163"/>
<source>Notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="172"/>
<source>Sound</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="181"/>
<location filename="../src/qml/SideBar.qml" line="190"/>
<source>Touchpad</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="199"/>
<location filename="../src/qml/SideBar.qml" line="208"/>
<source>Date &amp; Time</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="217"/>
<location filename="../src/qml/SideBar.qml" line="226"/>
<source>Language</source>
<translation type="unfinished">Language</translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="226"/>
<location filename="../src/qml/SideBar.qml" line="235"/>
<source>Battery</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="235"/>
<location filename="../src/qml/SideBar.qml" line="244"/>
<source>Power</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="244"/>
<location filename="../src/qml/SideBar.qml" line="253"/>
<source>About</source>
<translation type="unfinished">About</translation>
</message>

@ -774,6 +774,16 @@
<source>Terminal</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/Notification/Main.qml" line="28"/>
<source>Notifications</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/Notification/Main.qml" line="45"/>
<source>Do Not Disturb</source>
<translation></translation>
</message>
</context>
<context>
<name>PairDialog</name>
@ -861,7 +871,7 @@
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="172"/>
<location filename="../src/qml/SideBar.qml" line="181"/>
<source>Mouse</source>
<translation></translation>
</message>
@ -900,52 +910,58 @@
<location filename="../src/qml/SideBar.qml" line="168"/>
<location filename="../src/qml/SideBar.qml" line="177"/>
<location filename="../src/qml/SideBar.qml" line="186"/>
<location filename="../src/qml/SideBar.qml" line="204"/>
<location filename="../src/qml/SideBar.qml" line="195"/>
<location filename="../src/qml/SideBar.qml" line="213"/>
<location filename="../src/qml/SideBar.qml" line="222"/>
<location filename="../src/qml/SideBar.qml" line="231"/>
<location filename="../src/qml/SideBar.qml" line="240"/>
<location filename="../src/qml/SideBar.qml" line="249"/>
<location filename="../src/qml/SideBar.qml" line="258"/>
<source>System</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="163"/>
<source>Notifications</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="172"/>
<source>Sound</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="181"/>
<location filename="../src/qml/SideBar.qml" line="190"/>
<source>Touchpad</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="199"/>
<location filename="../src/qml/SideBar.qml" line="208"/>
<source>Date &amp; Time</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="208"/>
<location filename="../src/qml/SideBar.qml" line="217"/>
<source>Default Applications</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="217"/>
<location filename="../src/qml/SideBar.qml" line="226"/>
<source>Language</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="226"/>
<location filename="../src/qml/SideBar.qml" line="235"/>
<source>Battery</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="235"/>
<location filename="../src/qml/SideBar.qml" line="244"/>
<source>Power</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/SideBar.qml" line="244"/>
<location filename="../src/qml/SideBar.qml" line="253"/>
<source>About</source>
<translation></translation>
</message>

Loading…
Cancel
Save