Commit a6de73d4 authored by Piyush Aggarwal's avatar Piyush Aggarwal 🎮
Browse files

add compilation check for WIN_SDK_VERSION

parent d11f15a3
Pipeline #65894 passed with stage
in 4 minutes and 25 seconds
...@@ -100,6 +100,11 @@ if (KF5_OPTIONAL_COMPONENTS) ...@@ -100,6 +100,11 @@ if (KF5_OPTIONAL_COMPONENTS)
find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS}) find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS})
endif() 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) if (NOT ZSH_AUTOCOMPLETE_DIR)
set(ZSH_AUTOCOMPLETE_DIR "${KDE_INSTALL_DATADIR}/zsh/site-functions") set(ZSH_AUTOCOMPLETE_DIR "${KDE_INSTALL_DATADIR}/zsh/site-functions")
endif() endif()
......
...@@ -130,13 +130,14 @@ void MprisControlPlugin::updatePlayerList() { ...@@ -130,13 +130,14 @@ void MprisControlPlugin::updatePlayerList() {
const auto player = sessions.GetAt(i); const auto player = sessions.GetAt(i);
auto playerName = player.SourceAppUserModelId(); auto playerName = player.SourceAppUserModelId();
#if WIN_SDK_VERSION >= 19041
// try to resolve the AUMID to a user-friendly name // try to resolve the AUMID to a user-friendly name
try { try {
playerName = AppInfo::GetFromAppUserModelId(playerName).DisplayInfo().DisplayName(); playerName = AppInfo::GetFromAppUserModelId(playerName).DisplayInfo().DisplayName();
} catch (winrt::hresult_error e) { } catch (winrt::hresult_error e) {
qCDebug(KDECONNECT_PLUGIN_MPRIS) << QString::fromWCharArray(playerName.c_str()) << "doesn\'t have a valid AppUserModelID! Sending as-is.."; 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()); QString uniqueName = QString::fromWCharArray(playerName.c_str());
for (int i = 2; playerList.contains(uniqueName); ++i) { for (int i = 2; playerList.contains(uniqueName); ++i) {
uniqueName += QStringLiteral(" [") + QString::number(i) + QStringLiteral("]"); uniqueName += QStringLiteral(" [") + QString::number(i) + QStringLiteral("]");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment