Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Commit

Permalink
use com.lomiri namespace for new setting
Browse files Browse the repository at this point in the history
  • Loading branch information
wdehoog committed Aug 16, 2020
1 parent 32dbcd5 commit 83ad23e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
1 change: 1 addition & 0 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 11 additions & 0 deletions data/com.lomiri.gschema.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<schemalist>

<schema path="/com/lomiri/ledindication/" id="com.lomiri.LedIndication" gettext-domain="lomiri">
<key type="b" name="charging-state-visible">
<default>true</default>
<summary>Whether the battery charging state should be shown using the notification led</summary>
<description>Toggle the visibility of the battery charging state in the notification led patterns</description>
</key>
</schema>

</schemalist>
8 changes: 4 additions & 4 deletions qml/Panel/Indicators/IndicatorsLight.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
}
Expand All @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions tests/mocks/GSettings.1.0/fake_gsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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());
}
}
19 changes: 6 additions & 13 deletions tests/qmltests/Panel/Indicators/tst_IndicatorsLight.qml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ Item {
}

GSettings {
id: unity8settings
schema.id: "com.canonical.Unity8.LedIndication"
id: lomiriSettings
schema.id: "com.lomiri.LedIndication"
}

RowLayout {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"))
Expand Down

0 comments on commit 83ad23e

Please sign in to comment.