Merge branch 'main' into sdfs
This commit is contained in:
commit
bd35b2bef5
11 changed files with 264 additions and 163 deletions
5
.github/workflows/check-format.yml
vendored
5
.github/workflows/check-format.yml
vendored
|
|
@ -34,6 +34,5 @@ jobs:
|
||||||
- name: Check C++ format
|
- name: Check C++ format
|
||||||
shell: fish {0}
|
shell: fish {0}
|
||||||
run: |
|
run: |
|
||||||
for file in (string match -v 'build/*' **.cpp **.hpp)
|
find plugin extras -name '*.cpp' -o -name '*.hpp' \
|
||||||
clang-format $file | diff -u $file - || exit 1
|
| xargs clang-format --dry-run --Werror
|
||||||
end
|
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ Singleton {
|
||||||
const provider = {
|
const provider = {
|
||||||
displayName: p.displayName,
|
displayName: p.displayName,
|
||||||
enabled: p.enabled,
|
enabled: p.enabled,
|
||||||
iface: p.iface,
|
interface: p.interface,
|
||||||
name: p.name
|
name: p.name
|
||||||
};
|
};
|
||||||
if (p.connectCmd && p.connectCmd.length > 0) {
|
if (p.connectCmd && p.connectCmd.length > 0) {
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,8 @@ import qs.components.containers
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
|
|
||||||
Loader {
|
Variants {
|
||||||
asynchronous: true
|
model: Config.background.enabled ? Screens.screens : []
|
||||||
active: Config.background.enabled
|
|
||||||
|
|
||||||
sourceComponent: Variants {
|
|
||||||
model: Screens.screens
|
|
||||||
|
|
||||||
StyledWindow {
|
StyledWindow {
|
||||||
id: win
|
id: win
|
||||||
|
|
@ -163,4 +159,3 @@ Loader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ ColumnLayout {
|
||||||
|
|
||||||
required property PopoutState popouts
|
required property PopoutState popouts
|
||||||
|
|
||||||
|
width: 300
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|
@ -99,6 +100,13 @@ ColumnLayout {
|
||||||
Layout.rightMargin: Appearance.spacing.small / 2
|
Layout.rightMargin: Appearance.spacing.small / 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: device.modelData.name
|
text: device.modelData.name
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
visible: device.modelData.state === BluetoothDeviceState.Connected // qmllint disable unresolved-type
|
||||||
|
text: Icons.getBatteryIcon(device.modelData.batteryAvailable ? device.modelData.battery * 100 : -1)
|
||||||
|
color: device.modelData.battery < 0.2 ? Colours.palette.m3error : Colours.palette.m3onSurfaceVariant
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
|
|
@ -141,6 +149,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
visible: status === Loader.Ready
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
active: device.modelData.bonded
|
active: device.modelData.bonded
|
||||||
sourceComponent: Item {
|
sourceComponent: Item {
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,13 @@ DeviceDetails {
|
||||||
newProvider.enabled = (i === index) ? false : (p.enabled !== false);
|
newProvider.enabled = (i === index) ? false : (p.enabled !== false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p.connectCmd && p.connectCmd.length > 0) {
|
||||||
|
newProvider.connectCmd = p.connectCmd;
|
||||||
|
}
|
||||||
|
if (p.disconnectCmd && p.disconnectCmd.length > 0) {
|
||||||
|
newProvider.disconnectCmd = p.disconnectCmd;
|
||||||
|
}
|
||||||
|
|
||||||
providers.push(newProvider);
|
providers.push(newProvider);
|
||||||
} else {
|
} else {
|
||||||
providers.push(p);
|
providers.push(p);
|
||||||
|
|
@ -504,21 +511,31 @@ DeviceDetails {
|
||||||
const newProvider = {
|
const newProvider = {
|
||||||
displayName: editVpnDialog.displayName || editVpnDialog.interfaceName,
|
displayName: editVpnDialog.displayName || editVpnDialog.interfaceName,
|
||||||
enabled: wasEnabled,
|
enabled: wasEnabled,
|
||||||
iface: editVpnDialog.interfaceName,
|
interface: editVpnDialog.interfaceName,
|
||||||
name: editVpnDialog.providerName,
|
name: editVpnDialog.providerName
|
||||||
connectCmd: hasCommands ? editVpnDialog.connectCmd.split(" ").filter(s => s.length > 0) : undefined,
|
|
||||||
disconnectCmd: hasCommands ? editVpnDialog.disconnectCmd.split(" ").filter(s => s.length > 0) : undefined
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove undefined properties
|
if (hasCommands) {
|
||||||
if (!hasCommands) {
|
newProvider.connectCmd = editVpnDialog.connectCmd.split(" ").filter(s => s.length > 0);
|
||||||
delete newProvider.connectCmd;
|
newProvider.disconnectCmd = editVpnDialog.disconnectCmd.split(" ").filter(s => s.length > 0);
|
||||||
delete newProvider.disconnectCmd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
providers.push(newProvider);
|
providers.push(newProvider);
|
||||||
} else {
|
} else {
|
||||||
providers.push(Config.utilities.vpn.provider[i]);
|
const p = Config.utilities.vpn.provider[i];
|
||||||
|
const reconstructed = {
|
||||||
|
displayName: p.displayName,
|
||||||
|
enabled: p.enabled,
|
||||||
|
interface: p.interface,
|
||||||
|
name: p.name
|
||||||
|
};
|
||||||
|
if (p.connectCmd && p.connectCmd.length > 0) {
|
||||||
|
reconstructed.connectCmd = p.connectCmd;
|
||||||
|
}
|
||||||
|
if (p.disconnectCmd && p.disconnectCmd.length > 0) {
|
||||||
|
reconstructed.disconnectCmd = p.disconnectCmd;
|
||||||
|
}
|
||||||
|
providers.push(reconstructed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,12 @@ ColumnLayout {
|
||||||
interface: p.interface,
|
interface: p.interface,
|
||||||
enabled: (i === targetIndex)
|
enabled: (i === targetIndex)
|
||||||
};
|
};
|
||||||
|
if (p.connectCmd && p.connectCmd.length > 0) {
|
||||||
|
newProvider.connectCmd = p.connectCmd;
|
||||||
|
}
|
||||||
|
if (p.disconnectCmd && p.disconnectCmd.length > 0) {
|
||||||
|
newProvider.disconnectCmd = p.disconnectCmd;
|
||||||
|
}
|
||||||
providers.push(newProvider);
|
providers.push(newProvider);
|
||||||
} else {
|
} else {
|
||||||
providers.push(p);
|
providers.push(p);
|
||||||
|
|
@ -226,6 +232,12 @@ ColumnLayout {
|
||||||
interface: p.interface,
|
interface: p.interface,
|
||||||
enabled: (i === clickedIndex)
|
enabled: (i === clickedIndex)
|
||||||
};
|
};
|
||||||
|
if (p.connectCmd && p.connectCmd.length > 0) {
|
||||||
|
newProvider.connectCmd = p.connectCmd;
|
||||||
|
}
|
||||||
|
if (p.disconnectCmd && p.disconnectCmd.length > 0) {
|
||||||
|
newProvider.disconnectCmd = p.disconnectCmd;
|
||||||
|
}
|
||||||
providers.push(newProvider);
|
providers.push(newProvider);
|
||||||
} else {
|
} else {
|
||||||
providers.push(p);
|
providers.push(p);
|
||||||
|
|
@ -265,7 +277,20 @@ ColumnLayout {
|
||||||
const providers = [];
|
const providers = [];
|
||||||
for (let i = 0; i < Config.utilities.vpn.provider.length; i++) {
|
for (let i = 0; i < Config.utilities.vpn.provider.length; i++) {
|
||||||
if (i !== modelData.index) {
|
if (i !== modelData.index) {
|
||||||
providers.push(Config.utilities.vpn.provider[i]);
|
const p = Config.utilities.vpn.provider[i];
|
||||||
|
const reconstructed = {
|
||||||
|
name: p.name,
|
||||||
|
displayName: p.displayName,
|
||||||
|
interface: p.interface,
|
||||||
|
enabled: p.enabled
|
||||||
|
};
|
||||||
|
if (p.connectCmd && p.connectCmd.length > 0) {
|
||||||
|
reconstructed.connectCmd = p.connectCmd;
|
||||||
|
}
|
||||||
|
if (p.disconnectCmd && p.disconnectCmd.length > 0) {
|
||||||
|
reconstructed.disconnectCmd = p.disconnectCmd;
|
||||||
|
}
|
||||||
|
providers.push(reconstructed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Config.utilities.vpn.provider = providers;
|
Config.utilities.vpn.provider = providers;
|
||||||
|
|
|
||||||
|
|
@ -119,30 +119,62 @@ ColumnLayout {
|
||||||
icon: modelData.isActive ? "arrow_downward" : "arrow_upward"
|
icon: modelData.isActive ? "arrow_downward" : "arrow_upward"
|
||||||
visible: !modelData.isActive || Config.utilities.vpn.provider.length > 1
|
visible: !modelData.isActive || Config.utilities.vpn.provider.length > 1
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (modelData.isActive && index < Config.utilities.vpn.provider.length - 1) {
|
const providers = [];
|
||||||
|
for (let i = 0; i < Config.utilities.vpn.provider.length; i++) {
|
||||||
|
const p = Config.utilities.vpn.provider[i];
|
||||||
|
const reconstructed = {
|
||||||
|
name: p.name,
|
||||||
|
displayName: p.displayName,
|
||||||
|
interface: p.interface,
|
||||||
|
enabled: p.enabled
|
||||||
|
};
|
||||||
|
if (p.connectCmd && p.connectCmd.length > 0) {
|
||||||
|
reconstructed.connectCmd = p.connectCmd;
|
||||||
|
}
|
||||||
|
if (p.disconnectCmd && p.disconnectCmd.length > 0) {
|
||||||
|
reconstructed.disconnectCmd = p.disconnectCmd;
|
||||||
|
}
|
||||||
|
providers.push(reconstructed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modelData.isActive && index < providers.length - 1) {
|
||||||
// Move down
|
// Move down
|
||||||
const providers = [...Config.utilities.vpn.provider];
|
|
||||||
const temp = providers[index];
|
const temp = providers[index];
|
||||||
providers[index] = providers[index + 1];
|
providers[index] = providers[index + 1];
|
||||||
providers[index + 1] = temp;
|
providers[index + 1] = temp;
|
||||||
Config.utilities.vpn.provider = providers;
|
|
||||||
Config.save();
|
|
||||||
} else if (!modelData.isActive) {
|
} else if (!modelData.isActive) {
|
||||||
// Make active (move to top)
|
// Make active (move to top)
|
||||||
const providers = [...Config.utilities.vpn.provider];
|
|
||||||
const provider = providers.splice(index, 1)[0];
|
const provider = providers.splice(index, 1)[0];
|
||||||
providers.unshift(provider);
|
providers.unshift(provider);
|
||||||
|
}
|
||||||
|
|
||||||
Config.utilities.vpn.provider = providers;
|
Config.utilities.vpn.provider = providers;
|
||||||
Config.save();
|
Config.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
icon: "delete"
|
icon: "delete"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const providers = [...Config.utilities.vpn.provider];
|
const providers = [];
|
||||||
providers.splice(index, 1);
|
for (let i = 0; i < Config.utilities.vpn.provider.length; i++) {
|
||||||
|
if (i !== index) {
|
||||||
|
const p = Config.utilities.vpn.provider[i];
|
||||||
|
const reconstructed = {
|
||||||
|
name: p.name,
|
||||||
|
displayName: p.displayName,
|
||||||
|
interface: p.interface,
|
||||||
|
enabled: p.enabled
|
||||||
|
};
|
||||||
|
if (p.connectCmd && p.connectCmd.length > 0) {
|
||||||
|
reconstructed.connectCmd = p.connectCmd;
|
||||||
|
}
|
||||||
|
if (p.disconnectCmd && p.disconnectCmd.length > 0) {
|
||||||
|
reconstructed.disconnectCmd = p.disconnectCmd;
|
||||||
|
}
|
||||||
|
providers.push(reconstructed);
|
||||||
|
}
|
||||||
|
}
|
||||||
Config.utilities.vpn.provider = providers;
|
Config.utilities.vpn.provider = providers;
|
||||||
Config.save();
|
Config.save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,11 @@ Singleton {
|
||||||
|
|
||||||
function _doLoadLyrics() {
|
function _doLoadLyrics() {
|
||||||
const meta = getMetadata();
|
const meta = getMetadata();
|
||||||
if (!meta)
|
if (!meta) {
|
||||||
|
lyricsModel.clear();
|
||||||
|
root.currentIndex = -1;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
loading = true;
|
loading = true;
|
||||||
lyricsModel.clear();
|
lyricsModel.clear();
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,8 @@ QtObject {
|
||||||
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
||||||
const hash = (h2 >>> 0).toString(16).padStart(8, 0) + (h1 >>> 0).toString(16).padStart(8, 0);
|
const hash = (h2 >>> 0).toString(16).padStart(8, 0) + (h1 >>> 0).toString(16).padStart(8, 0);
|
||||||
|
|
||||||
const cache = Paths.notifimagecache + "/${hash}.png";
|
Paths; // Screw you qmlls
|
||||||
|
const cache = `${Paths.notifimagecache}/${hash}.png`;
|
||||||
CUtils.saveItem(this, Qt.resolvedUrl(cache), () => {
|
CUtils.saveItem(this, Qt.resolvedUrl(cache), () => {
|
||||||
notif.image = cache;
|
notif.image = cache;
|
||||||
notif.dummyImageLoader.active = false;
|
notif.dummyImageLoader.active = false;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
readonly property bool isCustomProvider: typeof providerInput === "object"
|
readonly property bool isCustomProvider: typeof providerInput === "object"
|
||||||
readonly property string providerName: isCustomProvider ? (providerInput.name || "custom") : String(providerInput)
|
readonly property string providerName: isCustomProvider ? (providerInput.name || "custom") : String(providerInput)
|
||||||
readonly property string interfaceName: isCustomProvider ? (providerInput.iface || "") : ""
|
readonly property string interfaceName: isCustomProvider ? (providerInput.interface || "") : ""
|
||||||
readonly property var currentConfig: {
|
readonly property var currentConfig: {
|
||||||
const name = providerName;
|
const name = providerName;
|
||||||
const iface = interfaceName;
|
const iface = interfaceName;
|
||||||
|
|
@ -36,7 +36,7 @@ Singleton {
|
||||||
return {
|
return {
|
||||||
connectCmd: custom.connectCmd || defaults.connectCmd,
|
connectCmd: custom.connectCmd || defaults.connectCmd,
|
||||||
disconnectCmd: custom.disconnectCmd || defaults.disconnectCmd,
|
disconnectCmd: custom.disconnectCmd || defaults.disconnectCmd,
|
||||||
interface: custom.iface || defaults.interface,
|
interface: custom.interface || defaults.interface,
|
||||||
displayName: custom.displayName || defaults.displayName
|
displayName: custom.displayName || defaults.displayName
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,4 +240,24 @@ Singleton {
|
||||||
}
|
}
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBatteryIcon(charge: int): string {
|
||||||
|
if (charge > 0 && charge < 5)
|
||||||
|
return "battery_0_bar";
|
||||||
|
if (charge >= 5 && charge < 20)
|
||||||
|
return "battery_1_bar";
|
||||||
|
if (charge >= 20 && charge < 35)
|
||||||
|
return "battery_2_bar";
|
||||||
|
if (charge >= 35 && charge < 50)
|
||||||
|
return "battery_3_bar";
|
||||||
|
if (charge >= 50 && charge < 65)
|
||||||
|
return "battery_4_bar";
|
||||||
|
if (charge >= 65 && charge < 80)
|
||||||
|
return "battery_5_bar";
|
||||||
|
if (charge >= 80 && charge < 95)
|
||||||
|
return "battery_6_bar";
|
||||||
|
if (charge >= 95)
|
||||||
|
return "battery_full";
|
||||||
|
return "battery_alert";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue