Merge branch 'master' of https://github.com/SokoloffA/liblxqt into qt5
authorHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sat, 19 Apr 2014 12:02:45 +0000 (20:02 +0800)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sat, 19 Apr 2014 12:02:45 +0000 (20:02 +0800)
Conflicts:
CMakeLists.txt
cmake/create_pkgconfig_file.cmake
cmake/lxqt-config.cmake.in
lxqtapplication.h
lxqtautostartentry.h

18 files changed:
1  2 
CMakeLists.txt
aboutdialog/technicalinfo.cpp
addplugindialog/lxqtaddplugindialog.cpp
cmake/lxqt-config.cmake.in
cmake/lxqt_use.cmake.in
configdialog/lxqtconfigdialog.cpp
lxqtapplication.cpp
lxqtapplication.h
lxqtautostartentry.cpp
lxqtautostartentry.h
lxqtnotification.cpp
lxqtnotification.h
lxqtplugininfo.h
lxqtpowermanager.cpp
lxqtscreensaver.cpp
lxqtsettings.cpp
lxqtxfitman.cpp
translatorsinfo/translatorsinfo.cpp

diff --cc CMakeLists.txt
@@@ -5,9 -5,7 +5,10 @@@ project(liblxqt
  set(LXQT_MAJOR_VERSION 0)
  set(LXQT_MINOR_VERSION 5)
  set(LXQT_PATCH_VERSION 0)
 +
 +# Set default installation paths
 +set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries")
+ set(LXGQT_PKG_CONFIG_DESCRIPTION "Shared library for LXQt applications")
  
  set(PUB_HDRS
      aboutdialog/lxqtaboutdialog.h
@@@ -118,75 -117,199 +119,191 @@@ file(GLOB TS_FILE
  # additional cmake files
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
  
- find_package(Qt4 REQUIRED QUIET)
- include(${QT_USE_FILE})
  
- QT4_ADD_DBUS_INTERFACE(SRCS
-     dbus/org.freedesktop.Notifications.xml
-     notifications_interface
- )
+ option(USE_QT5 "Force use the Qt5." $ENV{USE_QT5})
+ option(USE_QT4 "Force use the Qt4." $ENV{USE_QT4})
+ if((USE_QT4 AND USE_QT5) OR
+    (NOT USE_QT4 AND NOT USE_QT5))
+     # Autodetect Qt version
+     find_package(Qt4 QUIET)
+     if (QT4_FOUND)
+         set(USE_QT4 ON)
+         set(USE_QT5 OFF)
+     else()
+         set(USE_QT4 OFF)
+         set(USE_QT5 ON)
+     endif()
+ endif()
+ if(USE_QT5)
 -    cmake_minimum_required(VERSION 2.8.3)
++    cmake_minimum_required(VERSION 2.8.9)
+     set(CMAKE_INCLUDE_CURRENT_DIR ON)
+     set(CMAKE_AUTOMOC ON)
+     set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+     find_package(Qt5Widgets REQUIRED QUIET)
 -    message(STATUS "Building with Qt ${Qt5Core_VERSION_STRING}")
++    find_package(Qt5DBus REQUIRED QUIET)
+     find_package(Qt5X11Extras REQUIRED QUIET)
+     find_package(Qt5LinguistTools REQUIRED QUIET)
 -
 -    set(LXQT_QT_VERSION "5")
 -    set(LXQT_PKG_CONFIG_REQUIRES "Qt5Widgets Qt5Xml")
 -
 -    include_directories(${Qt5Widgets_INCLUDE_DIRS})
 -    add_definitions(${Qt5Widgets_DEFINITIONS})
++    message(STATUS "Building with Qt ${Qt5Core_VERSION_STRING}")
+     QT5_WRAP_UI(UIS ${FORMS})
+     QT5_ADD_TRANSLATION(QM_FILES ${TS_FILES})
 -    #set(CMAKE_CXX_FLAGS
 -    #    "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}"
 -    #)
 -
 -    set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
++    QT5_ADD_DBUS_INTERFACE(SRCS
++        dbus/org.freedesktop.Notifications.xml
++        notifications_interface
++    )
 -    #find_package(XDGQT5 REQUIRED QUIET)
++    set(LXQT_QT_VERSION "5")
++    set(LXQT_PKG_CONFIG_REQUIRES "Qt5Widgets Qt5Xml")
+ else()
+     find_package(Qt4 REQUIRED QUIET)
+     message(STATUS "Building with Qt ${QTVERSION}")
+     include(${QT_USE_FILE})
+     QT4_WRAP_CPP(MOCS ${MOCS})
+     QT4_WRAP_UI(UIS ${FORMS})
+     QT4_ADD_TRANSLATION(QM_FILES ${TS_FILES})
+     QT4_ADD_DBUS_INTERFACE(SRCS
+         dbus/org.freedesktop.Notifications.xml
+         notifications_interface
+     )
+     set(LXQT_QT_VERSION "4")
+     set(LXQT_PKG_CONFIG_REQUIRES "QtCore, QtXml")
+ endif()
  
  find_package(X11 REQUIRED QUIET)
  
- find_package(QTXDG REQUIRED QUIET)
 -find_package(xdgqt REQUIRED)
 -include(${XDGQT_USE_FILE})
++find_package(qtxdg REQUIRED)
 +include(${QTXDG_USE_FILE})
  
  include_directories (
      ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
      ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR}
      ${X11_INCLUDE_DIR}
 -    ${XDGQT_INCLUDE_DIRS}
 +    ${QTXDG_INCLUDE_DIRS}
  )
  
- set(LXQT_VERSION
-     ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PATCH_VERSION}
- )
+ # Standard directories for installation
+ include(GNUInstallDirs)
+ set(LXQT_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PATCH_VERSION})
+ set(LXQT_LIBRARY_NAME "lxqt${LXQT_QT_VERSION}")
+ set(LXQT_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/lxqt)
+ set(LXQT_TRANSLATIONS_DIR ${LXQT_SHARE_DIR}/translations)
+ set(LXQT_INTREE_INCLUDE_DIR     ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include)
+ set(LXQT_INTREE_TRAGETS_FILE    ${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-targets.cmake)
+ set(LXQT_INSTALL_INCLUDE_DIR   ${CMAKE_INSTALL_FULL_INCLUDEDIR})
+ set(LXQT_INSTALL_CMAKE_DIR     ${CMAKE_INSTALL_PREFIX}/share/cmake/)
+ include(cmake/FindInstallConfigPath.cmake)
+ include(create_portable_headers)
  
 -
 -
  message(STATUS "")
  message(STATUS "liblxqt version: ${LXQT_VERSION}")
  message(STATUS "")
  
  
+ # Copy public headers
+ foreach(h ${PUB_HDRS})
+     get_filename_component(bh ${h} NAME)
+     configure_file(${h} ${LXQT_INTREE_INCLUDE_DIR}/LxQt/${bh} COPYONLY)
+     configure_file(${h} ${LXQT_INTREE_INCLUDE_DIR}/lxqt/${bh} COPYONLY)
+ endforeach()
+ # Create the portable headers
+ create_portable_headers(INTREE_PORTABLE_HEADERS ${LXQT_INTREE_INCLUDE_DIR}/lxqt ${PUBLIC_CLASSES})
+ check_portable_headers(H_FILES ${PUB_HDRS} LINKS ${INTREE_PORTABLE_HEADERS})
+ create_portable_headers(INTREE_PORTABLE_HEADERS ${LXQT_INTREE_INCLUDE_DIR}/LxQt ${PUBLIC_CLASSES})
+ check_portable_headers(H_FILES ${PUB_HDRS} LINKS ${INTREE_PORTABLE_HEADERS})
  #************************************************
- # Build config.cmake files
+ # Create in-tree build infrastructure
  #************************************************
- set(LXQT_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/lxqt)
- set(LXQT_TRANSLATIONS_DIR ${LXQT_SHARE_DIR}/translations)
- include(cmake/FindInstallConfigPath.cmake)
+ set(CFG_LXQT_INCLUDE_DIR    ${LXQT_INTREE_INCLUDE_DIR})
+ set(CFG_LXQT_LIBRARY        ${LXQT_LIBRARY_NAME})
+ set(CFG_LXQT_USE_FILE       ${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}_use.cmake)
+ set(CFG_LXQT_TRAGETS_FILE   ${LXQT_INTREE_TRAGETS_FILE})
  
- set(LXQT_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include/lxqt)
 -
 -configure_file(
 -    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt-config.cmake.in 
 -    ${CMAKE_BINARY_DIR}/lxqt-config.cmake
 -    @ONLY
 -)
 -
  configure_file(
-     ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt-config.cmake.in
-     ${CMAKE_CURRENT_BINARY_DIR}/lxqt-config.cmake
+     ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqtX-config.cmake.in 
+     ${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-config.cmake
      @ONLY
  )
 -
+ configure_file(
+     ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt_use.cmake.in
+     ${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}_use.cmake
+     @ONLY
+ )
+ include(${CFG_LXQT_USE_FILE})
  #************************************************
- # End of build config.cmake
+ # Create instalable build infrastructure
  #************************************************
- include_directories(${LXQT_INCLUDE_DIR})
- set(APP_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/liblxqt)
+ set(CFG_LXQT_INCLUDE_DIR    ${LXQT_INSTALL_INCLUDE_DIR})
+ set(CFG_LXQT_LIBRARY        ${LXQT_LIBRARY_NAME})
+ set(CFG_LXQT_USE_FILE       ${LXQT_INSTALL_CMAKE_DIR}${LXQT_LIBRARY_NAME}/${LXQT_LIBRARY_NAME}_use.cmake)
+ set(CFG_LXQT_TRAGETS_FILE   ${LXQT_INSTALL_CMAKE_DIR}${LXQT_LIBRARY_NAME}/${LXQT_LIBRARY_NAME}-targets.cmake)
  
 -
 -configure_file(
 -    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt-config.cmake.in 
 -    ${CMAKE_CURRENT_BINARY_DIR}/install/lxqt-config.cmake
 -    @ONLY
 -)
 -
+ configure_file(
+     ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqtX-config.cmake.in 
+     ${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}-config.cmake
+     @ONLY
+ )
  
- qt4_wrap_cpp(MOCS ${MOCS})
- qt4_wrap_ui(UIS ${FORMS})
- qt4_add_translation(QM_FILES ${TS_FILES})
- include(cmake/lxqt_use.cmake)
 +# use gcc visibility feature to decrease unnecessary exported symbols
 +if (CMAKE_COMPILER_IS_GNUCXX)
 +    # set visibility to hidden to hide symbols, unlesss they're exporeted
 +    # manually in the code
 +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wl,-no-undefined -Wall")
 +endif()
 +add_definitions(-DCOMPILE_LIBLXQT)
 +
 +# create the portable headers *******************
 +include(create_portable_headers)
 +create_portable_headers(PORTABLE_HEADERS ${PUBLIC_CLASSES})
 +check_portable_headers("${PUB_HDRS}")
 +#************************************************
 +
+ configure_file(
+     ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt_use.cmake.in
+     ${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}_use.cmake
+     @ONLY
+ )
+ install(FILES 
+     ${CMAKE_CURRENT_BINARY_DIR}/install/lxqt-config.cmake
+     DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/lxqt
+     COMPONENT Devel
+ )
+ install(FILES 
+     ${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}-config.cmake
+     ${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}_use.cmake
+     DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}
+     COMPONENT Devel
+ )
+ install(EXPORT 
+     ${LXQT_LIBRARY_NAME}-targets
+     DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}
+     COMPONENT Devel
+ )
  
  
  include(translatorsinfo/CMakeLists.txt)
@@@ -206,24 -332,43 +326,44 @@@ target_link_libraries(${LXQT_LIBRARY_NA
      ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}
      ${QT_QTDBUS_LIBRARY}
      ${X11_X11_LIB}
 -    ${XDGQT_LIBRARIES}
 +    ${QTXDG_LIBRARIES}
  )
  
- set_target_properties(lxqt PROPERTIES
++if(USE_QT5)
++      qt5_use_modules(${LXQT_LIBRARY_NAME} Widgets DBus X11Extras)
++endif()
++
+ set_target_properties(${LXQT_LIBRARY_NAME} PROPERTIES
      VERSION   ${LXQT_VERSION}
      SOVERSION ${LXQT_MAJOR_VERSION}
  )
  
- install(TARGETS lxqt DESTINATION ${LIB_INSTALL_DIR})
- install(FILES ${PUB_HDRS}  DESTINATION ${LXQT_INCLUDE_DIR})
- install(FILES ${PORTABLE_HEADERS} DESTINATION ${LXQT_INCLUDE_DIR})
+ install(TARGETS 
+     ${LXQT_LIBRARY_NAME} 
+     DESTINATION ${CMAKE_INSTALL_LIBDIR} 
+     EXPORT ${LXQT_LIBRARY_NAME}-targets
 -    LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}        
++    LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
+ )
 -export(TARGETS ${LXQT_LIBRARY_NAME} ${XDGQT_TARGET} FILE ${LXQT_INTREE_TRAGETS_FILE})
 -
 -
++export(TARGETS ${LXQT_LIBRARY_NAME} ${QTXDG_TARGET} FILE ${LXQT_INTREE_TRAGETS_FILE})
+ # Install in two places for inclusions like "include <lxde/lxdeclass.h>" and "include <LxQt/Class>".
+ install(FILES ${PUB_HDRS}         DESTINATION ${LXQT_INSTALL_INCLUDE_DIR}/lxqt)
+ install(FILES ${PORTABLE_HEADERS} DESTINATION ${LXQT_INSTALL_INCLUDE_DIR}/lxqt)
+ install(FILES ${PUB_HDRS}         DESTINATION ${LXQT_INSTALL_INCLUDE_DIR}/LxQt)
+ install(FILES ${PORTABLE_HEADERS} DESTINATION ${LXQT_INSTALL_INCLUDE_DIR}/LxQt)
  install(FILES ${QM_FILES} DESTINATION ${LXQT_TRANSLATIONS_DIR})
  
- install(FILES
-     ${CMAKE_CURRENT_BINARY_DIR}/lxqt-config.cmake
-     DESTINATION share/cmake/lxqt
 -
+ #************************************************
+ # Create pkgconfig file
+ #************************************************
+ lxqt_create_pkgconfig_file(${LXQT_LIBRARY_NAME}
+     ${LXGQT_PKG_CONFIG_DESCRIPTION}
+     ${LXQT_PKG_CONFIG_REQUIRES}
+     ${LXQT_LIBRARY_NAME}
+     ${LXQT_VERSION}
  )
- install(FILES cmake/lxqt_use.cmake DESTINATION share/cmake/lxqt)
- include(cmake/create_pkgconfig_file.cmake)
- create_pkgconfig_file(lxqt "Shared library for LXQt applications")
+ #************************************************
@@@ -27,7 -27,7 +27,7 @@@
  
  
  #include "technicalinfo.h"
- #include <qtxdg/xdgdirs.h>
 -#include <xdgqt/XdgDirs>
++#include <qtxdg/XdgDirs>
  #include "lxqttranslator.h"
  
  using namespace LxQt;
@@@ -28,7 -28,7 +28,7 @@@
  
  #include "lxqtaddplugindialog.h"
  #include "ui_lxqtaddplugindialog.h"
- #include <qtxdg/xdgicon.h>
 -#include <xdgqt/XdgIcon>
++#include <qtxdg/XdgIcon>
  #include <QtGui/QListWidgetItem>
  #include <QtGui/QItemDelegate>
  #include <QtGui/QTextDocument>
  #   add_executable(myexe main.cpp)
  #   target_link_libraries(myexe $LXQT_LIBRARIES})
  
- set(LXQT_MAJOR_VERSION @LXQT_MAJOR_VERSION@)
- set(LXQT_MINOR_VERSION @LXQT_MINOR_VERSION@)
- set(LXQT_PATCH_VERSION @LXQT_PATCH_VERSION@)
- set(LXQT_VERSION       @LXQT_VERSION@)
+ option(USE_QT5 "Force use the Qt5." $ENV{USE_QT5})
+ option(USE_QT4 "Force use the Qt4." $ENV{USE_QT4})
  
- set(LXQT_SHARE_DIR     @LXQT_SHARE_DIR@)
- set(LXQT_TRANSLATIONS_DIR @LXQT_TRANSLATIONS_DIR@)
- set(LXQT_ETC_XDG_DIR   @LXQT_ETC_XDG_DIR@)
- set(LXQT_INCLUDE_DIR   @LXQT_INCLUDE_DIR@)
- set(LXQT_LIBRARY       lxqt)
+ if((USE_QT4 AND USE_QT5) OR
+    (NOT USE_QT4 AND NOT USE_QT5))
+     # Autodetect Qt version
+     find_package(LxQt4 QUIET)
+     if (LXQT4_FOUND)
+         set(USE_QT4 ON)
+         set(USE_QT5 OFF)
+     else()
+         set(USE_QT4 OFF)
+         set(USE_QT5 ON)
+     endif()
+ endif()
  
- set(LXQT_LIBRARIES     ${LXQT_LIBRARY} )
- set(LXQT_INCLUDE_DIRS  ${LXQT_INCLUDE_DIR} )
- set(LXQT_USE_FILE      ${CMAKE_CURRENT_LIST_DIR}/lxqt_use.cmake)
- set(LXQT_FOUND         1)
+ if(LXQT_FIND_REQUIRED)
+   set(REQUIRED_OPT "REQUIRED")
+ endif()
  
- # for backward compatability ----->
- #set(LXQT_SHARE_DIR     ${})
- #set(LXQT_ETC_XDG_DIR   ${})
- #set(LXQT_INCLUDE_DIR   ${LXQT_INCLUDE_DIR})
- #set(LXQT_INCLUDE_DIRS  ${LXQT_INCLUDE_DIRS})
- #set(LXQT_LIBRARY       ${LXQT_LIBRARY})
- # for backward compatability <-----
+ if(LXQT_FIND_QUIETLY)
+   set(QUIET_OPT "QUIET")
+ endif()
  
- mark_as_advanced(LXQT_LIBRARY LXQT_INCLUDE_DIR)
- #************************************************
- # LXQT_USE_MOUNT
- #
- #if (LXQT_USE_MOUNT)
- #    include(${CMAKE_CURRENT_LIST_DIR}/lxqtmount-config.cmake)
- #    set(LXQT_INCLUDE_DIRS       ${LXQT_INCLUDE_DIRS} ${LXQTMOUNT_INCLUDE_DIR})
- #    set(LXQT_LIBRARIES          ${LXQT_LIBRARIES}    ${LXQTMOUNT_LIBRARY})
- #endif(LXQT_USE_MOUNT)
- #************************************************
- # LXQT_USE_GLOBALKEYCLIENT
- #
- #if (LXQT_USE_GLOBALKEYCLIENT)
- #    include(${CMAKE_CURRENT_LIST_DIR}/lxqtglobalkeyclient-config.cmake)
- #    set(LXQT_INCLUDE_DIRS       ${LXQT_INCLUDE_DIRS} ${LXQTGLOBALKEYCLIENT_INCLUDE_DIR})
- #    set(LXQT_LIBRARIES          ${LXQT_LIBRARIES}    ${LXQTGLOBALKEYCLIENT_LIBRARIES})
--
- #endif(LXQT_USE_GLOBALKEYCLIENT)
+ if(USE_QT5)
+   find_package(LxQt5 ${REQUIRED_OPT} ${QUIET_OPT})
+ else()
+   find_package(LxQt4 ${REQUIRED_OPT} ${QUIET_OPT})
+ endif()
index 0000000,f2fb27c..14c5342
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,187 +1,187 @@@
 -#                          /etc/xdg/razor location. Unfortunately QSettings we are using internally
+ # - Find the LXQt include and library dirs and define a some macros
+ #
+ # The module defines the following functions
+ #
+ # lxqt_translate_desktop(desktop_files
+ #                         SOURCES sources ...
+ #                         [TRANSLATION_DIR] translation_directory
+ #                        )
+ #     out: desktop_files
+ #     generates commands to create .desktop files from sources.
+ #     The generated filenames can be found in desktop_files.
+ #
+ #     in: sources
+ #     List of the desktop.in files
+ #
+ #     in: translation_directory
+ #     A relative path to the directory with translations files, it is
+ #     relative to the CMakeList.txt. By default is "translations"
+ #
+ #
+ # lxqt_set_default_value(VAR_NAME VAR_VALUE)
+ #
+ #
+ # lxqt_create_pkgconfig_file(name 
+ #                            desc 
+ #                            requires 
+ #                            include_rel_dir 
+ #                            version)
+ #     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
+ #       requires: required libraries
+ #       include_rel_dir: include directory, relative to includedir
+ #       version: package version
+ #
+ #
+ #
+ # The module defines the following definitions
+ #
+ #  -DLXQT_SHARE_DIR      - This allows to install and read the configs from non-standard locations
+ #
+ #  -DLXQT_ETC_XDG_DIR    - XDG standards expects system-wide configuration files in the
 -add_definitions(-DRAZOR_SHARE_DIR=\"${LXQT_SHARE_DIR}\")
 -add_definitions(-DRAZOR_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\")
 -add_definitions(-DRAZOR_VERSION=\"${LXQT_VERSION}\")
++#                          /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
+ #
+ #
+ #
+ include_directories(${LXQT_INCLUDE_DIRS})
+ #cmake_policy(SET CMP0005 NEW)
+ add_definitions(-DLXQT_SHARE_DIR=\"${LXQT_SHARE_DIR}\")
+ add_definitions(-DLXQT_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\")
+ add_definitions(-DLXQT_VERSION=\"${LXQT_VERSION}\")
+ # for backward compatability ----->
++add_definitions(-DLXQT_SHARE_DIR=\"${LXQT_SHARE_DIR}\")
++add_definitions(-DLXQT_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\")
++add_definitions(-DLXQT_VERSION=\"${LXQT_VERSION}\")
+ # for backward compatability <-----
+ #if(NOT "${PROJECT_NAME}" STREQUAL "liblxqt")
+ #    message("#################${PROJECT_NAME} liblxqt${LXQT_QT_VERSION}")
+ #    add_dependencies("lxqt${LXQT_QT_VERSION}")
+ SET_SOURCE_FILES_PROPERTIES(LXQT_LIBRARIES PROPERTIES OBJECT_DEPENDS lxqt${LXQT_QT_VERSION})
+ #endif()
+ #else()
+ #    find_package(Qt4 REQUIRED QUIET)
+ #    include(${QT_USE_FILE})
+ #endif()
+ #**********************************************************
+ # DESKTOP files
+ #**********************************************************
+ function(lxqt_translate_desktop _RESULT)
+     set(_translationDir "translations")
+     # Parse arguments ***************************************
+     set(_state "")
+     foreach (_arg ${ARGN})
+         if (
+             ("${_arg}_I_HATE_CMAKE" STREQUAL "SOURCES_I_HATE_CMAKE") OR
+             ("${_arg}_I_HATE_CMAKE" STREQUAL "TRANSLATION_DIR_I_HATE_CMAKE")
+            )
+             set(_state ${_arg})
+         else()
+             if("${_state}" STREQUAL "SOURCES")
+                 get_filename_component (__file ${_arg} ABSOLUTE)
+                 set(_sources  ${_sources} ${__file})
+                 #set(_sources  ${_sources} ${_arg})
+             elseif("${_state}" STREQUAL "TRANSLATION_DIR")
+                 set(_translationDir ${_arg})
+                 set(_state "")
+             else()
+                 MESSAGE(FATAL_ERROR
+                   "Unknown argument '${_arg}'.\n"
+                   "See ${CMAKE_CURRENT_LIST_FILE} for more information.\n"
+                 )
+             endif()
+         endif()
+     endforeach(_arg)
+     get_filename_component (_translationDir ${_translationDir} ABSOLUTE)
+     foreach (_inFile ${_sources})
+         get_filename_component(_inFile   ${_inFile} ABSOLUTE)
+         get_filename_component(_fileName ${_inFile} NAME_WE)
+         #Extract the real extension ............
+         get_filename_component(_fileExt  ${_inFile} EXT)
+         string(REPLACE ".in" "" _fileExt ${_fileExt})
+         #.......................................
+         set(_outFile "${CMAKE_CURRENT_BINARY_DIR}/${_fileName}${_fileExt}")
+         file(GLOB _translations
+             ${_translationDir}/${_fileName}_*${_fileExt}
+             ${_translationDir}/local/${_fileName}_*${_fileExt}
+         )
+         set(_pattern "'\\[.*]\\s*='")
+         if (_translations)
+             add_custom_command(OUTPUT ${_outFile}
+                 COMMAND grep -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
+                 COMMAND grep --no-filename ${_pattern} ${_translations} >> ${_outFile}
+                 COMMENT "Generating ${_fileName}${_fileExt}"
+             )
+         else()
+             add_custom_command(OUTPUT ${_outFile}
+                 COMMAND grep -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
+                 COMMENT "Generating ${_fileName}${_fileExt}"
+             )
+         endif()
+         set(__result ${__result} ${_outFile})
+     endforeach()
+     set(${_RESULT} ${__result} PARENT_SCOPE)
+ endfunction()
+ macro(lxqt_set_default_value VAR_NAME VAR_VALUE)
+     if (NOT DEFINED ${VAR_NAME})
+         set (${VAR_NAME} ${VAR_VALUE})
+     endif ()
+ endmacro()
+ #
+ # 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(lxqt_create_pkgconfig_file name desc requires include_rel_dir version)
+     set(_pkgfname "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc")
+     message(STATUS "${name}: writing pkgconfig file ${_pkgfname}")
+     file(WRITE "${_pkgfname}"
+             "# file generated by razor-qt cmake build\n"
+             "prefix=${CMAKE_INSTALL_PREFIX}\n"
+             "libdir=\${prefix}/${CMAKE_INSTALL_LIBDIR}\n"
+             "includedir=\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}\n"
+             "\n"
+             "Name: ${name}\n"
+             "Description: ${desc}\n"
+             "Version: ${version}\n"
+             "Requires: ${requires}\n"
+             "Libs: -L\${libdir} -l${name}\n"
+             "Cflags: -I\${includedir} -I\${includedir}/${include_rel_dir}\n"
+             "\n"
+         )
+     install(FILES ${_pkgfname} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+ endmacro()
@@@ -25,7 -25,7 +25,7 @@@
  #include "lxqtconfigdialog.h"
  #include "ui_lxqtconfigdialog.h"
  
- #include <qtxdg/xdgicon.h>
 -#include <xdgqt/XdgIcon>
++#include <qtxdg/XdgIcon>
  #include <QtGui/QPushButton>
  
  using namespace LxQt;
@@@ -27,8 -27,8 +27,8 @@@
  
  #include <QtCore/QDir>
  
- #include <qtxdg/xdgicon.h>
- #include <qtxdg/xdgdirs.h>
 -#include <xdgqt/XdgIcon>
 -#include <xdgqt/XdgDirs>
++#include <qtxdg/XdgIcon>
++#include <qtxdg/XdgDirs>
  
  #include "lxqtapplication.h"
  #include "lxqtsettings.h"
@@@ -49,11 -49,11 +49,18 @@@ using namespace LxQt
  #include <QDateTime>
  /*! \brief Log qDebug input to file
  Used only in pure Debug builds or when is the system environment
 -variable RAZOR_DEBUG set
 +variable LXQT_DEBUG set
  */
++#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
++void dbgMessageOutput(QtMsgType type, const QMessageLogContext &ctx, const QString & msgStr)
++{
++    QByteArray msgBuf = msgStr.toUtf8();
++    const char* msg = msgBuf.constData();
++#else
  void dbgMessageOutput(QtMsgType type, const char *msg)
  {
 -    QDir dir(XdgDirs::configHome().toUtf8() + "/razor");
++#endif
 +    QDir dir(XdgDirs::configHome().toUtf8() + "/lxqt");
      dir.mkpath(".");
  
      const char* typestr;
@@@ -94,15 -94,15 +101,26 @@@ Application::Application(int &argc, cha
      : QApplication(argc, argv)
  {
  #ifdef DEBUG
-     qInstallMsgHandler(dbgMessageOutput);
++
++#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
++    qInstallMessageHandler(dbgMessageOutput);
 +#else
+     qInstallMsgHandler(dbgMessageOutput);
++#endif
++
++#else //  DEBUG
 +    if (!qgetenv("LXQT_DEBUG").isNull())
++#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
++        qInstallMessageHandler(dbgMessageOutput);
+ #else
 -    if (!qgetenv("RAZOR_DEBUG").isNull())
          qInstallMsgHandler(dbgMessageOutput);
  #endif
  
++#endif // DEBUG
++
      XdgIcon::setThemeName(Settings::globalSettings()->value("icon_theme").toString());
 -    setWindowIcon(QIcon(QString(LXQT_SHARE_DIR) + "/graphics/razor_logo.png"));
 -    connect(Settings::globalSettings(), SIGNAL(razorThemeChanged()), this, SLOT(updateTheme()));
 +    setWindowIcon(QIcon(QString(LXQT_SHARE_DIR) + "/graphics/lxqt_logo.png"));
 +    connect(Settings::globalSettings(), SIGNAL(lxqtThemeChanged()), this, SLOT(updateTheme()));
      updateTheme();
  }
  
@@@ -28,9 -28,8 +28,9 @@@
  #ifndef LXQTAPPLICATION_H
  #define LXQTAPPLICATION_H
  
- #include <QtGui/QApplication>
- #include <QtGui/QProxyStyle>
+ #include <QApplication>
+ #include <QProxyStyle>
 +#include "lxqtglobals.h"
  
  namespace LxQt
  {
@@@ -23,8 -23,8 +23,8 @@@
   * END_COMMON_COPYRIGHT_HEADER */
  
  #include "lxqtautostartentry.h"
- #include <qtxdg/xdgautostart.h>
- #include <qtxdg/xdgdirs.h>
 -#include <xdgqt/XdgAutoStart>
 -#include <xdgqt/XdgDirs>
++#include <qtxdg/XdgAutoStart>
++#include <qtxdg/XdgDirs>
  #include <QtCore/QFileInfo>
  
  using namespace LxQt;
@@@ -25,8 -25,7 +25,8 @@@
  #ifndef LXQTAUTOSTARTENTRY_H
  #define LXQTAUTOSTARTENTRY_H
  
- #include <qtxdg/xdgdesktopfile.h>
 -#include <xdgqt/XdgDesktopFile>
++#include <qtxdg/XdgDesktopFile>
 +#include "lxqtglobals.h"
  
  namespace LxQt
  {
@@@ -24,7 -24,7 +24,7 @@@
  
  #include "lxqtnotification.h"
  #include "lxqtnotification_p.h"
--#include <QtGui/QMessageBox>
++#include <QMessageBox>
  #include <QDebug>
  
  using namespace LxQt;
@@@ -25,8 -25,7 +25,8 @@@
  #ifndef LXQTNOTIFICATION_H
  #define LXQTNOTIFICATION_H
  
--#include <QtCore/QStringList>
++#include <QStringList>
 +#include "lxqtglobals.h"
  
  namespace LxQt
  {
@@@ -29,7 -29,7 +29,7 @@@
  #ifndef LXQTPLUGININFO_H
  #define LXQTPLUGININFO_H
  
- #include <qtxdg/xdgdesktopfile.h>
 -#include <xdgqt/XdgDesktopFile>
++#include <qtxdg/XdgDesktopFile>
  #include <QtCore/QString>
  #include <QtCore/QList>
  
@@@ -27,7 -27,7 +27,7 @@@
  
  #include "lxqtpowermanager.h"
  #include "lxqtpower/lxqtpower.h"
- #include <qtxdg/xdgicon.h>
 -#include <xdgqt/XdgIcon>
++#include <qtxdg/XdgIcon>
  #include <QDBusInterface>
  #include <QMessageBox>
  #include <QApplication>
@@@ -28,7 -28,7 +28,7 @@@
  #include <QtCore/QProcess>
  #include <QtGui/QMessageBox>
  
- #include <qtxdg/xdgicon.h>
 -#include <xdgqt/XdgIcon>
++#include <qtxdg/XdgIcon>
  #include "lxqtscreensaver.h"
  #include "lxqttranslator.h"
  
@@@ -27,8 -27,8 +27,8 @@@
   * END_COMMON_COPYRIGHT_HEADER */
  
  #include "lxqtsettings.h"
- #include <qtxdg/xdgicon.h>
- #include <qtxdg/xdgdirs.h>
 -#include <xdgqt/XdgIcon>
 -#include <xdgqt/XdgDirs>
++#include <qtxdg/XdgIcon>
++#include <qtxdg/XdgDirs>
  #include <QtCore/QDebug>
  #include <QtCore/QEvent>
  #include <QtCore/QDir>
diff --cc lxqtxfitman.cpp
@@@ -80,7 -79,7 +79,7 @@@ const XfitMan& xfitMan(
   */
  XfitMan::XfitMan()
  {
--    root = QX11Info::appRootWindow();
++    root = (Window)QX11Info::appRootWindow();
  }
  
  /**
@@@ -860,7 -859,7 +859,7 @@@ const QRect XfitMan::availableGeometry(
      uchar* data = 0;
      ulong nitems, after;
  
--    status = XGetWindowProperty(display, QX11Info::appRootWindow(x11Screen),
++    status = XGetWindowProperty(display, (Window)QX11Info::appRootWindow(x11Screen),
                                  atom("_NET_CLIENT_LIST"), 0L, ~0L, False, XA_WINDOW,
                                  &ret, &format, &nitems, &after, &data);
  
@@@ -976,57 -975,4 +975,57 @@@ bool XfitMan::isWindowManagerActive() c
      return false;
  }
  
-     clientMessage(QX11Info::appRootWindow(), atom("_NET_SHOWING_DESKTOP"), show ? 1 : 0);
 +bool XfitMan::getShowingDesktop() const
 +{
 +    bool show = false;
 +    unsigned long resultLen;
 +    unsigned char* result = NULL;
 +    if(getRootWindowProperty(atom("_NET_SHOWING_DESKTOP"), XA_CARDINAL, &resultLen, &result))
 +    {
 +        show = *reinterpret_cast<long*>(result) ? true : false;
 +        if(result)
 +            XFree(result);
 +    }
 +    return show;
 +}
 +
 +void XfitMan::setShowingDesktop(bool show) const
 +{
++    clientMessage((Window)QX11Info::appRootWindow(), atom("_NET_SHOWING_DESKTOP"), show ? 1 : 0);
 +}
 +
 +void XfitMan::setIconGeometry(Window _wid, QRect* rect) const
 +{
 +    Atom net_wm_icon_geometry = atom("_NET_WM_ICON_GEOMETRY");
 +    if(!rect)
 +        XDeleteProperty(QX11Info::display(), _wid, net_wm_icon_geometry);
 +    else
 +    {
 +        long data[4];
 +        data[0] = rect->x();
 +        data[1] = rect->y();
 +        data[2] = rect->width();
 +        data[3] = rect->height();
 +        XChangeProperty(QX11Info::display(), _wid, net_wm_icon_geometry,
 +                        XA_CARDINAL, 32, PropModeReplace, (unsigned char*)data, 4);
 +    }
 +}
 +
 +XfitMan::WMState XfitMan::getWMState(Window _wid) const
 +{
 +  WMState state = WMStateWithdrawn;
 +    Atom wm_state = atom("WM_STATE");
 +    unsigned long resultLen;
 +    unsigned char* result = NULL;
 +    if(getWindowProperty(_wid, wm_state, wm_state, &resultLen, &result))
 +    {
 +        if(result)
 +        {
 +            state = WMState(*((long*)result));
 +            XFree(result);
 +        }
 +    }
 +    return state;
 +}
 +
  } // namespace LxQt
Simple merge