diff --git a/kuassel/.travis.yml b/kuassel/.travis.yml deleted file mode 100644 index defbb623..00000000 --- a/kuassel/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -before_install: - - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - - sudo add-apt-repository -y ppa:kalakris/cmake - - sudo apt-add-repository -y ppa:beineri/opt-qt521 - - sudo apt-get -qq update - -install: - - sudo apt-get install -q gcc-4.7 g++-4.7 - - if [ "$CXX" = "clang" ]; then sudo apt-get install -q clang-3.4; fi - - sudo apt-get install -q cmake - - sudo apt-get install -q qt52base qt52webkit qt52tools qt52script - - if [ "$CXX" = "g++" ]; then export CXX="g++-4.7" CC="gcc-4.7"; fi - -language: cpp - -compiler: - - gcc - - clang - -env: - - QT_VERSION=qt4 - - QT_VERSION=qt5 - -script: - - mkdir build - - cd build - - if [ "$QT_VERSION" = "qt4" ]; then cmake ..; fi - - if [ "$QT_VERSION" = "qt5" ]; then source /opt/qt52/bin/qt52-env.sh && cmake -DUSE_QT5=ON ..; fi - - make \ No newline at end of file diff --git a/kuassel/CMakeLists.txt b/kuassel/CMakeLists.txt index 9b6edfce..247be16c 100644 --- a/kuassel/CMakeLists.txt +++ b/kuassel/CMakeLists.txt @@ -46,14 +46,6 @@ endif() # For this, the feature info is added after we know if QtWebkit is installed option(WITH_WEBKIT "WebKit support (for link previews)" ON) -if (APPLE) - # Notification Center is only available in > 10.8, which is Darwin v12 - if (CMAKE_SYSTEM_VERSION VERSION_GREATER "11.9.9") - option(WITH_NOTIFICATION_CENTER "OS X Notification Center support" ON) - add_feature_info(WITH_NOTIFICATION_CENTER WITH_NOTIFICATION_CENTER "Use the OS X Notification Center") - endif() -endif() - # Handle with care set(QT_PATH "" CACHE PATH "Path to a Qt4 installation to use instead of the system Qt (e.g. for static builds)") @@ -220,23 +212,10 @@ if(INDICATEQT_FOUND) add_definitions(-DXDG_APPS_INSTALL_DIR=${XDG_APPS_INSTALL_DIR}) endif() -if(NOT WIN32) - check_function_exists(umask HAVE_UMASK) - if(HAVE_UMASK) +check_function_exists(umask HAVE_UMASK) +if(HAVE_UMASK) add_definitions(-DHAVE_UMASK) - endif(HAVE_UMASK) -endif(NOT WIN32) - -# Generate version information from Git -include(GetGitRevisionDescription) -get_git_head_revision(GIT_REFSPEC GIT_HEAD) -git_describe(GIT_DESCRIBE --long) - -# Sanitize things if we're not in a Git repo -if(NOT GIT_HEAD OR NOT GIT_DESCRIBE) - set(GIT_HEAD "") - set(GIT_DESCRIBE "") -endif() +endif(HAVE_UMASK) configure_file(version.h.in ${CMAKE_BINARY_DIR}/version.h @ONLY) diff --git a/kuassel/INSTALL b/kuassel/INSTALL index a9dc9e2b..95e7899e 100644 --- a/kuassel/INSTALL +++ b/kuassel/INSTALL @@ -5,19 +5,9 @@ These should help you to install Quassel IRC from source. Note that this focuses mostly on building on Linux; please feel free to send patches for build instructions on other platforms. We are not familiar with them. -There are three versions of Quassel that can be built: - -* quasselcore - The server daemon. Typically runs on a headless server and - is permanently online. The core connects to IRC and stores - both settings and backlog. -* quasselclient - The GUI client. Requires a running quasselcore to connect to. - Upon connection, the client will fetch all session data and - a certain amount of backlog from the core and restore its - session almost as if you were never gone. -* quassel - This standalone version, often called "monolithic" or - "mono client", contains both a client and a core and can be - used like a "normal" IRC client, without having to setup - a server daemon. +There is one version of Quassel that can be built - standalone, often called +"monolithic" or "mono client", contains both a client and a core and can be +used like a "normal" IRC client, without having to setup a server daemon. Prerequisites ------------- @@ -71,36 +61,11 @@ use of several optional dependencies if installed. CMake will give a nice summary of all that after its run, so we'll just mention the most important options here: --DWANT_(CORE|QTCLIENT|MONO)=(ON|OFF) - Allow to choose which Quassel binaries to build. - --DUSE_QT5=ON - Build against Qt5 instead of the default Qt4. Note that you should empty - your build directory when switching between Qt versions, otherwise weird - things may happen. - --DWITH_KDE=ON - Enable integration into KDE4; only available if -DUSE_QT5=OFF - --DWITH_OXYGEN=(ON|OFF) - Install the parts of the Oxygen icon set Quassel uses. Oxygen is the default - icon set for KDE4, and thus already available on systems where KDE4 is - installed. By default, WITH_OXYGEN is ON iff WITH_KDE is OFF. If you are - sure that you have the icon set already installed on your system regardless, - use this option to disable installing the bundled icons. - -DWITH_WEBKIT=OFF Use Webkit for showing previews of webpages linked in the chat. Requires the QtWebkit module to be available, and increases the client's RAM usage by *a lot* if enabled at runtime. --DEMBED_DATA=(ON|OFF) - Specifies whether Quassel's data files (icons, translations and so on) - should be installed normally, or embedded into the binaries. The latter is - useful if you want to run Quassel from the build directory, or don't want - to use a standard installation. In particular, EMBED_DATA defaults to ON - on Windows and OS X, and to OFF on Linux. - You can find the list of optional packages for additional features in CMake's feature summary; install missing packages for enabling the functionality listed in the explanation. If you want to forcefully disable an optional feature, use diff --git a/kuassel/cmake/FindLibraryWithDebug.cmake b/kuassel/cmake/FindLibraryWithDebug.cmake deleted file mode 100644 index 58cd7308..00000000 --- a/kuassel/cmake/FindLibraryWithDebug.cmake +++ /dev/null @@ -1,113 +0,0 @@ -# -# FIND_LIBRARY_WITH_DEBUG -# -> enhanced FIND_LIBRARY to allow the search for an -# optional debug library with a WIN32_DEBUG_POSTFIX similar -# to CMAKE_DEBUG_POSTFIX when creating a shared lib -# it has to be the second and third argument - -# Copyright (c) 2007, Christian Ehrlicher, -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -MACRO(FIND_LIBRARY_WITH_DEBUG var_name win32_dbg_postfix_name dgb_postfix libname) - - IF(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX") - - # no WIN32_DEBUG_POSTFIX -> simply pass all arguments to FIND_LIBRARY - FIND_LIBRARY(${var_name} - ${win32_dbg_postfix_name} - ${dgb_postfix} - ${libname} - ${ARGN} - ) - - ELSE(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX") - - IF(NOT WIN32) - # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX - - FIND_LIBRARY(${var_name} ${libname} ${ARGN}) - - ELSE(NOT WIN32) - - # 1. get all possible libnames - SET(args ${ARGN}) - SET(newargs "") - SET(libnames_release "") - SET(libnames_debug "") - - LIST(LENGTH args listCount) - - IF("${libname}" STREQUAL "NAMES") - SET(append_rest 0) - LIST(APPEND args " ") - - FOREACH(i RANGE ${listCount}) - LIST(GET args ${i} val) - - IF(append_rest) - LIST(APPEND newargs ${val}) - ELSE(append_rest) - IF("${val}" STREQUAL "PATHS") - LIST(APPEND newargs ${val}) - SET(append_rest 1) - ELSE("${val}" STREQUAL "PATHS") - LIST(APPEND libnames_release "${val}") - LIST(APPEND libnames_debug "${val}${dgb_postfix}") - ENDIF("${val}" STREQUAL "PATHS") - ENDIF(append_rest) - - ENDFOREACH(i) - - ELSE("${libname}" STREQUAL "NAMES") - - # just one name - LIST(APPEND libnames_release "${libname}") - LIST(APPEND libnames_debug "${libname}${dgb_postfix}") - - SET(newargs ${args}) - - ENDIF("${libname}" STREQUAL "NAMES") - - # search the release lib - FIND_LIBRARY(${var_name}_RELEASE - NAMES ${libnames_release} - ${newargs} - ) - - # search the debug lib - FIND_LIBRARY(${var_name}_DEBUG - NAMES ${libnames_debug} - ${newargs} - ) - - IF(${var_name}_RELEASE AND ${var_name}_DEBUG) - - # both libs found - SET(${var_name} optimized ${${var_name}_RELEASE} - debug ${${var_name}_DEBUG}) - - ELSE(${var_name}_RELEASE AND ${var_name}_DEBUG) - - IF(${var_name}_RELEASE) - - # only release found - SET(${var_name} ${${var_name}_RELEASE}) - - ELSE(${var_name}_RELEASE) - - # only debug (or nothing) found - SET(${var_name} ${${var_name}_DEBUG}) - - ENDIF(${var_name}_RELEASE) - - ENDIF(${var_name}_RELEASE AND ${var_name}_DEBUG) - - MARK_AS_ADVANCED(${var_name}_RELEASE) - MARK_AS_ADVANCED(${var_name}_DEBUG) - - ENDIF(NOT WIN32) - - ENDIF(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX") - -ENDMACRO(FIND_LIBRARY_WITH_DEBUG) diff --git a/kuassel/cmake/FindPhonon.cmake b/kuassel/cmake/FindPhonon.cmake deleted file mode 100644 index cd9e5cb4..00000000 --- a/kuassel/cmake/FindPhonon.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# Find libphonon -# Once done this will define -# -# PHONON_FOUND - system has Phonon Library -# PHONON_INCLUDES - the Phonon include directory -# PHONON_LIBS - link these to use Phonon -# PHONON_VERSION - the version of the Phonon Library - -# Copyright (c) 2008, Matthias Kretz -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -macro(_phonon_find_version) - set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h") - if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") - set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") - endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") - file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000) - string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}") - set(PHONON_VERSION "${CMAKE_MATCH_1}") -endmacro(_phonon_find_version) - -# the dirs listed with HINTS are searched before the default sets of dirs -find_library(PHONON_LIBRARY NAMES phonon HINTS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR}) -find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h HINTS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR}) - -if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY}) - set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}) - _phonon_find_version() -endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Phonon DEFAULT_MSG PHONON_INCLUDE_DIR PHONON_LIBRARY) - -mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY) diff --git a/kuassel/cmake/FindQCA2.cmake b/kuassel/cmake/FindQCA2.cmake deleted file mode 100644 index e2d8f2a5..00000000 --- a/kuassel/cmake/FindQCA2.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# - Try to find QCA2 (Qt Cryptography Architecture 2) -# Once done this will define -# -# QCA2_FOUND - system has QCA2 -# QCA2_INCLUDE_DIR - the QCA2 include directory -# QCA2_LIBRARIES - the libraries needed to use QCA2 -# QCA2_DEFINITIONS - Compiler switches required for using QCA2 -# -# use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls - -# Copyright (c) 2006, Michael Larouche, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -include(FindLibraryWithDebug) - -if (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) - - # in cache already - set(QCA2_FOUND TRUE) - -else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) - - - if (NOT WIN32) - find_package(PkgConfig) - pkg_check_modules(PC_QCA2 QUIET qca2) - set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER}) - endif (NOT WIN32) - - find_library_with_debug(QCA2_LIBRARIES - WIN32_DEBUG_POSTFIX d - NAMES qca - HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS} - ) - - find_path(QCA2_INCLUDE_DIR QtCrypto - HINTS ${PC_QCA2_INCLUDEDIR} ${PC_QCA2_INCLUDE_DIRS} - PATH_SUFFIXES QtCrypto) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(QCA2 DEFAULT_MSG QCA2_LIBRARIES QCA2_INCLUDE_DIR) - - mark_as_advanced(QCA2_INCLUDE_DIR QCA2_LIBRARIES) - -endif (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) diff --git a/kuassel/cmake/GetGitRevisionDescription.cmake b/kuassel/cmake/GetGitRevisionDescription.cmake deleted file mode 100644 index 10e37074..00000000 --- a/kuassel/cmake/GetGitRevisionDescription.cmake +++ /dev/null @@ -1,124 +0,0 @@ -# - Returns a version string from Git -# -# These functions force a re-configure on each git commit so that you can -# trust the values of the variables in your build system. -# -# get_git_head_revision( [ ...]) -# -# Returns the refspec and sha hash of the current head revision -# -# git_describe( [ ...]) -# -# Returns the results of git describe on the source tree, and adjusting -# the output so that it tests false if an error occurs. -# -# git_get_exact_tag( [ ...]) -# -# Returns the results of git describe --exact-match on the source tree, -# and adjusting the output so that it tests false if there was no exact -# matching tag. -# -# Requires CMake 2.6 or newer (uses the 'function' command) -# -# Original Author: -# 2009-2010 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2009-2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -if(__get_git_revision_description) - return() -endif() -set(__get_git_revision_description YES) - -# We must run the following at "include" time, not at function call time, -# to find the path to this module rather than the path to a calling list file -get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) - -function(get_git_head_revision _refspecvar _hashvar) - set(GIT_DIR "${CMAKE_SOURCE_DIR}/.git") - if(NOT EXISTS "${GIT_DIR}") # .git dir not found - set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - return() - endif() - # check if this is a submodule - if(NOT IS_DIRECTORY ${GIT_DIR}) - file(READ ${GIT_DIR} submodule) - string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) - get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) - get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) - endif() - set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") - if(NOT EXISTS "${GIT_DATA}") - file(MAKE_DIRECTORY "${GIT_DATA}") - endif() - - if(NOT EXISTS "${GIT_DIR}/HEAD") - return() - endif() - set(HEAD_FILE "${GIT_DATA}/HEAD") - configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) - - configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" - "${GIT_DATA}/grabRef.cmake" - @ONLY) - include("${GIT_DATA}/grabRef.cmake") - - set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) - set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) -endfunction() - -function(git_describe _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() - - # TODO sanitize - #if((${ARGN}" MATCHES "&&") OR - # (ARGN MATCHES "||") OR - # (ARGN MATCHES "\\;")) - # message("Please report the following error to the project!") - # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") - #endif() - - #message(STATUS "Arguments to execute_process: ${ARGN}") - - execute_process(COMMAND - "${GIT_EXECUTABLE}" - describe - ${hash} - ${ARGN} - WORKING_DIRECTORY - "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE - res - OUTPUT_VARIABLE - out - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT res EQUAL 0) - message(STATUS "RES ${res} OUT ${out}") - set(out "${out}-${res}-NOTFOUND") - endif() - - set(${_var} "${out}" PARENT_SCOPE) -endfunction() - -function(git_get_exact_tag _var) - git_describe(out --exact-match ${ARGN}) - set(${_var} "${out}" PARENT_SCOPE) -endfunction() diff --git a/kuassel/cmake/GetGitRevisionDescription.cmake.in b/kuassel/cmake/GetGitRevisionDescription.cmake.in deleted file mode 100644 index 888ce13a..00000000 --- a/kuassel/cmake/GetGitRevisionDescription.cmake.in +++ /dev/null @@ -1,38 +0,0 @@ -# -# Internal file for GetGitRevisionDescription.cmake -# -# Requires CMake 2.6 or newer (uses the 'function' command) -# -# Original Author: -# 2009-2010 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2009-2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -set(HEAD_HASH) - -file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) - -string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) -if(HEAD_CONTENTS MATCHES "ref") - # named branch - string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") - if(EXISTS "@GIT_DIR@/${HEAD_REF}") - configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) - elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") - configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) - set(HEAD_HASH "${HEAD_REF}") - endif() -else() - # detached HEAD - configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) -endif() - -if(NOT HEAD_HASH) - file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) - string(STRIP "${HEAD_HASH}" HEAD_HASH) -endif() diff --git a/kuassel/cmake/QuasselMacros.cmake b/kuassel/cmake/QuasselMacros.cmake index 652c0042..4baf5e42 100644 --- a/kuassel/cmake/QuasselMacros.cmake +++ b/kuassel/cmake/QuasselMacros.cmake @@ -8,87 +8,6 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -############################ -# Macros for dealing with Qt -############################ - -# CMake gained this function in 2.8.10. To be able to use older versions, we've copied -# this here. If present, the function from CMake will take precedence and our copy will be ignored. -function(qt4_use_modules _target _link_type) - if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE") - set(modules ${ARGN}) - set(link_type ${_link_type}) - else() - set(modules ${_link_type} ${ARGN}) - endif() - foreach(_module ${modules}) - string(TOUPPER ${_module} _ucmodule) - set(_targetPrefix QT_QT${_ucmodule}) - if (_ucmodule STREQUAL QAXCONTAINER OR _ucmodule STREQUAL QAXSERVER) - if (NOT QT_Q${_ucmodule}_FOUND) - message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") - endif() - set(_targetPrefix QT_Q${_ucmodule}) - else() - if (NOT QT_QT${_ucmodule}_FOUND) - message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") - endif() - if ("${_ucmodule}" STREQUAL "MAIN") - message(FATAL_ERROR "Can not use \"${_module}\" module with qt4_use_modules.") - endif() - endif() - target_link_libraries(${_target} ${link_type} ${${_targetPrefix}_LIBRARIES}) - set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${${_targetPrefix}_INCLUDE_DIR} ${QT_HEADERS_DIR} ${QT_MKSPECS_DIR}/default) - set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${${_targetPrefix}_COMPILE_DEFINITIONS}) - endforeach() -endfunction() - -# Some wrappers for simplifying dual-Qt support - -function(qt_use_modules) - if (USE_QT5) - qt5_use_modules(${ARGN}) - else() - qt4_use_modules(${ARGN}) - endif() -endfunction() - -function(qt_wrap_ui _var) - if (USE_QT5) - qt5_wrap_ui(var ${ARGN}) - else() - qt4_wrap_ui(var ${ARGN}) - endif() - set(${_var} ${${_var}} ${var} PARENT_SCOPE) -endfunction() - -function(qt_add_resources _var) - if (USE_QT5) - qt5_add_resources(var ${ARGN}) - else() - qt4_add_resources(var ${ARGN}) - endif() - set(${_var} ${${_var}} ${var} PARENT_SCOPE) -endfunction() - -function(qt_add_dbus_interface _var) - if (USE_QT5) - qt5_add_dbus_interface(var ${ARGN}) - else() - qt4_add_dbus_interface(var ${ARGN}) - endif() - set(${_var} ${${_var}} ${var} PARENT_SCOPE) -endfunction() - -function(qt_add_dbus_adaptor _var) - if (USE_QT5) - qt5_add_dbus_adaptor(var ${ARGN}) - else() - qt4_add_dbus_adaptor(var ${ARGN}) - endif() - set(${_var} ${${_var}} ${var} PARENT_SCOPE) -endfunction() - ###################################### # Macros for dealing with translations ###################################### diff --git a/kuassel/data/networks.ini b/kuassel/data/networks.ini index f860d351..afa48fd3 100644 --- a/kuassel/data/networks.ini +++ b/kuassel/data/networks.ini @@ -20,7 +20,6 @@ Servers=irc.enterthegame.com:6667 [Freenode] Default=Yes -DefaultChannels=#quassel Servers=chat.freenode.net:6665,chat.freenode.net:7000 [GalaxyNet] diff --git a/kuassel/data/quasselclient.desktop b/kuassel/data/quasselclient.desktop deleted file mode 100644 index c11cffe9..00000000 --- a/kuassel/data/quasselclient.desktop +++ /dev/null @@ -1,74 +0,0 @@ -[Desktop Entry] -Type=Application -Version=1.0 -Name=Quassel IRC (Client only) -Name[ast]=IRC Quassel (namái veceru) -Name[ca]=Xat IRC Quassel (només el client) -Name[de]=Quassel IRC (nur Client) -Name[en_GB]=Quassel IRC (Client only) -Name[es]=IRC Quassel (sólo cliente) -Name[et]=Quassel IRC (ainult klient) -Name[fi]=Quassel IRC (vain asiakas) -Name[fr]=Quassel IRC (client uniquement) -Name[gl]=Quassel IRC (só cliente) -Name[hu]=Quassel IRC (Csak kliens) -Name[it]=Quassel IRC (solo client) -Name[ko]=Quassel IRC (클라이언트만) -Name[nl]=Quassel IRC (alleen client) -Name[oc]=Quassel IRC (client unicament) -Name[pl]=Quassel IRC (tylko klient) -Name[pt_BR]=Quassel IRC (Apenas cliente) -Name[ru]=Quassel IRC (только клиент) -Name[sq]=Quassel IRC (Vetëm klient) -Name[sv]=Quassel IRC (endast klient) -Name[tr]=Quassel IRC (sadece İstemci) -Name[uk]=Quassel IRC (лише клієнт) -Name[zh_CN]=Quassel IRC (仅仅包含客户端) -GenericName=IRC Client -GenericName[ast]=Veceru IRC -GenericName[ca]=Client d'IRC -GenericName[de]=IRC-Client -GenericName[en_GB]=IRC Client -GenericName[es]=Cliente IRC -GenericName[et]=IRC klient -GenericName[fi]=IRC-asiakas -GenericName[fr]=Client IRC -GenericName[gl]=Cliente de IRC -GenericName[hu]=IRC-kliens -GenericName[it]=Client IRC -GenericName[ko]=IRC 클라이언트 -GenericName[nb]=IRC-klient -GenericName[nl]=IRC-client -GenericName[oc]=Client IRC -GenericName[pl]=Klient IRC -GenericName[pt_BR]=Cliente IRC -GenericName[ru]=IRC клиент -GenericName[sq]=IRC Klient -GenericName[sv]=IRC-klient -GenericName[tr]=IRC İstemci -GenericName[uk]=Клієнт IRC -GenericName[zh_CN]=IRC 客户端 -Comment=Distributed IRC client with central core component -Comment[ast]=Veceru IRC distribuyíu con un componente central -Comment[ca]=Client d'IRC distribuït amb un component de nucli central -Comment[de]=Dezentralisierter IRC-Client mit einem zentralen Kern -Comment[en_GB]=Distributed IRC client with central core component -Comment[es]=Cliente IRC distribuido con un componente central -Comment[et]=Hajus IRC klient koos keskse tuumkomponendiga -Comment[fi]=Hajautettu IRC-asiakas, jolla keskitetty ydinkomponentti -Comment[fr]=Client IRC distribué avec composant essentiel centralisé -Comment[gl]=Cliente de IRC distribuído cun compoñente principal central -Comment[hu]=Elosztott IRC-kliens központi alapkomponenssel -Comment[it]=Client IRC distribuito con componente centrale -Comment[nl]=IRC-client met centraal kerncomponent -Comment[oc]=Client IRC distribuit amb component essencial centralizat -Comment[pt_BR]=Cliente IRC distribuido com o compotente central core -Comment[ru]=Распределённый клиент IRC с центральным ядром -Comment[sq]=Klient i shpërndarë IRC me përbërës qendror -Comment[sv]=Distribuerad IRC-klient med central kärnkomponent -Comment[uk]=Клієнт IRC з центральним ядром -Comment[zh_CN]=带有中央核心组件的分布式 IRC 客户端 -Icon=quassel -TryExec=quasselclient -Exec=quasselclient -Categories=Qt;Network;Chat;IRCClient; diff --git a/kuassel/src/CMakeLists.txt b/kuassel/src/CMakeLists.txt index 82b31e68..d927500d 100644 --- a/kuassel/src/CMakeLists.txt +++ b/kuassel/src/CMakeLists.txt @@ -13,11 +13,6 @@ include_directories(BEFORE qtui) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen -# We need to initialize the appropriate resources, so let's give our main.cpp some hints -if (EMBED_DATA) - add_definitions(-DEMBED_DATA) -endif() - # Needed for showing the cli option if appropriate if (HAVE_SYSLOG) add_definitions(-DHAVE_SYSLOG) @@ -26,28 +21,9 @@ endif() include_directories(${KDE4_INCLUDES}) add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${CLIENT_DEPS} ${CORE_DEPS} ${COMMON_DEPS}) -qt_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES}) +qt4_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES}) add_dependencies(quassel po) set_target_properties(quassel PROPERTIES - COMPILE_FLAGS "-DBUILD_MONO" OUTPUT_NAME ../quassel) target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY}) install(TARGETS quassel RUNTIME DESTINATION ${BIN_INSTALL_DIR}) - -# Build bundles for MacOSX -if(APPLE) - add_custom_command(TARGET quasselclient POST_BUILD - COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py - ${CMAKE_SOURCE_DIR} "Quassel Client" ../quasselclient) - add_custom_command(TARGET quassel POST_BUILD - COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py - ${CMAKE_SOURCE_DIR} "Quassel" ../quassel) - if(DEPLOY) - add_custom_command(TARGET quasselclient POST_BUILD - COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client ..) - add_custom_command(TARGET quasselcore POST_BUILD - COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ..) - add_custom_command(TARGET quasselcore POST_BUILD - COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Mono ..) - endif(DEPLOY) -endif(APPLE) diff --git a/kuassel/src/client/CMakeLists.txt b/kuassel/src/client/CMakeLists.txt index 3dd15044..05d75389 100644 --- a/kuassel/src/client/CMakeLists.txt +++ b/kuassel/src/client/CMakeLists.txt @@ -38,22 +38,13 @@ set(SOURCES clientcoreinfo.h ) -if (KDE4_FOUND) - include_directories(${KDE4_INCLUDES}) - add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS}) -endif() +include_directories(${KDE4_INCLUDES}) +add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS}) -if (USE_QT5) - list(APPEND qt_modules Widgets) -endif() - -qt_add_resources(SOURCES ${CLIENT_RCS}) +qt4_add_resources(SOURCES ${CLIENT_RCS}) add_library(mod_client STATIC ${SOURCES}) -qt_use_modules(mod_client Network Core Gui ${qt_modules}) - -if (KDE4_FOUND) - target_link_libraries(mod_client ${KDE4_SOLID_LIBS}) -endif() +qt4_use_modules(mod_client Network Core Gui ${qt_modules}) +target_link_libraries(mod_client ${KDE4_SOLID_LIBS}) add_dependencies(mod_client mod_common) diff --git a/kuassel/src/common/CMakeLists.txt b/kuassel/src/common/CMakeLists.txt index 23e5601e..0aad2f02 100644 --- a/kuassel/src/common/CMakeLists.txt +++ b/kuassel/src/common/CMakeLists.txt @@ -76,10 +76,10 @@ else() set(SOURCES ${SOURCES} logbacktrace_unix.cpp) endif() -qt_add_resources(SOURCES ${COMMON_RCS}) +qt4_add_resources(SOURCES ${COMMON_RCS}) add_library(mod_common STATIC ${SOURCES}) -qt_use_modules(mod_common Core Network) +qt4_use_modules(mod_common Core Network) if(APPLE) target_link_libraries(mod_common "-framework CoreServices" "-framework CoreFoundation") diff --git a/kuassel/src/common/main.cpp b/kuassel/src/common/main.cpp index 99b7b597..b53f5925 100644 --- a/kuassel/src/common/main.cpp +++ b/kuassel/src/common/main.cpp @@ -53,11 +53,6 @@ int main(int argc, char **argv) Q_INIT_RESOURCE(sql); Q_INIT_RESOURCE(pics); -#ifdef EMBED_DATA - Q_INIT_RESOURCE(i18n); - Q_INIT_RESOURCE(data); -#endif - AbstractCliParser *cliParser; // We need to init KCmdLineArgs first diff --git a/kuassel/src/core/CMakeLists.txt b/kuassel/src/core/CMakeLists.txt index 6a0611af..8db0bede 100644 --- a/kuassel/src/core/CMakeLists.txt +++ b/kuassel/src/core/CMakeLists.txt @@ -57,10 +57,10 @@ endif() include_directories(${CMAKE_SOURCE_DIR}/src/common) set(CORE_RCS ${CORE_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/sql.qrc) -qt_add_resources(SOURCES ${CORE_RCS}) +qt4_add_resources(SOURCES ${CORE_RCS}) add_library(mod_core STATIC ${SOURCES}) -qt_use_modules(mod_core Core Network Script Sql) +qt4_use_modules(mod_core Core Network Script Sql) add_dependencies(mod_core mod_common) diff --git a/kuassel/src/qtui/CMakeLists.txt b/kuassel/src/qtui/CMakeLists.txt index b66b090c..1b5a68fd 100644 --- a/kuassel/src/qtui/CMakeLists.txt +++ b/kuassel/src/qtui/CMakeLists.txt @@ -81,20 +81,10 @@ set(FORMS set(LIBS ) set(QT_MODULES ) -if (KDE4_FOUND) - add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS}) - include_directories(${KDE4_INCLUDES}) - list(APPEND SOURCES knotificationbackend.cpp) - list(APPEND LIBS ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBRARY}) -endif() - -if (LIBSNORE_FOUND) - add_definitions(-DHAVE_LIBSNORE) - include_directories(${LIBSNORE_INCLUDE_DIRS}) - list(APPEND SOURCES snorenotificationbackend.cpp) - list(APPEND FORMS snorentificationconfigwidget.ui) - list(APPEND LIBS ${LIBSNORE_LIBRARIES}) -endif() +add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS}) +include_directories(${KDE4_INCLUDES}) +list(APPEND SOURCES knotificationbackend.cpp) +list(APPEND LIBS ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBRARY}) if (PHONON_FOUND OR Phonon4Qt5_FOUND) add_definitions(-DHAVE_PHONON) @@ -104,31 +94,24 @@ if (PHONON_FOUND OR Phonon4Qt5_FOUND) list(APPEND LIBS ${PHONON_LIBS}) # PHONON_LIBRARIES only exists in config mode, it's not set by the legacy FindPhonon.cmake endif() -if (QT_QTDBUS_FOUND OR Qt5DBus_FOUND) +if (QT_QTDBUS_FOUND) add_definitions(-DHAVE_DBUS) list(APPEND QT_MODULES DBus) - if (dbusmenu-qt_FOUND OR dbusmenu-qt5_FOUND) + if (dbusmenu-qt_FOUND) add_definitions(-DHAVE_DBUSMENU) include_directories(${dbusmenu-qt_INCLUDE_DIRS} ${dbusmenu-qt5_INCLUDE_DIRS}) - if (dbusmenu-qt_FOUND) - list(APPEND LIBS dbusmenu-qt) - else() - list(APPEND LIBS dbusmenu-qt5) - endif() + list(APPEND LIBS dbusmenu-qt) endif() list(APPEND SOURCES statusnotifieritem.cpp statusnotifieritemdbus.cpp dockmanagernotificationbackend.cpp) - qt_add_dbus_interface(SOURCES ../../interfaces/org.kde.StatusNotifierWatcher.xml statusnotifierwatcher) - qt_add_dbus_interface(SOURCES ../../interfaces/org.freedesktop.Notifications.xml notificationsclient) - qt_add_dbus_adaptor (SOURCES ../../interfaces/org.kde.StatusNotifierItem.xml statusnotifieritemdbus.h StatusNotifierItemDBus) + qt4_add_dbus_interface(SOURCES ../../interfaces/org.kde.StatusNotifierWatcher.xml statusnotifierwatcher) + qt4_add_dbus_interface(SOURCES ../../interfaces/org.freedesktop.Notifications.xml notificationsclient) + qt4_add_dbus_adaptor (SOURCES ../../interfaces/org.kde.StatusNotifierItem.xml statusnotifieritemdbus.h StatusNotifierItemDBus) endif() -if (QT_QTWEBKIT_FOUND OR Qt5WebKitWidgets_FOUND) +if (QT_QTWEBKIT_FOUND) add_definitions(-DHAVE_WEBKIT) list(APPEND QT_MODULES WebKit) - if (USE_QT5) - list(APPEND QT_MODULES WebKitWidgets) - endif() endif() if(HAVE_SSL) @@ -144,12 +127,6 @@ if (INDICATEQT_FOUND) list(APPEND LIBS ${INDICATEQT_LIBRARIES}) endif() -if (WITH_NOTIFICATION_CENTER) - add_definitions(-DHAVE_NOTIFICATION_CENTER) - list(APPEND SOURCES osxnotificationbackend.mm) - list(APPEND LIBS "/System/Library/Frameworks/Foundation.framework") -endif() - foreach(FORM ${FORMS}) set(FORMPATH ${FORMPATH} ui/${FORM}) endforeach(FORM ${FORMS}) @@ -175,15 +152,11 @@ include_directories(${CMAKE_SOURCE_DIR}/src/common ) -qt_wrap_ui(UI ${FORMPATH} ${SPFRM}) - -if (USE_QT5) - list(APPEND QT_MODULES Widgets) -endif() +qt4_wrap_ui(UI ${FORMPATH} ${SPFRM}) add_library(mod_qtui STATIC ${SOURCES} ${SPSRC} ${UI}) -qt_use_modules(mod_qtui Core Gui Network ${QT_MODULES}) +qt4_use_modules(mod_qtui Core Gui Network ${QT_MODULES}) if (LIBS) target_link_libraries(mod_qtui ${LIBS}) diff --git a/kuassel/src/qtui/mainwin.cpp b/kuassel/src/qtui/mainwin.cpp index 0125968e..43824bdb 100644 --- a/kuassel/src/qtui/mainwin.cpp +++ b/kuassel/src/qtui/mainwin.cpp @@ -101,10 +101,6 @@ #include "indicatornotificationbackend.h" #endif -#ifdef HAVE_NOTIFICATION_CENTER - #include "osxnotificationbackend.h" -#endif - #ifdef HAVE_DBUS #include "dockmanagernotificationbackend.h" #endif @@ -200,10 +196,6 @@ void MainWin::init() QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this)); #endif -#ifdef HAVE_NOTIFICATION_CENTER - QtUi::registerNotificationBackend(new OSXNotificationBackend(this)); -#endif - #ifdef HAVE_DBUS QtUi::registerNotificationBackend(new DockManagerNotificationBackend(this)); #endif diff --git a/kuassel/src/qtui/osxnotificationbackend.h b/kuassel/src/qtui/osxnotificationbackend.h deleted file mode 100644 index 55a8d58e..00000000 --- a/kuassel/src/qtui/osxnotificationbackend.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef OSXNOTIFICATIONBACKEND_H_ -#define OSXNOTIFICATIONBACKEND_H_ - -#include "abstractnotificationbackend.h" -#include "settingspage.h" - -class OSXNotificationBackend : public AbstractNotificationBackend -{ - Q_OBJECT - -public: - OSXNotificationBackend(QObject *parent = 0); - - void notify(const Notification &); - void close(uint notificationId); - virtual SettingsPage *createConfigWidget() const; - -private slots: - void enabledChanged(const QVariant &value); - -private: - class ConfigWidget; - - bool _enabled; -}; - -class OSXNotificationBackend::ConfigWidget : public SettingsPage -{ - Q_OBJECT - -public: - ConfigWidget(QWidget *parent = 0); - void save(); - void load(); - bool hasDefaults() const; - void defaults(); - -private slots: - void widgetChanged(); - -private: - QCheckBox *_enabledBox; - bool _enabled; -}; - -#endif // OSXNOTIFICATIONBACKEND_H_ diff --git a/kuassel/src/qtui/osxnotificationbackend.mm b/kuassel/src/qtui/osxnotificationbackend.mm deleted file mode 100644 index 738ee265..00000000 --- a/kuassel/src/qtui/osxnotificationbackend.mm +++ /dev/null @@ -1,126 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "clientsettings.h" -#include "osxnotificationbackend.h" - -#include -#include - -#import - -namespace { - -void SendNotificationCenterMessage(NSString* title, NSString* subtitle) { - NSUserNotificationCenter* center = - [NSUserNotificationCenter defaultUserNotificationCenter]; - NSUserNotification* notification = - [[NSUserNotification alloc] init]; - - [notification setTitle: title]; - [notification setSubtitle: subtitle]; - - [center deliverNotification: notification]; - - [notification release]; -} - -} - -OSXNotificationBackend::OSXNotificationBackend(QObject *parent) - : AbstractNotificationBackend(parent), - _enabled(true) -{ - NotificationSettings notificationSettings; - notificationSettings.initAndNotify("OSXNotification/Enabled", this, SLOT(enabledChanged(QVariant)), true); -} - -void OSXNotificationBackend::enabledChanged(const QVariant &value) -{ - _enabled = value.toBool(); -} - -void OSXNotificationBackend::notify(const Notification ¬ification) -{ - if (!_enabled) - { - return; - } - - NSString* message = [[NSString alloc] initWithUTF8String:notification.sender.toUtf8().constData()]; - NSString* summary = [[NSString alloc] initWithUTF8String:notification.message.toUtf8().constData()]; - - SendNotificationCenterMessage(message, summary); - - [message release]; - [summary release]; -} - -void OSXNotificationBackend::close(uint notificationId) -{ -} - -SettingsPage *OSXNotificationBackend::createConfigWidget() const -{ - return new ConfigWidget(); -} - -OSXNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) - : SettingsPage("Internal", "OSXNotification", parent) -{ - _enabledBox = new QCheckBox(tr("Show OS X notifications")); - connect(_enabledBox, SIGNAL(toggled(bool)), this, SLOT(widgetChanged())); - QHBoxLayout *layout = new QHBoxLayout(this); - layout->addWidget(_enabledBox); -} - -void OSXNotificationBackend::ConfigWidget::widgetChanged() -{ - bool changed = (_enabled != _enabledBox->isChecked()); - if (changed != hasChanged()) - setChangedState(changed); -} - -bool OSXNotificationBackend::ConfigWidget::hasDefaults() const -{ - return true; -} - -void OSXNotificationBackend::ConfigWidget::defaults() -{ - _enabledBox->setChecked(true); - widgetChanged(); -} - -void OSXNotificationBackend::ConfigWidget::load() -{ - NotificationSettings s; - _enabled = s.value("OSXNotification/Enabled", false).toBool(); - _enabledBox->setChecked(_enabled); - setChangedState(false); -} - - -void OSXNotificationBackend::ConfigWidget::save() -{ - NotificationSettings s; - s.setValue("OSXNotification/Enabled", _enabledBox->isChecked()); - load(); -} diff --git a/kuassel/src/qtui/snorenotificationbackend.cpp b/kuassel/src/qtui/snorenotificationbackend.cpp deleted file mode 100644 index 6732c549..00000000 --- a/kuassel/src/qtui/snorenotificationbackend.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2011-2013 by Patrick von Reth * -* vonreth@kde.org * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) version 3. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ - -#include "snorenotificationbackend.h" - -#include -#include - -#include "client.h" -#include "networkmodel.h" -#include "systraynotificationbackend.h" -#include "qtui.h" - -#include - - -#include -#include - - -SnoreNotificationBackend::SnoreNotificationBackend (QObject *parent) - : AbstractNotificationBackend(parent), - m_systrayBackend(NULL) -{ - NotificationSettings notificationSettings; - QString backend = notificationSettings.value("Snore/Backend", "Default").toString(); - m_timeout = notificationSettings.value("Snore/Timeout", 10).toInt(); - - notificationSettings.notify("Snore/Backend", this, SLOT(backendChanged(const QVariant &))); - notificationSettings.notify("Snore/Timeout", this, SLOT(timeoutChanged(const QVariant &))); - - //TODO: try to get an instance of the tray icon to be able to show popups - m_snore = new Snore::SnoreCore(); - m_snore->loadPlugins(Snore::SnorePlugin::BACKEND); - m_icon = Snore::Icon(QIcon::fromTheme("quassel", QIcon(":/icons/quassel.png")).pixmap(48).toImage()); - m_application = Snore::Application("Quassel", m_icon); - m_application.hints().setValue("WINDOWS_APP_ID","QuasselProject.QuasselIRC"); - - connect(m_snore, SIGNAL(actionInvoked(Snore::Notification)), this, SLOT(actionInvoked(Snore::Notification))); - - - m_alert = Snore::Alert(tr("Private Message"), m_icon); - m_application.addAlert(m_alert); - - m_snore->registerApplication(m_application); - - backendChanged(QVariant::fromValue(backend)); - - -} - -SnoreNotificationBackend::~SnoreNotificationBackend() -{ - m_snore->deregisterApplication(m_application); - m_snore->deleteLater(); -} - -void SnoreNotificationBackend::backendChanged(const QVariant &v) -{ - QString backend = v.toString(); - if (backend != "Default") { - if (setSnoreBackend(backend)) { - return; - } - } - setTraybackend(); -} - -void SnoreNotificationBackend::timeoutChanged(const QVariant &v) -{ - m_timeout = v.toInt(); -} - -void SnoreNotificationBackend::notify(const Notification &n) -{ - if (m_systrayBackend != NULL) { - return; - } - QString title = Client::networkModel()->networkName(n.bufferId) + " - " + Client::networkModel()->bufferName(n.bufferId); - QString message = QString("<%1> %2").arg(n.sender, n.message); - Snore::Notification noti(m_application, m_alert, title, message, m_icon, m_timeout); - noti.hints().setValue("QUASSEL_ID", n.notificationId); - m_notificationIds.insert(n.notificationId, noti.id()); - m_snore->broadcastNotification(noti); -} - -void SnoreNotificationBackend::close(uint notificationId) -{ - if (m_systrayBackend != NULL) { - return; - } - Snore::Notification n = m_snore->getActiveNotificationByID(m_notificationIds.take(notificationId)); - m_snore->requestCloseNotification(n, Snore::Notification::CLOSED); -} - -void SnoreNotificationBackend::actionInvoked(Snore::Notification n) -{ - emit activated(n.hints().value("QUASSEL_ID").toUInt()); -} - -SettingsPage *SnoreNotificationBackend::createConfigWidget()const -{ - return new ConfigWidget(m_snore); -} - -void SnoreNotificationBackend::setTraybackend() -{ - if (m_systrayBackend == NULL) { - m_systrayBackend = new SystrayNotificationBackend(this); - QtUi::registerNotificationBackend(m_systrayBackend); - } -} - -bool SnoreNotificationBackend::setSnoreBackend(const QString &backend) -{ - if (m_systrayBackend != NULL) { - QtUi::unregisterNotificationBackend(m_systrayBackend); - delete m_systrayBackend; - m_systrayBackend = NULL; - } - return m_snore->setPrimaryNotificationBackend(backend); -} - - - - -/***************************************************************************/ - -SnoreNotificationBackend::ConfigWidget::ConfigWidget(Snore::SnoreCore *snore, QWidget *parent) - :SettingsPage("Internal", "SnoreNotification", parent), - m_snore(snore) -{ - ui.setupUi(this); - QStringList backends = m_snore->notificationBackends(); - backends.append("Default"); - qSort(backends); - ui.backends->insertItems(0, backends); - - connect(ui.backends, SIGNAL(currentIndexChanged(QString)), SLOT(backendChanged(QString))); - connect(ui.timeout, SIGNAL(valueChanged(int)), this, SLOT(timeoutChanged(int))); -} - -void SnoreNotificationBackend::ConfigWidget::backendChanged(const QString &b) -{ - ui.backends->setCurrentIndex(ui.backends->findText(b)); - setChangedState(true); -} - -void SnoreNotificationBackend::ConfigWidget::timeoutChanged(int i) -{ - ui.timeout->setValue(i); - setChangedState(true); - -} - -bool SnoreNotificationBackend::ConfigWidget::hasDefaults() const -{ - return true; -} - -void SnoreNotificationBackend::ConfigWidget::defaults() -{ - backendChanged("Default"); - timeoutChanged(10); -} - -void SnoreNotificationBackend::ConfigWidget::load() -{ - NotificationSettings s; - QString backend = s.value("Snore/Backend", "Default").toString(); - int timeout = s.value("Snore/Timeout", 10).toInt(); - ui.backends->setCurrentIndex(ui.backends->findText(backend)); - ui.timeout->setValue(timeout); - setChangedState(false); -} - -void SnoreNotificationBackend::ConfigWidget::save() -{ - NotificationSettings s; - s.setValue("Snore/Backend", ui.backends->currentText()); - s.setValue("Snore/Timeout", ui.timeout->value()); - load(); -} diff --git a/kuassel/src/qtui/snorenotificationbackend.h b/kuassel/src/qtui/snorenotificationbackend.h deleted file mode 100644 index fa57adc2..00000000 --- a/kuassel/src/qtui/snorenotificationbackend.h +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2011-2013 by Patrick von Reth * -* vonreth@kde.org * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) version 3. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ - -#ifndef SNORENOTIFICATIONBACKEND_H_ -#define SNORENOTIFICATIONBACKEND_H_ - -#include "abstractnotificationbackend.h" - -#include "settingspage.h" - -#include "ui_snorentificationconfigwidget.h" - -#include -#include - -class SystrayNotificationBackend; - -class SnoreNotificationBackend : public AbstractNotificationBackend { - Q_OBJECT -public: - SnoreNotificationBackend (QObject *parent); - ~SnoreNotificationBackend(); - - void notify(const Notification &); - void close(uint notificationId); - - virtual SettingsPage *createConfigWidget()const; - -signals: - void activated(uint notificationId = 0); - -public slots: - void actionInvoked(Snore::Notification); -private slots: - void backendChanged(const QVariant &); - void timeoutChanged(const QVariant &); - -private: - void setTraybackend(); - bool setSnoreBackend(const QString &backend); - - class ConfigWidget; - SystrayNotificationBackend * m_systrayBackend; - Snore::SnoreCore *m_snore; - QHash m_notificationIds; - Snore::Icon m_icon; - Snore::Application m_application; - Snore::Alert m_alert; - int m_timeout; -}; - -class SnoreNotificationBackend::ConfigWidget : public SettingsPage { - Q_OBJECT - -public: - ConfigWidget(Snore::SnoreCore *snore, QWidget *parent = 0); - void save(); - void load(); - bool hasDefaults() const; - void defaults(); - -private slots: - void backendChanged(const QString&); - void timeoutChanged(int); - -private: - Ui::SnoreNotificationConfigWidget ui; - Snore::SnoreCore *m_snore; - - // QSpinBox *timeoutBox; - - // bool enabled; - // int timeout; -}; - -#endif diff --git a/kuassel/src/qtui/ui/snorentificationconfigwidget.ui b/kuassel/src/qtui/ui/snorentificationconfigwidget.ui deleted file mode 100644 index 0e33248b..00000000 --- a/kuassel/src/qtui/ui/snorentificationconfigwidget.ui +++ /dev/null @@ -1,105 +0,0 @@ - - - SnoreNotificationConfigWidget - - - - 0 - 0 - 440 - 110 - - - - - 440 - 110 - - - - Form - - - - QLayout::SetNoConstraint - - - - - Snore - - - - - 10 - 25 - 46 - 13 - - - - Backend: - - - - - - 70 - 20 - 331 - 22 - - - - - - - 10 - 65 - 46 - 13 - - - - Timeout: - - - - - - 70 - 60 - 81 - 22 - - - - - - - s - - - 0 - - - - - - 170 - 65 - 101 - 16 - - - - 0 means infinite - - - - - - - - - diff --git a/kuassel/src/uisupport/CMakeLists.txt b/kuassel/src/uisupport/CMakeLists.txt index 0019f515..0d4da4cc 100644 --- a/kuassel/src/uisupport/CMakeLists.txt +++ b/kuassel/src/uisupport/CMakeLists.txt @@ -34,25 +34,16 @@ set(SOURCES abstractnotificationbackend.h ) -if (KDE4_FOUND) - include_directories(${KDE4_INCLUDES}) - add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS}) - set(SOURCES ${SOURCES} kcmdlinewrapper.cpp) -endif() +include_directories(${KDE4_INCLUDES}) +add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS}) +set(SOURCES ${SOURCES} kcmdlinewrapper.cpp) include_directories(${CMAKE_SOURCE_DIR}/src/common ${CMAKE_SOURCE_DIR}/src/client ) -if (USE_QT5) - list(APPEND qt_modules Widgets) -endif() - add_library(mod_uisupport STATIC ${SOURCES}) -qt_use_modules(mod_uisupport Core Gui Network ${qt_modules}) - -if (KDE4_FOUND) - target_link_libraries(mod_uisupport ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY}) -endif() +qt4_use_modules(mod_uisupport Core Gui Network ${qt_modules}) +target_link_libraries(mod_uisupport ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY}) add_dependencies(mod_uisupport mod_common mod_client)