From 83ad23e42c535c9a4a4553d4530a7b58bb456c02 Mon Sep 17 00:00:00 2001 From: Willem-Jan de Hoog Date: Thu, 5 Mar 2020 10:58:33 -0500 Subject: [PATCH] use com.lomiri namespace for new setting --- data/CMakeLists.txt | 1 + data/com.lomiri.gschema.xml | 11 +++++++++++ qml/Panel/Indicators/IndicatorsLight.qml | 8 ++++---- tests/mocks/GSettings.1.0/fake_gsettings.cpp | 4 ++-- .../Panel/Indicators/tst_IndicatorsLight.qml | 19 ++++++------------- 5 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 data/com.lomiri.gschema.xml diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 2cb8c2d5a2..d6d146d3a8 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -22,6 +22,7 @@ install(FILES add_custom_target(pkgversion ALL COMMAND dpkg-parsechangelog -l${CMAKE_SOURCE_DIR}/debian/changelog --show-field version > ${CMAKE_CURRENT_BINARY_DIR}/version) +install(FILES com.lomiri.gschema.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas) install(FILES com.canonical.Unity8.gschema.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas) install(FILES com.canonical.Unity.gschema.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version DESTINATION ${CMAKE_INSTALL_LOCALSTATEDIR}/lib/unity8) diff --git a/data/com.lomiri.gschema.xml b/data/com.lomiri.gschema.xml new file mode 100644 index 0000000000..c4794f0cdb --- /dev/null +++ b/data/com.lomiri.gschema.xml @@ -0,0 +1,11 @@ + + + + + true + Whether the battery charging state should be shown using the notification led + Toggle the visibility of the battery charging state in the notification led patterns + + + + diff --git a/qml/Panel/Indicators/IndicatorsLight.qml b/qml/Panel/Indicators/IndicatorsLight.qml index 239d183d39..a5475d4762 100644 --- a/qml/Panel/Indicators/IndicatorsLight.qml +++ b/qml/Panel/Indicators/IndicatorsLight.qml @@ -51,8 +51,8 @@ QtObject { updateLightState("onSupportsMultiColorLedChanged") } - property var _unity8Settings: GSettings { - schema.id: "com.canonical.Unity8.LedIndication" + property var _lomiriSettings: GSettings { + schema.id: "com.lomiri.LedIndication" onChanged: { root.updateLightState("onChanged (settings)") } @@ -75,7 +75,7 @@ QtObject { + ", displayStatus: " + displayStatus + ", deviceState: " + deviceState + ", batteryLevel: " + batteryLevel - + ", chargingStateVisible: " + _unity8Settings.chargingStateVisible) + + ", chargingStateVisible: " + _lomiriSettings.chargingStateVisible) // // If charging state visibility is disabled then only show messages. @@ -131,7 +131,7 @@ QtObject { } // if charging state is not to be shown set led off - if(!_unity8Settings.chargingStateVisible) { + if(!_lomiriSettings.chargingStateVisible) { indicatorState = "INDICATOR_OFF" return } diff --git a/tests/mocks/GSettings.1.0/fake_gsettings.cpp b/tests/mocks/GSettings.1.0/fake_gsettings.cpp index 27249c4aa2..6f70afa063 100644 --- a/tests/mocks/GSettings.1.0/fake_gsettings.cpp +++ b/tests/mocks/GSettings.1.0/fake_gsettings.cpp @@ -415,7 +415,7 @@ void GSettingsQml::setEnableIndicatorMenu(const QVariant &enableIndicatorMenu) QVariant GSettingsQml::chargingStateVisible() const { - if (m_valid && m_schema->id() == "com.canonical.Unity8.LedIndication") { + if (m_valid && m_schema->id() == "com.lomiri.LedIndication") { return GSettingsControllerQml::instance()->chargingStateVisible(); } else { return QVariant(); @@ -424,7 +424,7 @@ QVariant GSettingsQml::chargingStateVisible() const void GSettingsQml::setChargingStateVisible(const QVariant &chargingStateVisible) { - if (m_valid && m_schema->id() == "com.canonical.Unity8.LedIndication") { + if (m_valid && m_schema->id() == "com.lomiri.LedIndication") { GSettingsControllerQml::instance()->setChargingStateVisible(chargingStateVisible.toBool()); } } diff --git a/tests/qmltests/Panel/Indicators/tst_IndicatorsLight.qml b/tests/qmltests/Panel/Indicators/tst_IndicatorsLight.qml index a4f4e3eac0..1d66a32d0b 100644 --- a/tests/qmltests/Panel/Indicators/tst_IndicatorsLight.qml +++ b/tests/qmltests/Panel/Indicators/tst_IndicatorsLight.qml @@ -63,8 +63,8 @@ Item { } GSettings { - id: unity8settings - schema.id: "com.canonical.Unity8.LedIndication" + id: lomiriSettings + schema.id: "com.lomiri.LedIndication" } RowLayout { @@ -161,11 +161,8 @@ Item { ActionData.data = noNewMessage; loader.sourceComponent = undefined; loader.sourceComponent = light; -<<<<<<< 13a676575372b8cbe881471311dbeb3e9d7c572c -======= Powerd.setStatus(Powerd.On, Powerd.Unknown); - unity8settings.chargingStateVisible = true; ->>>>>>> added test cases for charge-state-visibility setting + lomiriSettings.chargingStateVisible = true; } function test_LightsStatus_data() { @@ -265,7 +262,6 @@ Item { powerd: Powerd.Off, actionData: batteryLevelDBusSignals["100"], wizardStatus: batteryIconNames.charging }, // -<<<<<<< 13a676575372b8cbe881471311dbeb3e9d7c572c // Support for Multicolor LED // { tag: "Powerd.Off with New Message & no support for multicolor led", @@ -277,7 +273,7 @@ Item { { tag: "Powerd.Off while charging & no support for multicolor led", expectedLightsState: Lights.Off, powerd: Powerd.Off, actionData: deviceStateDBusSignals.charging, supportsMultiColorLed: false }, -======= + // disabled charging state visible // { tag: "Powerd.Off with New Message & chargingStateVisible=false", @@ -286,20 +282,17 @@ Item { { tag: "Powerd.Off while charging & chargingStateVisible=false", expectedLightsState: Lights.Off, powerd: Powerd.Off, actionData: deviceStateDBusSignals.charging, chargingStateVisible: false }, ->>>>>>> added test cases for charge-state-visibility setting + ] } function test_LightsStatus(data) { console.log("----------------------------------------------------------------") -<<<<<<< 13a676575372b8cbe881471311dbeb3e9d7c572c if (data.hasOwnProperty("supportsMultiColorLed")) loader.item.supportsMultiColorLed = data.supportsMultiColorLed -======= if (data.hasOwnProperty("chargingStateVisible")) - unity8settings.chargingStateVisible = data.chargingStateVisible ->>>>>>> added test cases for charge-state-visibility setting + lomiriSettings.chargingStateVisible = data.chargingStateVisible if (data.hasOwnProperty("powerd")) Powerd.setStatus(data.powerd, Powerd.Unknown) if (data.hasOwnProperty("actionData"))