Skip to content

Commit

Permalink
Fix use of deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi committed Jun 8, 2024
1 parent 5c47940 commit 799ef26
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/smhi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn refresh(latitude: f32, longitude: f32, window: slint::Weak<ui::MainWindow
fn collect_forecasts(series: &[TimeSeries]) -> Vec<ui::Forecast> {
series
.iter()
.group_by(|s| s.valid_time.with_timezone(&Local).date_naive())
.chunk_by(|s| s.valid_time.with_timezone(&Local).date_naive())
.into_iter()
.map(|(date, s)| {
let params = s
Expand Down
13 changes: 6 additions & 7 deletions ui/components.slint
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

import { ListView, ProgressIndicator, StyleMetrics } from "std-widgets.slint";
import { ListView, Palette, ProgressIndicator } from "std-widgets.slint";
import { Icon, MaterialIcons } from "icons.slint";
import { DayTime, Forecast } from "globals.slint";
import { Symbols } from "symbols.slint";

export component SlintLogo inherits Image {
opacity: 0.5;
source: StyleMetrics.dark-color-scheme ? @image-url("../images/slint/MadeWithSlint-logo-light.png")
: @image-url("../images/slint/MadeWithSlint-logo-dark.png");
source: Palette.color-scheme == ColorScheme.dark ? @image-url("../images/slint/MadeWithSlint-logo-light.png")
: @image-url("../images/slint/MadeWithSlint-logo-dark.png");
}

export component SmhiLogo inherits Image {
opacity: 0.5;
source: StyleMetrics.dark-color-scheme ? @image-url("../images/smhi/smhi-logo-dark.png")
: @image-url("../images/smhi/smhi-logo-light.png");
source: Palette.color-scheme == ColorScheme.dark ? @image-url("../images/smhi/smhi-logo-dark.png")
: @image-url("../images/smhi/smhi-logo-light.png");
}

export component ToolBar {
Expand All @@ -23,7 +22,7 @@ export component ToolBar {
callback refresh <=> refresh-button.clicked;

Rectangle {
background: StyleMetrics.window-background.mix(StyleMetrics.default-text-color, 0.95);
background: Palette.background.mix(Palette.foreground, 0.95);
HorizontalLayout {
padding: 8px;
alignment: space-between;
Expand Down
4 changes: 2 additions & 2 deletions ui/icons.slint
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StyleMetrics } from "std-widgets.slint";
import { Palette } from "std-widgets.slint";
import "../fonts/MaterialIcons-Regular.ttf";

export struct IconData {
Expand All @@ -15,7 +15,7 @@ export global IconTheme {
export component Icon {
in property<IconData> icon;
in property<length> size: IconTheme.size;
in property<color> color: StyleMetrics.default-text-color;
in property<color> color: Palette.foreground;

Text {
text: root.icon.code-point;
Expand Down

0 comments on commit 799ef26

Please sign in to comment.