1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: MIT
3
4import { Theme, ScreenSize } from "theme.slint";
5import { SmallMain } from "small_main.slint";
6import { BigMain } from "big_main.slint";
7import { MidMain } from "mid_main.slint";
8import { MidMain } from "mid_main.slint";
9import { MobileMain } from "mobile_main.slint";
10import { BarTileModel } from "widgets/widgets.slint";
11import { Images } from "images.slint";
12import { Theme } from "theme.slint";
13import { HeaderAdapter } from "blocks/blocks.slint";
14import { Navigation, MenuButton, Menu, Value } from "widgets/widgets.slint";
15import { BalanceAdapter, OverviewAdapter, UsageAdapter, WeatherAdapter, MenuPageAdapter, MenuOverviewAdapter, SettingsAdapter } from "pages/pages.slint";
16import { KioskOverlay } from "blocks/kiosk_overlay.slint";
17
18export { OverviewAdapter, UsageAdapter, Value, WeatherAdapter, MenuPageAdapter, MenuOverviewAdapter, SettingsAdapter,
19 BarTileModel, Images, HeaderAdapter }
20
21export component MainWindow inherits Window {
22 private property <length> big-break-point: 1366px;
23 private property <length> mid-break-point: 799px;
24 private property <length> mobile-break-point: 444px;
25 private property <ScreenSize> screen-size: root.get-screen-size();
26
27 title: "EnergyMNG Demo";
28 min-width: 320px;
29 min-height: 240px;
30 background: Theme.palette.pure-black;
31 preferred-width: 800px;
32 preferred-height: 480px;
33
34 /* The design is not finished yet
35 if root.screen-size == ScreenSize.Desktop : BigMain {
36 preferred-width: 100%;
37 preferred-height: 100%;
38 }
39 */
40
41 if root.screen-size == ScreenSize.Mobile : MobileMain {
42 preferred-width: 100%;
43 preferred-height: 100%;
44 }
45
46 if root.screen-size == ScreenSize.EmbeddedMedium : MidMain {
47 preferred-width: 100%;
48 preferred-height: 100%;
49 }
50
51 if root.screen-size == ScreenSize.EmbeddedSmall : SmallMain {
52 preferred-width: 100%;
53 preferred-height: 100%;
54 }
55
56 if SettingsAdapter.kiosk-mode-checked : KioskOverlay {}
57
58 pure function get-screen-size() -> ScreenSize {
59 if (root.width <= root.mobile-break-point && root.width < root.height) {
60 return ScreenSize.Mobile;
61 }
62
63 if (root.width < root.mid-break-point) {
64 return ScreenSize.EmbeddedSmall;
65 }
66
67 return ScreenSize.EmbeddedMedium;
68 }
69}