mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
media: fix padding issues with long titles
This commit is contained in:
@@ -539,10 +539,38 @@ func (m *Manager) getDeadlineNormal(now time.Time, sched sunSchedule) time.Time
|
|||||||
case now.Before(times.Night):
|
case now.Before(times.Night):
|
||||||
return now.Add(sched.nightStepTime)
|
return now.Add(sched.nightStepTime)
|
||||||
default:
|
default:
|
||||||
return m.tomorrow(now)
|
return m.tomorrowDawn(now)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Manager) tomorrowDawn(now time.Time) time.Time {
|
||||||
|
tomorrow := time.Date(now.Year(), now.Month(), now.Day()+1, 0, 0, 0, 0, now.Location())
|
||||||
|
|
||||||
|
m.configMutex.RLock()
|
||||||
|
config := m.config
|
||||||
|
m.configMutex.RUnlock()
|
||||||
|
|
||||||
|
if config.ManualSunrise != nil {
|
||||||
|
dur := time.Hour
|
||||||
|
if config.ManualDuration != nil {
|
||||||
|
dur = *config.ManualDuration
|
||||||
|
}
|
||||||
|
return time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(),
|
||||||
|
config.ManualSunrise.Hour(), config.ManualSunrise.Minute(), config.ManualSunrise.Second(), 0, tomorrow.Location()).Add(-dur)
|
||||||
|
}
|
||||||
|
|
||||||
|
lat, lon := m.getLocation()
|
||||||
|
if lat == nil || lon == nil {
|
||||||
|
return tomorrow
|
||||||
|
}
|
||||||
|
|
||||||
|
times, cond := CalculateSunTimesWithTwilight(*lat, *lon, tomorrow, config.ElevationTwilight, config.ElevationDaylight)
|
||||||
|
if cond != SunNormal {
|
||||||
|
return tomorrow
|
||||||
|
}
|
||||||
|
return times.Dawn
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Manager) tomorrow(now time.Time) time.Time {
|
func (m *Manager) tomorrow(now time.Time) time.Time {
|
||||||
return time.Date(now.Year(), now.Month(), now.Day()+1, 0, 0, 0, 0, now.Location())
|
return time.Date(now.Year(), now.Month(), now.Day()+1, 0, 0, 0, 0, now.Location())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -384,260 +384,269 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Controls Group
|
Item {
|
||||||
Column {
|
id: seekbarContainer
|
||||||
id: controlsGroup
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingXS
|
anchors.top: songInfo.bottom
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: playbackControls.top
|
||||||
anchors.bottomMargin: 0
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
DankSeekbar {
|
Column {
|
||||||
width: parent.width * 0.8
|
|
||||||
height: 20
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
activePlayer: root.activePlayer
|
|
||||||
isSeeking: root.isSeeking
|
|
||||||
onIsSeekingChanged: root.isSeeking = isSeeking
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: parent.width * 0.8
|
|
||||||
height: 20
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: {
|
|
||||||
if (!activePlayer)
|
|
||||||
return "0:00";
|
|
||||||
const rawPos = Math.max(0, activePlayer.position || 0);
|
|
||||||
const pos = activePlayer.length ? rawPos % Math.max(1, activePlayer.length) : rawPos;
|
|
||||||
const minutes = Math.floor(pos / 60);
|
|
||||||
const seconds = Math.floor(pos % 60);
|
|
||||||
const timeStr = minutes + ":" + (seconds < 10 ? "0" : "") + seconds;
|
|
||||||
return timeStr;
|
|
||||||
}
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: {
|
|
||||||
if (!activePlayer || !activePlayer.length)
|
|
||||||
return "0:00";
|
|
||||||
const dur = Math.max(0, activePlayer.length || 0); // Length is already in seconds
|
|
||||||
const minutes = Math.floor(dur / 60);
|
|
||||||
const seconds = Math.floor(dur % 60);
|
|
||||||
return minutes + ":" + (seconds < 10 ? "0" : "") + seconds;
|
|
||||||
}
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 50
|
spacing: 2
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: parent.height * 0.2
|
||||||
|
|
||||||
Row {
|
DankSeekbar {
|
||||||
anchors.centerIn: parent
|
width: parent.width * 0.8
|
||||||
spacing: Theme.spacingM
|
height: 20
|
||||||
height: parent.height
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
activePlayer: root.activePlayer
|
||||||
|
isSeeking: root.isSeeking
|
||||||
|
onIsSeekingChanged: root.isSeeking = isSeeking
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 50
|
width: parent.width * 0.8
|
||||||
height: 50
|
height: 16
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: activePlayer && activePlayer.shuffleSupported
|
text: {
|
||||||
|
if (!activePlayer)
|
||||||
|
return "0:00";
|
||||||
|
const rawPos = Math.max(0, activePlayer.position || 0);
|
||||||
|
const pos = activePlayer.length ? rawPos % Math.max(1, activePlayer.length) : rawPos;
|
||||||
|
const minutes = Math.floor(pos / 60);
|
||||||
|
const seconds = Math.floor(pos % 60);
|
||||||
|
const timeStr = minutes + ":" + (seconds < 10 ? "0" : "") + seconds;
|
||||||
|
return timeStr;
|
||||||
|
}
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
StyledText {
|
||||||
width: 40
|
anchors.right: parent.right
|
||||||
height: 40
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
radius: 20
|
text: {
|
||||||
|
if (!activePlayer || !activePlayer.length)
|
||||||
|
return "0:00";
|
||||||
|
const dur = Math.max(0, activePlayer.length || 0);
|
||||||
|
const minutes = Math.floor(dur / 60);
|
||||||
|
const seconds = Math.floor(dur % 60);
|
||||||
|
return minutes + ":" + (seconds < 10 ? "0" : "") + seconds;
|
||||||
|
}
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: playbackControls
|
||||||
|
width: parent.width
|
||||||
|
height: 50
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: activePlayer && activePlayer.shuffleSupported
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
radius: 20
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: shuffleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: shuffleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
name: "shuffle"
|
||||||
|
size: 20
|
||||||
|
color: activePlayer && activePlayer.shuffle ? Theme.primary : Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
DankIcon {
|
MouseArea {
|
||||||
anchors.centerIn: parent
|
id: shuffleArea
|
||||||
name: "shuffle"
|
anchors.fill: parent
|
||||||
size: 20
|
hoverEnabled: true
|
||||||
color: activePlayer && activePlayer.shuffle ? Theme.primary : Theme.surfaceText
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
onClicked: {
|
||||||
|
if (activePlayer && activePlayer.canControl && activePlayer.shuffleSupported) {
|
||||||
MouseArea {
|
activePlayer.shuffle = !activePlayer.shuffle;
|
||||||
id: shuffleArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (activePlayer && activePlayer.canControl && activePlayer.shuffleSupported) {
|
|
||||||
activePlayer.shuffle = !activePlayer.shuffle;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 50
|
width: 50
|
||||||
height: 50
|
height: 50
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
||||||
radius: 20
|
radius: 20
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: prevBtnArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: prevBtnArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
|
name: "skip_previous"
|
||||||
|
size: 24
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
DankIcon {
|
MouseArea {
|
||||||
anchors.centerIn: parent
|
id: prevBtnArea
|
||||||
name: "skip_previous"
|
anchors.fill: parent
|
||||||
size: 24
|
hoverEnabled: true
|
||||||
color: Theme.surfaceText
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
onClicked: {
|
||||||
|
if (!activePlayer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
if (activePlayer.position > 8 && activePlayer.canSeek) {
|
||||||
id: prevBtnArea
|
activePlayer.position = 0;
|
||||||
anchors.fill: parent
|
} else {
|
||||||
hoverEnabled: true
|
activePlayer.previous();
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (!activePlayer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activePlayer.position > 8 && activePlayer.canSeek) {
|
|
||||||
activePlayer.position = 0;
|
|
||||||
} else {
|
|
||||||
activePlayer.previous();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
width: 50
|
width: 50
|
||||||
height: 50
|
height: 50
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
radius: 25
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: Theme.primary
|
||||||
|
|
||||||
Rectangle {
|
DankIcon {
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius: 25
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: Theme.primary
|
name: activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing ? "pause" : "play_arrow"
|
||||||
|
size: 28
|
||||||
|
color: Theme.background
|
||||||
|
weight: 500
|
||||||
|
}
|
||||||
|
|
||||||
DankIcon {
|
MouseArea {
|
||||||
anchors.centerIn: parent
|
anchors.fill: parent
|
||||||
name: activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing ? "pause" : "play_arrow"
|
hoverEnabled: true
|
||||||
size: 28
|
cursorShape: Qt.PointingHandCursor
|
||||||
color: Theme.background
|
onClicked: activePlayer && activePlayer.togglePlaying()
|
||||||
weight: 500
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
layer.enabled: true
|
||||||
anchors.fill: parent
|
layer.effect: MultiEffect {
|
||||||
hoverEnabled: true
|
shadowEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
shadowHorizontalOffset: 0
|
||||||
onClicked: activePlayer && activePlayer.togglePlaying()
|
shadowVerticalOffset: 0
|
||||||
}
|
shadowBlur: 1.0
|
||||||
|
shadowColor: Qt.rgba(0, 0, 0, 0.3)
|
||||||
layer.enabled: true
|
shadowOpacity: 0.3
|
||||||
layer.effect: MultiEffect {
|
|
||||||
shadowEnabled: true
|
|
||||||
shadowHorizontalOffset: 0
|
|
||||||
shadowVerticalOffset: 0
|
|
||||||
shadowBlur: 1.0
|
|
||||||
shadowColor: Qt.rgba(0, 0, 0, 0.3)
|
|
||||||
shadowOpacity: 0.3
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 50
|
width: 50
|
||||||
height: 50
|
height: 50
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
||||||
radius: 20
|
radius: 20
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: nextBtnArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: nextBtnArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
|
name: "skip_next"
|
||||||
|
size: 24
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
DankIcon {
|
MouseArea {
|
||||||
anchors.centerIn: parent
|
id: nextBtnArea
|
||||||
name: "skip_next"
|
anchors.fill: parent
|
||||||
size: 24
|
hoverEnabled: true
|
||||||
color: Theme.surfaceText
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
onClicked: activePlayer && activePlayer.next()
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: nextBtnArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: activePlayer && activePlayer.next()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 50
|
width: 50
|
||||||
height: 50
|
height: 50
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: activePlayer && activePlayer.loopSupported
|
visible: activePlayer && activePlayer.loopSupported
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
||||||
radius: 20
|
radius: 20
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: repeatArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: repeatArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
name: {
|
||||||
|
if (!activePlayer)
|
||||||
|
return "repeat";
|
||||||
|
switch (activePlayer.loopState) {
|
||||||
|
case MprisLoopState.Track:
|
||||||
|
return "repeat_one";
|
||||||
|
case MprisLoopState.Playlist:
|
||||||
|
return "repeat";
|
||||||
|
default:
|
||||||
|
return "repeat";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
size: 20
|
||||||
|
color: activePlayer && activePlayer.loopState !== MprisLoopState.None ? Theme.primary : Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
DankIcon {
|
MouseArea {
|
||||||
anchors.centerIn: parent
|
id: repeatArea
|
||||||
name: {
|
anchors.fill: parent
|
||||||
if (!activePlayer)
|
hoverEnabled: true
|
||||||
return "repeat";
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
if (activePlayer && activePlayer.canControl && activePlayer.loopSupported) {
|
||||||
switch (activePlayer.loopState) {
|
switch (activePlayer.loopState) {
|
||||||
case MprisLoopState.Track:
|
case MprisLoopState.None:
|
||||||
return "repeat_one";
|
activePlayer.loopState = MprisLoopState.Playlist;
|
||||||
|
break;
|
||||||
case MprisLoopState.Playlist:
|
case MprisLoopState.Playlist:
|
||||||
return "repeat";
|
activePlayer.loopState = MprisLoopState.Track;
|
||||||
default:
|
break;
|
||||||
return "repeat";
|
case MprisLoopState.Track:
|
||||||
}
|
activePlayer.loopState = MprisLoopState.None;
|
||||||
}
|
break;
|
||||||
size: 20
|
|
||||||
color: activePlayer && activePlayer.loopState !== MprisLoopState.None ? Theme.primary : Theme.surfaceText
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: repeatArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (activePlayer && activePlayer.canControl && activePlayer.loopSupported) {
|
|
||||||
switch (activePlayer.loopState) {
|
|
||||||
case MprisLoopState.None:
|
|
||||||
activePlayer.loopState = MprisLoopState.Playlist;
|
|
||||||
break;
|
|
||||||
case MprisLoopState.Playlist:
|
|
||||||
activePlayer.loopState = MprisLoopState.Track;
|
|
||||||
break;
|
|
||||||
case MprisLoopState.Track:
|
|
||||||
activePlayer.loopState = MprisLoopState.None;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -648,166 +657,166 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Rectangle {
|
|
||||||
id: playerSelectorButton
|
Rectangle {
|
||||||
width: 40
|
id: playerSelectorButton
|
||||||
height: 40
|
width: 40
|
||||||
radius: 20
|
height: 40
|
||||||
x: isRightEdge ? Theme.spacingM : parent.width - 40 - Theme.spacingM
|
radius: 20
|
||||||
y: 185
|
x: isRightEdge ? Theme.spacingM : parent.width - 40 - Theme.spacingM
|
||||||
color: playerSelectorArea.containsMouse || playersExpanded ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2) : "transparent"
|
y: 185
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3)
|
color: playerSelectorArea.containsMouse || playersExpanded ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2) : "transparent"
|
||||||
border.width: 1
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3)
|
||||||
z: 100
|
border.width: 1
|
||||||
visible: (allPlayers?.length || 0) >= 1
|
z: 100
|
||||||
|
visible: (allPlayers?.length || 0) >= 1
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
DankIcon {
|
||||||
name: "assistant_device"
|
anchors.centerIn: parent
|
||||||
size: 18
|
name: "assistant_device"
|
||||||
color: Theme.surfaceText
|
size: 18
|
||||||
}
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
MouseArea {
|
|
||||||
id: playerSelectorArea
|
MouseArea {
|
||||||
anchors.fill: parent
|
id: playerSelectorArea
|
||||||
hoverEnabled: true
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: true
|
||||||
onClicked: {
|
cursorShape: Qt.PointingHandCursor
|
||||||
if (playersExpanded) {
|
onClicked: {
|
||||||
hideDropdowns();
|
if (playersExpanded) {
|
||||||
return;
|
hideDropdowns();
|
||||||
}
|
return;
|
||||||
hideDropdowns();
|
}
|
||||||
playersExpanded = true;
|
hideDropdowns();
|
||||||
const buttonsOnRight = !isRightEdge;
|
playersExpanded = true;
|
||||||
const btnY = playerSelectorButton.y + playerSelectorButton.height / 2;
|
const buttonsOnRight = !isRightEdge;
|
||||||
const screenX = buttonsOnRight ? (popoutX + popoutWidth) : popoutX;
|
const btnY = playerSelectorButton.y + playerSelectorButton.height / 2;
|
||||||
const screenY = popoutY + contentOffsetY + btnY;
|
const screenX = buttonsOnRight ? (popoutX + popoutWidth) : popoutX;
|
||||||
showPlayersDropdown(Qt.point(screenX, screenY), targetScreen, buttonsOnRight, activePlayer, allPlayers);
|
const screenY = popoutY + contentOffsetY + btnY;
|
||||||
}
|
showPlayersDropdown(Qt.point(screenX, screenY), targetScreen, buttonsOnRight, activePlayer, allPlayers);
|
||||||
onEntered: sharedTooltip.show("Media Players", playerSelectorButton, 0, 0, isRightEdge ? "right" : "left")
|
}
|
||||||
onExited: sharedTooltip.hide()
|
onEntered: sharedTooltip.show("Media Players", playerSelectorButton, 0, 0, isRightEdge ? "right" : "left")
|
||||||
}
|
onExited: sharedTooltip.hide()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Rectangle {
|
|
||||||
id: volumeButton
|
Rectangle {
|
||||||
width: 40
|
id: volumeButton
|
||||||
height: 40
|
width: 40
|
||||||
radius: 20
|
height: 40
|
||||||
x: isRightEdge ? Theme.spacingM : parent.width - 40 - Theme.spacingM
|
radius: 20
|
||||||
y: 130
|
x: isRightEdge ? Theme.spacingM : parent.width - 40 - Theme.spacingM
|
||||||
color: volumeButtonArea.containsMouse && volumeAvailable || volumeExpanded ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2) : "transparent"
|
y: 130
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, volumeAvailable ? 0.3 : 0.15)
|
color: volumeButtonArea.containsMouse && volumeAvailable || volumeExpanded ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2) : "transparent"
|
||||||
border.width: 1
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, volumeAvailable ? 0.3 : 0.15)
|
||||||
z: 101
|
border.width: 1
|
||||||
enabled: volumeAvailable
|
z: 101
|
||||||
|
enabled: volumeAvailable
|
||||||
property real previousVolume: 0.0
|
|
||||||
|
property real previousVolume: 0.0
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
DankIcon {
|
||||||
name: getVolumeIcon()
|
anchors.centerIn: parent
|
||||||
size: 18
|
name: getVolumeIcon()
|
||||||
color: volumeAvailable && currentVolume > 0 ? Theme.primary : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, volumeAvailable ? 1.0 : 0.5)
|
size: 18
|
||||||
}
|
color: volumeAvailable && currentVolume > 0 ? Theme.primary : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, volumeAvailable ? 1.0 : 0.5)
|
||||||
|
}
|
||||||
MouseArea {
|
|
||||||
id: volumeButtonArea
|
MouseArea {
|
||||||
anchors.fill: parent
|
id: volumeButtonArea
|
||||||
hoverEnabled: true
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: true
|
||||||
onEntered: {
|
cursorShape: Qt.PointingHandCursor
|
||||||
if (volumeExpanded)
|
onEntered: {
|
||||||
return;
|
if (volumeExpanded)
|
||||||
hideDropdowns();
|
return;
|
||||||
volumeExpanded = true;
|
hideDropdowns();
|
||||||
const buttonsOnRight = !isRightEdge;
|
volumeExpanded = true;
|
||||||
const btnY = volumeButton.y + volumeButton.height / 2;
|
const buttonsOnRight = !isRightEdge;
|
||||||
const screenX = buttonsOnRight ? (popoutX + popoutWidth) : popoutX;
|
const btnY = volumeButton.y + volumeButton.height / 2;
|
||||||
const screenY = popoutY + contentOffsetY + btnY;
|
const screenX = buttonsOnRight ? (popoutX + popoutWidth) : popoutX;
|
||||||
showVolumeDropdown(Qt.point(screenX, screenY), targetScreen, buttonsOnRight, activePlayer, allPlayers);
|
const screenY = popoutY + contentOffsetY + btnY;
|
||||||
}
|
showVolumeDropdown(Qt.point(screenX, screenY), targetScreen, buttonsOnRight, activePlayer, allPlayers);
|
||||||
onExited: {
|
}
|
||||||
if (volumeExpanded)
|
onExited: {
|
||||||
volumeButtonExited();
|
if (volumeExpanded)
|
||||||
}
|
volumeButtonExited();
|
||||||
onClicked: {
|
}
|
||||||
SessionData.suppressOSDTemporarily();
|
onClicked: {
|
||||||
if (currentVolume > 0) {
|
SessionData.suppressOSDTemporarily();
|
||||||
volumeButton.previousVolume = currentVolume;
|
if (currentVolume > 0) {
|
||||||
if (usePlayerVolume) {
|
volumeButton.previousVolume = currentVolume;
|
||||||
activePlayer.volume = 0;
|
if (usePlayerVolume) {
|
||||||
} else if (AudioService.sink?.audio) {
|
activePlayer.volume = 0;
|
||||||
AudioService.sink.audio.volume = 0;
|
} else if (AudioService.sink?.audio) {
|
||||||
}
|
AudioService.sink.audio.volume = 0;
|
||||||
} else {
|
}
|
||||||
const restoreVolume = volumeButton.previousVolume > 0 ? volumeButton.previousVolume : 0.5;
|
} else {
|
||||||
if (usePlayerVolume) {
|
const restoreVolume = volumeButton.previousVolume > 0 ? volumeButton.previousVolume : 0.5;
|
||||||
activePlayer.volume = restoreVolume;
|
if (usePlayerVolume) {
|
||||||
} else if (AudioService.sink?.audio) {
|
activePlayer.volume = restoreVolume;
|
||||||
AudioService.sink.audio.volume = restoreVolume;
|
} else if (AudioService.sink?.audio) {
|
||||||
}
|
AudioService.sink.audio.volume = restoreVolume;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onWheel: wheelEvent => {
|
}
|
||||||
SessionData.suppressOSDTemporarily();
|
onWheel: wheelEvent => {
|
||||||
const delta = wheelEvent.angleDelta.y;
|
SessionData.suppressOSDTemporarily();
|
||||||
const current = (currentVolume * 100) || 0;
|
const delta = wheelEvent.angleDelta.y;
|
||||||
const newVolume = delta > 0 ? Math.min(100, current + 5) : Math.max(0, current - 5);
|
const current = (currentVolume * 100) || 0;
|
||||||
|
const newVolume = delta > 0 ? Math.min(100, current + 5) : Math.max(0, current - 5);
|
||||||
if (usePlayerVolume) {
|
|
||||||
activePlayer.volume = newVolume / 100;
|
if (usePlayerVolume) {
|
||||||
} else if (AudioService.sink?.audio) {
|
activePlayer.volume = newVolume / 100;
|
||||||
AudioService.sink.audio.volume = newVolume / 100;
|
} else if (AudioService.sink?.audio) {
|
||||||
}
|
AudioService.sink.audio.volume = newVolume / 100;
|
||||||
wheelEvent.accepted = true;
|
}
|
||||||
}
|
wheelEvent.accepted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Rectangle {
|
|
||||||
id: audioDevicesButton
|
Rectangle {
|
||||||
width: 40
|
id: audioDevicesButton
|
||||||
height: 40
|
width: 40
|
||||||
radius: 20
|
height: 40
|
||||||
x: isRightEdge ? Theme.spacingM : parent.width - 40 - Theme.spacingM
|
radius: 20
|
||||||
y: 240
|
x: isRightEdge ? Theme.spacingM : parent.width - 40 - Theme.spacingM
|
||||||
color: audioDevicesArea.containsMouse || devicesExpanded ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2) : "transparent"
|
y: 240
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3)
|
color: audioDevicesArea.containsMouse || devicesExpanded ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2) : "transparent"
|
||||||
border.width: 1
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3)
|
||||||
z: 100
|
border.width: 1
|
||||||
|
z: 100
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
DankIcon {
|
||||||
name: devicesExpanded ? "expand_less" : "speaker"
|
anchors.centerIn: parent
|
||||||
size: 18
|
name: devicesExpanded ? "expand_less" : "speaker"
|
||||||
color: Theme.surfaceText
|
size: 18
|
||||||
}
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
MouseArea {
|
|
||||||
id: audioDevicesArea
|
MouseArea {
|
||||||
anchors.fill: parent
|
id: audioDevicesArea
|
||||||
hoverEnabled: true
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: true
|
||||||
onClicked: {
|
cursorShape: Qt.PointingHandCursor
|
||||||
if (devicesExpanded) {
|
onClicked: {
|
||||||
hideDropdowns();
|
if (devicesExpanded) {
|
||||||
return;
|
hideDropdowns();
|
||||||
}
|
return;
|
||||||
hideDropdowns();
|
}
|
||||||
devicesExpanded = true;
|
hideDropdowns();
|
||||||
const buttonsOnRight = !isRightEdge;
|
devicesExpanded = true;
|
||||||
const btnY = audioDevicesButton.y + audioDevicesButton.height / 2;
|
const buttonsOnRight = !isRightEdge;
|
||||||
const screenX = buttonsOnRight ? (popoutX + popoutWidth) : popoutX;
|
const btnY = audioDevicesButton.y + audioDevicesButton.height / 2;
|
||||||
const screenY = popoutY + contentOffsetY + btnY;
|
const screenX = buttonsOnRight ? (popoutX + popoutWidth) : popoutX;
|
||||||
showAudioDevicesDropdown(Qt.point(screenX, screenY), targetScreen, buttonsOnRight);
|
const screenY = popoutY + contentOffsetY + btnY;
|
||||||
}
|
showAudioDevicesDropdown(Qt.point(screenX, screenY), targetScreen, buttonsOnRight);
|
||||||
onEntered: sharedTooltip.show("Output Device", audioDevicesButton, 0, 0, isRightEdge ? "right" : "left")
|
}
|
||||||
onExited: sharedTooltip.hide()
|
onEntered: sharedTooltip.show("Output Device", audioDevicesButton, 0, 0, isRightEdge ? "right" : "left")
|
||||||
}
|
onExited: sharedTooltip.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user