mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
feat: add sun and moon view to WeatherTab (#787)
* feat: add sun and moon view to WeatherTab * feat: hourly forecast and scrollable date * fix: put listviews in loaders to prevent ui blocking * dankdash/weather: wrap all tab content in loaders, weather updates - remove a bunch of transitions that make things feel glitchy - use animation durations from Theme - configurable detailed/compact hourly view * weather: fix scroll and some display issues --------- Co-authored-by: bbedward <bbedward@gmail.com>
This commit is contained in:
@@ -226,8 +226,8 @@ DankPopout {
|
||||
return;
|
||||
}
|
||||
|
||||
if (root.currentTabIndex === 2 && wallpaperTab.handleKeyEvent) {
|
||||
if (wallpaperTab.handleKeyEvent(event)) {
|
||||
if (root.currentTabIndex === 2 && wallpaperLoader.item?.handleKeyEvent) {
|
||||
if (wallpaperLoader.item.handleKeyEvent(event)) {
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ DankPopout {
|
||||
let settingsIndex = SettingsData.weatherEnabled ? 4 : 3;
|
||||
if (index === settingsIndex) {
|
||||
dashVisible = false;
|
||||
PopoutService.openSettings();
|
||||
settingsModal.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,71 +316,84 @@ DankPopout {
|
||||
width: parent.width
|
||||
implicitHeight: {
|
||||
if (currentIndex === 0)
|
||||
return overviewTab.implicitHeight;
|
||||
return overviewLoader.item?.implicitHeight ?? 410;
|
||||
if (currentIndex === 1)
|
||||
return mediaTab.implicitHeight;
|
||||
return mediaLoader.item?.implicitHeight ?? 410;
|
||||
if (currentIndex === 2)
|
||||
return wallpaperTab.implicitHeight;
|
||||
return wallpaperLoader.item?.implicitHeight ?? 410;
|
||||
if (SettingsData.weatherEnabled && currentIndex === 3)
|
||||
return weatherTab.implicitHeight;
|
||||
return overviewTab.implicitHeight;
|
||||
return weatherLoader.item?.implicitHeight ?? 410;
|
||||
return 410;
|
||||
}
|
||||
currentIndex: root.currentTabIndex
|
||||
|
||||
OverviewTab {
|
||||
id: overviewTab
|
||||
|
||||
onCloseDash: {
|
||||
root.dashVisible = false;
|
||||
}
|
||||
|
||||
onSwitchToWeatherTab: {
|
||||
if (SettingsData.weatherEnabled) {
|
||||
tabBar.currentIndex = 3;
|
||||
tabBar.tabClicked(3);
|
||||
Loader {
|
||||
id: overviewLoader
|
||||
active: root.currentTabIndex === 0
|
||||
sourceComponent: Component {
|
||||
OverviewTab {
|
||||
onCloseDash: root.dashVisible = false
|
||||
onSwitchToWeatherTab: {
|
||||
if (SettingsData.weatherEnabled) {
|
||||
tabBar.currentIndex = 3;
|
||||
tabBar.tabClicked(3);
|
||||
}
|
||||
}
|
||||
onSwitchToMediaTab: {
|
||||
tabBar.currentIndex = 1;
|
||||
tabBar.tabClicked(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSwitchToMediaTab: {
|
||||
tabBar.currentIndex = 1;
|
||||
tabBar.tabClicked(1);
|
||||
Loader {
|
||||
id: mediaLoader
|
||||
active: root.currentTabIndex === 1
|
||||
sourceComponent: Component {
|
||||
MediaPlayerTab {
|
||||
targetScreen: root.screen
|
||||
popoutX: root.alignedX
|
||||
popoutY: root.alignedY
|
||||
popoutWidth: root.alignedWidth
|
||||
popoutHeight: root.alignedHeight
|
||||
contentOffsetY: Theme.spacingM + 48 + Theme.spacingS + Theme.spacingXS
|
||||
Component.onCompleted: root.__mediaTabRef = this
|
||||
onShowVolumeDropdown: (pos, screen, rightEdge, player, players) => {
|
||||
root.__showVolumeDropdown(pos, rightEdge, player, players);
|
||||
}
|
||||
onShowAudioDevicesDropdown: (pos, screen, rightEdge) => {
|
||||
root.__showAudioDevicesDropdown(pos, rightEdge);
|
||||
}
|
||||
onShowPlayersDropdown: (pos, screen, rightEdge, player, players) => {
|
||||
root.__showPlayersDropdown(pos, rightEdge, player, players);
|
||||
}
|
||||
onHideDropdowns: root.__hideDropdowns()
|
||||
onVolumeButtonExited: root.__startCloseTimer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MediaPlayerTab {
|
||||
id: mediaTab
|
||||
targetScreen: root.screen
|
||||
popoutX: root.alignedX
|
||||
popoutY: root.alignedY
|
||||
popoutWidth: root.alignedWidth
|
||||
popoutHeight: root.alignedHeight
|
||||
contentOffsetY: Theme.spacingM + 48 + Theme.spacingS + Theme.spacingXS
|
||||
Component.onCompleted: root.__mediaTabRef = this
|
||||
onShowVolumeDropdown: (pos, screen, rightEdge, player, players) => {
|
||||
root.__showVolumeDropdown(pos, rightEdge, player, players);
|
||||
}
|
||||
onShowAudioDevicesDropdown: (pos, screen, rightEdge) => {
|
||||
root.__showAudioDevicesDropdown(pos, rightEdge);
|
||||
}
|
||||
onShowPlayersDropdown: (pos, screen, rightEdge, player, players) => {
|
||||
root.__showPlayersDropdown(pos, rightEdge, player, players);
|
||||
}
|
||||
onHideDropdowns: root.__hideDropdowns()
|
||||
onVolumeButtonExited: root.__startCloseTimer()
|
||||
}
|
||||
|
||||
WallpaperTab {
|
||||
id: wallpaperTab
|
||||
Loader {
|
||||
id: wallpaperLoader
|
||||
active: root.currentTabIndex === 2
|
||||
tabBarItem: tabBar
|
||||
keyForwardTarget: mainContainer
|
||||
targetScreen: root.screen
|
||||
parentPopout: root
|
||||
sourceComponent: Component {
|
||||
WallpaperTab {
|
||||
active: true
|
||||
tabBarItem: tabBar
|
||||
keyForwardTarget: mainContainer
|
||||
targetScreen: root.triggerScreen
|
||||
parentPopout: root
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WeatherTab {
|
||||
id: weatherTab
|
||||
visible: SettingsData.weatherEnabled && root.currentTabIndex === 3
|
||||
Loader {
|
||||
id: weatherLoader
|
||||
active: SettingsData.weatherEnabled && root.currentTabIndex === 3
|
||||
sourceComponent: Component {
|
||||
WeatherTab {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user