diff --git a/CMakeLists.txt b/CMakeLists.txt index 43d175093..27ed1d798 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,11 @@ if (KF5_OPTIONAL_COMPONENTS) find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS}) endif() +if (WIN32) + string(REGEX MATCH "[0-9][0-9][0-9][0-9][0-9]" WIN_SDK_VERSION "${CMAKE_SYSTEM_VERSION}" ) + add_compile_definitions(WIN_SDK_VERSION=${WIN_SDK_VERSION}) +endif() + if (NOT ZSH_AUTOCOMPLETE_DIR) set(ZSH_AUTOCOMPLETE_DIR "${KDE_INSTALL_DATADIR}/zsh/site-functions") endif() diff --git a/plugins/mpriscontrol/mpriscontrolplugin-win.cpp b/plugins/mpriscontrol/mpriscontrolplugin-win.cpp index f10ced96a..7acece777 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin-win.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin-win.cpp @@ -130,13 +130,14 @@ void MprisControlPlugin::updatePlayerList() { const auto player = sessions.GetAt(i); auto playerName = player.SourceAppUserModelId(); +#if WIN_SDK_VERSION >= 19041 // try to resolve the AUMID to a user-friendly 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.."; } - +#endif QString uniqueName = QString::fromWCharArray(playerName.c_str()); for (int i = 2; playerList.contains(uniqueName); ++i) { uniqueName += QStringLiteral(" [") + QString::number(i) + QStringLiteral("]");