From 09e58fda0b5ac32c344c5efb1ab9937fba37e900 Mon Sep 17 00:00:00 2001 From: Evgeniy Harchenko Date: Thu, 11 Apr 2024 01:22:35 +0300 Subject: [PATCH 1/8] Yet another fix for lastReloadedNotifier. --- package/contents/ui/CompactRepresentation.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/contents/ui/CompactRepresentation.qml b/package/contents/ui/CompactRepresentation.qml index 5ea60b4..ca051ab 100644 --- a/package/contents/ui/CompactRepresentation.qml +++ b/package/contents/ui/CompactRepresentation.qml @@ -63,13 +63,15 @@ Loader { anchors.bottomMargin: - defaultWidgetSize * 0.05 verticalAlignment: Text.AlignBottom width: parent.width + font.pixelSize: lastReloadedNotifier.height fontSizeMode: Text.Fit - font.pointSize: -1 - minimumPixelSize: 1 + minimumPixelSize: 10 color: Kirigami.Theme.highlightColor text: lastReloadedText elide: Text.ElideRight + wrapMode: Text.NoWrap visible: false + z: 1 } From 135892ab0ed65d659f7512a48003e87576c7d2e7 Mon Sep 17 00:00:00 2001 From: Evgeniy Harchenko Date: Thu, 11 Apr 2024 01:23:37 +0300 Subject: [PATCH 2/8] Now widget on desktop will grow correctly while font size increased. --- package/contents/ui/CompactItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/contents/ui/CompactItem.qml b/package/contents/ui/CompactItem.qml index 9b7bb39..f23233f 100644 --- a/package/contents/ui/CompactItem.qml +++ b/package/contents/ui/CompactItem.qml @@ -57,7 +57,7 @@ GridLayout { Layout.minimumWidth: iconAndText.vertical ? 0 : sizehelperText.paintedWidth Layout.maximumWidth: iconAndText.vertical ? Infinity : Layout.minimumWidth - Layout.minimumHeight: iconAndText.vertical ? sizehelperText.paintedHeight : 0 + Layout.minimumHeight: iconAndText.vertical ? sizehelperText.paintedHeight : (main.onDesktop ? sizehelperText.paintedHeight : 0) Layout.maximumHeight: iconAndText.vertical ? Layout.minimumHeight : Infinity Text { From 114758fc12346a2aa258b15441b905a472740cdd Mon Sep 17 00:00:00 2001 From: Evgeniy Harchenko Date: Thu, 11 Apr 2024 22:40:10 +0300 Subject: [PATCH 3/8] Reworked configs UI, moved to Kirigami.FormLayout. --- .../contents/ui/config/ConfigAppearance.qml | 117 ++----- package/contents/ui/config/ConfigGeneral.qml | 316 +++++++++--------- package/contents/ui/config/ConfigUnits.qml | 78 ++--- 3 files changed, 218 insertions(+), 293 deletions(-) diff --git a/package/contents/ui/config/ConfigAppearance.qml b/package/contents/ui/config/ConfigAppearance.qml index 763601a..e507bd9 100644 --- a/package/contents/ui/config/ConfigAppearance.qml +++ b/package/contents/ui/config/ConfigAppearance.qml @@ -58,79 +58,53 @@ KCM.SimpleKCM { id: layoutTypeGroup } - GridLayout { - anchors.left: parent.left - anchors.right: parent.right - columns: 3 - - Item { - width: 2 - height: 10 - Layout.columnSpan: 3 + Kirigami.FormLayout { + Kirigami.Separator { + Kirigami.FormData.isSection: true + Kirigami.FormData.label: i18n("Layout") } - Label { - text: i18n("Layout") - Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - font.bold: true - Layout.columnSpan: 3 - } - Label { - text: i18n("Layout type") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } RadioButton { + Kirigami.FormData.label: i18n("Layout type") + ":" id: layoutTypeRadioHorizontal + Layout.row: 0 + Layout.column: 0 ButtonGroup.group: layoutTypeGroup text: i18n("Horizontal") onCheckedChanged: if (checked) cfg_layoutType = 0; } - Label { - text: i18n("NOTE: Setting layout type for in-tray plasmoid has no effect.") - Layout.rowSpan: 3 - Layout.preferredWidth: 250 - wrapMode: Text.WordWrap - } - Item { - width: 2 - height: 2 - Layout.rowSpan: 2 - } RadioButton { id: layoutTypeRadioVertical + Layout.row: 1 + Layout.column: 0 ButtonGroup.group: layoutTypeGroup text: i18n("Vertical") onCheckedChanged: if (checked) cfg_layoutType = 1; } RadioButton { id: layoutTypeRadioCompact + Layout.row: 2 + Layout.column: 0 ButtonGroup.group: layoutTypeGroup text: i18n("Compact") onCheckedChanged: if (checked) cfg_layoutType = 2; } - Item { - width: 2 - height: 20 - Layout.columnSpan: 3 - } - Label { - text: i18n("In-Tray Settings") - Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - font.bold: true - Layout.columnSpan: 3 + text: i18n("NOTE: Setting layout type for in-tray plasmoid has no effect.") + font: Kirigami.Theme.smallFont + Layout.preferredWidth: 250 + wrapMode: Text.WordWrap } - - Label { - id: timeoutLabel - text: i18n("Active timeout") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - height: inTrayActiveTimeoutSec.height - // anchors.verticalCenter: inTrayActiveTimeoutSec.verticalCenter + Kirigami.Separator { + Kirigami.FormData.isSection: true + Kirigami.FormData.label: i18n("In-Tray Settings") } - Item { + + RowLayout { + Kirigami.FormData.label: i18n("Active timeout") + ":" + spacing: Kirigami.Units.smallSpacing SpinBox { id: inTrayActiveTimeoutSec Layout.alignment: Qt.AlignVCenter @@ -142,34 +116,27 @@ KCM.SimpleKCM { } Label { text: i18nc("Abbreviation for seconds", "sec") - anchors.verticalCenter: parent.verticalCenter - anchors.left:inTrayActiveTimeoutSec.right - anchors.leftMargin: 4 } } + Label { text: i18n("NOTE: After this timeout widget will be hidden in system tray until refreshed. You can always set the widget to be always \"Shown\" in system tray \"Entries\" settings.") - Layout.rowSpan: 3 + font: Kirigami.Theme.smallFont Layout.preferredWidth: 250 wrapMode: Text.WordWrap } - Item { - width: 2 - height: 20 - Layout.columnSpan: 3 + Kirigami.FormData.isSection: true } - Label { - text: i18n("Widget font style") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } ComboBox { + Kirigami.FormData.label: i18n("Widget font style") + ":" id: fontFamilyComboBox Layout.fillWidth: true currentIndex: 0 - Layout.minimumWidth: Kirigami.Units.gridUnit * 10 + //Layout.minimumWidth: Kirigami.Units.gridUnit * 10 + Layout.preferredWidth: 300 model: fontsModel textRole: "text" @@ -180,37 +147,25 @@ KCM.SimpleKCM { } } } - Item { - width: 2 - height: 20 - Layout.columnSpan: 3 - } - Label { - text: i18n("Show last reloaded time") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight + Item { + Kirigami.FormData.isSection: true } CheckBox { + Kirigami.FormData.label: i18n("Show last reloaded time") + ":" id: showLastReloadedTime Layout.fillWidth: true Layout.alignment: Qt.AlignLeft } Item { - width: 2 - height: 20 - Layout.columnSpan: 3 + Kirigami.FormData.isSection: true } - Label { - text: i18n("Widget font size") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - // anchors.verticalCenter: widgetFontSize.verticalCenter - - - } - Item { + RowLayout { + Kirigami.FormData.label: i18n("Widget font size") + ":" + spacing: Kirigami.Units.smallSpacing SpinBox { id: widgetFontSize Layout.alignment: Qt.AlignVCenter @@ -225,8 +180,6 @@ KCM.SimpleKCM { } } Label { - anchors.verticalCenter: parent.verticalCenter - anchors.left:widgetFontSize.right text: i18nc("pixels", "px") } } diff --git a/package/contents/ui/config/ConfigGeneral.qml b/package/contents/ui/config/ConfigGeneral.qml index 4ff4979..86707ce 100644 --- a/package/contents/ui/config/ConfigGeneral.qml +++ b/package/contents/ui/config/ConfigGeneral.qml @@ -193,42 +193,41 @@ KCM.SimpleKCM { // ConfigGeneral home page ColumnLayout { - id: rhsColumn - width: parent.width - spacing: 2 + spacing: 0 - Label { - text: i18n("Plasmoid version") + ": " + plasmoid.metaData.version - Layout.alignment: Qt.AlignRight - } - - Label { + Kirigami.Heading { text: i18n("Location") - font.bold: true - Layout.alignment: Qt.AlignLeft + type: Kirigami.Heading.Type.Primary + level: 3 + Layout.alignment: Qt.AlignCenter } - HorizontalHeaderView { - id: myhorizontalHeader - // anchors.left: mytableView.left - // anchors.leftMargin: 0 - // anchors.topMargin: 2 - // anchors.top: parent.top - // anchors.right: parent.right - // anchors.rightMargin: 2 + Kirigami.Separator { + Layout.fillWidth: true + Layout.margins: Kirigami.Units.largeSpacing + } - syncView: mytableView - clip: true - model: ListModel { - Component.onCompleted: { - append({ display: i18n("Source") }); - append({ display: i18n("Place Identifier") }); - append({ display: i18n("Displayed as") }); - append({ display: i18n("Action") }); - // append({ display: ("TBA") }); - } + HorizontalHeaderView { + id: myhorizontalHeader + // anchors.left: mytableView.left + // anchors.leftMargin: 0 + // anchors.topMargin: 2 + // anchors.top: parent.top + // anchors.right: parent.right + // anchors.rightMargin: 2 + + syncView: mytableView + clip: true + model: ListModel { + Component.onCompleted: { + append({ display: i18n("Source") }); + append({ display: i18n("Place Identifier") }); + append({ display: i18n("Displayed as") }); + append({ display: i18n("Action") }); + // append({ display: ("TBA") }); } } + } ScrollView { id: placesTable width: parent.width @@ -402,6 +401,11 @@ KCM.SimpleKCM { } } + + Kirigami.Separator { + Layout.margins: Kirigami.Units.largeSpacing + } + Row { Button { icon.name: 'list-add' @@ -434,157 +438,161 @@ KCM.SimpleKCM { } } - Label { - topPadding: 16 - bottomPadding: 6 - text: i18n("Miscellaneous") - font.bold: true - Layout.alignment: Qt.AlignLeft - } - - Item { - id: reloadItem - width: parent.width - - Label { - id: reloadLabel1 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - text: i18n("Reload interval") + ":" - Layout.alignment: Qt.AlignLeft - rightPadding: 6 - } - SpinBox { - anchors.verticalCenter: parent.verticalCenter - anchors.left:reloadLabel1.right - id: reloadIntervalMin - stepSize: 10 - - from: 20 - to: 120 - // suffix: i18nc("Abbreviation for minutes", "min") + Kirigami.FormLayout { + Kirigami.Separator { + Kirigami.FormData.isSection: true + Kirigami.FormData.label: i18n("Miscellaneous") } - Label { - anchors.verticalCenter: parent.verticalCenter - anchors.left:reloadIntervalMin.right - text: i18nc("Abbreviation for minutes", "min") - leftPadding: 6 - } - } - CheckBox { - id: debugLogging - checked: false - text: "Debug" - Layout.alignment: Qt.AlignLeft - visible: false - } + RowLayout { + Kirigami.FormData.label: i18n("Reload interval") + ":" + id: reloadItem + spacing: Kirigami.Units.smallSpacing - } - Item { - anchors.bottom: parent.bottom - Rectangle { - anchors.fill: parent - // anchors.top: - } - Label { - id: attribution1 - anchors.bottom: attribution2.top - anchors.bottomMargin: 2 - font: Kirigami.Theme.smallFont - text: i18n("Met.no weather forecast data provided by The Norwegian Meteorological Institute.") - MouseArea { - cursorShape: Qt.PointingHandCursor - anchors.fill: attribution1 + SpinBox { + anchors.verticalCenter: parent.verticalCenter + anchors.left:reloadLabel1.right + id: reloadIntervalMin + stepSize: 10 - hoverEnabled: true + from: 20 + to: 120 + // suffix: i18nc("Abbreviation for minutes", "min") - onClicked: { - Qt.openUrlExternally('https://www.met.no/en/About-us') } - - onEntered: { - attribution1.font.underline = true + Label { + anchors.verticalCenter: parent.verticalCenter + anchors.left:reloadIntervalMin.right + text: i18nc("Abbreviation for minutes", "min") + leftPadding: 6 } + } - onExited: { - attribution1.font.underline = false - } + CheckBox { + Kirigami.FormData.label: "Debug" + id: debugLogging + checked: false + Layout.alignment: Qt.AlignLeft + visible: false + } + + Label { + Kirigami.FormData.label: i18n("Plasmoid version") + ":" + text: plasmoid.metaData.version + Layout.alignment: Qt.AlignRight } } - Label { - id: attribution2 - anchors.bottom: attribution3.top - anchors.bottomMargin: 2 - font: Kirigami.Theme.smallFont - text: i18n("Sunrise/sunset data provided by Sunrise - Sunset.") - MouseArea { - cursorShape: Qt.PointingHandCursor - anchors.fill: attribution2 - hoverEnabled: true + ColumnLayout { - onClicked: { - Qt.openUrlExternally('https://sunrise-sunset.org/about') - } + Label { + id: attribution1 + anchors.bottom: attribution2.top + font: Kirigami.Theme.smallFont + text: i18n("Met.no weather forecast data provided by The Norwegian Meteorological Institute.") + Layout.fillHeight: true + Layout.fillWidth: true + wrapMode: Text.WordWrap + MouseArea { + cursorShape: Qt.PointingHandCursor + anchors.fill: attribution1 + + hoverEnabled: true + + onClicked: { + Qt.openUrlExternally('https://www.met.no/en/About-us') + } - onEntered: { - attribution2.font.underline = true - } + onEntered: { + attribution1.font.underline = true + } - onExited: { - attribution2.font.underline = false + onExited: { + attribution1.font.underline = false + } } } - } - Label { - id: attribution3 - anchors.bottom: attribution4.top - anchors.bottomMargin: 2 - font: Kirigami.Theme.smallFont - text: i18n("OWM weather forecast data provided by OpenWeather.") - MouseArea { - cursorShape: Qt.PointingHandCursor - anchors.fill: attribution3 - - hoverEnabled: true - - onClicked: { - Qt.openUrlExternally('https://openweathermap.org/about-us') - } + Label { + id: attribution2 + anchors.bottom: attribution3.top + font: Kirigami.Theme.smallFont + text: i18n("Sunrise/sunset data provided by Sunrise - Sunset.") + Layout.fillHeight: true + Layout.fillWidth: true + wrapMode: Text.WordWrap + MouseArea { + cursorShape: Qt.PointingHandCursor + anchors.fill: attribution2 + + hoverEnabled: true + + onClicked: { + Qt.openUrlExternally('https://sunrise-sunset.org/about') + } - onEntered: { - attribution3.font.underline = true - } + onEntered: { + attribution2.font.underline = true + } - onExited: { - attribution3.font.underline = false + onExited: { + attribution2.font.underline = false + } } } - } - Label { - id: attribution4 - anchors.bottom: parent.bottom - anchors.bottomMargin: 2 - font: Kirigami.Theme.smallFont - text: i18n("Weather icons created by Erik Flowers.") - MouseArea { - cursorShape: Qt.PointingHandCursor - anchors.fill: attribution4 + Label { + id: attribution3 + anchors.bottom: attribution4.top + font: Kirigami.Theme.smallFont + text: i18n("OWM weather forecast data provided by OpenWeather.") + Layout.fillHeight: true + Layout.fillWidth: true + wrapMode: Text.WordWrap + MouseArea { + cursorShape: Qt.PointingHandCursor + anchors.fill: attribution3 + + hoverEnabled: true + + onClicked: { + Qt.openUrlExternally('https://openweathermap.org/about-us') + } - hoverEnabled: true + onEntered: { + attribution3.font.underline = true + } - onClicked: { - Qt.openUrlExternally('https://erikflowers.github.io/weather-icons/') + onExited: { + attribution3.font.underline = false + } } + } + Label { + id: attribution4 + anchors.bottom: parent.bottom + anchors.bottomMargin: 2 + font: Kirigami.Theme.smallFont + text: i18n("Weather icons created by Erik Flowers.") + Layout.fillHeight: true + Layout.fillWidth: true + wrapMode: Text.WordWrap + MouseArea { + cursorShape: Qt.PointingHandCursor + anchors.fill: attribution4 + + hoverEnabled: true + + onClicked: { + Qt.openUrlExternally('https://erikflowers.github.io/weather-icons/') + } - onEntered: { - attribution4.font.underline = true - } + onEntered: { + attribution4.font.underline = true + } - onExited: { - attribution4.font.underline = false + onExited: { + attribution4.font.underline = false + } } } } diff --git a/package/contents/ui/config/ConfigUnits.qml b/package/contents/ui/config/ConfigUnits.qml index 5f13616..ccc82a0 100644 --- a/package/contents/ui/config/ConfigUnits.qml +++ b/package/contents/ui/config/ConfigUnits.qml @@ -2,6 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import org.kde.kcmutils as KCM +import org.kde.kirigami as Kirigami KCM.SimpleKCM { @@ -94,35 +95,24 @@ KCM.SimpleKCM { id: timezoneTypeGroup } - GridLayout { - columns: 2 + Kirigami.FormLayout { - Label { - text: i18n("Temperature") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } RadioButton { + Kirigami.FormData.label: i18n("Temperature") + ":" + id: temperatureTypeRadioCelsius ButtonGroup.group: temperatureTypeGroup text: i18n("°C") onCheckedChanged: if (checked) cfg_temperatureType = 0 } - Item { - width: 2 - height: 2 - Layout.rowSpan: 1 - } + RadioButton { id: temperatureTypeRadioFahrenheit ButtonGroup.group: temperatureTypeGroup text: i18n("°F") onCheckedChanged: if (checked) cfg_temperatureType = 1 } - Item { - width: 2 - height: 2 - Layout.rowSpan: 1 - } + RadioButton { id: temperatureTypeRadioKelvin ButtonGroup.group: temperatureTypeGroup @@ -131,32 +121,25 @@ KCM.SimpleKCM { } Item { - width: 2 - height: 10 - Layout.columnSpan: 2 + Kirigami.FormData.isSection: true } - Label { - text: i18n("Pressure") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } RadioButton { + Kirigami.FormData.label: i18n("Pressure") + ":" + id: pressureTypeRadioHpa ButtonGroup.group: pressureTypeGroup text: i18n("hPa") onCheckedChanged: if (checked) cfg_pressureType = 0 } - Item { - width: 2 - height: 2 - Layout.rowSpan: 2 - } + RadioButton { id: pressureTypeRadioInhg ButtonGroup.group: pressureTypeGroup text: i18n("inHg") onCheckedChanged: if (checked) cfg_pressureType = 1 } + RadioButton { id: pressureTypeRadioMmhg ButtonGroup.group: pressureTypeGroup @@ -165,32 +148,25 @@ KCM.SimpleKCM { } Item { - width: 2 - height: 10 - Layout.columnSpan: 2 + Kirigami.FormData.isSection: true } - Label { - text: i18n("Wind speed") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } RadioButton { + Kirigami.FormData.label: i18n("Wind speed") + ":" + id: windSpeedTypeRadioMps ButtonGroup.group: windSpeedTypeGroup text: i18n("m/s") onCheckedChanged: if (checked) cfg_windSpeedType = 0 } - Item { - width: 2 - height: 2 - Layout.rowSpan: 2 - } + RadioButton { id: windSpeedTypeRadioMph ButtonGroup.group: windSpeedTypeGroup text: i18n("mph") onCheckedChanged: if (checked) cfg_windSpeedType = 1 } + RadioButton { id: windSpeedTypeRadioKmh ButtonGroup.group: windSpeedTypeGroup @@ -199,37 +175,25 @@ KCM.SimpleKCM { } Item { - width: 2 - height: 10 - Layout.columnSpan: 2 + Kirigami.FormData.isSection: true } - Label { - text: i18n("Timezone") + ":" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } RadioButton { + Kirigami.FormData.label: i18n("Timezone") + ":" + id: timezoneTypeRadioUserLocalTime ButtonGroup.group: timezoneTypeGroup text: i18n("My local-time") onCheckedChanged: if (checked) cfg_timezoneType = 0 } - Item { - width: 2 - height: 2 - Layout.rowSpan: 1 - } + RadioButton { id: timezoneTypeRadioUtc ButtonGroup.group: timezoneTypeGroup text: i18n("UTC") onCheckedChanged: if (checked) cfg_timezoneType = 1 } - Item { - width: 2 - height: 2 - Layout.rowSpan: 1 - } + RadioButton { id: timezoneTypeRadioLocationLocal ButtonGroup.group: timezoneTypeGroup From 1322157c2d2a2ea722381e06c9a99eca69362888 Mon Sep 17 00:00:00 2001 From: Evgeniy Harchenko Date: Fri, 12 Apr 2024 14:18:05 +0300 Subject: [PATCH 4/8] Some fixes for configs UI. --- .../contents/ui/config/ConfigAppearance.qml | 2 - package/contents/ui/config/ConfigGeneral.qml | 198 +++++++++--------- 2 files changed, 102 insertions(+), 98 deletions(-) diff --git a/package/contents/ui/config/ConfigAppearance.qml b/package/contents/ui/config/ConfigAppearance.qml index e507bd9..b956c47 100644 --- a/package/contents/ui/config/ConfigAppearance.qml +++ b/package/contents/ui/config/ConfigAppearance.qml @@ -111,7 +111,6 @@ KCM.SimpleKCM { stepSize: 10 from: 10 to: 8000 - anchors.verticalCenter: parent.verticalCenter // suffix: i18nc("Abbreviation for seconds", "sec") } Label { @@ -169,7 +168,6 @@ KCM.SimpleKCM { SpinBox { id: widgetFontSize Layout.alignment: Qt.AlignVCenter - anchors.verticalCenter: parent.verticalCenter // decimals: 0 stepSize: 1 from: 4 diff --git a/package/contents/ui/config/ConfigGeneral.qml b/package/contents/ui/config/ConfigGeneral.qml index 86707ce..7b4063d 100644 --- a/package/contents/ui/config/ConfigGeneral.qml +++ b/package/contents/ui/config/ConfigGeneral.qml @@ -234,20 +234,21 @@ KCM.SimpleKCM { clip: true Layout.preferredHeight: 180 Layout.preferredWidth: parent.width - Layout.columnSpan: 2 - + ScrollBar.horizontal.interactive: true + ScrollBar.vertical.interactive: true TableView { anchors.fill: parent - property var columnWidths: [10, 40, 25, 22] + property var columnWidths: [15, 35, 25, 25] columnWidthProvider: function (column) { - let aw = placesTable.width - placesTable.effectiveScrollBarWidth + let minW = 500 + let aw = (placesTable.width > minW ? placesTable.width : minW) - placesTable.effectiveScrollBarWidth return parseInt(aw * columnWidths[column] / 100 ) } implicitHeight: 200 - implicitWidth: 600 + implicitWidth: 500 clip: true interactive: true rowSpacing: 1 @@ -267,6 +268,7 @@ KCM.SimpleKCM { DelegateChoice { column: 0 delegate: Rectangle { + implicitHeight: Kirigami.Units.gridUnit * 2 color: (row % 2) === 0 ? backgroundColor : alternateBackgroundColor Text { anchors.fill: parent @@ -314,83 +316,91 @@ KCM.SimpleKCM { DelegateChoice { column: 3 id: myChoice3 - delegate: GridLayout { - columnSpacing: 1 - Text { - id: myrowValue - visible: false - text: display - } - Button { - id:myButton1 - icon.name: 'go-up' - enabled: row === 0 ? false : true - MouseArea { - anchors.fill: parent - onClicked: { - if (row > 0) { - placesModel.moveRow(row, row - 1, 1) - placesModelChanged() + delegate: Rectangle { + color: (row % 2) === 0 ? backgroundColor : alternateBackgroundColor + GridLayout { + anchors.fill: parent + columnSpacing: 1 + Text { + id: myrowValue + visible: false + text: "display" + } + Button { + id:myButton1 + icon.name: 'go-up' + enabled: row === 0 ? false : true + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + MouseArea { + anchors.fill: parent + onClicked: { + if (row > 0) { + placesModel.moveRow(row, row - 1, 1) + placesModelChanged() + } } } } - } - Button { - id:myButton2 - icon.name: 'go-down' - enabled: row == (placesModel.rowCount - 1) ? false: true - MouseArea { - anchors.fill: parent - onClicked: { - if (row < placesModel.rowCount) { - placesModel.moveRow(row, row + 1, 1) - placesModelChanged() + Button { + id:myButton2 + icon.name: 'go-down' + enabled: row == (placesModel.rowCount - 1) ? false: true + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + MouseArea { + anchors.fill: parent + onClicked: { + if (row < placesModel.rowCount) { + placesModel.moveRow(row, row + 1, 1) + placesModelChanged() + } } } } - } - Button { - icon.name: 'list-remove' - MouseArea { - anchors.fill: parent - onClicked: { - placesModel.removeRow(row, 1) - placesModelChanged() + Button { + icon.name: 'list-remove' + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + MouseArea { + anchors.fill: parent + onClicked: { + placesModel.removeRow(row, 1) + placesModelChanged() + } } + enabled: (placesModel.rowCount > 1) } - enabled: (placesModel.rowCount > 1) - } - Button { - icon.name: 'entry-edit' - MouseArea { - anchors.fill: parent - onClicked: { - let entry = placesModel.getRow(row) - if (entry.providerId === "metno") { - let url = entry.placeIdentifier - newMetnoUrl.text = url - var data = url.match(RegExp("([+-]?[0-9]{1,5}[.]?[0-9]{0,5})","g")) - newMetnoCityLatitudeField.text = Number(data[0]).toLocaleString(Qt.locale(),"f",5) - newMetnoCityLongitudeField.text = Number(data[1]).toLocaleString(Qt.locale(),"f",5) - newMetnoCityAltitudeField.text = (data[2] === undefined) ? 0:data[2] - dbgprint("timezone ID=" + entry.timezoneID) - addMetnoCityIdDialog.timezoneID = entry.timezoneID - for (var i = 0; i < timezoneDataModel.count; i++) { - if (timezoneDataModel.get(i).id == Number(entry.timezoneID)) { - tzComboBox.currentIndex = i - break + Button { + icon.name: 'entry-edit' + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + MouseArea { + anchors.fill: parent + onClicked: { + let entry = placesModel.getRow(row) + if (entry.providerId === "metno") { + let url = entry.placeIdentifier + newMetnoUrl.text = url + var data = url.match(RegExp("([+-]?[0-9]{1,5}[.]?[0-9]{0,5})","g")) + newMetnoCityLatitudeField.text = Number(data[0]).toLocaleString(Qt.locale(),"f",5) + newMetnoCityLongitudeField.text = Number(data[1]).toLocaleString(Qt.locale(),"f",5) + newMetnoCityAltitudeField.text = (data[2] === undefined) ? 0:data[2] + dbgprint("timezone ID=" + entry.timezoneID) + addMetnoCityIdDialog.timezoneID = entry.timezoneID + for (var i = 0; i < timezoneDataModel.count; i++) { + if (timezoneDataModel.get(i).id == Number(entry.timezoneID)) { + tzComboBox.currentIndex = i + break + } } + newMetnoCityAlias.text = entry.placeAlias + addMetnoCityIdDialog.placeNumberID = row + addMetnoCityIdDialog.open() } - newMetnoCityAlias.text = entry.placeAlias - addMetnoCityIdDialog.placeNumberID = row - addMetnoCityIdDialog.open() - } - if (entry.providerId === "owm") { - newOwmCityIdField.text = "https://openweathermap.org/city/"+entry.placeIdentifier - newOwmCityAlias.text = entry.placeAlias - addOwmCityIdDialog.placeNumberID = row - addOwmCityIdDialog.open() + if (entry.providerId === "owm") { + newOwmCityIdField.text = "https://openweathermap.org/city/"+entry.placeIdentifier + newOwmCityAlias.text = entry.placeAlias + addOwmCityIdDialog.placeNumberID = row + addOwmCityIdDialog.open() + } } } } @@ -402,15 +412,17 @@ KCM.SimpleKCM { } - Kirigami.Separator { - Layout.margins: Kirigami.Units.largeSpacing - } + Kirigami.FormLayout { + + Item { + Kirigami.FormData.isSection: true + } - Row { Button { + Kirigami.FormData.label: i18n("Add Open Weather Map Place") + ":" icon.name: 'list-add' - text: 'OWM' - width: 100 + //text: 'OWM' + //Layout.minimumWidth: Kirigami.Units.gridUnit * 6 onClicked: { addOwmCityIdDialog.placeNumberID = -1 newOwmCityIdField.text = '' @@ -421,11 +433,11 @@ KCM.SimpleKCM { } Button { + Kirigami.FormData.label: i18n("Add Met.no Map Place") + ":" icon.name: 'list-add' - text: 'metno' - width: 100 + //text: 'metno' + //Layout.minimumWidth: Kirigami.Units.gridUnit * 6 onClicked: { - newMetnoCityAlias.text = '' newMetnoCityLatitudeField.text = '' newMetnoCityLongitudeField.text = '' @@ -436,9 +448,6 @@ KCM.SimpleKCM { addMetnoCityIdDialog.open() } } - } - - Kirigami.FormLayout { Kirigami.Separator { Kirigami.FormData.isSection: true @@ -451,8 +460,6 @@ KCM.SimpleKCM { spacing: Kirigami.Units.smallSpacing SpinBox { - anchors.verticalCenter: parent.verticalCenter - anchors.left:reloadLabel1.right id: reloadIntervalMin stepSize: 10 @@ -462,8 +469,6 @@ KCM.SimpleKCM { } Label { - anchors.verticalCenter: parent.verticalCenter - anchors.left:reloadIntervalMin.right text: i18nc("Abbreviation for minutes", "min") leftPadding: 6 } @@ -484,11 +489,15 @@ KCM.SimpleKCM { } } + Kirigami.Separator { + Layout.margins: Kirigami.Units.gridUnit + } + ColumnLayout { + spacing: 0 Label { id: attribution1 - anchors.bottom: attribution2.top font: Kirigami.Theme.smallFont text: i18n("Met.no weather forecast data provided by The Norwegian Meteorological Institute.") Layout.fillHeight: true @@ -513,9 +522,9 @@ KCM.SimpleKCM { } } } + Label { id: attribution2 - anchors.bottom: attribution3.top font: Kirigami.Theme.smallFont text: i18n("Sunrise/sunset data provided by Sunrise - Sunset.") Layout.fillHeight: true @@ -540,9 +549,9 @@ KCM.SimpleKCM { } } } + Label { id: attribution3 - anchors.bottom: attribution4.top font: Kirigami.Theme.smallFont text: i18n("OWM weather forecast data provided by OpenWeather.") Layout.fillHeight: true @@ -567,10 +576,9 @@ KCM.SimpleKCM { } } } + Label { id: attribution4 - anchors.bottom: parent.bottom - anchors.bottomMargin: 2 font: Kirigami.Theme.smallFont text: i18n("Weather icons created by Erik Flowers.") Layout.fillHeight: true @@ -599,7 +607,7 @@ KCM.SimpleKCM { } // changePlaceAliasDialog - Dialog { + /*Dialog { id: changePlaceAliasDialog title: i18n("Change Displayed As") @@ -618,7 +626,7 @@ KCM.SimpleKCM { placeholderText: i18n("Enter place alias") width: parent.width } - } + }*/ // addOwmCityIdDialog Dialog { @@ -1303,8 +1311,6 @@ KCM.SimpleKCM { } } - - Loader { id: saveSearchedData property int rowNumber From ae183f843a93c0cc89bba2827063bd36cdb4dbc6 Mon Sep 17 00:00:00 2001 From: Evgeniy Harchenko Date: Fri, 12 Apr 2024 15:16:11 +0300 Subject: [PATCH 5/8] Fixed table with places behavior in General config. --- package/contents/ui/config/ConfigGeneral.qml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/package/contents/ui/config/ConfigGeneral.qml b/package/contents/ui/config/ConfigGeneral.qml index 7b4063d..4cd9ae9 100644 --- a/package/contents/ui/config/ConfigGeneral.qml +++ b/package/contents/ui/config/ConfigGeneral.qml @@ -232,19 +232,17 @@ KCM.SimpleKCM { id: placesTable width: parent.width clip: true - Layout.preferredHeight: 180 + Layout.maximumHeight: 180 Layout.preferredWidth: parent.width - ScrollBar.horizontal.interactive: true - ScrollBar.vertical.interactive: true TableView { anchors.fill: parent property var columnWidths: [15, 35, 25, 25] columnWidthProvider: function (column) { let minW = 500 - let aw = (placesTable.width > minW ? placesTable.width : minW) - placesTable.effectiveScrollBarWidth - return parseInt(aw * columnWidths[column] / 100 ) - + let horizontalMargin = placesTable.effectiveScrollBarWidth !== 0 ? placesTable.effectiveScrollBarWidth : Kirigami.Units.smallSpacing + let aw = (placesTable.width > minW ? placesTable.width : minW) - horizontalMargin + return parseInt(aw * columnWidths[column] / 100) } implicitHeight: 200 From 786008e2b17cd6a2a7070a7c60ebaddb9672ad4a Mon Sep 17 00:00:00 2001 From: Evgeniy Harchenko Date: Fri, 12 Apr 2024 21:06:44 +0300 Subject: [PATCH 6/8] Changed z-index of BusyIndicator in CompactRepresentation. --- package/contents/ui/CompactRepresentation.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/package/contents/ui/CompactRepresentation.qml b/package/contents/ui/CompactRepresentation.qml index ca051ab..3bac940 100644 --- a/package/contents/ui/CompactRepresentation.qml +++ b/package/contents/ui/CompactRepresentation.qml @@ -80,6 +80,7 @@ Loader { anchors.fill: parent visible: false running: false + z: 1 states: [ State { From c931db9010d6ecb8508b5b602da0cddf04badfb5 Mon Sep 17 00:00:00 2001 From: Evgeniy Harchenko Date: Mon, 29 Apr 2024 14:23:01 +0300 Subject: [PATCH 7/8] Fixed issue with tooltip overlapping. --- package/contents/ui/CompactRepresentation.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/contents/ui/CompactRepresentation.qml b/package/contents/ui/CompactRepresentation.qml index 3bac940..72f2cb5 100644 --- a/package/contents/ui/CompactRepresentation.qml +++ b/package/contents/ui/CompactRepresentation.qml @@ -150,7 +150,7 @@ Loader { PlasmaCore.ToolTipArea { id: toolTipArea anchors.fill: parent - active: !plasmoid.expanded + active: !main.expanded interactive: true mainText: main.currentPlace.alias subText: main.toolTipSubText From 9208dffe8ed55fe8ecde2358c49fdd6e498b4365 Mon Sep 17 00:00:00 2001 From: Evgeniy Harchenko Date: Mon, 29 Apr 2024 14:26:56 +0300 Subject: [PATCH 8/8] Fixed lastReloadedNotifier visibility when plasmoid is expanded. --- package/contents/ui/CompactRepresentation.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/contents/ui/CompactRepresentation.qml b/package/contents/ui/CompactRepresentation.qml index 72f2cb5..61caf29 100644 --- a/package/contents/ui/CompactRepresentation.qml +++ b/package/contents/ui/CompactRepresentation.qml @@ -123,7 +123,7 @@ Loader { onEntered: { if (showLastReloadedTime) { - lastReloadedNotifier.visible = !plasmoid.expanded + lastReloadedNotifier.visible = !main.expanded } }