Replaced all NWidgets callback by proper signals

This commit is contained in:
quadbyte 2025-08-12 13:22:15 -04:00
parent 1a7a0dbb16
commit a7d4e0ec1d
27 changed files with 93 additions and 88 deletions

View file

@ -109,7 +109,7 @@ Variants {
sizeMultiplier: 0.8
showBorder: false
anchors.verticalCenter: parent.verticalCenter
onClicked: function () {
onClicked: {
demoPanel.isLoaded = !demoPanel.isLoaded
}
}
@ -121,7 +121,7 @@ Variants {
sizeMultiplier: 0.8
showBorder: false
anchors.verticalCenter: parent.verticalCenter
onClicked: function () {
onClicked: {
// Map this button's center to the screen and open the side panel below it
const localCenterX = width / 2
const localCenterY = height / 2

View file

@ -12,15 +12,15 @@ NClock {
target: root
}
onEntered: function () {
onEntered: {
if (!calendar.isLoaded) {
tooltip.show()
}
}
onExited: function () {
onExited: {
tooltip.hide()
}
onClicked: function () {
onClicked: {
tooltip.hide()
calendar.isLoaded = !calendar.isLoaded
}

View file

@ -70,7 +70,7 @@ Item {
Audio.volumeDecrement()
}
}
onClicked: function () {
onClicked: {
audioDeviceSelector.isLoaded = !audioDeviceSelector.isLoaded
}
}

View file

@ -24,7 +24,7 @@ NIconButton {
return connected ? network.signalIcon(parent.currentSignal) : "wifi_off"
}
tooltipText: "WiFi Networks"
onClicked: function () {
onClicked: {
if (!wifiMenuLoader.active) {
wifiMenuLoader.isLoaded = true
}

View file

@ -78,7 +78,7 @@ NLoader {
NIconButton {
icon: "refresh"
sizeMultiplier: 0.8
onClicked: function () {
onClicked: {
network.refreshNetworks()
}
}
@ -86,7 +86,7 @@ NLoader {
NIconButton {
icon: "close"
sizeMultiplier: 0.8
onClicked: function () {
onClicked: {
wifiPanel.visible = false
network.onMenuClosed()
}

View file

@ -47,7 +47,7 @@ NLoader {
NIconButton {
icon: "chevron_left"
onClicked: function () {
onClicked: {
let newDate = new Date(grid.year, grid.month - 1, 1)
grid.year = newDate.getFullYear()
grid.month = newDate.getMonth()
@ -65,7 +65,7 @@ NLoader {
NIconButton {
icon: "chevron_right"
onClicked: function () {
onClicked: {
let newDate = new Date(grid.year, grid.month + 1, 1)
grid.year = newDate.getFullYear()
grid.month = newDate.getMonth()

View file

@ -73,17 +73,17 @@ NLoader {
stepSize: 0.01
value: Scaling.overrideScale
implicitWidth: bgRect.width * 0.75
onMoved: function () {
onMoved: {
Scaling.overrideScale = value
}
onPressedChanged: function () {
onPressedChanged: {
Scaling.overrideEnabled = true
}
}
NIconButton {
icon: "refresh"
fontPointSize: Style.fontSizeXL * scaling
onClicked: function () {
onClicked: {
Scaling.overrideEnabled = false
Scaling.overrideScale = 1.0
}
@ -171,8 +171,9 @@ NLoader {
NTextInput {
text: "Type anything"
Layout.fillWidth: true
onEditingFinished: function () {}
onEditingFinished: {
}
NDivider {
Layout.fillWidth: true
}

View file

@ -191,7 +191,7 @@ PanelWindow {
anchors.right: parent.right
anchors.margins: Style.marginSmall * scaling
icon: "close"
onClicked: function () {
onClicked: {
animateOut()
}
}

View file

@ -60,7 +60,7 @@ NLoader {
"source": "Tabs/About.qml"
}]
onVisibleChanged: function () {
onVisibleChanged: {
if (visible)
currentTabIndex = 0
}
@ -188,7 +188,7 @@ NLoader {
icon: "close"
tooltipText: "Close settings panel"
Layout.alignment: Qt.AlignVCenter
onClicked: function () {
onClicked: {
settingsWindow.isLoaded = !settingsWindow.isLoaded
}
}

View file

@ -84,7 +84,7 @@ ColumnLayout {
text: Settings.data.general.avatarImage
placeholderText: "/home/user/.face"
Layout.fillWidth: true
onEditingFinished: function () {
onEditingFinished: {
Settings.data.general.avatarImage = text
}
}

View file

@ -65,7 +65,7 @@ ColumnLayout {
NTextInput {
text: Settings.data.screenRecorder.directory
Layout.fillWidth: true
onEditingFinished: function () {
onEditingFinished: {
Settings.data.screenRecorder.directory = text
}
}

View file

@ -58,7 +58,7 @@ ColumnLayout {
text: Settings.data.location.name
placeholderText: "Enter city name"
Layout.fillWidth: true
onEditingFinished: function () {
onEditingFinished: {
Settings.data.location.name = text
}
}

View file

@ -70,7 +70,7 @@ ColumnLayout {
NTextInput {
text: Settings.data.wallpaper.directory
Layout.fillWidth: true
onEditingFinished: function () {
onEditingFinished: {
Settings.data.wallpaper.directory = text
}
}

View file

@ -83,9 +83,8 @@ Item {
}
NText {
text: Settings.data.wallpaper.swww.enabled ?
"Wallpapers will change with " + Settings.data.wallpaper.swww.transitionType + " transition" :
"Wallpapers will change instantly"
text: Settings.data.wallpaper.swww.enabled ? "Wallpapers will change with " + Settings.data.wallpaper.swww.transitionType
+ " transition" : "Wallpapers will change instantly"
color: Colors.textSecondary
font.pointSize: Style.fontSizeSmall * scaling
visible: Settings.data.wallpaper.swww.enabled
@ -128,13 +127,13 @@ Item {
anchors.fill: parent
clip: true
model: folderModel
// Fixed 5 items per row - more aggressive sizing
property int itemSize: Math.floor((width - leftMargin - rightMargin - (4 * Style.marginSmall * scaling)) / 5)
cellWidth: Math.floor((width - leftMargin - rightMargin) / 5)
cellHeight: Math.floor(itemSize * 0.67) + Style.marginSmall * scaling
leftMargin: Style.marginSmall * scaling
rightMargin: Style.marginSmall * scaling
topMargin: Style.marginSmall * scaling
@ -191,9 +190,11 @@ Item {
color: Colors.textPrimary
opacity: mouseArea.containsMouse ? 0.1 : 0
radius: parent.radius
Behavior on opacity {
NumberAnimation { duration: 150 }
NumberAnimation {
duration: 150
}
}
}
@ -249,4 +250,4 @@ Item {
}
}
}
}
}

View file

@ -21,17 +21,23 @@ NBox {
// Performance
NIconButton {
icon: "speed"
onClicked: function () {/* TODO: hook to power profile */ }
onClicked: {
/* TODO: hook to power profile */ }
}
// Balanced
NIconButton {
icon: "balance"
onClicked: function () {/* TODO: hook to power profile */ }
onClicked: {
/* TODO: hook to power profile */ }
}
// Eco
NIconButton {
icon: "eco"
onClicked: function () {/* TODO: hook to power profile */ }
onClicked: {
/* TODO: hook to power profile */ }
}
Item {
Layout.fillWidth: true

View file

@ -59,7 +59,7 @@ NBox {
}
NIconButton {
icon: "settings"
onClicked: function () {
onClicked: {
if (!root.settingsWindow) {
const comp = Qt.createComponent("../../Settings/SettingsWindow.qml")
if (comp.status === Component.Ready) {