Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KDE Connect
Commits
d71af013
Commit
d71af013
authored
Jun 24, 2021
by
Piyush Aggarwal
🎮
Browse files
mpriscontrolplugin-win: add nullptr check for autoRepeatMode and isShuffleActive
parent
3ffe96a8
Pipeline
#67335
passed with stage
in 6 minutes and 31 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
plugins/mpriscontrol/mpriscontrolplugin-win.cpp
View file @
d71af013
...
...
@@ -86,6 +86,19 @@ void MprisControlPlugin::sendPlaybackInfo(std::variant<NetworkPacket, QString> c
auto
playbackInfo
=
player
.
GetPlaybackInfo
();
auto
playbackControls
=
playbackInfo
.
Controls
();
np
.
set
(
QStringLiteral
(
"isPlaying"
),
playbackInfo
.
PlaybackStatus
()
==
GlobalSystemMediaTransportControlsSessionPlaybackStatus
::
Playing
);
np
.
set
(
QStringLiteral
(
"canPause"
),
playbackControls
.
IsPauseEnabled
());
np
.
set
(
QStringLiteral
(
"canPlay"
),
playbackControls
.
IsPlayEnabled
());
np
.
set
(
QStringLiteral
(
"canGoNext"
),
playbackControls
.
IsNextEnabled
());
np
.
set
(
QStringLiteral
(
"canGoPrevious"
),
playbackControls
.
IsPreviousEnabled
());
np
.
set
(
QStringLiteral
(
"canSeek"
),
playbackControls
.
IsPlaybackPositionEnabled
());
if
(
playbackInfo
.
IsShuffleActive
())
{
const
bool
shuffleStatus
=
playbackInfo
.
IsShuffleActive
().
Value
();
np
.
set
(
QStringLiteral
(
"shuffle"
),
shuffleStatus
);
}
if
(
playbackInfo
.
AutoRepeatMode
())
{
QString
loopStatus
;
switch
(
playbackInfo
.
AutoRepeatMode
().
Value
())
{
case
Windows
::
Media
::
MediaPlaybackAutoRepeatMode
::
List
:
{
...
...
@@ -101,15 +114,8 @@ void MprisControlPlugin::sendPlaybackInfo(std::variant<NetworkPacket, QString> c
break
;
}
}
np
.
set
(
QStringLiteral
(
"isPlaying"
),
playbackInfo
.
PlaybackStatus
()
==
GlobalSystemMediaTransportControlsSessionPlaybackStatus
::
Playing
);
np
.
set
(
QStringLiteral
(
"canPause"
),
playbackControls
.
IsPauseEnabled
());
np
.
set
(
QStringLiteral
(
"canPlay"
),
playbackControls
.
IsPlayEnabled
());
np
.
set
(
QStringLiteral
(
"canGoNext"
),
playbackControls
.
IsNextEnabled
());
np
.
set
(
QStringLiteral
(
"canGoPrevious"
),
playbackControls
.
IsPreviousEnabled
());
np
.
set
(
QStringLiteral
(
"canSeek"
),
playbackControls
.
IsPlaybackPositionEnabled
());
np
.
set
(
QStringLiteral
(
"shuffle"
),
playbackInfo
.
IsShuffleActive
().
Value
());
np
.
set
(
QStringLiteral
(
"loopStatus"
),
loopStatus
);
}
sendTimelineProperties
(
np
,
player
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment