summaryrefslogtreecommitdiff
path: root/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/Settings/TimeWeatherTab.qml
blob: 61f4d43cb0d056a51abfed5c0e39b0a422b56c07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
import QtQuick
import QtQuick.Effects
import QtQuick.Layouts
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets

Item {
    id: root

    readonly property string _systemDefaultLabel: I18n.tr("System Default")

    function weekStartQt() {
        if (SettingsData.firstDayOfWeek < 0 || SettingsData.firstDayOfWeek >= 7)
            return Qt.locale().firstDayOfWeek;
        return SettingsData.firstDayOfWeek;
    }

    function weekStartJs() {
        return weekStartQt() % 7;
    }

    function _dayNames() {
        return Array(7).fill(0).map((_, i) => new Date(Date.UTC(2026, 2, 1 + i, 0, 0, 0)).toLocaleDateString(I18n.locale(), "dddd")).map(d => d[0].toUpperCase() + d.slice(1));
    }

    DankFlickable {
        anchors.fill: parent
        clip: true
        contentHeight: mainColumn.height + Theme.spacingXL
        contentWidth: width

        Column {
            id: mainColumn
            topPadding: 4

            width: Math.min(550, parent.width - Theme.spacingL * 2)
            anchors.horizontalCenter: parent.horizontalCenter
            spacing: Theme.spacingXL

            SettingsCard {
                tab: "time"
                tags: ["time", "clock", "format", "24hour"]
                title: I18n.tr("Time Format")
                settingKey: "timeFormat"
                iconName: "schedule"

                SettingsToggleRow {
                    tab: "time"
                    tags: ["time", "24hour", "format"]
                    settingKey: "use24HourClock"
                    text: I18n.tr("24-Hour Format")
                    description: I18n.tr("Use 24-hour time format instead of 12-hour AM/PM")
                    checked: SettingsData.use24HourClock
                    onToggled: checked => SettingsData.set("use24HourClock", checked)
                }

                SettingsToggleRow {
                    tab: "time"
                    tags: ["time", "seconds", "clock"]
                    settingKey: "showSeconds"
                    text: I18n.tr("Show Seconds")
                    description: I18n.tr("Display seconds in the clock")
                    checked: SettingsData.showSeconds
                    onToggled: checked => SettingsData.set("showSeconds", checked)
                }

                SettingsToggleRow {
                    tab: "time"
                    tags: ["time", "12hour", "format", "padding", "leading", "zero"]
                    settingKey: "padHours12Hour"
                    text: I18n.tr("Pad Hours")
                    description: "02:31 PM vs 2:31 PM"
                    checked: SettingsData.padHours12Hour
                    onToggled: checked => SettingsData.set("padHours12Hour", checked)
                    visible: !SettingsData.use24HourClock
                }
            }

            SettingsCard {
                tab: "time"
                tags: ["date", "format", "calendar"]
                title: I18n.tr("Date Format")
                settingKey: "dateFormat"
                iconName: "calendar_today"

                SettingsToggleRow {
                    tab: "time"
                    tags: ["show", "week"]
                    settingKey: "showWeekNumber"
                    text: I18n.tr("Show Week Number")
                    description: I18n.tr("Show week number in the calendar")
                    checked: SettingsData.showWeekNumber
                    onToggled: checked => SettingsData.set("showWeekNumber", checked)
                }

                SettingsDropdownRow {
                    tab: "time"
                    tags: ["first", "day", "week"]
                    settingKey: "firstDayOfWeek"
                    text: I18n.tr("First Day of Week")
                    options: [root._systemDefaultLabel].concat(root._dayNames())
                    currentValue: {
                        if (SettingsData.firstDayOfWeek < 0 || SettingsData.firstDayOfWeek >= 7)
                            return root._systemDefaultLabel;
                        return root._dayNames()[root.weekStartJs()];
                    }
                    onValueChanged: value => {
                        if (value === root._systemDefaultLabel) {
                            SettingsData.set("firstDayOfWeek", -1);
                            return;
                        }
                        SettingsData.set("firstDayOfWeek", root._dayNames().indexOf(value));
                    }
                }

                Rectangle {
                    width: parent.width
                    height: 1
                    color: Theme.outline
                    opacity: 0.15
                }

                SettingsDropdownRow {
                    tab: "time"
                    tags: ["date", "format", "topbar"]
                    settingKey: "clockDateFormat"
                    text: I18n.tr("Top Bar Format")
                    description: "Preview: " + (SettingsData.clockDateFormat ? new Date().toLocaleDateString(I18n.locale(), SettingsData.clockDateFormat) : new Date().toLocaleDateString(I18n.locale(), "ddd d"))
                    options: [I18n.tr("System Default", "date format option"), I18n.tr("Day Date", "date format option"), I18n.tr("Day Month Date", "date format option"), I18n.tr("Month Date", "date format option"), I18n.tr("Numeric (M/D)", "date format option"), I18n.tr("Numeric (D/M)", "date format option"), I18n.tr("Full with Year", "date format option"), I18n.tr("ISO Date", "date format option"), I18n.tr("Full Day & Month", "date format option"), I18n.tr("Custom...", "date format option")]
                    currentValue: {
                        if (!SettingsData.clockDateFormat || SettingsData.clockDateFormat.length === 0)
                            return I18n.tr("System Default", "date format option");
                        const presets = [
                            {
                                "format": "ddd d",
                                "label": I18n.tr("Day Date", "date format option")
                            },
                            {
                                "format": "ddd MMM d",
                                "label": I18n.tr("Day Month Date", "date format option")
                            },
                            {
                                "format": "MMM d",
                                "label": I18n.tr("Month Date", "date format option")
                            },
                            {
                                "format": "M/d",
                                "label": I18n.tr("Numeric (M/D)", "date format option")
                            },
                            {
                                "format": "d/M",
                                "label": I18n.tr("Numeric (D/M)", "date format option")
                            },
                            {
                                "format": "ddd d MMM yyyy",
                                "label": I18n.tr("Full with Year", "date format option")
                            },
                            {
                                "format": "yyyy-MM-dd",
                                "label": I18n.tr("ISO Date", "date format option")
                            },
                            {
                                "format": "dddd, MMMM d",
                                "label": I18n.tr("Full Day & Month", "date format option")
                            }
                        ];
                        const match = presets.find(p => p.format === SettingsData.clockDateFormat);
                        return match ? match.label : I18n.tr("Custom: ") + SettingsData.clockDateFormat;
                    }
                    onValueChanged: value => {
                        const formatMap = {};
                        formatMap[I18n.tr("System Default", "date format option")] = "";
                        formatMap[I18n.tr("Day Date", "date format option")] = "ddd d";
                        formatMap[I18n.tr("Day Month Date", "date format option")] = "ddd MMM d";
                        formatMap[I18n.tr("Month Date", "date format option")] = "MMM d";
                        formatMap[I18n.tr("Numeric (M/D)", "date format option")] = "M/d";
                        formatMap[I18n.tr("Numeric (D/M)", "date format option")] = "d/M";
                        formatMap[I18n.tr("Full with Year", "date format option")] = "ddd d MMM yyyy";
                        formatMap[I18n.tr("ISO Date", "date format option")] = "yyyy-MM-dd";
                        formatMap[I18n.tr("Full Day & Month", "date format option")] = "dddd, MMMM d";
                        if (value === I18n.tr("Custom...", "date format option")) {
                            customFormatInput.visible = true;
                        } else {
                            customFormatInput.visible = false;
                            SettingsData.set("clockDateFormat", formatMap[value]);
                        }
                    }
                }

                DankTextField {
                    id: customFormatInput
                    width: parent.width - Theme.spacingM * 2
                    x: Theme.spacingM
                    visible: false
                    placeholderText: I18n.tr("Enter custom top bar format (e.g., ddd MMM d)")
                    text: SettingsData.clockDateFormat
                    onTextChanged: {
                        if (visible && text)
                            SettingsData.set("clockDateFormat", text);
                    }
                }

                Rectangle {
                    width: parent.width
                    height: 1
                    color: Theme.outline
                    opacity: 0.15
                }

                SettingsDropdownRow {
                    tab: "time"
                    tags: ["date", "format", "lock", "screen"]
                    settingKey: "lockDateFormat"
                    text: I18n.tr("Lock Screen Format")
                    description: "Preview: " + (SettingsData.lockDateFormat ? new Date().toLocaleDateString(I18n.locale(), SettingsData.lockDateFormat) : new Date().toLocaleDateString(I18n.locale(), Locale.LongFormat))
                    options: [I18n.tr("System Default", "date format option"), I18n.tr("Day Date", "date format option"), I18n.tr("Day Month Date", "date format option"), I18n.tr("Month Date", "date format option"), I18n.tr("Numeric (M/D)", "date format option"), I18n.tr("Numeric (D/M)", "date format option"), I18n.tr("Full with Year", "date format option"), I18n.tr("ISO Date", "date format option"), I18n.tr("Full Day & Month", "date format option"), I18n.tr("Custom...", "date format option")]
                    currentValue: {
                        if (!SettingsData.lockDateFormat || SettingsData.lockDateFormat.length === 0)
                            return I18n.tr("System Default", "date format option");
                        const presets = [
                            {
                                "format": "ddd d",
                                "label": I18n.tr("Day Date", "date format option")
                            },
                            {
                                "format": "ddd MMM d",
                                "label": I18n.tr("Day Month Date", "date format option")
                            },
                            {
                                "format": "MMM d",
                                "label": I18n.tr("Month Date", "date format option")
                            },
                            {
                                "format": "M/d",
                                "label": I18n.tr("Numeric (M/D)", "date format option")
                            },
                            {
                                "format": "d/M",
                                "label": I18n.tr("Numeric (D/M)", "date format option")
                            },
                            {
                                "format": "ddd d MMM yyyy",
                                "label": I18n.tr("Full with Year", "date format option")
                            },
                            {
                                "format": "yyyy-MM-dd",
                                "label": I18n.tr("ISO Date", "date format option")
                            },
                            {
                                "format": "dddd, MMMM d",
                                "label": I18n.tr("Full Day & Month", "date format option")
                            }
                        ];
                        const match = presets.find(p => p.format === SettingsData.lockDateFormat);
                        return match ? match.label : I18n.tr("Custom: ") + SettingsData.lockDateFormat;
                    }
                    onValueChanged: value => {
                        const formatMap = {};
                        formatMap[I18n.tr("System Default", "date format option")] = "";
                        formatMap[I18n.tr("Day Date", "date format option")] = "ddd d";
                        formatMap[I18n.tr("Day Month Date", "date format option")] = "ddd MMM d";
                        formatMap[I18n.tr("Month Date", "date format option")] = "MMM d";
                        formatMap[I18n.tr("Numeric (M/D)", "date format option")] = "M/d";
                        formatMap[I18n.tr("Numeric (D/M)", "date format option")] = "d/M";
                        formatMap[I18n.tr("Full with Year", "date format option")] = "ddd d MMM yyyy";
                        formatMap[I18n.tr("ISO Date", "date format option")] = "yyyy-MM-dd";
                        formatMap[I18n.tr("Full Day & Month", "date format option")] = "dddd, MMMM d";
                        if (value === I18n.tr("Custom...", "date format option")) {
                            customLockFormatInput.visible = true;
                        } else {
                            customLockFormatInput.visible = false;
                            SettingsData.set("lockDateFormat", formatMap[value]);
                        }
                    }
                }

                DankTextField {
                    id: customLockFormatInput
                    width: parent.width - Theme.spacingM * 2
                    x: Theme.spacingM
                    visible: false
                    placeholderText: I18n.tr("Enter custom lock screen format (e.g., dddd, MMMM d)")
                    text: SettingsData.lockDateFormat
                    onTextChanged: {
                        if (visible && text)
                            SettingsData.set("lockDateFormat", text);
                    }
                }

                Rectangle {
                    width: parent.width
                    height: 1
                    color: Theme.outline
                    opacity: 0.15
                }

                Rectangle {
                    width: parent.width - Theme.spacingM * 2
                    x: Theme.spacingM
                    height: formatHelp.implicitHeight + Theme.spacingM * 2
                    radius: Theme.cornerRadius
                    color: Theme.surfaceContainerHigh

                    Column {
                        id: formatHelp
                        anchors.fill: parent
                        anchors.margins: Theme.spacingM
                        spacing: Theme.spacingXS

                        StyledText {
                            text: I18n.tr("Format Legend")
                            font.pixelSize: Theme.fontSizeSmall
                            color: Theme.primary
                            font.weight: Font.Medium
                        }

                        Row {
                            width: parent.width
                            spacing: Theme.spacingL

                            Column {
                                width: (parent.width - Theme.spacingL) / 2
                                spacing: 2

                                StyledText {
                                    text: I18n.tr("• d - Day (1-31)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                                StyledText {
                                    text: I18n.tr("• dd - Day (01-31)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                                StyledText {
                                    text: I18n.tr("• ddd - Day name (Mon)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                                StyledText {
                                    text: I18n.tr("• dddd - Day name (Monday)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                                StyledText {
                                    text: I18n.tr("• M - Month (1-12)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                            }

                            Column {
                                width: (parent.width - Theme.spacingL) / 2
                                spacing: 2

                                StyledText {
                                    text: I18n.tr("• MM - Month (01-12)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                                StyledText {
                                    text: I18n.tr("• MMM - Month (Jan)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                                StyledText {
                                    text: I18n.tr("• MMMM - Month (January)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                                StyledText {
                                    text: I18n.tr("• yy - Year (24)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                                StyledText {
                                    text: I18n.tr("• yyyy - Year (2024)")
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Theme.surfaceVariantText
                                }
                            }
                        }
                    }
                }
            }

            SettingsCard {
                tab: "time"
                tags: ["weather", "enable", "forecast"]
                title: I18n.tr("Weather")
                settingKey: "weather"
                iconName: "cloud"

                SettingsToggleRow {
                    tab: "time"
                    tags: ["weather", "enable"]
                    settingKey: "weatherEnabled"
                    text: I18n.tr("Enable Weather")
                    description: I18n.tr("Show weather information in top bar and control center")
                    checked: SettingsData.weatherEnabled
                    onToggled: checked => SettingsData.set("weatherEnabled", checked)
                }

                Column {
                    width: parent.width
                    spacing: 0
                    visible: SettingsData.weatherEnabled

                    Rectangle {
                        width: parent.width
                        height: 1
                        color: Theme.outline
                        opacity: 0.15
                    }

                    SettingsToggleRow {
                        tab: "time"
                        tags: ["weather", "imperial", "fahrenheit", "units"]
                        settingKey: "useFahrenheit"
                        text: I18n.tr("Use Imperial Units")
                        description: I18n.tr("Use Imperial units (°F, mph, inHg) instead of Metric (°C, km/h, hPa)")
                        checked: SettingsData.useFahrenheit
                        onToggled: checked => SettingsData.set("useFahrenheit", checked)
                    }

                    Rectangle {
                        width: parent.width
                        height: 1
                        color: Theme.outline
                        opacity: 0.15
                        visible: !SettingsData.useFahrenheit
                    }

                    SettingsToggleRow {
                        tab: "time"
                        tags: ["weather", "wind", "speed", "units", "metric"]
                        settingKey: "windSpeedUnit"
                        text: I18n.tr("Wind Speed in m/s")
                        description: I18n.tr("Use meters per second instead of km/h for wind speed")
                        checked: SettingsData.windSpeedUnit === "ms"
                        onToggled: checked => SettingsData.set("windSpeedUnit", checked ? "ms" : "kmh")
                        visible: !SettingsData.useFahrenheit
                    }

                    Rectangle {
                        width: parent.width
                        height: 1
                        color: Theme.outline
                        opacity: 0.15
                    }

                    SettingsToggleRow {
                        tab: "time"
                        tags: ["weather", "location", "auto", "gps"]
                        settingKey: "useAutoLocation"
                        text: I18n.tr("Auto Location")
                        description: I18n.tr("Automatically determine your location using your IP address")
                        checked: SettingsData.useAutoLocation
                        onToggled: checked => SettingsData.set("useAutoLocation", checked)
                    }

                    Column {
                        width: parent.width
                        spacing: Theme.spacingM
                        visible: !SettingsData.useAutoLocation

                        Rectangle {
                            width: parent.width
                            height: 1
                            color: Theme.outline
                            opacity: 0.15
                        }

                        Item {
                            width: parent.width
                            height: locationContent.height

                            Column {
                                id: locationContent
                                width: parent.width - Theme.spacingM * 2
                                x: Theme.spacingM
                                spacing: Theme.spacingM

                                StyledText {
                                    text: I18n.tr("Custom Location")
                                    font.pixelSize: Theme.fontSizeMedium
                                    color: Theme.surfaceText
                                    font.weight: Font.Medium
                                }

                                Row {
                                    width: parent.width
                                    spacing: Theme.spacingM

                                    Column {
                                        width: (parent.width - Theme.spacingM) / 2
                                        spacing: Theme.spacingXS

                                        StyledText {
                                            text: I18n.tr("Latitude")
                                            font.pixelSize: Theme.fontSizeSmall
                                            color: Theme.surfaceVariantText
                                        }

                                        DankTextField {
                                            id: latitudeInput
                                            width: parent.width
                                            height: 48
                                            placeholderText: "40.7128"
                                            backgroundColor: Theme.surfaceVariant
                                            normalBorderColor: Theme.primarySelected
                                            focusedBorderColor: Theme.primary
                                            keyNavigationTab: longitudeInput

                                            Component.onCompleted: {
                                                if (SettingsData.weatherCoordinates) {
                                                    const coords = SettingsData.weatherCoordinates.split(',');
                                                    if (coords.length > 0)
                                                        text = coords[0].trim();
                                                }
                                            }

                                            Connections {
                                                target: SettingsData
                                                function onWeatherCoordinatesChanged() {
                                                    if (SettingsData.weatherCoordinates) {
                                                        const coords = SettingsData.weatherCoordinates.split(',');
                                                        if (coords.length > 0)
                                                            latitudeInput.text = coords[0].trim();
                                                    }
                                                }
                                            }

                                            onTextEdited: {
                                                if (text && longitudeInput.text) {
                                                    const coords = text + "," + longitudeInput.text;
                                                    SessionData.weatherCoordinates = coords;
                                                    SessionData.saveSettings();
                                                }
                                            }
                                        }
                                    }

                                    Column {
                                        width: (parent.width - Theme.spacingM) / 2
                                        spacing: Theme.spacingXS

                                        StyledText {
                                            text: I18n.tr("Longitude")
                                            font.pixelSize: Theme.fontSizeSmall
                                            color: Theme.surfaceVariantText
                                        }

                                        DankTextField {
                                            id: longitudeInput
                                            width: parent.width
                                            height: 48
                                            placeholderText: "-74.0060"
                                            backgroundColor: Theme.surfaceVariant
                                            normalBorderColor: Theme.primarySelected
                                            focusedBorderColor: Theme.primary
                                            keyNavigationTab: locationSearchInput
                                            keyNavigationBacktab: latitudeInput

                                            Component.onCompleted: {
                                                if (SettingsData.weatherCoordinates) {
                                                    const coords = SettingsData.weatherCoordinates.split(',');
                                                    if (coords.length > 1)
                                                        text = coords[1].trim();
                                                }
                                            }

                                            Connections {
                                                target: SettingsData
                                                function onWeatherCoordinatesChanged() {
                                                    if (SettingsData.weatherCoordinates) {
                                                        const coords = SettingsData.weatherCoordinates.split(',');
                                                        if (coords.length > 1)
                                                            longitudeInput.text = coords[1].trim();
                                                    }
                                                }
                                            }

                                            onTextEdited: {
                                                if (text && latitudeInput.text) {
                                                    const coords = latitudeInput.text + "," + text;
                                                    SessionData.weatherCoordinates = coords;
                                                    SessionData.saveSettings();
                                                }
                                            }
                                        }
                                    }
                                }

                                Column {
                                    width: parent.width
                                    spacing: Theme.spacingXS

                                    StyledText {
                                        text: I18n.tr("Location Search")
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Theme.surfaceVariantText
                                        font.weight: Font.Medium
                                    }

                                    DankLocationSearch {
                                        id: locationSearchInput
                                        width: parent.width
                                        currentLocation: ""
                                        placeholderText: I18n.tr("New York, NY")
                                        keyNavigationBacktab: longitudeInput
                                        onLocationSelected: (displayName, coordinates) => {
                                            SettingsData.setWeatherLocation(displayName, coordinates);
                                            const coords = coordinates.split(',');
                                            if (coords.length >= 2) {
                                                latitudeInput.text = coords[0].trim();
                                                longitudeInput.text = coords[1].trim();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            SettingsCard {
                tab: "time"
                tags: ["weather", "current", "display"]
                title: I18n.tr("Current Weather")
                settingKey: "weather"
                iconName: "visibility"
                visible: SettingsData.weatherEnabled

                Column {
                    width: parent.width
                    spacing: Theme.spacingL
                    visible: !WeatherService.weather.available

                    DankIcon {
                        name: "cloud_off"
                        size: Theme.iconSize * 2
                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
                        anchors.horizontalCenter: parent.horizontalCenter
                    }

                    StyledText {
                        text: I18n.tr("No Weather Data Available")
                        font.pixelSize: Theme.fontSizeLarge
                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                        anchors.horizontalCenter: parent.horizontalCenter
                    }
                }

                Column {
                    width: parent.width
                    spacing: Theme.spacingM
                    visible: WeatherService.weather.available

                    Item {
                        width: parent.width
                        height: 70

                        DankIcon {
                            id: refreshButton
                            name: "refresh"
                            size: Theme.iconSize - 4
                            color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.4)
                            anchors.right: parent.right
                            anchors.top: parent.top

                            property bool isRefreshing: false
                            enabled: !isRefreshing

                            MouseArea {
                                anchors.fill: parent
                                hoverEnabled: true
                                cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ForbiddenCursor
                                onClicked: {
                                    refreshButton.isRefreshing = true;
                                    WeatherService.forceRefresh();
                                    refreshTimer.restart();
                                }
                                enabled: parent.enabled
                            }

                            Timer {
                                id: refreshTimer
                                interval: 2000
                                onTriggered: refreshButton.isRefreshing = false
                            }

                            NumberAnimation on rotation {
                                running: refreshButton.isRefreshing
                                from: 0
                                to: 360
                                duration: 1000
                                loops: Animation.Infinite
                            }
                        }

                        Item {
                            anchors.horizontalCenter: parent.horizontalCenter
                            anchors.verticalCenter: parent.verticalCenter
                            width: weatherIcon.width + tempColumn.width + sunriseColumn.width + Theme.spacingM * 2
                            height: 70

                            DankIcon {
                                id: weatherIcon
                                name: WeatherService.getWeatherIcon(WeatherService.weather.wCode)
                                size: Theme.iconSize * 1.5
                                color: Theme.primary
                                anchors.left: parent.left
                                anchors.verticalCenter: parent.verticalCenter

                                layer.enabled: Theme.elevationEnabled
                                layer.effect: MultiEffect {
                                    shadowEnabled: Theme.elevationEnabled
                                    shadowHorizontalOffset: Theme.elevationOffsetX(Theme.elevationLevel1)
                                    shadowVerticalOffset: Theme.elevationOffsetY(Theme.elevationLevel1, 1)
                                    shadowBlur: Theme.elevationEnabled ? Math.max(0, Math.min(1, (Theme.elevationLevel1 && Theme.elevationLevel1.blurPx !== undefined ? Theme.elevationLevel1.blurPx : 4) / Theme.elevationBlurMax)) : 0
                                    blurMax: Theme.elevationBlurMax
                                    shadowColor: Theme.elevationShadowColor(Theme.elevationLevel1)
                                    shadowOpacity: Theme.elevationLevel1 && Theme.elevationLevel1.alpha !== undefined ? Theme.elevationLevel1.alpha : 0.2
                                }
                            }

                            Column {
                                id: tempColumn
                                spacing: Theme.spacingXS
                                anchors.left: weatherIcon.right
                                anchors.leftMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter

                                Item {
                                    width: tempText.width + unitText.width + Theme.spacingXS
                                    height: tempText.height

                                    StyledText {
                                        id: tempText
                                        text: (SettingsData.useFahrenheit ? WeatherService.weather.tempF : WeatherService.weather.temp) + "°"
                                        font.pixelSize: Theme.fontSizeLarge + 4
                                        color: Theme.surfaceText
                                        font.weight: Font.Light
                                        anchors.left: parent.left
                                        anchors.verticalCenter: parent.verticalCenter
                                    }

                                    StyledText {
                                        id: unitText
                                        text: SettingsData.useFahrenheit ? "F" : "C"
                                        font.pixelSize: Theme.fontSizeMedium
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                                        anchors.left: tempText.right
                                        anchors.leftMargin: Theme.spacingXS
                                        anchors.verticalCenter: parent.verticalCenter

                                        MouseArea {
                                            anchors.fill: parent
                                            hoverEnabled: true
                                            cursorShape: Qt.PointingHandCursor
                                            onClicked: {
                                                if (WeatherService.weather.available)
                                                    SettingsData.set("useFahrenheit", !SettingsData.useFahrenheit);
                                            }
                                            enabled: WeatherService.weather.available
                                        }
                                    }
                                }

                                StyledText {
                                    property var feelsLike: SettingsData.useFahrenheit ? (WeatherService.weather.feelsLikeF || WeatherService.weather.tempF) : (WeatherService.weather.feelsLike || WeatherService.weather.temp)
                                    text: I18n.tr("Feels Like %1°").arg(feelsLike)
                                    font.pixelSize: Theme.fontSizeSmall
                                    color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
                                }

                                StyledText {
                                    text: WeatherService.weather.city || ""
                                    font.pixelSize: Theme.fontSizeMedium
                                    color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                                    visible: text.length > 0
                                }
                            }

                            Column {
                                id: sunriseColumn
                                spacing: Theme.spacingXS
                                anchors.left: tempColumn.right
                                anchors.leftMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                visible: WeatherService.weather.sunrise && WeatherService.weather.sunset

                                Item {
                                    width: sunriseIcon.width + sunriseText.width + Theme.spacingXS
                                    height: sunriseIcon.height

                                    DankIcon {
                                        id: sunriseIcon
                                        name: "wb_twilight"
                                        size: Theme.iconSize - 6
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
                                        anchors.left: parent.left
                                        anchors.verticalCenter: parent.verticalCenter
                                    }

                                    StyledText {
                                        id: sunriseText
                                        text: WeatherService.weather.sunrise || ""
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
                                        anchors.left: sunriseIcon.right
                                        anchors.leftMargin: Theme.spacingXS
                                        anchors.verticalCenter: parent.verticalCenter
                                    }
                                }

                                Item {
                                    width: sunsetIcon.width + sunsetText.width + Theme.spacingXS
                                    height: sunsetIcon.height

                                    DankIcon {
                                        id: sunsetIcon
                                        name: "bedtime"
                                        size: Theme.iconSize - 6
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
                                        anchors.left: parent.left
                                        anchors.verticalCenter: parent.verticalCenter
                                    }

                                    StyledText {
                                        id: sunsetText
                                        text: WeatherService.weather.sunset || ""
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
                                        anchors.left: sunsetIcon.right
                                        anchors.leftMargin: Theme.spacingXS
                                        anchors.verticalCenter: parent.verticalCenter
                                    }
                                }
                            }
                        }
                    }

                    Rectangle {
                        width: parent.width
                        height: 1
                        color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
                    }

                    GridLayout {
                        width: parent.width
                        height: 95
                        columns: 6
                        columnSpacing: Theme.spacingS
                        rowSpacing: 0

                        Rectangle {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                            radius: Theme.cornerRadius
                            color: Theme.surfaceContainerHigh

                            Column {
                                anchors.centerIn: parent
                                spacing: Theme.spacingXS

                                Rectangle {
                                    width: 32
                                    height: 32
                                    radius: 16
                                    color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    DankIcon {
                                        anchors.centerIn: parent
                                        name: "device_thermostat"
                                        size: Theme.iconSize - 4
                                        color: Theme.primary
                                    }
                                }

                                Column {
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    spacing: 2
                                    StyledText {
                                        text: I18n.tr("Feels Like")
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                    StyledText {
                                        text: (SettingsData.useFahrenheit ? (WeatherService.weather.feelsLikeF || WeatherService.weather.tempF) : (WeatherService.weather.feelsLike || WeatherService.weather.temp)) + "°"
                                        font.pixelSize: Theme.fontSizeSmall + 1
                                        color: Theme.surfaceText
                                        font.weight: Font.Medium
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                }
                            }
                        }

                        Rectangle {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                            radius: Theme.cornerRadius
                            color: Theme.surfaceContainerHigh

                            Column {
                                anchors.centerIn: parent
                                spacing: Theme.spacingXS

                                Rectangle {
                                    width: 32
                                    height: 32
                                    radius: 16
                                    color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    DankIcon {
                                        anchors.centerIn: parent
                                        name: "humidity_low"
                                        size: Theme.iconSize - 4
                                        color: Theme.primary
                                    }
                                }

                                Column {
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    spacing: 2
                                    StyledText {
                                        text: I18n.tr("Humidity")
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                    StyledText {
                                        text: WeatherService.weather.humidity ? WeatherService.weather.humidity + "%" : "--"
                                        font.pixelSize: Theme.fontSizeSmall + 1
                                        color: Theme.surfaceText
                                        font.weight: Font.Medium
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                }
                            }
                        }

                        Rectangle {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                            radius: Theme.cornerRadius
                            color: Theme.surfaceContainerHigh

                            Column {
                                anchors.centerIn: parent
                                spacing: Theme.spacingXS

                                Rectangle {
                                    width: 32
                                    height: 32
                                    radius: 16
                                    color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    DankIcon {
                                        anchors.centerIn: parent
                                        name: "air"
                                        size: Theme.iconSize - 4
                                        color: Theme.primary
                                    }
                                }

                                Column {
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    spacing: 2
                                    StyledText {
                                        text: I18n.tr("Wind")
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                    StyledText {
                                        id: windText
                                        text: {
                                            SettingsData.windSpeedUnit;
                                            SettingsData.useFahrenheit;
                                            return WeatherService.formatSpeed(WeatherService.weather.wind) || "--";
                                        }
                                        font.pixelSize: Theme.fontSizeSmall + 1
                                        color: Theme.surfaceText
                                        font.weight: Font.Medium
                                        anchors.horizontalCenter: parent.horizontalCenter

                                        MouseArea {
                                            anchors.fill: parent
                                            hoverEnabled: true
                                            cursorShape: SettingsData.useFahrenheit ? Qt.ArrowCursor : Qt.PointingHandCursor
                                            enabled: !SettingsData.useFahrenheit
                                            onClicked: SettingsData.set("windSpeedUnit", SettingsData.windSpeedUnit === "kmh" ? "ms" : "kmh")
                                        }
                                    }
                                }
                            }
                        }

                        Rectangle {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                            radius: Theme.cornerRadius
                            color: Theme.surfaceContainerHigh

                            Column {
                                anchors.centerIn: parent
                                spacing: Theme.spacingXS

                                Rectangle {
                                    width: 32
                                    height: 32
                                    radius: 16
                                    color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    DankIcon {
                                        anchors.centerIn: parent
                                        name: "speed"
                                        size: Theme.iconSize - 4
                                        color: Theme.primary
                                    }
                                }

                                Column {
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    spacing: 2
                                    StyledText {
                                        text: I18n.tr("Pressure")
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                    StyledText {
                                        text: {
                                            if (!WeatherService.weather.pressure)
                                                return "--";
                                            if (SettingsData.useFahrenheit)
                                                return (WeatherService.weather.pressure * 0.02953).toFixed(2) + " inHg";
                                            return WeatherService.weather.pressure + " hPa";
                                        }
                                        font.pixelSize: Theme.fontSizeSmall + 1
                                        color: Theme.surfaceText
                                        font.weight: Font.Medium
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                }
                            }
                        }

                        Rectangle {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                            radius: Theme.cornerRadius
                            color: Theme.surfaceContainerHigh

                            Column {
                                anchors.centerIn: parent
                                spacing: Theme.spacingXS

                                Rectangle {
                                    width: 32
                                    height: 32
                                    radius: 16
                                    color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    DankIcon {
                                        anchors.centerIn: parent
                                        name: "rainy"
                                        size: Theme.iconSize - 4
                                        color: Theme.primary
                                    }
                                }

                                Column {
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    spacing: 2
                                    StyledText {
                                        text: I18n.tr("Rain Chance")
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                    StyledText {
                                        text: WeatherService.weather.precipitationProbability ? WeatherService.weather.precipitationProbability + "%" : "0%"
                                        font.pixelSize: Theme.fontSizeSmall + 1
                                        color: Theme.surfaceText
                                        font.weight: Font.Medium
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                }
                            }
                        }

                        Rectangle {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                            radius: Theme.cornerRadius
                            color: Theme.surfaceContainerHigh

                            Column {
                                anchors.centerIn: parent
                                spacing: Theme.spacingXS

                                Rectangle {
                                    width: 32
                                    height: 32
                                    radius: 16
                                    color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    DankIcon {
                                        anchors.centerIn: parent
                                        name: "wb_sunny"
                                        size: Theme.iconSize - 4
                                        color: Theme.primary
                                    }
                                }

                                Column {
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    spacing: 2
                                    StyledText {
                                        text: I18n.tr("Visibility")
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                    StyledText {
                                        text: I18n.tr("Good")
                                        font.pixelSize: Theme.fontSizeSmall + 1
                                        color: Theme.surfaceText
                                        font.weight: Font.Medium
                                        anchors.horizontalCenter: parent.horizontalCenter
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}