Skip to content

Commit

Permalink
v0.37.1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
martonborzak committed Jan 10, 2024
1 parent 3a00d56 commit 78e6eb8
Show file tree
Hide file tree
Showing 33 changed files with 775 additions and 363 deletions.
181 changes: 116 additions & 65 deletions resources/translations/en_US.ts

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,17 @@ void Config::setEntityButtonFuncInverted(bool value) {
emit entityButtonFuncInvertedChanged();
}

bool Config::getShowBatteryPercentage()
{
return m_settings->value("ui/batteryPercent", false).toBool();
}

void Config::setShowBatteryPercentage(bool value)
{
m_settings->setValue("ui/batteryPercent", value);
emit showBatteryPercentageChanged();
}

void Config::setWakeupSensitivity(Config::WakeupSensitivities sensitivity) {
if (m_wakeupSensitivity != sensitivity) {
int id = m_core->setPowerSavingCfg(sensitivity, getDisplayTimeout(), getSleepTimeout());
Expand Down
7 changes: 7 additions & 0 deletions src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class Config : public QObject {
Q_PROPERTY(bool entityButtonFuncInverted READ getEntityButtonFuncInverted WRITE setEntityButtonFuncInverted NOTIFY
entityButtonFuncInvertedChanged)

Q_PROPERTY(bool showBatteryPercentage READ getShowBatteryPercentage WRITE setShowBatteryPercentage NOTIFY showBatteryPercentageChanged)

public:
explicit Config(core::Api* core, QObject* parent = nullptr);
~Config();
Expand Down Expand Up @@ -133,6 +135,9 @@ class Config : public QObject {
bool getEntityButtonFuncInverted();
void setEntityButtonFuncInverted(bool value);

bool getShowBatteryPercentage();
void setShowBatteryPercentage(bool value);

enum WakeupSensitivities { off = 0, low = 1, medium = 2, high = 3 };
Q_ENUM(WakeupSensitivities)

Expand Down Expand Up @@ -235,6 +240,8 @@ class Config : public QObject {

void entityButtonFuncInvertedChanged();

void showBatteryPercentageChanged();

public slots:
void onCoreConnected();
void onConfigChanged(int reqId, int code, core::Config config);
Expand Down
6 changes: 3 additions & 3 deletions src/hardware/battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ void Battery::onWarning(core::MsgEventTypes::WarningEvent event, bool shutdown,
case core::MsgEventTypes::WarningEvent::BATTERY_UNDERVOLT:
qCDebug(lcHwBattery()) << "Low battery";
uc::ui::Notification::createActionableWarningNotification(
tr("Battery needs servicing"),
tr("Critically low battery voltage detected. Charging has been disabled. Battery needs servicing."),
"uc:battery-crit");
tr("Low battery"),
tr("Low battery voltage detected. Charge the battery to 100% before using the remote again."),
"uc:battery-low");
break;
default:
break;
Expand Down
15 changes: 8 additions & 7 deletions src/hardware/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ Wifi::Wifi(core::Api *core, QObject *parent) : QObject(parent), m_core(core) {
QObject::connect(m_core, &core::Api::wifiEventChanged, this, &Wifi::onWifiEventChanged);
}

Wifi::~Wifi() {
s_instance = nullptr;
}
Wifi::~Wifi() { s_instance = nullptr; }

QList<WifiNetwork *> Wifi::getNetworkList() {
QList<WifiNetwork *> list;
Expand Down Expand Up @@ -77,7 +75,7 @@ void Wifi::connect(const QString &ssid, const QString &password, uc::hw::Securit
emit connecting();

addNetwork(ssid, password, security);
m_lastConnectedSSid = ssid;
m_lastConnectedSSid = ssid;
m_lastConnectedPassword = password;
}

Expand Down Expand Up @@ -232,9 +230,7 @@ void Wifi::stopNetworkScan() {
});
}

void Wifi::clearNetworkList() {
m_networkList.clear();
}
void Wifi::clearNetworkList() { m_networkList.clear(); }

void Wifi::getAllWifiNetworks() {
m_knownNetworkList.clear();
Expand Down Expand Up @@ -266,6 +262,11 @@ void Wifi::getAllWifiNetworks() {
void Wifi::deleteSavedNetwork(const QString &networkId) {
auto network = m_knownNetworkList.value(networkId);

if (!network) {
ui::Notification::createNotification(tr("Failed to delete network. Wifi network does not exist."), true);
return;
}

int id = m_core->wifiDeleteNetwork(network->getId());

m_core->onResult(
Expand Down
20 changes: 17 additions & 3 deletions src/qml/MainContainer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Item {
popupMenu.open();
}

function openEntityEditMenu(obj) {
function openEntityEditMenu(obj, parentGroupId) {
mainContainerRoot.entityObjToEdit = obj;

popupMenu.title = obj.name;
Expand All @@ -111,6 +111,12 @@ Item {
title: qsTr("Remove"),
icon: "uc:trash",
callback: function() {
if (parentGroupId !== "") {
let group = GroupController.get(parentGroupId);
group.removeEntity(obj.id);
} else {
currentPage.items.removeItem(obj.id);
}
currentPage.items.removeItem(obj.id);
ui.updatePageItems(currentPage._id);
}
Expand Down Expand Up @@ -260,14 +266,22 @@ Item {
currentEntity.delegateItem.toggle();
} else {
if (Config.entityButtonFuncInverted) {
currentEntity.delegateItem.groups.currentItem.item.open();
if (currentEntity.delegateItem.groups.currentItem.item.enabled) {
currentEntity.delegateItem.groups.currentItem.item.open();
} else {
ui.createNotification(currentEntity.delegateItem.groups.currentItem.item.name + " " + qsTr("is unavailable"), true);
}
} else {
currentEntity.delegateItem.groups.currentItem.item.controlTrigger();
}
}
} else {
if (Config.entityButtonFuncInverted) {
currentEntity.delegateItem.open();
if (currentEntity.delegateItem.enabled) {
currentEntity.delegateItem.open();
} else {
ui.createNotification(currentEntity.delegateItem.name + " " + qsTr("is unavailable"), true);
}
} else {
currentEntity.delegateItem.controlTrigger();
}
Expand Down
1 change: 1 addition & 0 deletions src/qml/components/PopupMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Popup {
text: popupMenu.title
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
font: fonts.primaryFont(24, "Bold")
}
Expand Down
2 changes: 1 addition & 1 deletion src/qml/components/Profile.qml
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ Item {
target: closeAnimation

function onFinished() {
buttonNavigation.releaseControl();
buttonNavigation.releaseControl(String(root.containerMain.item));
closed();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/qml/components/StatusBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Item {
Layout.alignment: Qt.AlignVCenter

pressAndHoldInterval: 500
onPressAndHold: batteryIcon.showPercentage = !batteryIcon.showPercentage
onPressAndHold: Config.showBatteryPercentage = !Config.showBatteryPercentage

RowLayout {
id: batteryIcon
Expand All @@ -306,7 +306,7 @@ Item {
text: Battery.level
verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter
font: fonts.primaryFontCapitalized(22)
visible: Battery.isCharging || batteryIcon.showPercentage
visible: Battery.isCharging || Config.showBatteryPercentage
}

Components.Icon {
Expand Down
Loading

0 comments on commit 78e6eb8

Please sign in to comment.