icons: add qrc for device status icons

This commit is contained in:
Piyush Aggarwal 2021-05-23 10:24:04 +05:30
parent 92237d416e
commit aee2b593de
7 changed files with 66 additions and 45 deletions

View file

@ -1,6 +1,12 @@
qt5_add_resources(kdeconnect_SRCS resources.qrc) qt5_add_resources(kdeconnect_SRCS resources.qrc)
add_executable(kdeconnect-app main.cpp ${kdeconnect_SRCS}) qt5_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc)
add_executable(kdeconnect-app
main.cpp
${kdeconnect_SRCS}
${kdeconnect_custom_icons_SRCS}
)
target_link_libraries(kdeconnect-app Qt5::Quick Qt5::QuickControls2 Qt5::Widgets KF5::CoreAddons KF5::I18n) target_link_libraries(kdeconnect-app Qt5::Quick Qt5::QuickControls2 Qt5::Widgets KF5::CoreAddons KF5::I18n)
install(TARGETS kdeconnect-app ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kdeconnect-app ${INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -13,42 +13,3 @@ if(APPLE)
endif() endif()
ecm_install_icons(ICONS ${APP_ICONS} DESTINATION ${ICON_INSTALL_DIR}) ecm_install_icons(ICONS ${APP_ICONS} DESTINATION ${ICON_INSTALL_DIR})
ecm_install_icons(ICONS
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-laptopconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-laptopdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-laptoptrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-smartphoneconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-smartphonedisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-smartphonetrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-tabletconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-tabletdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-tablettrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-tvconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-tvdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/16-status-tvtrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-laptopconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-laptopdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-laptoptrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-smartphoneconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-smartphonedisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-smartphonetrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-tabletconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-tabletdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-tablettrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-tvconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-tvdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/22-status-tvtrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-laptopconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-laptopdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-laptoptrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-smartphoneconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-smartphonedisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-smartphonetrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-tabletconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-tabletdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-tablettrusted.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-tvconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-tvdisconnected.svg
${CMAKE_CURRENT_SOURCE_DIR}/status/32-status-tvtrusted.svg
DESTINATION ${ICON_INSTALL_DIR})

46
icons/custom_icons.qrc Normal file
View file

@ -0,0 +1,46 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/icons/hicolor/16x16/status/">
<file alias="laptopconnected.svg">status/16-status-laptopconnected.svg</file>
<file alias="laptopdisconnected.svg">status/16-status-laptopdisconnected.svg</file>
<file alias="laptoptrusted.svg">status/16-status-laptoptrusted.svg</file>
<file alias="smartphoneconnected.svg">status/16-status-smartphoneconnected.svg</file>
<file alias="smartphonedisconnected.svg">status/16-status-smartphonedisconnected.svg</file>
<file alias="smartphonetrusted.svg">status/16-status-smartphonetrusted.svg</file>
<file alias="tabletconnected.svg">status/16-status-tabletconnected.svg</file>
<file alias="tabletdisconnected.svg">status/16-status-tabletdisconnected.svg</file>
<file alias="tablettrusted.svg">status/16-status-tablettrusted.svg</file>
<file alias="tvconnected.svg">status/16-status-tvconnected.svg</file>
<file alias="tvdisconnected.svg">status/16-status-tvdisconnected.svg</file>
<file alias="tvtrusted.svg">status/16-status-tvtrusted.svg</file>
</qresource>
<qresource prefix="/icons/hicolor/22x22/status/">
<file alias="laptopconnected.svg">status/22-status-laptopconnected.svg</file>
<file alias="laptopdisconnected.svg">status/22-status-laptopdisconnected.svg</file>
<file alias="laptoptrusted.svg">status/22-status-laptoptrusted.svg</file>
<file alias="smartphoneconnected.svg">status/22-status-smartphoneconnected.svg</file>
<file alias="smartphonedisconnected.svg">status/22-status-smartphonedisconnected.svg</file>
<file alias="smartphonetrusted.svg">status/22-status-smartphonetrusted.svg</file>
<file alias="tabletconnected.svg">status/22-status-tabletconnected.svg</file>
<file alias="tabletdisconnected.svg">status/22-status-tabletdisconnected.svg</file>
<file alias="tablettrusted.svg">status/22-status-tablettrusted.svg</file>
<file alias="tvconnected.svg">status/22-status-tvconnected.svg</file>
<file alias="tvdisconnected.svg">status/22-status-tvdisconnected.svg</file>
<file alias="tvtrusted.svg">status/22-status-tvtrusted.svg</file>
</qresource>
<qresource prefix="/icons/hicolor/32x32/status/">
<file alias="laptopconnected.svg">status/32-status-laptopconnected.svg</file>
<file alias="laptopdisconnected.svg">status/32-status-laptopdisconnected.svg</file>
<file alias="laptoptrusted.svg">status/32-status-laptoptrusted.svg</file>
<file alias="smartphoneconnected.svg">status/32-status-smartphoneconnected.svg</file>
<file alias="smartphonedisconnected.svg">status/32-status-smartphonedisconnected.svg</file>
<file alias="smartphonetrusted.svg">status/32-status-smartphonetrusted.svg</file>
<file alias="tabletconnected.svg">status/32-status-tabletconnected.svg</file>
<file alias="tabletdisconnected.svg">status/32-status-tabletdisconnected.svg</file>
<file alias="tablettrusted.svg">status/32-status-tablettrusted.svg</file>
<file alias="tvconnected.svg">status/32-status-tvconnected.svg</file>
<file alias="tvdisconnected.svg">status/32-status-tvdisconnected.svg</file>
<file alias="tvtrusted.svg">status/32-status-tvtrusted.svg</file>
</qresource>
</RCC>

View file

@ -7,9 +7,12 @@ ecm_qt_declare_logging_category(
DEFAULT_SEVERITY Warning DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (indicator)") EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (indicator)")
qt5_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc)
set(indicator_SRCS set(indicator_SRCS
main.cpp main.cpp
deviceindicator.cpp deviceindicator.cpp
${kdeconnect_custom_icons_SRCS}
) )
include(ECMAddAppIcon) include(ECMAddAppIcon)

View file

@ -58,11 +58,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
, m_device(device) , m_device(device)
, m_remoteCommandsInterface(new RemoteCommandsDbusInterface(m_device->id())) , m_remoteCommandsInterface(new RemoteCommandsDbusInterface(m_device->id()))
{ {
#ifdef Q_OS_WIN
setIcon(QIcon(QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("icons/hicolor/scalable/status/") + device->iconName() + QStringLiteral(".svg"))));
#else
setIcon(QIcon::fromTheme(device->iconName())); setIcon(QIcon::fromTheme(device->iconName()));
#endif
connect(device, SIGNAL(nameChanged(QString)), this, SLOT(setText(QString))); connect(device, SIGNAL(nameChanged(QString)), this, SLOT(setText(QString)));

View file

@ -1,6 +1,12 @@
add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-settings") add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-settings")
add_executable(kdeconnect-settings main.cpp) qt5_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc)
add_executable(kdeconnect-settings
main.cpp
${kdeconnect_custom_icons_SRCS}
)
target_link_libraries(kdeconnect-settings kdeconnectversion KF5::I18n KF5::KCMUtils KF5::DBusAddons) target_link_libraries(kdeconnect-settings kdeconnectversion KF5::I18n KF5::KCMUtils KF5::DBusAddons)
install(TARGETS kdeconnect-settings ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kdeconnect-settings ${INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -35,6 +35,8 @@ target_link_libraries(kdeconnectsmshelper
kdeconnectinterfaces kdeconnectinterfaces
) )
qt5_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc)
add_executable(kdeconnect-sms add_executable(kdeconnect-sms
main.cpp main.cpp
conversationlistmodel.cpp conversationlistmodel.cpp
@ -43,6 +45,7 @@ add_executable(kdeconnect-sms
resources.qrc resources.qrc
thumbnailsprovider.cpp thumbnailsprovider.cpp
attachmentinfo.cpp attachmentinfo.cpp
${kdeconnect_custom_icons_SRCS}
${sms_debug_files_SRCS}) ${sms_debug_files_SRCS})
target_link_libraries(kdeconnect-sms target_link_libraries(kdeconnect-sms