Skip to content

Commit

Permalink
Plasmoid updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkXero-dev committed Nov 18, 2024
1 parent c21a238 commit 1b51329
Show file tree
Hide file tree
Showing 53 changed files with 2,900 additions and 616 deletions.
Binary file added .install.sh.kate-swp
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"Id": "com.github.exequtic.apdatifier",
"Name": "Apdatifier",
"EnabledByDefault": true,
"Version": "2.8",
"Version": "2.8.1",
"License": "MIT",
"BugReportUrl": "https://github.com/exequtic/apdatifier/issues",
"Website": "https://github.com/exequtic/apdatifier"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,59 @@ let ELEV_UNITS = {
}

/** Map from Wunderground provided icon codes to opendesktop icon theme descs */
let iconThemeMap = {
let iconThemeMapPredefined = {
0: "weather-storm",
1: "weather-storm",
2: "weather-storm",
3: "weather-storm",
4: "weather-storm",
5: "weather-snow-rain",
6: "weather-snow-rain",
7: "weather-freezing-rain",
8: "weather-freezing-rain",
9: "weather-showers-scattered",
10: "weather-freezing-rain",
11: "weather-showers",
12: "weather-showers",
13: "weather-snow-scattered",
14: "weather-snow",
15: "weather-snow",
16: "weather-snow",
17: "weather-hail",
18: "weather-snow-scattered",
19: "weather-many-clouds-wind",
20: "weather-fog",
21: "weather-fog",
22: "weather-fog",
23: "weather-clouds-wind",
24: "weather-clouds-wind",
25: "weather-snow",
26: "weather-many-clouds",
27: "weather-many-clouds",
28: "weather-clouds",
29: "weather-clouds-night",
30: "weather-few-clouds",
31: "weather-clear-night",
32: "weather-clear",
33: "weather-few-clouds-night",
34: "weather-few-clouds-day",
35: "weather-freezing-storm-day",
36: "weather-clear",
37: "weather-storm-day",
38: "weather-storm-day",
39: "weather-showers-scattered-day",
40: "weather-showers",
41: "weather-snow-scattered-day",
42: "weather-snow",
43: "weather-snow",
44: "weather-none-available",
45: "weather-showers-scattered-night",
46: "weather-snow-storm-night",
47: "weather-storm-night"
}

/** Map from Wunderground provided icon codes to opendesktop icon theme descs */
let iconThemeMapSymbolic = {
0: "weather-storm-symbolic",
1: "weather-storm-symbolic",
2: "weather-storm-symbolic",
Expand Down Expand Up @@ -110,7 +162,6 @@ let iconThemeMap = {
47: "weather-storm-night-symbolic"
}


/**
* Turn a 1-360° angle into the corresponding part on the compass.
*
Expand Down Expand Up @@ -461,10 +512,6 @@ function getPressureTrendIcon(code) {
* @retruns {string} Filename
*/
function getWindBarbIcon(windSpeed) {
if (plasmoid.configuration.useSystemThemeIcons) {
return "gnumeric-object-arrow";
}

var speedKts, fileName;
if (unitsChoice === UNITS_SYSTEM.METRIC) {
speedKts = kmhToKts(windSpeed);
Expand Down Expand Up @@ -505,7 +552,11 @@ function getWindBarbIcon(windSpeed) {
*/
function getConditionIcon(code) {
if (plasmoid.configuration.useSystemThemeIcons) {
return iconThemeMap[code];
if (plasmoid.configuration.applyColorScheme) {
return iconThemeMapSymbolic[code];
} else {
return iconThemeMapPredefined[code];
}
} else {
return Qt.resolvedUrl("../icons/" + code + ".svg");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,34 @@
</entry>
</group>
<group name="Appearance">
<entry name="showCompactTemp" type="Bool">
<default>true</default>
</entry>
<entry name="autoFontAndSize" type="Bool">
<label>Use Plasma default font and automatically determine font size.</label>
<default>true</default>
</entry>
<entry name="fontFamily" type="string">
<label>Font family. e.g "arial". The system font is used if this is not set.</label>
<entry name="fontFamily" type="String">
<default></default>
</entry>
<entry name="boldText" type="Bool">
<label>Sets the font to bold.</label>
<default>false</default>
</entry>
<entry name="italicText" type="Bool">
<label>Sets the font to italic.</label>
<default>false</default>
</entry>
<entry name="underlineText" type="Bool">
<default>false</default>
</entry>
<entry name="strikeoutText" type="Bool">
<default>false</default>
</entry>
<entry name="fontWeight" type="Int">
<label>Sets font weight.</label>
<default>50</default>
</entry>
<entry name="fontStyleName" type="string">
<label>Sets font style </label>
<entry name="fontStyleName" type="String">
<default></default>
</entry>
<entry name="fontSize" type="Int">
<label>Sets font size.</label>
<default>10</default>
</entry>
<entry name="propHeadPointSize" type="Int">
Expand All @@ -63,6 +65,15 @@
<entry name="useSystemThemeIcons" type="Bool">
<default>false</default>
</entry>
<entry name="applyColorScheme" type="Bool">
<default>true</default>
</entry>
<entry name="detailsIconSize" type="Int">
<default>48</default>
</entry>
<entry name="topIconMargins" type="Int">
<default>0</default>
</entry>
<entry name="tempAutoColor" type="Bool">
<default>true</default>
</entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ ColumnLayout {
Kirigami.Icon {
source: "documentinfo-symbolic"

isMask: plasmoid.configuration.applyColorScheme ? true : false
color: Kirigami.Theme.textColor

Layout.alignment: Qt.AlignHCenter

PlasmaCore.ToolTipArea {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import "../code/utils.js" as Utils
Loader {
id: compactRoot

readonly property bool showTemperature: !inTray

sourceComponent: showTemperature ? iconAndTextComponent : iconComponent
sourceComponent: (!inTray && plasmoid.configuration.showCompactTemp) ? iconAndTextComponent : iconComponent

function printDebug(msg) {
if (plasmoid.configuration.logConsole) {
Expand Down Expand Up @@ -98,7 +96,8 @@ Loader {
Kirigami.Icon {
id: soleIcon

// readonly property int minIconSize: Math.max((compactRoot.vertical ? compactRoot.width : compactRoot.height), Kirigami.Units.iconSizes.small)
isMask: plasmoid.configuration.applyColorScheme ? true : false
color: Kirigami.Theme.textColor

source: Utils.getConditionIcon(iconCode)
active: compactMouseArea.containsMouse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ GridLayout {

source: Utils.getWindBarbIcon(weatherData["details"]["windSpeed"])

isMask: plasmoid.configuration.applyColorScheme ? true : false
color: Kirigami.Theme.textColor
isMask: true

// wind barb icons are 270 degrees deviated from 0 degrees (north)
// themed icons are 135 degrees deviated
Expand Down Expand Up @@ -133,6 +133,9 @@ GridLayout {

height: Kirigami.Units.iconSizes.small

isMask: plasmoid.configuration.applyColorScheme ? true : false
color: Kirigami.Theme.textColor

PlasmaCore.ToolTipArea {
anchors.fill: parent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import "../code/utils.js" as Utils
RowLayout {
id: forecastItemRoot

readonly property int preferredIconSize: Kirigami.Units.iconSizes.large
readonly property int preferredIconSize: plasmoid.configuration.detailsIconSize

Repeater {
id: forecastRepeater
Expand Down Expand Up @@ -65,7 +65,7 @@ RowLayout {

source: Utils.getConditionIcon(iconCode)

isMask: true
isMask: plasmoid.configuration.applyColorScheme ? true : false
color: Kirigami.Theme.textColor

PlasmaCore.ToolTipArea {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import QtQuick

import QtQuick.Layouts

import org.kde.plasma.core as PlasmaCore
import org.kde.kirigami as Kirigami
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components as PlasmaComponents

GridLayout {
Expand Down Expand Up @@ -74,7 +74,6 @@ GridLayout {
fontSizeMode: Text.VerticalFit
}
},

State {
name: "verticalPanel"
when: plasmoid.formFactor === PlasmaCore.Types.Vertical
Expand Down Expand Up @@ -123,7 +122,8 @@ GridLayout {
Kirigami.Icon {
id: icon

isMask: true
isMask: plasmoid.configuration.applyColorScheme ? true : false
color: Kirigami.Theme.textColor

readonly property int implicitMinimumIconSize: Math.max(iconSize, minimumIconSize)
// reset implicit size, so layout in free dimension does not stop at the default one
Expand Down Expand Up @@ -157,7 +157,7 @@ GridLayout {
// These magic values are taken from the digital clock, so that the
// text sizes here are identical with various clock text sizes
height: {
const textHeightScaleFactor = (parent.height > 26) ? 0.7 : 0.9;
const textHeightScaleFactor = (parent.height > 26) ? 0.7: 0.9;
return Math.min (parent.height * textHeightScaleFactor, 3 * Kirigami.Theme.defaultFont.pixelSize);
}
visible: false
Expand All @@ -174,6 +174,9 @@ GridLayout {
family: (plasmoid.configuration.autoFontAndSize || plasmoid.configuration.fontFamily.length === 0) ? Kirigami.Theme.defaultFont.family : plasmoid.configuration.fontFamily
weight: plasmoid.configuration.autoFontAndSize ? Kirigami.Theme.defaultFont.weight : plasmoid.configuration.fontWeight
italic: plasmoid.configuration.autoFontAndSize ? Kirigami.Theme.defaultFont.italic : plasmoid.configuration.italicText
bold: plasmoid.configuration.autoFontAndSize ? Kirigami.Theme.defaultFont.bold : plasmoid.configuration.boldText
underline: plasmoid.configuration.autoFontAndSize ? Kirigami.Theme.defaultFont.underline : plasmoid.configuration.underlineText
strikeout: plasmoid.configuration.autoFontAndSize ? Kirigami.Theme.defaultFont.strikeout : plasmoid.configuration.strikeoutText
pixelSize: plasmoid.configuration.autoFontAndSize ? 3 * Kirigami.Theme.defaultFont.pixelSize : pointToPixel(plasmoid.configuration.fontSize)
}
minimumPixelSize: Math.round(Kirigami.Units.gridUnit / 2)
Expand All @@ -192,16 +195,4 @@ GridLayout {
}
}
}

Component.onCompleted: {
console.log("icon painted width: " + icon.paintedWidth);
console.log("icon width: " + icon.Layout.minimumWidth);
console.log("text painted width: " + text.paintedWidth);
console.log("text width: " + text.Layout.minimumWidth);
console.log("label painted width: " + label.paintedWidth);
console.log("label width: " + label.width);
console.log("iconAndTextRoot painted width: " + iconAndTextRoot.paintedWidth);
console.log("iconAndTextRoot width: " + iconAndTextRoot.width);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,20 @@ import "../code/utils.js" as Utils
RowLayout {
id: topPanelRoot

readonly property int preferredIconSize: plasmoid.configuration.detailsIconSize

Kirigami.Icon {
id: topPanelIcon

source: Utils.getConditionIcon(iconCode)

isMask: true
isMask: plasmoid.configuration.applyColorScheme ? true : false
color: Kirigami.Theme.textColor

Layout.minimumWidth: Kirigami.Units.iconSizes.large
Layout.minimumHeight: Kirigami.Units.iconSizes.large
Layout.margins: plasmoid.configuration.topIconMargins

Layout.minimumWidth: preferredIconSize
Layout.minimumHeight: preferredIconSize
Layout.preferredWidth: Layout.minimumWidth
Layout.preferredHeight: Layout.minimumHeight
}
Expand Down
Loading

0 comments on commit 1b51329

Please sign in to comment.