Merging upstream version 0.9.0+20150806.
This commit is contained in:
parent
8180839f3b
commit
16d840e14e
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
|
||||
|
||||
project(lxqt-globalkeys)
|
||||
|
||||
@ -11,64 +11,85 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
# Set default library installation path
|
||||
set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Installation directory for libraries")
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5DBus REQUIRED)
|
||||
find_package(Qt5LinguistTools REQUIRED QUIET)
|
||||
find_package(lxqt REQUIRED QUIET)
|
||||
include(${LXQT_USE_FILE})
|
||||
|
||||
|
||||
include(LXQtTranslate)
|
||||
include(LXQtCreatePkgConfigFile)
|
||||
include(LXQtCompilerSettings NO_POLICY_SCOPE)
|
||||
|
||||
# Standard directories for installation
|
||||
include(GNUInstallDirs)
|
||||
include(GNUInstallDirs) # Standard directories for installation
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
set(LXQT_GLOBALKEYS_LIBRARY_NAME lxqt-globalkeys)
|
||||
set(LXQT_GLOBALKEYS_UI_LIBRARY_NAME lxqt-globalkeys-ui)
|
||||
set(LXQT_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)
|
||||
set(LXQT_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake")
|
||||
|
||||
#************************************************
|
||||
# Build config.cmake files
|
||||
#************************************************
|
||||
#set(LXQT_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/lxqt)
|
||||
#set(LXQT_TRANSLATIONS_DIR ${LXQT_SHARE_DIR}/translations)
|
||||
include(cmake/FindInstallConfigPath.cmake)
|
||||
|
||||
set(LXQT_GLOBALKEYS_CMAKE_NAME ${LXQT_GLOBALKEYS_LIBRARY_NAME})
|
||||
set(LXQT_GLOBALKEYS_UI_CMAKE_NAME ${LXQT_GLOBALKEYS_UI_LIBRARY_NAME})
|
||||
|
||||
set(LXQT_GLOBALKEYS_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/${LXQT_GLOBALKEYS_LIBRARY_NAME}")
|
||||
configure_file(
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt_globalkeys-config.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}-config.cmake"
|
||||
@ONLY
|
||||
"${CMAKE_BINARY_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}-config.cmake"
|
||||
INSTALL_DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}"
|
||||
)
|
||||
|
||||
set(LXQT_GLOBALKEYS_UI_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include/${LXQT_GLOBALKEYS_UI_LIBRARY_NAME})
|
||||
configure_file(
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt_globalkeys_ui-config.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}-config.cmake"
|
||||
@ONLY
|
||||
"${CMAKE_BINARY_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}-config.cmake"
|
||||
INSTALL_DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}"
|
||||
)
|
||||
#************************************************
|
||||
# End of build config.cmake
|
||||
#************************************************
|
||||
|
||||
#************************************************
|
||||
# Generate config-version.cmake files
|
||||
#************************************************
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_BINARY_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}-config-version.cmake"
|
||||
VERSION ${LXQT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_BINARY_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}-config-version.cmake"
|
||||
VERSION ${LXQT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
#************************************************
|
||||
# End of generate config-version.cmake files
|
||||
#************************************************
|
||||
|
||||
set(LXQT_GLOBALKEYS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
add_subdirectory(daemon)
|
||||
add_subdirectory(config)
|
||||
add_subdirectory(client)
|
||||
add_subdirectory(ui)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}-config.cmake DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME})
|
||||
install(FILES cmake/lxqt_globalkeys_use.cmake DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME})
|
||||
install(FILES
|
||||
"${CMAKE_BINARY_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}-config.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}-config-version.cmake"
|
||||
DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}"
|
||||
)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}-config.cmake DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME})
|
||||
install(FILES cmake/lxqt_globalkeys_ui_use.cmake DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME})
|
||||
install(FILES
|
||||
"${CMAKE_BINARY_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}-config.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}-config-version.cmake"
|
||||
DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}"
|
||||
)
|
||||
|
||||
# building tarball with CPack -------------------------------------------------
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
@ -5,15 +5,8 @@ set(QT_DBUS_PREFIX "org.qtproject")
|
||||
|
||||
set(${PROJECT_NAME}_HEADER_NAMESPACE "LXQtGlobalKeys")
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_PATH_TO_DAEMON "${LXQT_GLOBALKEYS_SOURCE_DIR}/daemon")
|
||||
|
||||
add_definitions(-DSHARED_EXPORT=Q_DECL_EXPORT)
|
||||
|
||||
set(${PROJECT_NAME}_SOURCES
|
||||
client.cpp
|
||||
action.cpp
|
||||
@ -21,7 +14,7 @@ set(${PROJECT_NAME}_SOURCES
|
||||
|
||||
#
|
||||
# WARNING: Changing stuff here implies changing this:
|
||||
# install(FILES ${${PROJECT_NAME}_MAIN_HEADER} DESTINATION include/${PROJECT_NAME} COMPONENT development RENAME "lxqtglobalkeys.h")
|
||||
# install(FILES ${${PROJECT_NAME}_MAIN_HEADER} DESTINATION include/${PROJECT_NAME} COMPONENT Devel RENAME "lxqtglobalkeys.h")
|
||||
#
|
||||
set(${PROJECT_NAME}_MAIN_HEADER
|
||||
lxqt-globalkeys.h
|
||||
@ -53,10 +46,10 @@ set(${PROJECT_NAME}_TRANSLATIONS
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_DBUS_ADAPTORS
|
||||
${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.client.xml
|
||||
"${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.client.xml"
|
||||
)
|
||||
|
||||
set_source_files_properties(${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.client.xml PROPERTIES
|
||||
set_source_files_properties("${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.client.xml" PROPERTIES
|
||||
INCLUDE action_p.h
|
||||
PARENT_CLASSNAME GlobalKeyShortcut::ActionImpl
|
||||
BASENAME org.lxqt.global_key_shortcuts.client
|
||||
@ -64,10 +57,10 @@ set_source_files_properties(${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_ke
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_DBUS_INTERFACES
|
||||
${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.native.xml
|
||||
"${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.native.xml"
|
||||
)
|
||||
|
||||
set_source_files_properties(${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.native.xml PROPERTIES
|
||||
set_source_files_properties("${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.native.xml" PROPERTIES
|
||||
BASENAME org.lxqt.global_key_shortcuts.native
|
||||
)
|
||||
|
||||
@ -128,16 +121,15 @@ foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
|
||||
get_source_file_property(DBUS_INTERFACE_INCLUDE ${DBUS_INTERFACE} INCLUDE)
|
||||
get_source_file_property(DBUS_INTERFACE_CLASSNAME ${DBUS_INTERFACE} CLASSNAME)
|
||||
get_source_file_property(DBUS_INTERFACE_NO_NAMESPACE ${DBUS_INTERFACE} NO_NAMESPACE)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} PROPERTIES
|
||||
set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}" PROPERTIES
|
||||
INCLUDE ${DBUS_INTERFACE_INCLUDE}
|
||||
CLASSNAME ${DBUS_INTERFACE_CLASSNAME}
|
||||
NO_NAMESPACE ${DBUS_INTERFACE_NO_NAMESPACE}
|
||||
)
|
||||
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} ${DBUS_INTERFACE_BASENAME})
|
||||
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}" ${DBUS_INTERFACE_BASENAME})
|
||||
endforeach()
|
||||
|
||||
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
|
||||
qt5_wrap_ui(${PROJECT_NAME}_FORM_FILES ${${PROJECT_NAME}_FORMS})
|
||||
|
||||
set(${PROJECT_NAME}_GENERATED_FILES
|
||||
${${PROJECT_NAME}_FORM_FILES}
|
||||
@ -153,13 +145,32 @@ set(${PROJECT_NAME}_ALL_FILES
|
||||
${${PROJECT_NAME}_GENERATED_FILES}
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_PKG_CONFIG_REQUIRES "Qt5Widget, Qt5DBus")
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_ALL_FILES})
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::DBus)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
Qt5::Widgets
|
||||
Qt5::DBus
|
||||
)
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
VERSION ${LXQT_VERSION}
|
||||
SOVERSION ${LXQT_MAJOR_VERSION}
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${LXQT_GLOBALKEYS_LIBRARY_NAME}>"
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/include>"
|
||||
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}>"
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PRIVATE "SHARED_EXPORT=Q_DECL_EXPORT"
|
||||
)
|
||||
|
||||
export(TARGETS ${PROJECT_NAME} FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}-targets.cmake")
|
||||
|
||||
include(create_portable_headers)
|
||||
|
||||
@ -167,11 +178,75 @@ create_portable_headers(${PROJECT_NAME}_PORTABLE_HEADERS
|
||||
NAMESPACE "${${PROJECT_NAME}_NAMESPACE}/"
|
||||
FILENAMES ${${PROJECT_NAME}_PUBLIC_CLASSES}
|
||||
)
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT runtime)
|
||||
install(FILES ${${PROJECT_NAME}_MAIN_HEADER} DESTINATION include/${PROJECT_NAME} COMPONENT development)
|
||||
install(FILES ${${PROJECT_NAME}_MAIN_HEADER} DESTINATION include/${PROJECT_NAME} COMPONENT development RENAME "lxqtglobalkeys.h")
|
||||
install(FILES ${${PROJECT_NAME}_PORTABLE_HEADERS} DESTINATION include/${PROJECT_NAME}/${${PROJECT_NAME}_HEADER_NAMESPACE} COMPONENT development)
|
||||
install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT development)
|
||||
|
||||
include(create_pkgconfig_file)
|
||||
create_pkgconfig_file(${PROJECT_NAME} "LXQt global key shortcuts client library")
|
||||
# Copy public headers for intree building
|
||||
foreach(h ${${PROJECT_NAME}_PUBLIC_HEADERS})
|
||||
get_filename_component(bh ${h} NAME)
|
||||
configure_file(${h} "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}/${bh}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
foreach(h ${${PROJECT_NAME}_PORTABLE_HEADERS})
|
||||
get_filename_component(bh ${h} NAME)
|
||||
configure_file(${h} "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}/${${PROJECT_NAME}_HEADER_NAMESPACE}/${bh}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
configure_file(
|
||||
"${${PROJECT_NAME}_MAIN_HEADER}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}/${${PROJECT_NAME}_MAIN_HEADER}"
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
configure_file(
|
||||
"${${PROJECT_NAME}_MAIN_HEADER}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}/lxqtglobalkeys.h"
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
install(TARGETS
|
||||
${PROJECT_NAME}
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
EXPORT ${PROJECT_NAME}-targets
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
||||
install(EXPORT
|
||||
${PROJECT_NAME}-targets
|
||||
DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${${PROJECT_NAME}_MAIN_HEADER}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${${PROJECT_NAME}_MAIN_HEADER}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
|
||||
COMPONENT Devel
|
||||
RENAME "lxqtglobalkeys.h"
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${${PROJECT_NAME}_PORTABLE_HEADERS}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${${PROJECT_NAME}_HEADER_NAMESPACE}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${${PROJECT_NAME}_PUBLIC_HEADERS}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
lxqt_create_pkgconfig_file(
|
||||
PACKAGE_NAME ${PROJECT_NAME}
|
||||
DESCRIPTIVE_NAME ${PROJECT_NAME}
|
||||
DESCRIPTION "LXQt global key shortcuts client library"
|
||||
INCLUDEDIRS ${PROJECT_NAME}
|
||||
LIBS ${PROJECT_NAME}
|
||||
REQUIRES ${${PROJECT_NAME}_PKG_CONFIG_REQUIRES}
|
||||
VERSION ${LXQT_VERSION}
|
||||
INSTALL
|
||||
)
|
||||
|
@ -41,9 +41,11 @@ ActionImpl::ActionImpl(ClientImpl *client, Action *interface, const QString &pat
|
||||
, mInterface(interface)
|
||||
, mPath(path)
|
||||
, mDescription(description)
|
||||
, mRegistrationPending(false)
|
||||
{
|
||||
new OrgLxqtActionClientAdaptor(this);
|
||||
|
||||
connect(this, SIGNAL(emitRegistrationFinished()), mInterface, SIGNAL(registrationFinished()));
|
||||
connect(this, SIGNAL(emitActivated()), mInterface, SIGNAL(activated()));
|
||||
connect(this, SIGNAL(emitShortcutChanged(QString, QString)), mInterface, SIGNAL(shortcutChanged(QString, QString)));
|
||||
}
|
||||
@ -55,12 +57,18 @@ ActionImpl::~ActionImpl()
|
||||
|
||||
QString ActionImpl::changeShortcut(const QString &shortcut)
|
||||
{
|
||||
if (mRegistrationPending)
|
||||
return mShortcut;
|
||||
|
||||
mShortcut = mClient->changeClientActionShortcut(mPath, shortcut);
|
||||
return mShortcut;
|
||||
}
|
||||
|
||||
bool ActionImpl::changeDescription(const QString &description)
|
||||
{
|
||||
if (mRegistrationPending)
|
||||
return false;
|
||||
|
||||
bool result = mClient->modifyClientAction(mPath, description);
|
||||
if (result)
|
||||
{
|
||||
@ -99,6 +107,19 @@ bool ActionImpl::isValid() const
|
||||
return mValid;
|
||||
}
|
||||
|
||||
void ActionImpl::setRegistrationPending(bool registrationPending)
|
||||
{
|
||||
mRegistrationPending = registrationPending;
|
||||
if (!mRegistrationPending)
|
||||
emit emitRegistrationFinished();
|
||||
|
||||
}
|
||||
|
||||
bool ActionImpl::isRegistrationPending() const
|
||||
{
|
||||
return mRegistrationPending;
|
||||
}
|
||||
|
||||
void ActionImpl::activated()
|
||||
{
|
||||
emit emitActivated();
|
||||
|
@ -62,8 +62,10 @@ public:
|
||||
QString description() const;
|
||||
|
||||
bool isValid() const;
|
||||
bool isRegistrationPending() const;
|
||||
|
||||
signals:
|
||||
void registrationFinished();
|
||||
void activated();
|
||||
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
|
||||
|
||||
|
@ -60,11 +60,15 @@ public:
|
||||
void setValid(bool valid);
|
||||
bool isValid() const;
|
||||
|
||||
void setRegistrationPending(bool registrationPending);
|
||||
bool isRegistrationPending() const;
|
||||
|
||||
public slots:
|
||||
void activated();
|
||||
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
|
||||
|
||||
signals:
|
||||
void emitRegistrationFinished();
|
||||
void emitActivated();
|
||||
void emitShortcutChanged(const QString &oldShortcut, const QString &newShortcut);
|
||||
|
||||
@ -76,6 +80,7 @@ private:
|
||||
QString mShortcut;
|
||||
QString mDescription;
|
||||
bool mValid;
|
||||
bool mRegistrationPending;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -82,14 +82,11 @@ void ClientImpl::daemonAppeared(const QString &)
|
||||
{
|
||||
ActionImpl *globalActionImpl = I.value()->impl;
|
||||
|
||||
QDBusPendingReply<QString, qulonglong> reply = mProxy->addClientAction(globalActionImpl->shortcut(), QDBusObjectPath(globalActionImpl->path()), globalActionImpl->description());
|
||||
reply.waitForFinished();
|
||||
globalActionImpl->setValid(!reply.isError() && reply.argumentAt<1>());
|
||||
|
||||
if (globalActionImpl->isValid())
|
||||
{
|
||||
globalActionImpl->setShortcut(reply.argumentAt<0>());
|
||||
}
|
||||
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(mProxy->addClientAction(globalActionImpl->shortcut(), QDBusObjectPath(globalActionImpl->path()), globalActionImpl->description()));
|
||||
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), this, SLOT(registrationFinished(QDBusPendingCallWatcher *)));
|
||||
mPendingRegistrationsActions[watcher] = globalActionImpl;
|
||||
mPendingRegistrationsWatchers[globalActionImpl] = watcher;
|
||||
globalActionImpl->setRegistrationPending(true);
|
||||
}
|
||||
mDaemonPresent = true;
|
||||
emit emitDaemonAppeared();
|
||||
@ -101,6 +98,29 @@ bool ClientImpl::isDaemonPresent() const
|
||||
return mDaemonPresent;
|
||||
}
|
||||
|
||||
void ClientImpl::registrationFinished(QDBusPendingCallWatcher *watcher)
|
||||
{
|
||||
QMap<QDBusPendingCallWatcher*, ActionImpl*>::Iterator I = mPendingRegistrationsActions.find(watcher);
|
||||
if (I != mPendingRegistrationsActions.end())
|
||||
{
|
||||
ActionImpl *globalActionImpl = I.value();
|
||||
|
||||
QDBusPendingReply<QString, qulonglong> reply = *watcher;
|
||||
globalActionImpl->setValid(!reply.isError() && reply.argumentAt<1>());
|
||||
|
||||
if (globalActionImpl->isValid())
|
||||
{
|
||||
globalActionImpl->setShortcut(reply.argumentAt<0>());
|
||||
}
|
||||
|
||||
mPendingRegistrationsWatchers.remove(globalActionImpl);
|
||||
mPendingRegistrationsActions.erase(I);
|
||||
watcher->deleteLater();
|
||||
|
||||
globalActionImpl->setRegistrationPending(false);
|
||||
}
|
||||
}
|
||||
|
||||
Action *ClientImpl::addClientAction(const QString &shortcut, const QString &path, const QString &description, QObject *parent)
|
||||
{
|
||||
if (!QRegExp("(/[A-Za-z0-9_]+){2,}").exactMatch(path))
|
||||
@ -125,13 +145,11 @@ Action *ClientImpl::addClientAction(const QString &shortcut, const QString &path
|
||||
|
||||
if (mDaemonPresent)
|
||||
{
|
||||
QDBusPendingReply<QString, qulonglong> reply = mProxy->addClientAction(shortcut, QDBusObjectPath(path), description);
|
||||
reply.waitForFinished();
|
||||
globalActionImpl->setValid(!reply.isError() && reply.argumentAt<1>());
|
||||
if (globalActionImpl->isValid())
|
||||
{
|
||||
globalActionImpl->setShortcut(reply.argumentAt<0>());
|
||||
}
|
||||
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(mProxy->addClientAction(shortcut, QDBusObjectPath(path), description));
|
||||
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), this, SLOT(registrationFinished(QDBusPendingCallWatcher *)));
|
||||
mPendingRegistrationsActions[watcher] = globalActionImpl;
|
||||
mPendingRegistrationsWatchers[globalActionImpl] = watcher;
|
||||
globalActionImpl->setRegistrationPending(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -204,6 +222,21 @@ bool ClientImpl::removeClientAction(const QString &path)
|
||||
|
||||
void ClientImpl::removeAction(ActionImpl *actionImpl)
|
||||
{
|
||||
if (actionImpl->isRegistrationPending())
|
||||
{
|
||||
QMap<ActionImpl*, QDBusPendingCallWatcher*>::Iterator I = mPendingRegistrationsWatchers.find(actionImpl);
|
||||
if (I != mPendingRegistrationsWatchers.end())
|
||||
{
|
||||
QDBusPendingCallWatcher *watcher = I.value();
|
||||
|
||||
watcher->disconnect();
|
||||
|
||||
mPendingRegistrationsActions.remove(watcher);
|
||||
mPendingRegistrationsWatchers.erase(I);
|
||||
watcher->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
QString path = actionImpl->path();
|
||||
if (!mActions.contains(path))
|
||||
{
|
||||
|
@ -81,6 +81,7 @@ public slots:
|
||||
void grabShortcutFinished(QDBusPendingCallWatcher *call);
|
||||
void daemonDisappeared(const QString &);
|
||||
void daemonAppeared(const QString &);
|
||||
void registrationFinished(QDBusPendingCallWatcher *call);
|
||||
|
||||
signals:
|
||||
void emitShortcutGrabbed(const QString &);
|
||||
@ -98,6 +99,9 @@ private:
|
||||
QMap<QString, Action*> mActions;
|
||||
QDBusServiceWatcher *mServiceWatcher;
|
||||
bool mDaemonPresent;
|
||||
|
||||
QMap<QDBusPendingCallWatcher*, ActionImpl*> mPendingRegistrationsActions;
|
||||
QMap<ActionImpl*, QDBusPendingCallWatcher*> mPendingRegistrationsWatchers;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
# XDG standards expects system-wide configuration files in the /etc/xdg/lxqt location.
|
||||
# Unfortunately QSettings we are using internally can be overriden in the Qt compilation
|
||||
# time to use different path for system-wide configs. (for example configure ... -sysconfdir /etc/settings ...)
|
||||
# This path can be found calling Qt4's qmake:
|
||||
# qmake -query QT_INSTALL_CONFIGURATION
|
||||
#
|
||||
if(NOT DEFINED LXQT_ETC_XDG_DIR)
|
||||
if(NOT QT_QMAKE_EXECUTABLE)
|
||||
message(FATAL_ERROR "LXQT_ETC_XDG_DIR: qmake not found or wrongly detected (inlude before qt configured?)")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_CONFIGURATION
|
||||
OUTPUT_VARIABLE LXQT_ETC_XDG_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
message(STATUS "LXQT_ETC_XDG_DIR autodetected as '${LXQT_ETC_XDG_DIR}'")
|
||||
message(STATUS "You can set it manually with -DLXQT_ETC_XDG_DIR=<value>")
|
||||
message(STATUS "")
|
||||
endif ()
|
||||
|
@ -1,33 +0,0 @@
|
||||
#
|
||||
# Write a pkg-config pc file for given "name" with "decription"
|
||||
# Arguments:
|
||||
# name: a library name (withoud "lib" prefix and "so" suffixes
|
||||
# desc: a desription string
|
||||
#
|
||||
macro (create_pkgconfig_file name desc)
|
||||
set(_pkgfname "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc")
|
||||
#message(STATUS "${name}: writing pkgconfig file ${_pkgfname}")
|
||||
|
||||
file(WRITE "${_pkgfname}"
|
||||
"# file generated by LXQt cmake build\n"
|
||||
"prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"libdir=\${prefix}/lib${LIB_SUFFIX}\n"
|
||||
"includedir=\${prefix}/include\n"
|
||||
"\n"
|
||||
"Name: ${name}\n"
|
||||
"Description: ${desc}\n"
|
||||
"Version: ${LXQT_VERSION}\n"
|
||||
"Libs: -L\${libdir} -l${name}\n"
|
||||
"Cflags: -I\${includedir}\n"
|
||||
"\n"
|
||||
)
|
||||
|
||||
# FreeBSD loves to install files to different locations
|
||||
# http://www.freebsd.org/doc/handbook/dirstructure.html
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
install(FILES ${_pkgfname} DESTINATION libdata/pkgconfig)
|
||||
else()
|
||||
install(FILES ${_pkgfname} DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
||||
endif()
|
||||
|
||||
endmacro()
|
@ -3,41 +3,24 @@
|
||||
# The module defines the following variables
|
||||
# LXQT_GLOBALKEYS_FOUND - Set to TRUE if all of the above has been found
|
||||
#
|
||||
# LXQT_GLOBALKEYS_INCLUDE_DIR - The lxqt-globalkeys include directory
|
||||
#
|
||||
# LXQT_GLOBALKEYS_INCLUDE_DIRS - The lxqt-globalkeys include directory
|
||||
#
|
||||
# LXQT_GLOBALKEYS_LIBRARY_DIRS - The lxqt-globalkeys include directory
|
||||
#
|
||||
# LXQT_GLOBALKEYS_LIBRARIES - The libraries needed to use lxqt-globalkeys
|
||||
#
|
||||
# LXQT_GLOBALKEYS_USE_FILE - The variable LXQT_GLOBALKEYS_USE_FILE is set which is the path
|
||||
# to a CMake file that can be included to compile lxqt-globalkeys
|
||||
# applications and libraries. It sets up the compilation
|
||||
# environment for include directories and populates a
|
||||
# LXQT_GLOBALKEYS_LIBRARIES variable.
|
||||
#
|
||||
# LXQT_GLOBALKEYS_QT_LIBRARIES - The Qt libraries needed by lxqt-globalkeys
|
||||
#
|
||||
# Typical usage:
|
||||
# find_package(lxqt-globalkeys)
|
||||
# include(${LXQT_GLOBALKEYS_USE_FILE})
|
||||
# add_executable(use-lxqt-globalkeys main.cpp)
|
||||
# target_link_libraries(use-qtxdg ${LXQT_GLOBALKEYS_QT_LIBRARIES} ${LXQT_GLOBALKEYS_LIBRARIES})
|
||||
# target_link_libraries(use-lxqt-globalkeys lxqt-globalkeys)
|
||||
|
||||
set(LXQT_GLOBALKEYS_INCLUDE_DIR @LXQT_GLOBALKEYS_INCLUDE_DIR@)
|
||||
set(LXQT_GLOBALKEYS_LIBRARY @LXQT_GLOBALKEYS_LIBRARY_NAME@)
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set(LXQT_GLOBALKEYS_LIBRARIES "${LXQT_GLOBALKEYS_LIBRARY}")
|
||||
set(LXQT_GLOBALKEYS_INCLUDE_DIRS "${LXQT_GLOBALKEYS_INCLUDE_DIR}")
|
||||
set(LXQT_GLOBALKEYS_LIBRARY_DIRS @CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@)
|
||||
|
||||
set(LXQT_GLOBALKEYS_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/lxqt_globalkeys_use.cmake")
|
||||
set(LXQT_GLOBALKEYS_FOUND 1)
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
set(LXQT_GLOBALKEYS_MAJOR_VERSION @LXQT_MAJOR_VERSION@)
|
||||
set(LXQT_GLOBALKEYS_MINOR_VERSION @LXQT_MINOR_VERSION@)
|
||||
set(LXQT_GLOBALKEYS_PATCH_VERSION @LXQT_PATCH_VERSION@)
|
||||
set(LXQT_GLOBALKEYS_VERSION @LXQT_VERSION@)
|
||||
|
||||
mark_as_advanced(LXQT_GLOBALKEYS_LIBRARY LXQT_GLOBALKEYS_INCLUDE_DIR)
|
||||
find_dependency(Qt5Widgets)
|
||||
find_dependency(Qt5DBus)
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER 2.8.12)
|
||||
cmake_policy(SET CMP0024 OLD)
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/lxqt-globalkeys-targets.cmake")
|
||||
|
@ -3,41 +3,25 @@
|
||||
# The module defines the following variables
|
||||
# LXQT_GLOBALKEYS_UI_FOUND - Set to TRUE if all of the above has been found
|
||||
#
|
||||
# LXQT_GLOBALKEYS_UI_INCLUDE_DIR - The lxqt-globalkeys-ui include directory
|
||||
#
|
||||
# LXQT_GLOBALKEYS_UI_INCLUDE_DIRS - The lxqt-globalkeys-ui include directory
|
||||
#
|
||||
# LXQT_GLOBALKEYS_LIBRARY_DIRS - The lxqt-globalkeys include directory
|
||||
#
|
||||
# LXQT_GLOBALKEYS_UI_LIBRARIES - The libraries needed to use lxqt-globalkeys-ui
|
||||
#
|
||||
# LXQT_GLOBALKEYS_UI_USE_FILE - The variable LXQT_GLOBALKEYS_UI_USE_FILE is set which is the path
|
||||
# to a CMake file that can be included to compile lxqt-globalkeys-ui
|
||||
# applications and libraries. It sets up the compilation
|
||||
# environment for include directories and populates a
|
||||
# LXQT_GLOBALKEYS_UI_LIBRARIES variable.
|
||||
#
|
||||
# LXQT_GLOBALKEYS_UI_QT_LIBRARIES - The Qt libraries needed by lxqt-globalkeys-ui
|
||||
#
|
||||
# Typical usage:
|
||||
# find_package(lxqt-globalkeys-ui)
|
||||
# include(${LXQT_GLOBALKEYS_UI_USE_FILE})
|
||||
# add_executable(use-lxqt-globalkeys-ui main.cpp)
|
||||
# target_link_libraries(use-qtxdg ${LXQT_GLOBALKEYS_UI_QT_LIBRARIES} ${LXQT_GLOBALKEYS_UI_LIBRARIES})
|
||||
# target_link_libraries(use-lxqt-globalkeys-ui lxqt-globalkeys-ui)
|
||||
|
||||
set(LXQT_GLOBALKEYS_UI_INCLUDE_DIR @LXQT_GLOBALKEYS_UI_INCLUDE_DIR@)
|
||||
set(LXQT_GLOBALKEYS_UI_LIBRARY @LXQT_GLOBALKEYS_UI_LIBRARY_NAME@)
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set(LXQT_GLOBALKEYS_UI_LIBRARIES "${LXQT_GLOBALKEYS_UI_LIBRARY}")
|
||||
set(LXQT_GLOBALKEYS_UI_INCLUDE_DIRS "${LXQT_GLOBALKEYS_UI_INCLUDE_DIR}")
|
||||
set(LXQT_GLOBALKEYS_UI_LIBRARY_DIRS @CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@)
|
||||
|
||||
set(LXQT_GLOBALKEYS_UI_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/lxqt_globalkeys_ui_use.cmake")
|
||||
set(LXQT_GLOBALKEYS_UI_FOUND 1)
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
set(LXQT_GLOBALKEYS_UI_MAJOR_VERSION @LXQT_MAJOR_VERSION@)
|
||||
set(LXQT_GLOBALKEYS_UI_MINOR_VERSION @LXQT_MINOR_VERSION@)
|
||||
set(LXQT_GLOBALKEYS_UI_PATCH_VERSION @LXQT_PATCH_VERSION@)
|
||||
set(LXQT_GLOBALKEYS_UI_VERSION @LXQT_VERSION@)
|
||||
|
||||
mark_as_advanced(LXQT_GLOBALKEYS_UI_LIBRARY LXQT_GLOBALKEYS_UI_INCLUDE_DIR)
|
||||
find_dependency(Qt5Widgets)
|
||||
find_dependency(Qt5DBus)
|
||||
find_dependency(lxqt-globalkeys)
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER 2.8.12)
|
||||
cmake_policy(SET CMP0024 OLD)
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/lxqt-globalkeys-ui-targets.cmake")
|
||||
|
@ -1,2 +0,0 @@
|
||||
include_directories(${LXQT_GLOBALKEYS_UI_INCLUDE_DIRS})
|
||||
link_directories(${LXQT_GLOBALKEYS_UI_LIBRARY_DIRS})
|
@ -1,2 +0,0 @@
|
||||
include_directories(${LXQT_GLOBALKEYS_INCLUDE_DIRS})
|
||||
link_directories(${LXQT_GLOBALKEYS_LIBRARY_DIRS})
|
@ -7,18 +7,8 @@ endif()
|
||||
|
||||
find_package(KF5WindowSystem REQUIRED QUIET)
|
||||
|
||||
set(QTX_INCLUDE_DIRS "")
|
||||
set(QTX_LIBRARIES Qt5::Widgets Qt5::DBus)
|
||||
|
||||
set(QT_DBUS_PREFIX "org.qtproject")
|
||||
|
||||
include_directories(
|
||||
"${PROJECT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${QTX_INCLUDE_DIRS}
|
||||
${LXQT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_PATH_TO_DAEMON "${LXQT_GLOBALKEYS_SOURCE_DIR}/daemon")
|
||||
|
||||
set(${PROJECT_NAME}_SOURCES
|
||||
@ -94,23 +84,22 @@ foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
|
||||
get_filename_component(DBUS_INTERFACE_FILENAME ${DBUS_INTERFACE} NAME)
|
||||
configure_file(
|
||||
${DBUS_INTERFACE}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}"
|
||||
@ONLY
|
||||
)
|
||||
get_source_file_property(DBUS_INTERFACE_BASENAME ${DBUS_INTERFACE} BASENAME)
|
||||
get_source_file_property(DBUS_INTERFACE_INCLUDE ${DBUS_INTERFACE} INCLUDE)
|
||||
get_source_file_property(DBUS_INTERFACE_CLASSNAME ${DBUS_INTERFACE} CLASSNAME)
|
||||
get_source_file_property(DBUS_INTERFACE_NO_NAMESPACE ${DBUS_INTERFACE} NO_NAMESPACE)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} PROPERTIES
|
||||
set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}" PROPERTIES
|
||||
INCLUDE ${DBUS_INTERFACE_INCLUDE}
|
||||
CLASSNAME ${DBUS_INTERFACE_CLASSNAME}
|
||||
NO_NAMESPACE ${DBUS_INTERFACE_NO_NAMESPACE}
|
||||
)
|
||||
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} ${DBUS_INTERFACE_BASENAME})
|
||||
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}" ${DBUS_INTERFACE_BASENAME})
|
||||
endforeach()
|
||||
|
||||
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
|
||||
qt5_wrap_ui(${PROJECT_NAME}_FORM_FILES ${${PROJECT_NAME}_FORMS})
|
||||
|
||||
# Translations **********************************
|
||||
lxqt_translate_ts(${PROJECT_NAME}_QM_FILES
|
||||
@ -145,7 +134,16 @@ set(${PROJECT_NAME}_ALL_FILES
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_ALL_FILES})
|
||||
target_link_libraries(${PROJECT_NAME} KF5::WindowSystem ${QTX_LIBRARIES} ${LXQT_LIBRARIES})
|
||||
target_link_libraries(${PROJECT_NAME} KF5::WindowSystem lxqt)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
|
||||
install(FILES ${${PROJECT_NAME}_DESKTOP_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
|
||||
install(TARGETS
|
||||
${PROJECT_NAME}
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${${PROJECT_NAME}_DESKTOP_FILES}
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
@ -0,0 +1,4 @@
|
||||
# Translations
|
||||
Name[hu]=LxQt gyorsbillentyűk
|
||||
Comment[hu]=LXQt általános forróbillentyűinek beállítása
|
||||
GenericName[hu]=LXQt gyorsbillentyűk beállítása
|
93
config/translations/lxqt-config-globalkeyshortcuts_hu.ts
Normal file
93
config/translations/lxqt-config-globalkeyshortcuts_hu.ts
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="hu_HU">
|
||||
<context>
|
||||
<name>CommandFinder</name>
|
||||
<message>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Find a command</source>
|
||||
<translation>Parancs keresés</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ShortcutConfigWindow</name>
|
||||
<message>
|
||||
<source>LxQt Shortcut Editor</source>
|
||||
<translation>LXQt forróbillentyű szerkesztés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Description</source>
|
||||
<translation>Leírás</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shortcut</source>
|
||||
<translation>Forróbillentyű</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Command</source>
|
||||
<translation>Parancs</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add New</source>
|
||||
<translation>Új</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Remove</source>
|
||||
<translation>Törlés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add Group</source>
|
||||
<translation>Csoport</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation>Visszavon</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close</source>
|
||||
<translation>Bezár</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ShortcutEditor</name>
|
||||
<message>
|
||||
<source>None</source>
|
||||
<translation>Nincs</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add Shortcut</source>
|
||||
<translation>Forróbillentyű adás</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Remove</source>
|
||||
<translation>Törlés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>New Group</source>
|
||||
<translation>Új csoport</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset Changes</source>
|
||||
<translation>Visszavonás</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Question</source>
|
||||
<translation>Kérdés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete group: %1? (everything inside will be removed altogether)</source>
|
||||
<translation>A %1 csoport törlése? (Minden kapcsolata is törlődik)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete %1?</source>
|
||||
<translation>%1 törlése?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Binding for %1 already exists. Replace old one?</source>
|
||||
<translation>A %1 már foglalt. Felváltsuk az újjal?</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
@ -1,4 +1,3 @@
|
||||
# Translations
|
||||
Name[it_IT]=Configurazione delle scorciatoie di LxQt
|
||||
Comment[it_IT]=Configura le scorciatoie globali del desktop LxQt
|
||||
GenericName[it_IT]=Configurazione delle scorciatoie globali di LxQt
|
||||
Name[it_IT]=Scorciatoie globali
|
||||
Comment[it_IT]=Configura le scorciatoie globali di LXQt
|
||||
|
@ -6,15 +6,10 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
find_package(X11)
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
include_directories("${X11_INCLUDE_DIR}")
|
||||
|
||||
set(QT_DBUS_PREFIX "org.qtproject")
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_SOURCES
|
||||
main.cpp
|
||||
core.cpp
|
||||
@ -92,7 +87,7 @@ foreach(DBUS_ADAPTOR ${${PROJECT_NAME}_DBUS_ADAPTORS})
|
||||
get_filename_component(DBUS_ADAPTOR_FILENAME ${DBUS_ADAPTOR} NAME)
|
||||
configure_file(
|
||||
${DBUS_ADAPTOR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}"
|
||||
@ONLY
|
||||
)
|
||||
get_source_file_property(DBUS_ADAPTOR_INCLUDE ${DBUS_ADAPTOR} INCLUDE)
|
||||
@ -101,12 +96,12 @@ foreach(DBUS_ADAPTOR ${${PROJECT_NAME}_DBUS_ADAPTORS})
|
||||
get_source_file_property(DBUS_ADAPTOR_CLASSNAME ${DBUS_ADAPTOR} CLASSNAME)
|
||||
if(DBUS_ADAPTOR_BASENAME)
|
||||
if(DBUS_ADAPTOR_CLASSNAME)
|
||||
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME} ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME} ${DBUS_ADAPTOR_CLASSNAME})
|
||||
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME} ${DBUS_ADAPTOR_CLASSNAME})
|
||||
else()
|
||||
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME} ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME})
|
||||
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME})
|
||||
endif()
|
||||
else()
|
||||
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME} ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME})
|
||||
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@ -114,23 +109,22 @@ foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
|
||||
get_filename_component(DBUS_INTERFACE_FILENAME ${DBUS_INTERFACE} NAME)
|
||||
configure_file(
|
||||
${DBUS_INTERFACE}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}"
|
||||
@ONLY
|
||||
)
|
||||
get_source_file_property(DBUS_INTERFACE_BASENAME ${DBUS_INTERFACE} BASENAME)
|
||||
get_source_file_property(DBUS_INTERFACE_INCLUDE ${DBUS_INTERFACE} INCLUDE)
|
||||
get_source_file_property(DBUS_INTERFACE_CLASSNAME ${DBUS_INTERFACE} CLASSNAME)
|
||||
get_source_file_property(DBUS_INTERFACE_NO_NAMESPACE ${DBUS_INTERFACE} NO_NAMESPACE)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} PROPERTIES
|
||||
set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}" PROPERTIES
|
||||
INCLUDE ${DBUS_INTERFACE_INCLUDE}
|
||||
CLASSNAME ${DBUS_INTERFACE_CLASSNAME}
|
||||
NO_NAMESPACE ${DBUS_INTERFACE_NO_NAMESPACE}
|
||||
)
|
||||
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} ${DBUS_INTERFACE_BASENAME})
|
||||
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}" ${DBUS_INTERFACE_BASENAME})
|
||||
endforeach()
|
||||
|
||||
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
|
||||
qt5_wrap_ui(${PROJECT_NAME}_FORM_FILES ${${PROJECT_NAME}_FORMS})
|
||||
|
||||
set(${PROJECT_NAME}_GENERATED_FILES
|
||||
${${PROJECT_NAME}_FORM_FILES}
|
||||
@ -147,6 +141,11 @@ set(${PROJECT_NAME}_ALL_FILES
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_ALL_FILES})
|
||||
target_link_libraries(${PROJECT_NAME} ${X11_LIBRARIES} Qt5::Widgets Qt5::DBus)
|
||||
target_link_libraries(${PROJECT_NAME} ${X11_LIBRARIES} lxqt Qt5::Widgets Qt5::DBus)
|
||||
lxqt_enable_target_exceptions(${PROJECT_NAME} PRIVATE)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
|
||||
install(TARGETS
|
||||
${PROJECT_NAME}
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
343
daemon/core.cpp
343
daemon/core.cpp
@ -25,8 +25,9 @@
|
||||
*
|
||||
* END_COMMON_COPYRIGHT_HEADER */
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <LXQt/Application>
|
||||
|
||||
#include <QScopedArrayPointer>
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
#include <QDBusConnectionInterface>
|
||||
@ -69,14 +70,6 @@ enum
|
||||
static Core *s_Core = 0;
|
||||
|
||||
|
||||
void unixSignalHandler(int signalNumber)
|
||||
{
|
||||
if (s_Core)
|
||||
{
|
||||
s_Core->unixSignalHandler(signalNumber);
|
||||
}
|
||||
}
|
||||
|
||||
int x11ErrorHandler(Display *display, XErrorEvent *errorEvent)
|
||||
{
|
||||
if (s_Core)
|
||||
@ -411,8 +404,8 @@ Core::Core(bool useSyslog, bool minLogLevelSet, int minLogLevel, const QStringLi
|
||||
|
||||
openlog("lxqt-global-action-daemon", LOG_PID, LOG_USER);
|
||||
|
||||
::signal(SIGTERM, ::unixSignalHandler);
|
||||
::signal(SIGINT, ::unixSignalHandler);
|
||||
connect(lxqtApp, &LxQt::Application::unixSignal, this, &Core::unixSignalHandler);
|
||||
lxqtApp->listenToUnixSignals(QList<int>() << SIGTERM << SIGINT);
|
||||
|
||||
|
||||
if (!QDBusConnection::sessionBus().registerService("org.lxqt.global_key_shortcuts"))
|
||||
@ -581,7 +574,7 @@ Core::Core(bool useSyslog, bool minLogLevelSet, int minLogLevel, const QStringLi
|
||||
}
|
||||
if (id)
|
||||
{
|
||||
mShortcutAndActionById[id].second->setEnabled(enabled);
|
||||
enableActionNonGuarded(id, enabled);
|
||||
}
|
||||
|
||||
settings.endGroup();
|
||||
@ -828,7 +821,7 @@ int Core::x11ErrorHandler(Display */*display*/, XErrorEvent *errorEvent)
|
||||
|
||||
bool Core::waitForX11Error(int level, uint timeout)
|
||||
{
|
||||
pollfd *fds = new pollfd[1];
|
||||
pollfd fds[1];
|
||||
fds[0].fd = mX11ErrorPipe[STDIN_FILENO];
|
||||
fds[0].events = POLLIN | POLLERR | POLLHUP;
|
||||
if (poll(fds, 1, timeout) < 0)
|
||||
@ -1367,7 +1360,7 @@ void Core::run()
|
||||
|
||||
default:
|
||||
{
|
||||
pollfd *fds = new pollfd[1];
|
||||
pollfd fds[1];
|
||||
fds[0].fd = mX11RequestPipe[STDIN_FILENO];
|
||||
fds[0].events = POLLIN | POLLERR | POLLHUP;
|
||||
if (poll(fds, 1, 0) >= 0)
|
||||
@ -1400,17 +1393,16 @@ void Core::run()
|
||||
}
|
||||
if (length)
|
||||
{
|
||||
char *str = new char[length + 1];
|
||||
QScopedArrayPointer<char> str(new char[length + 1]);
|
||||
str[length] = '\0';
|
||||
if (error_t error = readAll(mX11RequestPipe[STDIN_FILENO], str, length))
|
||||
if (error_t error = readAll(mX11RequestPipe[STDIN_FILENO], str.data(), length))
|
||||
{
|
||||
log(LOG_CRIT, "Cannot read from X11 request pipe: %s", strerror(error));
|
||||
close(mX11ResponsePipe[STDIN_FILENO]);
|
||||
mX11EventLoopActive = false;
|
||||
break;
|
||||
}
|
||||
KeySym keySym = XStringToKeysym(str);
|
||||
delete[] str;
|
||||
KeySym keySym = XStringToKeysym(str.data());
|
||||
lockX11Error();
|
||||
keyCode = XKeysymToKeycode(mDisplay, keySym);
|
||||
x11Error = checkX11Error();
|
||||
@ -1682,22 +1674,38 @@ void Core::serviceDisappeared(const QString &sender)
|
||||
{
|
||||
const QString &shortcut = shortcutAndActionById.value().first;
|
||||
|
||||
dynamic_cast<ClientAction *>(shortcutAndActionById.value().second)->disappeared();
|
||||
ClientAction * action = dynamic_cast<ClientAction *>(shortcutAndActionById.value().second);
|
||||
action->disappeared();
|
||||
mDaemonAdaptor->emit_clientActionSenderChanged(id, QString());
|
||||
|
||||
X11Shortcut X11shortcut = mX11ByShortcut[shortcut];
|
||||
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
if (action->isEnabled())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
{
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(X11shortcut))
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(X11shortcut))
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IdsByShortcut::iterator idsByShortcut = mDisabledIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mDisabledIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
mDisabledIdsByShortcut.erase(idsByShortcut);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1798,17 +1806,15 @@ QString Core::remoteKeycodeToString(KeyCode keyCode)
|
||||
}
|
||||
if (length)
|
||||
{
|
||||
char *str = new char[length + 1];
|
||||
QScopedArrayPointer<char> str(new char[length + 1]);
|
||||
str[length] = '\0';
|
||||
if (error_t error = readAll(mX11ResponsePipe[STDIN_FILENO], str, length))
|
||||
if (error_t error = readAll(mX11ResponsePipe[STDIN_FILENO], str.data(), length))
|
||||
{
|
||||
log(LOG_CRIT, "Cannot read from X11 response pipe: %s", strerror(error));
|
||||
qApp->quit();
|
||||
return QString();
|
||||
}
|
||||
result = str;
|
||||
|
||||
delete[] str;
|
||||
result = str.data();
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -2389,7 +2395,7 @@ void Core::enableClientAction(bool &result, const QDBusObjectPath &path, bool en
|
||||
|
||||
qulonglong id = idByNativeClient.value();
|
||||
|
||||
mShortcutAndActionById[id].second->setEnabled(enabled);
|
||||
enableActionNonGuarded(id, enabled);
|
||||
|
||||
saveConfig();
|
||||
|
||||
@ -2429,24 +2435,75 @@ void Core::isClientActionEnabled(bool &enabled, const QDBusObjectPath &path, con
|
||||
}
|
||||
|
||||
void Core::enableAction(bool &result, qulonglong id, bool enabled)
|
||||
{
|
||||
QMutexLocker lock(&mDataMutex);
|
||||
result = enableActionNonGuarded(id, enabled);
|
||||
}
|
||||
|
||||
bool Core::enableActionNonGuarded(qulonglong id, bool enabled)
|
||||
{
|
||||
log(LOG_INFO, "enableAction id:%llu enabled:%s", id, enabled ? "true" : " false");
|
||||
|
||||
QMutexLocker lock(&mDataMutex);
|
||||
|
||||
ShortcutAndActionById::iterator shortcutAndActionById = mShortcutAndActionById.find(id);
|
||||
if (shortcutAndActionById == mShortcutAndActionById.end())
|
||||
{
|
||||
log(LOG_WARNING, "No action registered with id #%llu", id);
|
||||
result = false;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
shortcutAndActionById.value().second->setEnabled(enabled);
|
||||
BaseAction * action = shortcutAndActionById.value().second;
|
||||
QString const & shortcut = shortcutAndActionById.value().first;
|
||||
if (action->isEnabled() != enabled)
|
||||
{
|
||||
shortcutAndActionById.value().second->setEnabled(enabled);
|
||||
if (enabled)
|
||||
{
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
{
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
if (!remoteXGrabKey(mX11ByShortcut[shortcut]))
|
||||
{
|
||||
log(LOG_WARNING, "Cannot grab shortcut '%s'", qPrintable(shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
idsByShortcut = mDisabledIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mDisabledIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
mDisabledIdsByShortcut.erase(idsByShortcut);
|
||||
}
|
||||
}
|
||||
mIdsByShortcut[shortcut].insert(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
saveConfig();
|
||||
if (!remoteXUngrabKey(mX11ByShortcut[shortcut]))
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
mDisabledIdsByShortcut[shortcut].insert(id);
|
||||
}
|
||||
|
||||
result = true;
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Core::isActionEnabled(bool &enabled, qulonglong id)
|
||||
@ -2540,29 +2597,48 @@ void Core::changeClientActionShortcut(QPair<QString, qulonglong> &result, const
|
||||
|
||||
if (oldShortcut != newShortcut)
|
||||
{
|
||||
newShortcut = grabOrReuseKey(X11shortcut, newShortcut);
|
||||
if (newShortcut.isEmpty())
|
||||
{
|
||||
result = qMakePair(QString(), id);
|
||||
return;
|
||||
}
|
||||
BaseAction const * const action = shortcutAndActionById.value().second;
|
||||
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(oldShortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
if (action->isEnabled())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
newShortcut = grabOrReuseKey(X11shortcut, newShortcut);
|
||||
if (newShortcut.isEmpty())
|
||||
{
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
result = qMakePair(QString(), id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!remoteXUngrabKey(mX11ByShortcut[oldShortcut]))
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(oldShortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(mX11ByShortcut[oldShortcut]))
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mIdsByShortcut[newShortcut].insert(id);
|
||||
mIdsByShortcut[newShortcut].insert(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
IdsByShortcut::iterator idsByShortcut = mDisabledIdsByShortcut.find(oldShortcut);
|
||||
if (idsByShortcut != mDisabledIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
mDisabledIdsByShortcut.erase(idsByShortcut);
|
||||
}
|
||||
}
|
||||
|
||||
mDisabledIdsByShortcut[newShortcut].insert(id);
|
||||
}
|
||||
shortcutAndActionById.value().first = newShortcut;
|
||||
}
|
||||
|
||||
@ -2607,29 +2683,48 @@ void Core::changeShortcut(QString &result, const qulonglong &id, const QString &
|
||||
|
||||
if (oldShortcut != newShortcut)
|
||||
{
|
||||
newShortcut = grabOrReuseKey(X11shortcut, newShortcut);
|
||||
if (newShortcut.isEmpty())
|
||||
{
|
||||
result = QString();
|
||||
return;
|
||||
}
|
||||
BaseAction const * const action = shortcutAndActionById.value().second;
|
||||
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(oldShortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
if (action->isEnabled())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
newShortcut = grabOrReuseKey(X11shortcut, newShortcut);
|
||||
if (newShortcut.isEmpty())
|
||||
{
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
result = QString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!remoteXUngrabKey(mX11ByShortcut[oldShortcut]))
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(oldShortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(mX11ByShortcut[oldShortcut]))
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mIdsByShortcut[newShortcut].insert(id);
|
||||
mIdsByShortcut[newShortcut].insert(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
IdsByShortcut::iterator idsByShortcut = mDisabledIdsByShortcut.find(oldShortcut);
|
||||
if (idsByShortcut != mDisabledIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
mDisabledIdsByShortcut.erase(idsByShortcut);
|
||||
}
|
||||
}
|
||||
|
||||
mDisabledIdsByShortcut[newShortcut].insert(id);
|
||||
}
|
||||
shortcutAndActionById.value().first = newShortcut;
|
||||
|
||||
if (!strcmp(shortcutAndActionById.value().second->type(), ClientAction::id()))
|
||||
@ -2715,21 +2810,38 @@ void Core::removeClientAction(bool &result, const QDBusObjectPath &path, const Q
|
||||
|
||||
X11Shortcut X11shortcut = mX11ByShortcut[shortcut];
|
||||
|
||||
delete shortcutAndActionById.value().second;
|
||||
BaseAction * action = shortcutAndActionById.value().second;
|
||||
const bool enabled = action->isEnabled();
|
||||
delete action;
|
||||
mShortcutAndActionById.erase(shortcutAndActionById);
|
||||
mIdByClientPath.remove(path);
|
||||
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
if (enabled)
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
{
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(X11shortcut))
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(X11shortcut))
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IdsByShortcut::iterator idsByShortcut = mDisabledIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mDisabledIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
mDisabledIdsByShortcut.erase(idsByShortcut);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2791,21 +2903,36 @@ void Core::removeAction(bool &result, const qulonglong &id)
|
||||
QString shortcut = shortcutAndActionById.value().first;
|
||||
|
||||
X11Shortcut X11shortcut = mX11ByShortcut[shortcut];
|
||||
|
||||
const bool enabled = action->isEnabled();
|
||||
delete action;
|
||||
mShortcutAndActionById.erase(shortcutAndActionById);
|
||||
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
if (enabled)
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
{
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(X11shortcut))
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (enabled && !remoteXUngrabKey(X11shortcut))
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IdsByShortcut::iterator idsByShortcut = mDisabledIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mDisabledIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
mDisabledIdsByShortcut.erase(idsByShortcut);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2849,19 +2976,35 @@ void Core::deactivateClientAction(bool &result, const QDBusObjectPath &path, con
|
||||
ShortcutAndActionById::iterator shortcutAndActionById = mShortcutAndActionById.find(id);
|
||||
QString shortcut = shortcutAndActionById.value().first;
|
||||
|
||||
dynamic_cast<ClientAction*>(shortcutAndActionById.value().second)->disappeared();
|
||||
ClientAction * const action = dynamic_cast<ClientAction*>(shortcutAndActionById.value().second);
|
||||
action->disappeared();
|
||||
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
if (action->isEnabled())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mIdsByShortcut.end())
|
||||
{
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(mX11ByShortcut[shortcut]))
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
mIdsByShortcut.erase(idsByShortcut);
|
||||
|
||||
if (!remoteXUngrabKey(mX11ByShortcut[shortcut]))
|
||||
{
|
||||
log(LOG_WARNING, "Cannot ungrab shortcut '%s'", qPrintable(shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IdsByShortcut::iterator idsByShortcut = mDisabledIdsByShortcut.find(shortcut);
|
||||
if (idsByShortcut != mDisabledIdsByShortcut.end())
|
||||
{
|
||||
idsByShortcut.value().remove(id);
|
||||
if (idsByShortcut.value().isEmpty())
|
||||
{
|
||||
mDisabledIdsByShortcut.erase(idsByShortcut);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3174,17 +3317,15 @@ void Core::shortcutGrabbed()
|
||||
}
|
||||
if (length)
|
||||
{
|
||||
char *str = new char[length + 1];
|
||||
QScopedArrayPointer<char> str(new char[length + 1]);
|
||||
str[length] = '\0';
|
||||
if (error_t error = readAll(mX11ResponsePipe[STDIN_FILENO], str, length))
|
||||
if (error_t error = readAll(mX11ResponsePipe[STDIN_FILENO], str.data(), length))
|
||||
{
|
||||
log(LOG_CRIT, "Cannot read from X11 response pipe: %s", strerror(error));
|
||||
qApp->quit();
|
||||
return;
|
||||
}
|
||||
shortcut = str;
|
||||
|
||||
delete[] str;
|
||||
shortcut = str.data();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,6 +150,7 @@ private slots:
|
||||
void shortcutGrabTimedout();
|
||||
|
||||
private:
|
||||
bool enableActionNonGuarded(qulonglong id, bool enabled);
|
||||
QPair<QString, qulonglong> addOrRegisterClientAction(const QString &shortcut, const QDBusObjectPath &path, const QString &description, const QString &sender);
|
||||
qulonglong registerClientAction(const QString &shortcut, const QDBusObjectPath &path, const QString &description);
|
||||
qulonglong registerMethodAction(const QString &shortcut, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description);
|
||||
@ -218,6 +219,7 @@ private:
|
||||
X11ByShortcut mX11ByShortcut;
|
||||
ShortcutByX11 mShortcutByX11;
|
||||
IdsByShortcut mIdsByShortcut;
|
||||
IdsByShortcut mDisabledIdsByShortcut;
|
||||
ShortcutAndActionById mShortcutAndActionById;
|
||||
IdByClientPath mIdByClientPath;
|
||||
SenderByClientPath mSenderByClientPath; // add: path->sender
|
||||
|
@ -25,7 +25,7 @@
|
||||
*
|
||||
* END_COMMON_COPYRIGHT_HEADER */
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <LXQt/Application>
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
@ -230,15 +230,16 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
int ignoreIt = chdir("/");
|
||||
const char* home = getenv("HOME");
|
||||
int ignoreIt = chdir((home && *home) ? home : "/");
|
||||
(void)ignoreIt;
|
||||
|
||||
if (configFiles.empty())
|
||||
if (configFiles.empty() && home && *home)
|
||||
{
|
||||
configFiles.push_back(QString::fromLocal8Bit(getenv("HOME")) + "/" DEFAULT_CONFIG);
|
||||
configFiles.push_back(QString::fromLocal8Bit(home) + "/" DEFAULT_CONFIG);
|
||||
}
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
LxQt::Application app(argc, argv);
|
||||
|
||||
Core core(runAsDaemon || useSyslog, minLogLevelSet, minLogLevel, configFiles, multipleActionsBehaviourSet, multipleActionsBehaviour);
|
||||
|
||||
|
@ -6,14 +6,6 @@ set(QT_DBUS_PREFIX "org.qtproject")
|
||||
set(LXQT_GLOBALKEYS_LIBRARY lxqt-globalkeys)
|
||||
set(${PROJECT_NAME}_HEADER_NAMESPACE "LXQtGlobalKeysUi")
|
||||
|
||||
include_directories(
|
||||
"${PROJECT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${LXQT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
add_definitions(-DSHARED_EXPORT=Q_DECL_EXPORT)
|
||||
|
||||
set(${PROJECT_NAME}_SOURCES
|
||||
shortcut_selector.cpp
|
||||
)
|
||||
@ -23,7 +15,7 @@ set(${PROJECT_NAME}_MAIN_HEADER
|
||||
|
||||
#
|
||||
# WARNING: Changing stuff here implies changing this:
|
||||
#install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT development RENAME "shortcutselector.h")
|
||||
#install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT Devel RENAME "shortcutselector.h")
|
||||
#
|
||||
set(${PROJECT_NAME}_PUBLIC_CPP_HEADERS
|
||||
shortcut_selector.h
|
||||
@ -101,7 +93,7 @@ foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
|
||||
get_filename_component(DBUS_INTERFACE_FILENAME ${DBUS_INTERFACE} NAME)
|
||||
configure_file(
|
||||
${DBUS_INTERFACE}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}"
|
||||
@ONLY
|
||||
)
|
||||
get_source_file_property(DBUS_INTERFACE_BASENAME ${DBUS_INTERFACE} BASENAME)
|
||||
@ -113,11 +105,10 @@ foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
|
||||
CLASSNAME ${DBUS_INTERFACE_CLASSNAME}
|
||||
NO_NAMESPACE ${DBUS_INTERFACE_NO_NAMESPACE}
|
||||
)
|
||||
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} ${DBUS_INTERFACE_BASENAME})
|
||||
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}" ${DBUS_INTERFACE_BASENAME})
|
||||
endforeach()
|
||||
|
||||
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
|
||||
qt5_wrap_ui(${PROJECT_NAME}_FORM_FILES ${${PROJECT_NAME}_FORMS})
|
||||
|
||||
set(${PROJECT_NAME}_GENERATED_FILES
|
||||
${${PROJECT_NAME}_FORM_FILES}
|
||||
@ -133,17 +124,34 @@ set(${PROJECT_NAME}_ALL_FILES
|
||||
${${PROJECT_NAME}_GENERATED_FILES}
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_PKG_CONFIG_REQUIRES "Qt5Widgets, Qt5DBus, ${LXQT_GLOBALKEYS_LIBRARY}")
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_ALL_FILES})
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Qt5::Widgets
|
||||
Qt5::DBus
|
||||
${LXQT_GLOBALKEYS_LIBRARY}
|
||||
PUBLIC
|
||||
Qt5::Widgets
|
||||
Qt5::DBus
|
||||
${LXQT_GLOBALKEYS_LIBRARY}
|
||||
)
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
VERSION ${LXQT_VERSION}
|
||||
SOVERSION ${LXQT_MAJOR_VERSION}
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${LXQT_GLOBALKEYS_UI_LIBRARY_NAME}>"
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/include>"
|
||||
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}>"
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PRIVATE "SHARED_EXPORT=Q_DECL_EXPORT"
|
||||
)
|
||||
|
||||
export(TARGETS ${PROJECT_NAME} APPEND FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}-targets.cmake")
|
||||
|
||||
include(create_portable_headers)
|
||||
create_portable_headers(${PROJECT_NAME}_PORTABLE_HEADERS
|
||||
@ -151,11 +159,62 @@ create_portable_headers(${PROJECT_NAME}_PORTABLE_HEADERS
|
||||
FILENAMES ${${PROJECT_NAME}_PUBLIC_CLASSES}
|
||||
)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT runtime)
|
||||
install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT development)
|
||||
install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT development RENAME "shortcutselector.h")
|
||||
install(FILES ${${PROJECT_NAME}_PORTABLE_HEADERS} DESTINATION include/${PROJECT_NAME}/${${PROJECT_NAME}_HEADER_NAMESPACE} COMPONENT development)
|
||||
# Copy public headers for intree building
|
||||
foreach(h ${${PROJECT_NAME}_PUBLIC_HEADERS})
|
||||
get_filename_component(bh ${h} NAME)
|
||||
configure_file("${h}" "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}/${bh}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
foreach(h ${${PROJECT_NAME}_PORTABLE_HEADERS})
|
||||
get_filename_component(bh ${h} NAME)
|
||||
configure_file("${h}" "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}/${${PROJECT_NAME}_HEADER_NAMESPACE}/${bh}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
foreach(h ${${PROJECT_NAME}_PUBLIC_HEADERS})
|
||||
get_filename_component(bh ${h} NAME)
|
||||
configure_file("${h}" "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/${PROJECT_NAME}/shortcutselector.h" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
install(TARGETS
|
||||
${PROJECT_NAME}
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
EXPORT ${PROJECT_NAME}-targets
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
||||
install(EXPORT
|
||||
${PROJECT_NAME}-targets
|
||||
DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${${PROJECT_NAME}_PUBLIC_HEADERS}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${${PROJECT_NAME}_PUBLIC_HEADERS}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
|
||||
COMPONENT Devel
|
||||
RENAME "shortcutselector.h"
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${${PROJECT_NAME}_PORTABLE_HEADERS}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${${PROJECT_NAME}_HEADER_NAMESPACE}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
|
||||
include(create_pkgconfig_file)
|
||||
create_pkgconfig_file(${PROJECT_NAME} "LXQt global key shortcuts GUI support library")
|
||||
lxqt_create_pkgconfig_file(
|
||||
PACKAGE_NAME ${PROJECT_NAME}
|
||||
DESCRIPTIVE_NAME ${PROJECT_NAME}
|
||||
DESCRIPTION "LXQt global key shortcuts GUI support library"
|
||||
INCLUDEDIRS ${PROJECT_NAME}
|
||||
LIBS ${PROJECT_NAME}
|
||||
REQUIRES ${${PROJECT_NAME}_PKG_CONFIG_REQUIRES}
|
||||
VERSION ${LXQT_VERSION}
|
||||
INSTALL
|
||||
)
|
||||
|
@ -40,7 +40,11 @@ namespace GlobalKeyShortcut
|
||||
class Client;
|
||||
}
|
||||
|
||||
class ShortcutSelector : public QToolButton
|
||||
#ifndef SHARED_EXPORT
|
||||
#define SHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
class SHARED_EXPORT ShortcutSelector : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user