kdeconnect-kde/interfaces/CMakeLists.txt
Holger Kaelberer 040ad7357b kdeconnect-kde: Add remotekeyboard plugin
Allow to inject keypress events to remote peers (most notably Android devices)

Notes / open issues / possible improvements:

- For the json-payload I used the syntax of the key-events as sent by mousepad-plugin with the addition of a "sendAck"-flag. If "sendAck" is set to true the remote peer should echo a key-event if it could be handled, thus allowing the local client to find out whether the key was accepted. For performance reasons, it's allowed to send multi-char strings in the "key" property (performs much better if you send a whole string via "echo '...' |  kdeconnect-cli ..." e.g.)

- kdeconnect-cli: For now takes a string and transforms it into single key-events for visible characters only. In a first implementation I used a kbhit() helper that used termios.h to catch and relay keypresses interactively (including some special-events), which was not optimal. A better approch might be to use linux input-api directly. Would this be an option regarding cross-platform compatibility or can I assume to develop for Linux only? Being a command-line guy, I'd really like to have a fully featured kdeconnect-cli interface ;-)

- Factor out the Qt::Key-to-internal keymap to some core-helper because it corresponds to the mapping in the mousepad-plugin?

- The plasmoid is not perfect as it is: A single line containing a non-echoing TextField (i.e. it eats all the KeyPress events), and only ack-ed keypress-packets from the peer device are injected if they contain visible keys. Advantage: the user sees whether his key-presses are accepted by the peer device. Disadvantage: The echoed text does not correspond 1:1 to what is shown on the peer's display, user might be confused when typing without success. I played around with different variations each of which with its proper shortcomings:
1. An echoing Textfield for typing: Has the advantage that the user can directly see what he is typing, which makes interaction in the typing field easier, BUT messes up interaction if the Editor on the peer is changed silently and does not notify the user if his keypresses are not handled by the peer.
2. A non-echoing TextField for typing PLUS a readonly one for printing visible echoed keys. Disadvantage: same as for the previous one and uses more space on the plasmoid.
Comments? Ideas?

REVIEW: 129727
BUG: 370919
2017-01-10 21:12:42 +01:00

81 lines
3.6 KiB
CMake

project(KDEConnectInterfaces)
function(geninterface source_h output_h)
set(xml_file ${CMAKE_CURRENT_BINARY_DIR}/${output_h}.xml)
qt5_generate_dbus_interface( ${source_h} ${xml_file})
list(APPEND libkdeconnect_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${output_h})
set_source_files_properties(${xml_file} PROPERTIES NO_NAMESPACE true)
qt5_add_dbus_interface(libkdeconnect_SRC ${xml_file} ${output_h})
set(libkdeconnect_SRC ${libkdeconnect_SRC} PARENT_SCOPE)
set(libkdeconnect_HEADERS ${libkdeconnect_HEADERS} PARENT_SCOPE)
endfunction()
set(libkdeconnect_SRC
dbusinterfaces.cpp
devicesmodel.cpp
notificationsmodel.cpp
devicessortproxymodel.cpp
# modeltest.cpp
)
set(libkdeconnect_public_HEADERS
KDEConnect/DevicesModel
KDEConnect/NotificationsModel
)
set(libkdeconnect_HEADERS
devicesmodel.h
notificationsmodel.h
dbusinterfaces.h
${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterfaces_export.h
)
geninterface(${CMAKE_SOURCE_DIR}/core/daemon.h daemoninterface)
geninterface(${CMAKE_SOURCE_DIR}/core/device.h deviceinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/battery/batterydbusinterface.h devicebatteryinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/sftp/sftpplugin.h devicesftpinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notificationsdbusinterface.h devicenotificationsinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/findmyphone/findmyphoneplugin.h devicefindmyphoneinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notification.h notificationinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/mprisremote/mprisremoteplugin.h mprisremoteinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/remotecontrol/remotecontrolplugin.h remotecontrolinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/lockdevice/lockdeviceplugin.h lockdeviceinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/remotecommands/remotecommandsplugin.h remotecommandsinterface)
geninterface(${CMAKE_SOURCE_DIR}/plugins/remotekeyboard/remotekeyboardplugin.h remotekeyboardinterface)
add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC})
set_target_properties(kdeconnectinterfaces PROPERTIES
VERSION ${KDECONNECT_VERSION}
SOVERSION ${KDECONNECT_VERSION_MAJOR}
)
generate_export_header(kdeconnectinterfaces EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterfaces_export.h BASE_NAME KDEConnectInterfaces)
target_link_libraries(kdeconnectinterfaces
LINK_PUBLIC
Qt5::Gui
Qt5::DBus
LINK_PRIVATE
KF5::ConfigCore
KF5::I18n
)
configure_file(KDEConnectConfig.cmake.in ${CMAKE_BINARY_DIR}/interfaces/KDEConnectConfig.cmake @ONLY)
ecm_setup_version( "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}" VARIABLE_PREFIX KDECONNECTINTERFACES
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterfaces_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDEConnectConfigVersion.cmake"
SOVERSION ${KDECONNECT_VERSION_MAJOR})
install(TARGETS kdeconnectinterfaces EXPORT kdeconnectLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
## Don't install header files until API/ABI policy is defined
#
# install(FILES ${libkdeconnect_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kdeconnect COMPONENT Devel)
# install(FILES ${libkdeconnect_public_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/KDEConnect COMPONENT Devel)
# install(FILES ${CMAKE_BINARY_DIR}/interfaces/KDEConnectConfig.cmake
# ${CMAKE_BINARY_DIR}/interfaces/KDEConnectConfigVersion.cmake
# DESTINATION ${LIB_INSTALL_DIR}/cmake/KDEConnect)