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
d11f15a3
Commit
d11f15a3
authored
Jun 15, 2021
by
Piyush Aggarwal
🎮
Browse files
mpriscontrolplugin: resolve AUMID to display name of the media app when possible
parent
ad35ae75
Pipeline
#65891
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
plugins/mpriscontrol/mpriscontrolplugin-win.cpp
View file @
d11f15a3
...
@@ -128,11 +128,18 @@ void MprisControlPlugin::updatePlayerList() {
...
@@ -128,11 +128,18 @@ void MprisControlPlugin::updatePlayerList() {
for
(
uint32_t
i
=
0
;
i
<
sessions
.
Size
();
i
++
)
{
for
(
uint32_t
i
=
0
;
i
<
sessions
.
Size
();
i
++
)
{
const
auto
player
=
sessions
.
GetAt
(
i
);
const
auto
player
=
sessions
.
GetAt
(
i
);
auto
playerName
=
player
.
SourceAppUserModelId
();
QString
name
=
QString
::
fromWCharArray
(
player
.
SourceAppUserModelId
().
c_str
());
// try to resolve the AUMID to a user-friendly name
QString
uniqueName
=
name
;
try
{
playerName
=
AppInfo
::
GetFromAppUserModelId
(
playerName
).
DisplayInfo
().
DisplayName
();
}
catch
(
winrt
::
hresult_error
e
)
{
qCDebug
(
KDECONNECT_PLUGIN_MPRIS
)
<<
QString
::
fromWCharArray
(
playerName
.
c_str
())
<<
"doesn
\'
t have a valid AppUserModelID! Sending as-is.."
;
}
QString
uniqueName
=
QString
::
fromWCharArray
(
playerName
.
c_str
());
for
(
int
i
=
2
;
playerList
.
contains
(
uniqueName
);
++
i
)
{
for
(
int
i
=
2
;
playerList
.
contains
(
uniqueName
);
++
i
)
{
uniqueName
=
name
+
QStringLiteral
(
" ["
)
+
QString
::
number
(
i
)
+
QStringLiteral
(
"]"
);
uniqueName
+
=
QStringLiteral
(
" ["
)
+
QString
::
number
(
i
)
+
QStringLiteral
(
"]"
);
}
}
playerList
.
insert
(
uniqueName
,
player
);
playerList
.
insert
(
uniqueName
,
player
);
...
...
plugins/mpriscontrol/mpriscontrolplugin-win.h
View file @
d11f15a3
...
@@ -17,10 +17,12 @@
...
@@ -17,10 +17,12 @@
#include
<winrt/Windows.Media.Control.h>
#include
<winrt/Windows.Media.Control.h>
#include
<winrt/Windows.Storage.Streams.h>
#include
<winrt/Windows.Storage.Streams.h>
#include
<winrt/Windows.Foundation.Collections.h>
#include
<winrt/Windows.Foundation.Collections.h>
#include
<winrt/Windows.ApplicationModel.h>
using
namespace
winrt
;
using
namespace
winrt
;
using
namespace
Windows
::
Media
::
Control
;
using
namespace
Windows
::
Media
::
Control
;
using
namespace
Windows
::
Storage
::
Streams
;
using
namespace
Windows
::
Storage
::
Streams
;
using
namespace
Windows
::
ApplicationModel
;
#define PACKET_TYPE_MPRIS QStringLiteral("kdeconnect.mpris")
#define PACKET_TYPE_MPRIS QStringLiteral("kdeconnect.mpris")
...
...
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